Skip to content

bug(l1): connection attempt on already connected peer due to revalidation #1684

@fmoletta

Description

@fmoletta

During peer revalidation we ping the least recently pinged peers and expect them to reply with a pong message. When a peer replies with pong we also try to initiate a connection with it. If a peer we are already connected to were to fall under this revalidation then we would attempt to initiate a second connection with the peer to which the peer would reply to by disconnecting from us.
Here are some logs to illustrate the problem:

025-01-09T19:24:05.888572Z  INFO ethrex_net::kademlia: Snap Peers: 2 / Active Peers 2 / Total Peers: 101
2025-01-09T19:24:05.888674Z  INFO ethrex_net::kademlia: Active Peers ID: 0xa343…5072, 0xac90…5e2b
2025-01-09T19:24:05.888748Z  INFO ethrex_net::sync: Requesting Block Headers from 0xde8f…79e7
2025-01-09T19:24:05.889382Z  INFO ethrex_net: Running peer revalidation
2025-01-09T19:24:05.891256Z  INFO ethrex_net: Pinging peer 0xa343…5072 to re-validate!
2025-01-09T19:24:05.892743Z  INFO ethrex_net: Pinging peer 0x0010…e3e7 to re-validate!
2025-01-09T19:24:05.894219Z  INFO ethrex_net: Pinging peer 0x743d…7122 to re-validate!
2025-01-09T19:24:05.894262Z  INFO ethrex_net: Peer revalidation finished
2025-01-09T19:24:05.926046Z  INFO ethrex_net: Peer 0xa343…5072 answered ping with pong
2025-01-09T19:24:05.929520Z  INFO ethrex_net: Peer 0x743d…7122 answered ping with pong
2025-01-09T19:24:05.958563Z  INFO ethrex_net: Starting Peer as Initiator
2025-01-09T19:24:05.970228Z  INFO ethrex_net: Starting Peer as Initiator
2025-01-09T19:24:06.006510Z ERROR ethrex_net::rlpx::connection: Handshake failed: (Peer disconnected due to: Already connected), discarding peer 0xa343…5072

We should read the spec in order to handle this case accordingly

Metadata

Metadata

Assignees

Labels

L1Ethereum clientp2pIssues related to p2p network

Type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions