Skip to content

Commit cb17078

Browse files
cskiralyhowjmay
authored andcommitted
core/state: fix prefetch on single core CPU (ethereum#32075)
We need at least one prefetch goroutine. SetLimit(0) would block prefetch. Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
1 parent d22d7e8 commit cb17078

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)