From e1fe4a1a98e531ded82805dd1724b189b3f22037 Mon Sep 17 00:00:00 2001 From: Charles Dusek <38732970+cgdusek@users.noreply.github.com> Date: Tue, 14 Apr 2026 02:43:44 -0500 Subject: [PATCH] p2p/discover: fix flaky TestUDPv5_findnodeHandling (#34109) Fixes #34108 The UDPv5 test harness (`newUDPV5Test`) uses the default `PingInterval` of 3 seconds. When tests like `TestUDPv5_findnodeHandling` insert nodes into the routing table via `fillTable`, the table's revalidation loop may schedule PING packets for those nodes. Under the race detector or on slow CI runners, the test runs long enough for revalidation to fire, causing background pings to be written to the test pipe. The `close()` method then finds these as unmatched packets and fails. The fix sets `PingInterval` to a very large value in the test harness so revalidation never fires during tests. Verified locally: 100 iterations with `-race -count=100` pass reliably, where previously the test would fail within ~50 iterations. --- p2p/discover/v5_udp_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index 9429fbaf0a..1c41941c70 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -937,6 +937,7 @@ func newUDPV5Test(t *testing.T) *udpV5Test { PrivateKey: test.localkey, Log: testlog.Logger(t, log.LvlTrace), ValidSchemes: enode.ValidSchemesForTesting, + PingInterval: 1000 * time.Hour, }) test.udp.codec = &testCodec{test: test, id: ln.ID()} test.table = test.udp.tab