Skip to content

Commit

Permalink
Ensure handlers see a consistent set of peers on conn rejection
Browse files Browse the repository at this point in the history
If a message handler decides to reject a connection, other handlers
should see the disconnection if they've already seen the
connection. We weren't previously doing that, and do it here.
  • Loading branch information
TheBlueMatt committed Oct 18, 2023
1 parent d758d76 commit 9ac7282
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lightning/src/ln/peer_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,10 +1561,13 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
}
if let Err(()) = self.message_handler.onion_message_handler.peer_connected(&their_node_id, &msg, peer_lock.inbound_connection) {
log_debug!(self.logger, "Onion Message Handler decided we couldn't communicate with peer {}", log_pubkey!(their_node_id));
self.message_handler.chan_handler.peer_disconnected(&their_node_id);
return Err(PeerHandleError { }.into());
}
if let Err(()) = self.message_handler.custom_message_handler.peer_connected(&their_node_id, &msg, peer_lock.inbound_connection) {
log_debug!(self.logger, "Custom Message Handler decided we couldn't communicate with peer {}", log_pubkey!(their_node_id));
self.message_handler.onion_message_handler.peer_disconnected(&their_node_id);
self.message_handler.chan_handler.peer_disconnected(&their_node_id);
return Err(PeerHandleError { }.into());
}

Expand Down

0 comments on commit 9ac7282

Please sign in to comment.