diff --git a/beacon-chain/p2p/iterator.go b/beacon-chain/p2p/iterator.go index 2530e46a5b8d..cd5451ba3048 100644 --- a/beacon-chain/p2p/iterator.go +++ b/beacon-chain/p2p/iterator.go @@ -2,14 +2,10 @@ package p2p import ( "context" - "runtime" - "time" "github.com/ethereum/go-ethereum/p2p/enode" ) -const backOffCounter = 50 - // filterNodes wraps an iterator such that Next only returns nodes for which // the 'check' function returns true. This custom implementation also // checks for context deadlines so that in the event the parent context has @@ -28,21 +24,13 @@ type filterIter struct { // Next looks up for the next valid node according to our // filter criteria. func (f *filterIter) Next() bool { - lookupCounter := 0 for f.Iterator.Next() { - // Do not excessively perform lookups if we constantly receive non-viable peers. - if lookupCounter > backOffCounter { - lookupCounter = 0 - runtime.Gosched() - time.Sleep(pollingPeriod) - } if f.Context.Err() != nil { return false } if f.check(f.Node()) { return true } - lookupCounter++ } return false }