X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fln%2Frouter.rs;h=4c3bcb98074fd8301941739c9352ce6bef593e05;hb=d3ca7da67268568227472bc689268d73b5853e44;hp=16f996df062047134248d43298aa77d2d6ee4ad1;hpb=66fbc66da0c064e4ee271ad5a8e0a37410c80078;p=rust-lightning diff --git a/src/ln/router.rs b/src/ln/router.rs index 16f996df..4c3bcb98 100644 --- a/src/ln/router.rs +++ b/src/ln/router.rs @@ -1,4 +1,5 @@ //! The top-level routing/network map tracking logic lives here. +//! //! You probably want to create a Router and use that as your RoutingMessageHandler and then //! interrogate it to get routes for your own payments. @@ -348,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); + }, } } @@ -523,13 +531,18 @@ impl Router { } /// Gets a route from us to the given target node. + /// /// Extra routing hops between known nodes and the target will be used if they are included in /// last_hops. + /// /// If some channels aren't announced, it may be useful to fill in a first_hops with the /// results from a local ChannelManager::list_usable_channels() call. If it is filled in, our /// (this Router's) view of our local channels will be ignored, and only those in first_hops - /// will be used. Panics if first_hops contains channels without short_channel_ids + /// will be used. + /// + /// Panics if first_hops contains channels without short_channel_ids /// (ChannelManager::list_usable_channels will never include such channels). + /// /// The fees on channels from us to next-hops are ignored (as they are assumed to all be /// equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat /// *is* checked as they may change based on the receiving node.