eth/tracers: avoid data race when tracing block with bor tx (#1214)

This commit is contained in:
easyfold 2024-05-03 14:20:10 +08:00 committed by GitHub
parent 7e2be02c26
commit 3a719a86d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -835,8 +835,10 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
if stateSyncPresent && task.index == len(txs)-1 { if stateSyncPresent && task.index == len(txs)-1 {
if *config.BorTraceEnabled { if *config.BorTraceEnabled {
config.BorTx = newBoolPtr(true) // avoid data race
res, err = api.traceTx(ctx, msg, txctx, blockCtx, task.statedb, config) newConfig := *config
newConfig.BorTx = newBoolPtr(true)
res, err = api.traceTx(ctx, msg, txctx, blockCtx, task.statedb, &newConfig)
} else { } else {
break break
} }