Skip to content

Commit

Permalink
Relax OnionMessenger::peer_disconnected assertion
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jkczyz committed Dec 12, 2023
1 parent 0c67753 commit a4f2c36
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lightning/src/onion_message/messenger.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {},
}
}

Expand Down

0 comments on commit a4f2c36

Please sign in to comment.