mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-13 15:33:47 +00:00
fix:make only sent whoareyou challenges first time
Signed-off-by: Chen Kai <281165273grape@gmail.com>
This commit is contained in:
parent
4605c46a53
commit
076e33c53f
1 changed files with 4 additions and 0 deletions
|
|
@ -217,6 +217,10 @@ func (c *Codec) Encode(id enode.ID, addr string, packet Packet, challenge *Whoar
|
||||||
|
|
||||||
// Store sent WHOAREYOU challenges.
|
// Store sent WHOAREYOU challenges.
|
||||||
if challenge, ok := packet.(*Whoareyou); ok {
|
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)
|
challenge.ChallengeData = bytesCopy(&c.buf)
|
||||||
c.sc.storeSentHandshake(id, addr, challenge)
|
c.sc.storeSentHandshake(id, addr, challenge)
|
||||||
} else if msgData == nil {
|
} else if msgData == nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue