From 72d3e881b32c214b51863661f0d625bb3e5bf319 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Fri, 12 Sep 2025 10:52:53 +0200 Subject: [PATCH] p2p/discover: clarify lookup behavior on empty table We have changed this behavior, better clarify in comment. Signed-off-by: Csaba Kiraly --- p2p/discover/lookup.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/p2p/discover/lookup.go b/p2p/discover/lookup.go index 88c93a57cf..7382bbe41a 100644 --- a/p2p/discover/lookup.go +++ b/p2p/discover/lookup.go @@ -27,6 +27,7 @@ import ( // lookup performs a network search for nodes close to the given target. It approaches the // target by querying nodes that are closer to it on each iteration. The given target does // not need to be an actual node identifier. +// lookup on an empty table will return immediately with no nodes. type lookup struct { tab *Table queryfunc queryFunc @@ -142,6 +143,9 @@ func (it *lookup) query(n *enode.Node, reply chan<- []*enode.Node) { // lookupIterator performs lookup operations and iterates over all seen nodes. // When a lookup finishes, a new one is created through nextLookup. +// LookupIterator waits for table initialization and triggers a table refresh +// when necessary. + type lookupIterator struct { buffer []*enode.Node nextLookup lookupFunc