mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 07:06:42 +00:00
p2p/discover: fix test
This commit is contained in:
parent
220a8cf423
commit
df865cb868
1 changed files with 7 additions and 9 deletions
|
|
@ -181,18 +181,16 @@ func TestUDPv5_handshakeRepeatChallenge(t *testing.T) {
|
||||||
nonce1 := v5wire.Nonce{1}
|
nonce1 := v5wire.Nonce{1}
|
||||||
nonce2 := v5wire.Nonce{2}
|
nonce2 := v5wire.Nonce{2}
|
||||||
nonce3 := v5wire.Nonce{3}
|
nonce3 := v5wire.Nonce{3}
|
||||||
var authTag1 v5wire.Nonce
|
var firstAuthTag *v5wire.Nonce
|
||||||
check := func(p *v5wire.Whoareyou, actualAuthTag, wantNonce v5wire.Nonce) {
|
check := func(p *v5wire.Whoareyou, authTag, wantNonce v5wire.Nonce) {
|
||||||
t.Helper()
|
t.Helper()
|
||||||
if p.Nonce != wantNonce {
|
if p.Nonce != wantNonce {
|
||||||
t.Error("wrong nonce in WHOAREYOU:", p.Nonce, wantNonce)
|
t.Error("wrong nonce in WHOAREYOU:", p.Nonce, "want:", wantNonce)
|
||||||
}
|
|
||||||
if authTag1 == (v5wire.Nonce{}) {
|
|
||||||
authTag1 = actualAuthTag
|
|
||||||
} else {
|
|
||||||
if authTag1 != authTag1 {
|
|
||||||
t.Error("wrong auth tag in WHOAREYOU header:", authTag1, wantNonce)
|
|
||||||
}
|
}
|
||||||
|
if firstAuthTag == nil {
|
||||||
|
firstAuthTag = &authTag
|
||||||
|
} else if authTag != *firstAuthTag {
|
||||||
|
t.Error("wrong auth tag in WHOAREYOU header:", authTag, "want:", *firstAuthTag)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue