@@ -1704,6 +1704,7 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
1704
1704
for scid in scids_to_remove {
1705
1705
let info = channels. remove ( & scid) . expect ( "We just accessed this scid, it should be present" ) ;
1706
1706
Self :: remove_channel_in_nodes ( & mut nodes, & info, scid) ;
1707
+ self . removed_channels . lock ( ) . unwrap ( ) . insert ( scid, Some ( current_time_unix) ) ;
1707
1708
}
1708
1709
}
1709
1710
@@ -2579,6 +2580,11 @@ mod tests {
2579
2580
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 1 ) ;
2580
2581
assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) , 2 ) ;
2581
2582
network_graph. remove_stale_channels_and_tracking_with_time ( 1 + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS ) ;
2583
+ // Make sure removed channels are tracked.
2584
+ assert_eq ! ( network_graph. removed_channels. lock( ) . unwrap( ) . len( ) , 1 ) ;
2585
+ // Provide a later time so that sufficient time has passed
2586
+ network_graph. remove_stale_channels_and_tracking_with_time ( 101 + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS +
2587
+ REMOVED_ENTRIES_TRACKING_AGE_LIMIT_SECS ) ;
2582
2588
}
2583
2589
2584
2590
#[ cfg( feature = "std" ) ]
@@ -2603,10 +2609,16 @@ mod tests {
2603
2609
assert ! ( gossip_sync. handle_channel_update( & valid_channel_update) . is_ok( ) ) ;
2604
2610
assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_some( ) ) ;
2605
2611
network_graph. remove_stale_channels_and_tracking_with_time ( announcement_time + 1 + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS ) ;
2612
+ // Make sure removed channels are tracked.
2613
+ assert_eq ! ( network_graph. removed_channels. lock( ) . unwrap( ) . len( ) , 1 ) ;
2614
+ // Provide a later time so that sufficient time has passed
2615
+ network_graph. remove_stale_channels_and_tracking_with_time ( announcement_time + 1 + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS +
2616
+ REMOVED_ENTRIES_TRACKING_AGE_LIMIT_SECS ) ;
2606
2617
}
2607
2618
2608
2619
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
2609
2620
assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) , 0 ) ;
2621
+ assert ! ( network_graph. removed_channels. lock( ) . unwrap( ) . is_empty( ) ) ;
2610
2622
2611
2623
#[ cfg( feature = "std" ) ]
2612
2624
{
0 commit comments