From b3df9d66779c40ff94def8e9e00da6949636dc90 Mon Sep 17 00:00:00 2001 From: linhaiyang <1183679527@qq.com> Date: Wed, 27 Oct 2021 15:51:05 +0800 Subject: [PATCH] fix trace Transaction --- core/state_processor.go | 2 +- eth/api_pre_exec.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/core/state_processor.go b/core/state_processor.go index d85da2aa02..71ecaa6a2a 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -154,7 +154,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo func ApplyTransactionForPreExec(config *params.ChainConfig, bc ChainContext, author *common.Address, gp *GasPool, statedb *state.StateDB, header *types.Header, tx *types.Transaction, msg types.Message, usedGas *uint64, cfg vm.Config) (*types.Receipt, error) { blockContext := NewEVMBlockContext(header, bc, author) + blockContext.BaseFee = big.NewInt(0) vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, config, cfg) - vmenv.Context.BaseFee = big.NewInt(0) return applyTransaction(msg, config, bc, author, gp, statedb, header.Number, header.Hash(), tx, usedGas, vmenv) } diff --git a/eth/api_pre_exec.go b/eth/api_pre_exec.go index 365a387805..ab63e1ff16 100644 --- a/eth/api_pre_exec.go +++ b/eth/api_pre_exec.go @@ -188,6 +188,7 @@ func (api *PreExecAPI) TraceTransaction(ctx context.Context, origin *PreExecTx, } // Run the transaction with tracing enabled. vmenv := vm.NewEVM(core.NewEVMBlockContext(d.header, bc, nil), txContext, d.stateDb, bc.Config(), vm.Config{Debug: true, Tracer: tracer}) + vmenv.Context.BaseFee = big.NewInt(0) // Call Prepare to clear out the statedb access list d.stateDb.Prepare(d.tx.Hash(), txIndex)