Skip to content

Commit f56b115

Browse files
holimanpalango
authored andcommitted
eth/tracers: avoid using blockCtx concurrently (#24286)
1 parent 9cfc93d commit f56b115

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

eth/tracers/api.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
620620
if threads > len(txs) {
621621
threads = len(txs)
622622
}
623-
blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
624623
blockHash := block.Hash()
625624

626625
isEspresso := api.backend.ChainConfig().IsEspresso(block.Number())
@@ -631,6 +630,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
631630
for th := 0; th < threads; th++ {
632631
pend.Add(1)
633632
go func() {
633+
blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
634634
defer pend.Done()
635635
// Fetch and execute the next transaction trace tasks
636636
for task := range jobs {
@@ -654,6 +654,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
654654
vmRunner := api.backend.NewEVMRunner(block.Header(), statedb)
655655
// Feed the transactions into the tracers and return
656656
var failed error
657+
blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
657658
for i, tx := range txs {
658659
// Send the trace task over for execution
659660
jobs <- &txTraceTask{statedb: statedb.Copy(), index: i}

0 commit comments

Comments
 (0)