Skip to content

Commit dd55d47

Browse files
committed
Stop archiving ChannelMonitors
.. as this is now done by the background processor.
1 parent d8d6861 commit dd55d47

File tree

7 files changed

+6
-62
lines changed

7 files changed

+6
-62
lines changed

bindings/ldk_node.udl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,6 @@ dictionary NodeStatus {
359359
u64? latest_rgs_snapshot_timestamp;
360360
u64? latest_pathfinding_scores_sync_timestamp;
361361
u64? latest_node_announcement_broadcast_timestamp;
362-
u32? latest_channel_monitor_archival_height;
363362
};
364363

365364
dictionary BestBlock {

src/chain/bitcoind.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use lightning_block_sync::{
2929
};
3030
use serde::Serialize;
3131

32-
use super::{periodically_archive_fully_resolved_monitors, WalletSyncStatus};
32+
use super::WalletSyncStatus;
3333
use crate::config::{
3434
BitcoindRestClientConfig, Config, FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS, TX_BROADCAST_TIMEOUT_SECS,
3535
};
@@ -414,14 +414,6 @@ impl BitcoindChainSource {
414414
now.elapsed().unwrap().as_millis()
415415
);
416416
*self.latest_chain_tip.write().unwrap() = Some(tip);
417-
418-
periodically_archive_fully_resolved_monitors(
419-
&*channel_manager,
420-
&*chain_monitor,
421-
&*self.kv_store,
422-
&*self.logger,
423-
&*self.node_metrics,
424-
)?;
425417
},
426418
Ok(_) => {},
427419
Err(e) => {

src/chain/electrum.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use lightning::chain::{Confirm, Filter, WatchedOutput};
2323
use lightning::util::ser::Writeable;
2424
use lightning_transaction_sync::ElectrumSyncClient;
2525

26-
use super::{periodically_archive_fully_resolved_monitors, WalletSyncStatus};
26+
use super::WalletSyncStatus;
2727
use crate::config::{
2828
Config, ElectrumSyncConfig, BDK_CLIENT_STOP_GAP, BDK_WALLET_SYNC_TIMEOUT_SECS,
2929
FEE_RATE_CACHE_UPDATE_TIMEOUT_SECS, LDK_WALLET_SYNC_TIMEOUT_SECS, TX_BROADCAST_TIMEOUT_SECS,
@@ -241,14 +241,6 @@ impl ElectrumChainSource {
241241
locked_node_metrics.latest_lightning_wallet_sync_timestamp = unix_time_secs_opt;
242242
write_node_metrics(&*locked_node_metrics, &*self.kv_store, &*self.logger)?;
243243
}
244-
245-
periodically_archive_fully_resolved_monitors(
246-
&*channel_manager,
247-
&*chain_monitor,
248-
&*self.kv_store,
249-
&*self.logger,
250-
&*self.node_metrics,
251-
)?;
252244
}
253245

254246
res

src/chain/esplora.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use lightning::chain::{Confirm, Filter, WatchedOutput};
1616
use lightning::util::ser::Writeable;
1717
use lightning_transaction_sync::EsploraSyncClient;
1818

19-
use super::{periodically_archive_fully_resolved_monitors, WalletSyncStatus};
19+
use super::WalletSyncStatus;
2020
use crate::config::{
2121
Config, EsploraSyncConfig, BDK_CLIENT_CONCURRENCY, BDK_CLIENT_STOP_GAP,
2222
BDK_WALLET_SYNC_TIMEOUT_SECS, DEFAULT_ESPLORA_CLIENT_TIMEOUT_SECS,
@@ -261,14 +261,6 @@ impl EsploraChainSource {
261261
unix_time_secs_opt;
262262
write_node_metrics(&*locked_node_metrics, &*self.kv_store, &*self.logger)?;
263263
}
264-
265-
periodically_archive_fully_resolved_monitors(
266-
&*channel_manager,
267-
&*chain_monitor,
268-
&*self.kv_store,
269-
&*self.logger,
270-
&*self.node_metrics,
271-
)?;
272264
Ok(())
273265
},
274266
Err(e) => {

src/chain/mod.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ use crate::chain::electrum::ElectrumChainSource;
2121
use crate::chain::esplora::EsploraChainSource;
2222
use crate::config::{
2323
BackgroundSyncConfig, BitcoindRestClientConfig, Config, ElectrumSyncConfig, EsploraSyncConfig,
24-
RESOLVED_CHANNEL_MONITOR_ARCHIVAL_INTERVAL, WALLET_SYNC_INTERVAL_MINIMUM_SECS,
24+
WALLET_SYNC_INTERVAL_MINIMUM_SECS,
2525
};
2626
use crate::fee_estimator::OnchainFeeEstimator;
27-
use crate::io::utils::write_node_metrics;
2827
use crate::logger::{log_debug, log_info, log_trace, LdkLogger, Logger};
2928
use crate::runtime::Runtime;
3029
use crate::types::{Broadcaster, ChainMonitor, ChannelManager, DynStore, Sweeper, Wallet};
@@ -486,22 +485,3 @@ impl Filter for ChainSource {
486485
}
487486
}
488487
}
489-
490-
fn periodically_archive_fully_resolved_monitors(
491-
channel_manager: &ChannelManager, chain_monitor: &ChainMonitor, kv_store: &DynStore,
492-
logger: &Logger, node_metrics: &RwLock<NodeMetrics>,
493-
) -> Result<(), Error> {
494-
let mut locked_node_metrics = node_metrics.write().unwrap();
495-
let cur_height = channel_manager.current_best_block().height;
496-
let should_archive = locked_node_metrics
497-
.latest_channel_monitor_archival_height
498-
.as_ref()
499-
.map_or(true, |h| cur_height >= h + RESOLVED_CHANNEL_MONITOR_ARCHIVAL_INTERVAL);
500-
501-
if should_archive {
502-
chain_monitor.archive_fully_resolved_channel_monitors();
503-
locked_node_metrics.latest_channel_monitor_archival_height = Some(cur_height);
504-
write_node_metrics(&*locked_node_metrics, kv_store, logger)?;
505-
}
506-
Ok(())
507-
}

src/config.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ pub(crate) const BDK_CLIENT_CONCURRENCY: usize = 4;
5454
// The timeout after which we abandon retrying failed payments.
5555
pub(crate) const LDK_PAYMENT_RETRY_TIMEOUT: Duration = Duration::from_secs(10);
5656

57-
// The interval (in block height) after which we retry archiving fully resolved channel monitors.
58-
pub(crate) const RESOLVED_CHANNEL_MONITOR_ARCHIVAL_INTERVAL: u32 = 6;
59-
6057
// The time in-between peer reconnection attempts.
6158
pub(crate) const PEER_RECONNECTION_INTERVAL: Duration = Duration::from_secs(60);
6259

src/lib.rs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -728,8 +728,6 @@ impl Node {
728728
locked_node_metrics.latest_pathfinding_scores_sync_timestamp;
729729
let latest_node_announcement_broadcast_timestamp =
730730
locked_node_metrics.latest_node_announcement_broadcast_timestamp;
731-
let latest_channel_monitor_archival_height =
732-
locked_node_metrics.latest_channel_monitor_archival_height;
733731

734732
NodeStatus {
735733
is_running,
@@ -740,7 +738,6 @@ impl Node {
740738
latest_rgs_snapshot_timestamp,
741739
latest_pathfinding_scores_sync_timestamp,
742740
latest_node_announcement_broadcast_timestamp,
743-
latest_channel_monitor_archival_height,
744741
}
745742
}
746743

@@ -1806,10 +1803,6 @@ pub struct NodeStatus {
18061803
///
18071804
/// Will be `None` if we have no public channels or we haven't broadcasted yet.
18081805
pub latest_node_announcement_broadcast_timestamp: Option<u64>,
1809-
/// The block height when we last archived closed channel monitor data.
1810-
///
1811-
/// Will be `None` if we haven't archived any monitors of closed channels yet.
1812-
pub latest_channel_monitor_archival_height: Option<u32>,
18131806
}
18141807

18151808
/// Status fields that are persisted across restarts.
@@ -1821,7 +1814,6 @@ pub(crate) struct NodeMetrics {
18211814
latest_rgs_snapshot_timestamp: Option<u32>,
18221815
latest_pathfinding_scores_sync_timestamp: Option<u64>,
18231816
latest_node_announcement_broadcast_timestamp: Option<u64>,
1824-
latest_channel_monitor_archival_height: Option<u32>,
18251817
}
18261818

18271819
impl Default for NodeMetrics {
@@ -1833,7 +1825,6 @@ impl Default for NodeMetrics {
18331825
latest_rgs_snapshot_timestamp: None,
18341826
latest_pathfinding_scores_sync_timestamp: None,
18351827
latest_node_announcement_broadcast_timestamp: None,
1836-
latest_channel_monitor_archival_height: None,
18371828
}
18381829
}
18391830
}
@@ -1845,7 +1836,8 @@ impl_writeable_tlv_based!(NodeMetrics, {
18451836
(4, latest_fee_rate_cache_update_timestamp, option),
18461837
(6, latest_rgs_snapshot_timestamp, option),
18471838
(8, latest_node_announcement_broadcast_timestamp, option),
1848-
(10, latest_channel_monitor_archival_height, option),
1839+
// 10 used to be latest_channel_monitor_archival_height
1840+
(10, _legacy_latest_channel_monitor_archival_height, (legacy, Option<u32>, |_: &NodeMetrics| None::<Option<u32>> )),
18491841
});
18501842

18511843
pub(crate) fn total_anchor_channels_reserve_sats(

0 commit comments

Comments
 (0)