diff --git a/eth/tracers/api.go b/eth/tracers/api.go index 0fb6501399..929f41cb0a 100644 --- a/eth/tracers/api.go +++ b/eth/tracers/api.go @@ -25,6 +25,7 @@ import ( "math/big" "os" "runtime" + "strings" "sync" "time" @@ -990,6 +991,10 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor 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) if err != nil { + // Due to how our mempool works, a transaction with insufficient funds can be included in a block. For tracing purposes, we should ignore this. + if strings.Contains(err.Error(), core.ErrInsufficientFunds.Error()) { + return json.RawMessage(`{}`), nil + } return nil, fmt.Errorf("tracing failed: %w", err) } return tracer.GetResult()