Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit e36f1e5

Browse files
tomakaarkpar
authored andcommitted
Better logging for public key mismatch (#429)
1 parent 56f67b5 commit e36f1e5

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

substrate/network-libp2p/src/service.rs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,20 +1115,21 @@ fn open_peer_custom_proto<T, To, St, C>(
11151115
let socket = out.socket;
11161116
let original_addr = out.original_addr;
11171117
out.info
1118-
.and_then(move |info|
1119-
if info.info.public_key.into_peer_id() == expected_peer_id {
1118+
.and_then(move |info| {
1119+
let actual_peer_id = info.info.public_key.into_peer_id();
1120+
if actual_peer_id == expected_peer_id {
11201121
Ok(socket)
11211122
} else {
11221123
debug!(target: "sub-libp2p",
1123-
"Public key mismatch for node {:?} with proto {:?}",
1124+
"Public key mismatch for node {:?} ; actual: {:?}",
11241125
expected_peer_id,
1125-
proto_id
1126+
actual_peer_id
11261127
);
11271128
trace!(target: "sub-libp2p", "Removing addr {} for {:?}", original_addr, expected_peer_id);
11281129
shared.network_state.set_invalid_kad_address(&expected_peer_id, &original_addr);
1129-
Err(IoError::new(IoErrorKind::InvalidData, "public key mismatch when identifyed peer"))
1130+
Err(IoError::new(IoErrorKind::InvalidData, "public key mismatch when identifying peer"))
11301131
}
1131-
)
1132+
})
11321133
.and_then(move |socket|
11331134
upgrade::apply(socket, proto, endpoint, client_addr)
11341135
)

0 commit comments

Comments
 (0)