set txCtx upfront

This commit is contained in:
Tony Chen 2025-05-30 11:52:54 +08:00
parent 5a06321a8d
commit d23ebb244c

View file

@ -22,7 +22,6 @@ import (
"encoding/json" "encoding/json"
"errors" "errors"
"fmt" "fmt"
"math/big"
"os" "os"
"runtime" "runtime"
"strings" "strings"
@ -1035,7 +1034,8 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
return nil, err return nil, err
} }
} }
vmenv := vm.NewEVM(vmctx, vm.TxContext{GasPrice: big.NewInt(0)}, statedb, api.backend.ChainConfig(), vm.Config{Tracer: tracer.Hooks, NoBaseFee: true}, api.backend.GetCustomPrecompiles(vmctx.BlockNumber.Int64())) txCtx := core.NewEVMTxContext(message)
vmenv := vm.NewEVM(vmctx, txCtx, statedb, api.backend.ChainConfig(), vm.Config{Tracer: tracer.Hooks}, api.backend.GetCustomPrecompiles(vmctx.BlockNumber.Int64()))
statedb.SetLogger(tracer.Hooks) statedb.SetLogger(tracer.Hooks)
// Define a meaningful timeout of a single transaction trace // Define a meaningful timeout of a single transaction trace