-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
A PeerIdMismatch mismatch error implies:
- (I) The local node can establish a socket connection to the given IP address
- (II) Negotiation of protocols fails because the provided encryption key corresponds to a different PeerID
The first (I) step increments the score of the address by 100 points:
litep2p/src/transport/manager/mod.rs
Lines 821 to 841 in b16c74c
| /// Update the address on a connection established. | |
| fn update_address_on_connection_established(&mut self, peer: PeerId, endpoint: &Endpoint) { | |
| // The connection can be inbound or outbound. | |
| // For the inbound connection type, in most cases, the remote peer dialed | |
| // with an ephemeral port which it might not be listening on. | |
| // Therefore, we only insert the address into the store if we're the dialer. | |
| if endpoint.is_listener() { | |
| return; | |
| } | |
| let mut peers = self.peers.write(); | |
| let record = AddressRecord::new( | |
| &peer, | |
| endpoint.address().clone(), | |
| scores::CONNECTION_ESTABLISHED, | |
| ); | |
| let context = peers.entry(peer).or_default(); | |
| context.addresses.insert(record); | |
| } |
The second step (II) decrements the score of the address by 100 points:
litep2p/src/transport/manager/mod.rs
Lines 713 to 717 in b16c74c
| // Update the address on a dial failure. | |
| fn update_address_on_dial_failure(&mut self, address: Multiaddr, error: &DialError) { | |
| let mut peers = self.peers.write(); | |
| let score = AddressStore::error_score(error); |
This effectively leaves the score of the invalid IP address unmodified.
The downstream effect of this is that the IP address will be retried in the future, effectively wasting resources.
Discovered during:
Metadata
Metadata
Assignees
Labels
No labels