Skip to content

Commit

Permalink
Merge pull request ethereum#80 from ethereum-optimism/handle-local-on…
Browse files Browse the repository at this point in the history
…ly-tx-pool-err

eth: when forwarding txs, silence local tx pool errors
  • Loading branch information
trianglesphere authored Apr 19, 2023
2 parents 547f15b + 96a0140 commit 753e01d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions eth/api_backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/ethereum/go-ethereum/eth/tracers"
"github.com/ethereum/go-ethereum/ethdb"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/log"
"github.com/ethereum/go-ethereum/miner"
"github.com/ethereum/go-ethereum/params"
"github.com/ethereum/go-ethereum/rpc"
Expand Down Expand Up @@ -290,6 +291,11 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, tx *types.Transaction) error
if err := b.eth.seqRPCService.CallContext(ctx, nil, "eth_sendRawTransaction", hexutil.Encode(data)); err != nil {
return err
}
// Retain tx in local tx pool after forwarding, for local RPC usage.
if err := b.eth.txPool.AddLocal(tx); err != nil {
log.Warn("successfully sent tx to sequencer, but failed to persist in local tx pool", "err", err, "tx", tx.Hash())
}
return nil
}
return b.eth.txPool.AddLocal(tx)
}
Expand Down

0 comments on commit 753e01d

Please sign in to comment.