@@ -1541,6 +1541,14 @@ impl<L: Deref> NetworkGraph<L> where L::Target: Logger {
1541
1541
#[ cfg( not( feature = "std" ) ) ]
1542
1542
let current_time_unix = None ;
1543
1543
1544
+ self . channel_failed_with_time ( short_channel_id, is_permanent, current_time_unix)
1545
+ }
1546
+
1547
+ /// Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
1548
+ /// If permanent, removes a channel from the local storage.
1549
+ /// May cause the removal of nodes too, if this was their last channel.
1550
+ /// If not permanent, makes channels unavailable for routing.
1551
+ fn channel_failed_with_time ( & self , short_channel_id : u64 , is_permanent : bool , current_time_unix : Option < u64 > ) {
1544
1552
let mut channels = self . channels . write ( ) . unwrap ( ) ;
1545
1553
if is_permanent {
1546
1554
if let Some ( chan) = channels. remove ( & short_channel_id) {
@@ -2537,7 +2545,7 @@ mod tests {
2537
2545
2538
2546
// Mark the channel as permanently failed. This will also remove the two nodes
2539
2547
// and all of the entries will be tracked as removed.
2540
- network_graph. channel_failed ( short_channel_id, true ) ;
2548
+ network_graph. channel_failed_with_time ( short_channel_id, true , Some ( tracking_time ) ) ;
2541
2549
2542
2550
// Should not remove from tracking if insufficient time has passed
2543
2551
network_graph. remove_stale_channels_and_tracking_with_time (
0 commit comments