X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fln%2Frouter.rs;h=0d049f5a78d6bfcb68bd41a49ab06602e98069c3;hb=74cec623fd1d6a505f41cdb8cc6479e6f6fae8ab;hp=4a55df88c6f90fd30d309e506377d819a7720a02;hpb=b2a855b57ace202243a3fd410b94e1e09f22a502;p=rust-lightning diff --git a/src/ln/router.rs b/src/ln/router.rs index 4a55df88..0d049f5a 100644 --- a/src/ln/router.rs +++ b/src/ln/router.rs @@ -349,10 +349,24 @@ impl RoutingMessageHandler for Router { &msgs::HTLCFailChannelUpdate::ChannelUpdateMessage { ref msg } => { let _ = self.handle_channel_update(msg); }, - &msgs::HTLCFailChannelUpdate::ChannelClosed { ref short_channel_id } => { + &msgs::HTLCFailChannelUpdate::ChannelClosed { ref short_channel_id, ref is_permanent } => { let mut network = self.network_map.write().unwrap(); - if let Some(chan) = network.channels.remove(short_channel_id) { - Self::remove_channel_in_nodes(&mut network.nodes, &chan, *short_channel_id); + if *is_permanent { + if let Some(chan) = network.channels.remove(short_channel_id) { + Self::remove_channel_in_nodes(&mut network.nodes, &chan, *short_channel_id); + } + } else { + if let Some(chan) = network.channels.get_mut(short_channel_id) { + chan.one_to_two.enabled = false; + chan.two_to_one.enabled = false; + } + } + }, + &msgs::HTLCFailChannelUpdate::NodeFailure { ref node_id, ref is_permanent } => { + if *is_permanent { + //TODO: Wholly remove the node + } else { + self.mark_node_bad(node_id, false); } }, }