From 2da18aaeae1225d1d47ee6a1a373061c4e204978 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 4 Jun 2025 16:37:07 +0200 Subject: [PATCH] p2p/enode: add more documentation on AsyncFilter --- p2p/enode/iter.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/p2p/enode/iter.go b/p2p/enode/iter.go index 5089404bce..f8f79a9436 100644 --- a/p2p/enode/iter.go +++ b/p2p/enode/iter.go @@ -172,6 +172,9 @@ type asyncFilterIter struct { type AsyncFilterFunc func(context.Context, *Node) *Node // AsyncFilter creates an iterator which checks nodes in parallel. +// The 'check' function is called on multiple goroutines to filter each node +// from the upstream iterator. When check returns nil, the node will be skipped. +// It can also return a new node to be returned by the iterator instead of the . func AsyncFilter(it Iterator, check AsyncFilterFunc, workers int) Iterator { f := &asyncFilterIter{ it: ensureSourceIter(it),