From 338d754ed008c425162af244fb8aff04e36b4986 Mon Sep 17 00:00:00 2001 From: Csaba Kiraly Date: Sun, 22 Jun 2025 14:28:29 +0200 Subject: [PATCH] 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 --- core/state_prefetcher.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/state_prefetcher.go b/core/state_prefetcher.go index 2f40e3dc97..c0ce705c77 100644 --- a/core/state_prefetcher.go +++ b/core/state_prefetcher.go @@ -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() {