},
1 => {
let short_channel_id = slice_to_be64(get_slice!(8));
- router.handle_htlc_fail_channel_update(&msgs::HTLCFailChannelUpdate::ChannelClosed {short_channel_id});
+ router.handle_htlc_fail_channel_update(&msgs::HTLCFailChannelUpdate::ChannelClosed {short_channel_id, is_permanent: false});
},
_ => return,
}
// No such next-hop. We know this came from the
// current node as the HMAC validated.
res = Some(msgs::HTLCFailChannelUpdate::ChannelClosed {
- short_channel_id: route_hop.short_channel_id
+ short_channel_id: route_hop.short_channel_id,
+ is_permanent: true,
});
},
_ => {}, //TODO: Enumerate all of these!
let as_chan = a_channel_lock.by_id.get(&chan_announcement.3).unwrap();
let bs_chan = b_channel_lock.by_id.get(&chan_announcement.3).unwrap();
- let _ = nodes[0].router.handle_htlc_fail_channel_update(&msgs::HTLCFailChannelUpdate::ChannelClosed { short_channel_id : as_chan.get_short_channel_id().unwrap() } );
+ let _ = nodes[0].router.handle_htlc_fail_channel_update(&msgs::HTLCFailChannelUpdate::ChannelClosed { short_channel_id : as_chan.get_short_channel_id().unwrap(), is_permanent: false } );
let as_bitcoin_key = PublicKey::from_secret_key(&secp_ctx, &as_chan.get_local_keys().funding_key);
let bs_bitcoin_key = PublicKey::from_secret_key(&secp_ctx, &bs_chan.get_local_keys().funding_key);
let unsigned_msg = dummy_unsigned_msg!();
sign_msg!(unsigned_msg);
assert_eq!(nodes[0].router.handle_channel_announcement(&chan_announcement).unwrap(), true);
- let _ = nodes[0].router.handle_htlc_fail_channel_update(&msgs::HTLCFailChannelUpdate::ChannelClosed { short_channel_id : as_chan.get_short_channel_id().unwrap() } );
+ let _ = nodes[0].router.handle_htlc_fail_channel_update(&msgs::HTLCFailChannelUpdate::ChannelClosed { short_channel_id : as_chan.get_short_channel_id().unwrap(), is_permanent: false } );
// Configured with Network::Testnet
let mut unsigned_msg = dummy_unsigned_msg!();
ChannelClosed {
/// The short_channel_id which has now closed.
short_channel_id: u64,
+ /// when this true, this channel should be permanently removed from the
+ /// consideration. Otherwise, this channel can be restored as new channel_update is received
+ is_permanent: bool,
},
+ /// We received an error which indicated only that a node has failed
+ NodeFailure {
+ /// The node_id that has failed.
+ node_id: PublicKey,
+ /// when this true, node should be permanently removed from the
+ /// consideration. Otherwise, the channels connected to this node can be
+ /// restored as new channel_update is received
+ is_permanent: bool,
+ }
}
/// A trait to describe an object which can receive channel messages.
&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:_ } => {
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:_ } => {
+ //let mut network = self.network_map.write().unwrap();
+ //TODO: check _blamed_upstream_node
+ self.mark_node_bad(node_id, false);
+ },
}
}