From de24150203a7866b34cd090ebda07ad9fbd59f35 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Mon, 24 Feb 2020 18:47:38 -0500 Subject: [PATCH] Dont treat a timer tick as no_connection_possible and log In testing, due to other patches, I managed to flood the send queue with messages and cause us not to be able to send pings, thus getting a peer disconnected for ping timeout. To my surprise, this also force-closed all of my channels with that peeer. Obviously a ping timeout does not indicate that no future connection with said peer will be possible, and we shouldn't be force-closing channels as a result. This also logs when a peer is disconnected to ping timeout to make debug easier. --- lightning/src/ln/peer_handler.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lightning/src/ln/peer_handler.rs b/lightning/src/ln/peer_handler.rs index 049aae701..29e67e6ba 100644 --- a/lightning/src/ln/peer_handler.rs +++ b/lightning/src/ln/peer_handler.rs @@ -1089,10 +1089,15 @@ impl PeerManager where descriptors_needing_disconnect.push(descriptor.clone()); match peer.their_node_id { Some(node_id) => { + log_trace!(self, "Disconnecting peer with id {} due to ping timeout", node_id); node_id_to_descriptor.remove(&node_id); - self.message_handler.chan_handler.peer_disconnected(&node_id, true); + self.message_handler.chan_handler.peer_disconnected(&node_id, false); } - None => {} + None => { + // This can't actually happen as we should have hit + // is_ready_for_encryption() previously on this same peer. + unreachable!(); + }, } return false; } -- 2.39.5