From: Jeffrey Czyz Date: Tue, 12 Dec 2023 14:46:10 +0000 (-0600) Subject: Relax OnionMessenger::peer_disconnected assertion X-Git-Tag: v0.0.119~11^2 X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=a4f2c36015545c9607eb07a4bef5061997d2d322;p=rust-lightning Relax OnionMessenger::peer_disconnected assertion When a peer is connected, OnionMessenger tracks it only if it supports onion messages. On disconnect, we debug_assert that the peer was in a state ConnectedPeer, failing when it is in the PendingConnection state. However, we were mistakenly asserting for peers that we were not tracking (i.e., that don't support onion messages). Relax the check to not fail on the latter. --- diff --git a/lightning/src/onion_message/messenger.rs b/lightning/src/onion_message/messenger.rs index 21a1b302d..8a44eb2a5 100644 --- a/lightning/src/onion_message/messenger.rs +++ b/lightning/src/onion_message/messenger.rs @@ -914,7 +914,8 @@ where fn peer_disconnected(&self, their_node_id: &PublicKey) { match self.message_recipients.lock().unwrap().remove(their_node_id) { Some(OnionMessageRecipient::ConnectedPeer(..)) => {}, - _ => debug_assert!(false), + Some(_) => debug_assert!(false), + None => {}, } }