mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
p2p/discover/v5wire: use Encoded field of Whoareyou
This commit is contained in:
parent
c5e94b67db
commit
9b74d7912e
1 changed files with 4 additions and 3 deletions
|
|
@ -190,8 +190,9 @@ func (c *Codec) Encode(id enode.ID, addr string, packet Packet, challenge *Whoar
|
|||
switch {
|
||||
case packet.Kind() == WhoareyouPacket:
|
||||
// just send the WHOAREYOU packet raw again, rather than the re-encoded challenge data
|
||||
if sentWhoareyou := c.sc.getHandshake(id, addr); sentWhoareyou != nil {
|
||||
return sentWhoareyou.Encoded, sentWhoareyou.Nonce, nil
|
||||
w := packet.(*Whoareyou)
|
||||
if len(w.Encoded) > 0 {
|
||||
return w.Encoded, w.Nonce, nil
|
||||
}
|
||||
head, err = c.encodeWhoareyou(id, packet.(*Whoareyou))
|
||||
case challenge != nil:
|
||||
|
|
@ -227,7 +228,7 @@ func (c *Codec) Encode(id enode.ID, addr string, packet Packet, challenge *Whoar
|
|||
if err != nil {
|
||||
return nil, Nonce{}, err
|
||||
}
|
||||
challenge.Encoded = enc
|
||||
challenge.Encoded = bytes.Clone(enc)
|
||||
c.sc.storeSentHandshake(id, addr, challenge)
|
||||
return enc, head.Nonce, err
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue