Skip to content

Commit

Permalink
fix:make only sent whoareyou challenges first time
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <[email protected]>
  • Loading branch information
GrapeBaBa committed Oct 9, 2024
1 parent 4605c46 commit 076e33c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions p2p/discover/v5wire/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,10 @@ func (c *Codec) Encode(id enode.ID, addr string, packet Packet, challenge *Whoar

// Store sent WHOAREYOU challenges.
if challenge, ok := packet.(*Whoareyou); ok {
// check if we already sent a challenge to this node
if c.sc.getHandshake(id, addr) != nil {
return nil, Nonce{}, nil
}
challenge.ChallengeData = bytesCopy(&c.buf)
c.sc.storeSentHandshake(id, addr, challenge)
} else if msgData == nil {
Expand Down

0 comments on commit 076e33c

Please sign in to comment.