@@ -1704,6 +1704,7 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
17041704 for scid in scids_to_remove {
17051705 let info = channels. remove ( & scid) . expect ( "We just accessed this scid, it should be present" ) ;
17061706 Self :: remove_channel_in_nodes ( & mut nodes, & info, scid) ;
1707+ self . removed_channels . lock ( ) . unwrap ( ) . insert ( scid, Some ( current_time_unix) ) ;
17071708 }
17081709 }
17091710
@@ -2579,6 +2580,11 @@ mod tests {
25792580 assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 1 ) ;
25802581 assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) , 2 ) ;
25812582 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 ) ;
25822588 }
25832589
25842590 #[ cfg( feature = "std" ) ]
@@ -2603,10 +2609,16 @@ mod tests {
26032609 assert ! ( gossip_sync. handle_channel_update( & valid_channel_update) . is_ok( ) ) ;
26042610 assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_some( ) ) ;
26052611 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 ) ;
26062617 }
26072618
26082619 assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
26092620 assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) , 0 ) ;
2621+ assert ! ( network_graph. removed_channels. lock( ) . unwrap( ) . is_empty( ) ) ;
26102622
26112623 #[ cfg( feature = "std" ) ]
26122624 {
0 commit comments