Add is_permanent field to ChannelClosed message and add NodeFailure
[rust-lightning] / src / ln / router.rs
index 4a55df88c6f90fd30d309e506377d819a7720a02..4c3bcb98074fd8301941739c9352ce6bef593e05 100644 (file)
@@ -349,12 +349,19 @@ 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, is_permanent:_ } => {
+//XXX
                                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);
                                }
                        },
+                       &msgs::HTLCFailChannelUpdate::NodeFailure { ref node_id, is_permanent:_ } => {
+//XXX
+                               //let mut network = self.network_map.write().unwrap();
+                               //TODO: check _blamed_upstream_node
+                               self.mark_node_bad(node_id, false);
+                       },
                }
        }