@@ -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
@@ -2578,6 +2579,16 @@ mod tests {
2578
2579
assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) , 2 ) ;
2579
2580
2580
2581
network_graph. remove_stale_channels_and_tracking_with_time ( 101 + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS ) ;
2582
+
2583
+ #[ cfg( not( feature = "std" ) ) ]
2584
+ {
2585
+ // Make sure removed channels are tracked.
2586
+ assert_eq ! ( network_graph. removed_channels. lock( ) . unwrap( ) . len( ) , 1 ) ;
2587
+ // Provide a later time so that sufficient time has passed
2588
+ network_graph. remove_stale_channels_and_tracking_with_time ( 101 + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS +
2589
+ REMOVED_ENTRIES_TRACKING_AGE_LIMIT_SECS ) ;
2590
+ }
2591
+
2581
2592
#[ cfg( feature = "std" ) ]
2582
2593
{
2583
2594
// In std mode, a further check is performed before fully removing the channel -
@@ -2598,10 +2609,16 @@ mod tests {
2598
2609
assert ! ( gossip_sync. handle_channel_update( & valid_channel_update) . is_ok( ) ) ;
2599
2610
assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_some( ) ) ;
2600
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 ) ;
2601
2617
}
2602
2618
2603
2619
assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) , 0 ) ;
2604
2620
assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) , 0 ) ;
2621
+ assert ! ( network_graph. removed_channels. lock( ) . unwrap( ) . is_empty( ) ) ;
2605
2622
2606
2623
#[ cfg( feature = "std" ) ]
2607
2624
{
0 commit comments