From df865cb86838bb6642464b62f0f2250040df76d6 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 2 Apr 2025 13:18:40 +0200 Subject: [PATCH] p2p/discover: fix test --- p2p/discover/v5_udp_test.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index 75ab000118..606b35c4f2 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -181,18 +181,16 @@ func TestUDPv5_handshakeRepeatChallenge(t *testing.T) { nonce1 := v5wire.Nonce{1} nonce2 := v5wire.Nonce{2} nonce3 := v5wire.Nonce{3} - var authTag1 v5wire.Nonce - check := func(p *v5wire.Whoareyou, actualAuthTag, wantNonce v5wire.Nonce) { + var firstAuthTag *v5wire.Nonce + check := func(p *v5wire.Whoareyou, authTag, wantNonce v5wire.Nonce) { t.Helper() 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) } }