Skip to content

Commit 338d754

Browse files
authored
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 <[email protected]>
1 parent 6eab053 commit 338d754

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/state_prefetcher.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c
5757
workers errgroup.Group
5858
reader = statedb.Reader()
5959
)
60-
workers.SetLimit(4 * runtime.NumCPU() / 5) // Aggressively run the prefetching
60+
workers.SetLimit(max(1, 4*runtime.NumCPU()/5)) // Aggressively run the prefetching
6161

6262
// Iterate over and process the individual transactions
6363
for i, tx := range block.Transactions() {

0 commit comments

Comments
 (0)