Skip to content

Commit 7a03fe9

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 right away 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 `REMOVED_ENTRIES_TRACKING_AGE_LIMIT_SECS` which is currently set to one week.
1 parent af03788 commit 7a03fe9

File tree

2 files changed

+224
-26
lines changed

2 files changed

+224
-26
lines changed

lightning-background-processor/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ use futures::{select, future::FutureExt};
4646
/// [`ChannelManager`] persistence should be done in the background.
4747
/// * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
4848
/// at the appropriate intervals.
49-
/// * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`]
50-
/// is provided to [`BackgroundProcessor::start`]).
49+
/// * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
50+
/// [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
5151
///
5252
/// It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
5353
/// upon as doing so may result in high latency.
@@ -312,7 +312,7 @@ macro_rules! define_run_body {
312312
// The network graph must not be pruned while rapid sync completion is pending
313313
log_trace!($logger, "Assessing prunability of network graph");
314314
if let Some(network_graph) = $gossip_sync.prunable_network_graph() {
315-
network_graph.remove_stale_channels();
315+
network_graph.remove_stale_channels_and_tracking();
316316

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

0 commit comments

Comments
 (0)