diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 630830b5f0..375dacb07a 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -1392,11 +1392,6 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor config.BorTx = newBoolPtr(false) } - _, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv, context.Background()) - if err != nil { - return nil, fmt.Errorf("tracing failed: %w", err) - } - if *config.BorTx { callmsg := prepareCallMessage(*message) // nolint : contextcheck @@ -1404,8 +1399,10 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor return nil, fmt.Errorf("tracing failed: %w", err) } } else { - // nolint : contextcheck - if _, err = core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit), context.Background()); err != nil { + // Call Prepare to clear out the statedb access list + statedb.SetTxContext(txctx.TxHash, txctx.TxIndex) + _, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv, context.Background()) + if err != nil { return nil, fmt.Errorf("tracing failed: %w", err) } } diff --git a/eth/tracers/api_test.go b/eth/tracers/api_test.go index a72a74db98..fd20e8b8f2 100644 --- a/eth/tracers/api_test.go +++ b/eth/tracers/api_test.go @@ -469,7 +469,6 @@ func TestTraceTransaction(t *testing.T) { api := NewAPI(backend) result, err := api.TraceTransaction(context.Background(), target, nil) - fmt.Println("Anshal trace txn - ", result) if err != nil { t.Errorf("Failed to trace transaction %v", err) }