From 835a4e59438a9ecd9177b8be5482f96c353b5773 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Mon, 28 Apr 2025 19:21:39 +0200 Subject: [PATCH] add maxParallelENRRequests parameter Signed-off-by: Csaba Kiraly --- eth/backend.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/eth/backend.go b/eth/backend.go index fde6b2e1a4..e93d023d25 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -70,6 +70,10 @@ const ( // in the next rounds, giving it overall more time but a proportionally smaller share. // We expect a normal source to produce ~10 candidates per second. discmixTimeout = 100 * time.Millisecond + + // maxParallelENRRequests is the maximum number of parallel ENR requests that can be + // performed by a disc/v4 source. + maxParallelENRRequests = 16 ) // Config contains the configuration options of the ETH protocol. @@ -501,7 +505,7 @@ func (s *Ethereum) setupDiscovery() error { if s.p2pServer.DiscoveryV4() != nil { asyncFilter := s.p2pServer.DiscoveryV4().RequestENR filter := eth.NewNodeFilter(s.blockchain) - iter := enode.AsyncFilter(s.p2pServer.DiscoveryV4().RandomNodes(), asyncFilter, 16) + iter := enode.AsyncFilter(s.p2pServer.DiscoveryV4().RandomNodes(), asyncFilter, maxParallelENRRequests) iter = enode.Filter(iter, filter) s.discmix.AddSource(iter) }