diff --git a/eth/state_accessor.go b/eth/state_accessor.go index bc8934414e25..8540393059f8 100644 --- a/eth/state_accessor.go +++ b/eth/state_accessor.go @@ -215,10 +215,10 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block, msg, _ := tx.AsMessage(signer, block.BaseFee()) txContext := core.NewEVMTxContext(msg) context := core.NewEVMBlockContext(block.Header(), eth.blockchain, nil) + context.L1CostFunc = types.NewL1CostFunc(eth.blockchain.Config(), statedb) if idx == txIndex { return msg, context, statedb, release, nil } - context.L1CostFunc = types.NewL1CostFunc(eth.blockchain.Config(), statedb) // Not yet the searched for transaction, execute on top of the current state vmenv := vm.NewEVM(context, txContext, statedb, eth.blockchain.Config(), vm.Config{}) statedb.SetTxContext(tx.Hash(), idx) diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 2040ef2a35f1..4e1132a3200c 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -873,7 +873,7 @@ func (api *API) TraceTransaction(ctx context.Context, hash common.Hash, config * if err != nil { return nil, err } - if tx == nil { + if tx == nil && api.backend.HistoricalRPCService() != nil { var histResult []*txTraceResult err = api.backend.HistoricalRPCService().CallContext(ctx, &histResult, "debug_traceTransaction", hash, config) if err != nil && err.Error() == "not found" {