add maxParallelENRRequests parameter

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2025-04-28 19:21:39 +02:00
parent 83b16c72f7
commit 835a4e5943
No known key found for this signature in database
GPG key ID: 0FE274EE8C95166E

View file

@ -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)
}