@@ -349,18 +349,25 @@ impl RoutingMessageHandler for Router {
349
349
& msgs:: HTLCFailChannelUpdate :: ChannelUpdateMessage { ref msg } => {
350
350
let _ = self . handle_channel_update ( msg) ;
351
351
} ,
352
- & msgs:: HTLCFailChannelUpdate :: ChannelClosed { ref short_channel_id, is_permanent : _ } => {
353
- //XXX
352
+ & msgs:: HTLCFailChannelUpdate :: ChannelClosed { ref short_channel_id, ref is_permanent } => {
354
353
let mut network = self . network_map . write ( ) . unwrap ( ) ;
355
- if let Some ( chan) = network. channels . remove ( short_channel_id) {
356
- Self :: remove_channel_in_nodes ( & mut network. nodes , & chan, * short_channel_id) ;
354
+ if * is_permanent {
355
+ if let Some ( chan) = network. channels . remove ( short_channel_id) {
356
+ Self :: remove_channel_in_nodes ( & mut network. nodes , & chan, * short_channel_id) ;
357
+ }
358
+ } else {
359
+ if let Some ( chan) = network. channels . get_mut ( short_channel_id) {
360
+ chan. one_to_two . enabled = false ;
361
+ chan. two_to_one . enabled = false ;
362
+ }
357
363
}
358
364
} ,
359
- & msgs:: HTLCFailChannelUpdate :: NodeFailure { ref node_id, is_permanent : _ } => {
360
- //XXX
361
- //let mut network = self.network_map.write().unwrap();
362
- //TODO: check _blamed_upstream_node
363
- self . mark_node_bad ( node_id, false ) ;
365
+ & msgs:: HTLCFailChannelUpdate :: NodeFailure { ref node_id, ref is_permanent } => {
366
+ if * is_permanent {
367
+ //TODO: Wholly remove the node
368
+ } else {
369
+ self . mark_node_bad ( node_id, false ) ;
370
+ }
364
371
} ,
365
372
}
366
373
}
0 commit comments