@@ -1667,6 +1667,7 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
16671667			for  scid in  scids_to_remove { 
16681668				let  info = channels. remove ( & scid) . expect ( "We just accessed this scid, it should be present" ) ; 
16691669				Self :: remove_channel_in_nodes ( & mut  nodes,  & info,  scid) ; 
1670+ 				self . removed_channels . lock ( ) . unwrap ( ) . insert ( scid,  Some ( current_time_unix) ) ; 
16701671			} 
16711672		} 
16721673
@@ -2546,6 +2547,13 @@ mod tests {
25462547		assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) ,  2 ) ; 
25472548
25482549		network_graph. remove_stale_channels_and_tracking_with_time ( 101  + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS ) ; 
2550+ 		#[ cfg( not( feature = "std" ) ) ]   { 
2551+ 			// Make sure removed channels are tracked. 
2552+ 			assert_eq ! ( network_graph. removed_channels. lock( ) . unwrap( ) . len( ) ,  1 ) ; 
2553+ 		} 
2554+ 		network_graph. remove_stale_channels_and_tracking_with_time ( 101  + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS  +
2555+ 			REMOVED_ENTRIES_TRACKING_AGE_LIMIT_SECS ) ; 
2556+ 
25492557		#[ cfg( feature = "std" ) ]  
25502558		{ 
25512559			// In std mode, a further check is performed before fully removing the channel - 
@@ -2566,10 +2574,16 @@ mod tests {
25662574			assert ! ( gossip_sync. handle_channel_update( & valid_channel_update) . is_ok( ) ) ; 
25672575			assert ! ( network_graph. read_only( ) . channels( ) . get( & short_channel_id) . unwrap( ) . one_to_two. is_some( ) ) ; 
25682576			network_graph. remove_stale_channels_and_tracking_with_time ( announcement_time + 1  + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS ) ; 
2577+ 			// Make sure removed channels are tracked. 
2578+ 			assert_eq ! ( network_graph. removed_channels. lock( ) . unwrap( ) . len( ) ,  1 ) ; 
2579+ 			// Provide a later time so that sufficient time has passed 
2580+ 			network_graph. remove_stale_channels_and_tracking_with_time ( announcement_time + 1  + STALE_CHANNEL_UPDATE_AGE_LIMIT_SECS  +
2581+ 				REMOVED_ENTRIES_TRACKING_AGE_LIMIT_SECS ) ; 
25692582		} 
25702583
25712584		assert_eq ! ( network_graph. read_only( ) . channels( ) . len( ) ,  0 ) ; 
25722585		assert_eq ! ( network_graph. read_only( ) . nodes( ) . len( ) ,  0 ) ; 
2586+ 		assert ! ( network_graph. removed_channels. lock( ) . unwrap( ) . is_empty( ) ) ; 
25732587
25742588		#[ cfg( feature = "std" ) ]  
25752589		{ 
0 commit comments