From 6337577434abcd99a24ff5e14dce9bd6381efbeb Mon Sep 17 00:00:00 2001 From: Delweng Date: Tue, 14 Oct 2025 01:58:50 +0800 Subject: [PATCH] p2p/discover: wait for bootstrap to be done (#32881) This ensures the node is ready to accept other nodes into the table before it is used in a test. Closes #32863 --- p2p/discover/v4_udp_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/p2p/discover/v4_udp_test.go b/p2p/discover/v4_udp_test.go index 44863183fa..287f0c34fa 100644 --- a/p2p/discover/v4_udp_test.go +++ b/p2p/discover/v4_udp_test.go @@ -575,6 +575,13 @@ func startLocalhostV4(t *testing.T, cfg Config) *UDPv4 { if err != nil { t.Fatal(err) } + + // Wait for bootstrap to complete. + select { + case <-udp.tab.initDone: + case <-time.After(5 * time.Second): + t.Fatalf("timed out waiting for table initialization") + } return udp }