Skip to content

Commit 0326774

Browse files
committed
Remove and track perm failed nodes & channels
We never had the `NetworkGraph::node_failed` method implemented. The scorer now handles non-permanent failures by downgrading nodes, so we don't want that implemented. The method is renamed to `node_failed_permanent` to explicitly indicate that this is the only case it handles. We also add tracking in the form of two maps as fields of `NetworkGraph`, namely, `removed_nodes` and `removed_channels`. We track these removed graph entries to ensure we don't just resync them from gossip soon after removing them. We stop tracking these removed nodes whenever `remove_stale_channels_and_tracking()` is called and the entries have been tracked for longer than `STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS`.
1 parent 496e79f commit 0326774

File tree

2 files changed

+216
-23
lines changed

2 files changed

+216
-23
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ use std::ops::Deref;
4343
/// [`ChannelManager`] persistence should be done in the background.
4444
/// * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
4545
/// at the appropriate intervals.
46-
/// * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
47-
/// is provided to [`BackgroundProcessor::start`]).
46+
/// * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
47+
/// [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
4848
///
4949
/// It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
5050
/// upon as doing so may result in high latency.
@@ -396,7 +396,7 @@ impl BackgroundProcessor {
396396
// The network graph must not be pruned while rapid sync completion is pending
397397
log_trace!(logger, "Assessing prunability of network graph");
398398
if let Some(network_graph) = gossip_sync.prunable_network_graph() {
399-
network_graph.remove_stale_channels();
399+
network_graph.remove_stale_channels_and_tracking();
400400

401401
if let Err(e) = persister.persist_graph(network_graph) {
402402
log_error!(logger, "Error: Failed to persist network graph, check your disk and permissions {}", e)

0 commit comments

Comments
 (0)