core/state: fix prefetch on single core CPU (#32075)

We need at least one prefetch goroutine. SetLimit(0) would block
prefetch.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2025-06-22 14:28:29 +02:00 committed by GitHub
parent 6eab053088
commit 338d754ed0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -57,7 +57,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
workers errgroup.Group
reader = statedb.Reader()
)
workers.SetLimit(4 * runtime.NumCPU() / 5) // Aggressively run the prefetching
workers.SetLimit(max(1, 4*runtime.NumCPU()/5)) // Aggressively run the prefetching
// Iterate over and process the individual transactions
for i, tx := range block.Transactions() {