From 24d3c430ab3f4e6bc9d86ca398473c7b931304da Mon Sep 17 00:00:00 2001 From: Gary Rong Date: Wed, 31 Dec 2025 10:59:33 +0800 Subject: [PATCH] core: address comments --- core/state_prefetcher.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/core/state_prefetcher.go b/core/state_prefetcher.go index 2836598e1f..c48f4192c1 100644 --- a/core/state_prefetcher.go +++ b/core/state_prefetcher.go @@ -120,15 +120,19 @@ func (p *statePrefetcher) Prefetch(block *types.Block, statedb *state.StateDB, c } } for { - tx, done := fetchTx() + next, done := fetchTx() if done { break } - if _, exists := processed[tx.Hash()]; exists { + if _, exists := processed[next.Hash()]; exists { continue } - stateCpy := statedb.Copy() // closure + processed[next.Hash()] = struct{}{} + var ( + stateCpy = statedb.Copy() // closure + tx = next // closure + ) workers.Go(func() error { // If block precaching was interrupted, abort if interrupt != nil && interrupt.Load() {