From fb4dff44dc8bff482df310b74285c6fa5894b1ee Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Thu, 28 Aug 2025 23:42:47 +0200 Subject: [PATCH] p2p/discover: fix timeout on refresh if no bootnodes If we have no nodes to add in a refresh, and the table is empty, it is useless to do lookups. This was triggering a 3 second wait for a timeout in the initialization code, making some hive tests fail. Signed-off-by: Csaba Kiraly --- p2p/discover/table.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/p2p/discover/table.go b/p2p/discover/table.go index b6c35aaaa9..b4831a8cdd 100644 --- a/p2p/discover/table.go +++ b/p2p/discover/table.go @@ -428,6 +428,12 @@ func (tab *Table) doRefresh(done chan struct{}) { // (hopefully) still alive. tab.loadSeedNodes() + // If the table is empty, we cannot perform any lookups. + if tab.len() == 0 { + log.Debug("doRefresh called, but no nodes to start from") + return + } + // Run self lookup to discover new neighbor nodes. tab.net.lookupSelf()