Skip to content

Commit 8167c46

Browse files
committed
f
1 parent e43b843 commit 8167c46

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lightning/src/ln/peer_handler.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,15 @@ impl<Descriptor: SocketDescriptor, CM: Deref, RM: Deref, OM: Deref, L: Deref, CM
11531153
macro_rules! insert_node_id {
11541154
() => {
11551155
match self.node_id_to_descriptor.lock().unwrap().entry(peer.their_node_id.unwrap().0) {
1156-
hash_map::Entry::Occupied(_) => {
1156+
hash_map::Entry::Occupied(e) => {
11571157
log_trace!(self.logger, "Got second connection with {}, closing", log_pubkey!(peer.their_node_id.unwrap().0));
11581158
peer.their_node_id = None; // Unset so that we don't generate a peer_disconnected event
1159+
#[cfg(debug_assertions)] {
1160+
// Check that the peers map is consistent with the
1161+
// node_id_to_descriptor map, as this has been broken
1162+
// before.
1163+
peers.get(e.get()).unwrap();
1164+
}
11591165
return Err(PeerHandleError { })
11601166
},
11611167
hash_map::Entry::Vacant(entry) => {

0 commit comments

Comments
 (0)