Skip to content

Commit

Permalink
eth/tracers: avoid using blockCtx concurrently (ethereum#24286)
Browse files Browse the repository at this point in the history
  • Loading branch information
holiman authored and jagdeep sidhu committed Jan 28, 2022
1 parent 8a04092 commit d6911d1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion eth/tracers/api.go
Expand Up @@ -601,11 +601,11 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
if threads > len(txs) {
threads = len(txs)
}
blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
blockHash := block.Hash()
for th := 0; th < threads; th++ {
pend.Add(1)
go func() {
blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
defer pend.Done()
// Fetch and execute the next transaction trace tasks
for task := range jobs {
Expand All @@ -626,6 +626,7 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
}
// Feed the transactions into the tracers and return
var failed error
blockCtx := core.NewEVMBlockContext(block.Header(), api.chainContext(ctx), nil)
for i, tx := range txs {
// Send the trace task over for execution
jobs <- &txTraceTask{statedb: statedb.Copy(), index: i}
Expand Down

0 comments on commit d6911d1

Please sign in to comment.