From 96a0140275b89c45ccef7e573fb72a68ab6749c7 Mon Sep 17 00:00:00 2001 From: protolambda Date: Mon, 10 Apr 2023 17:33:53 +0200 Subject: [PATCH] eth: when forwarding txs, silence local tx pool errors --- eth/api_backend.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eth/api_backend.go b/eth/api_backend.go index 1aebf4e47d9f..2f339d7a3335 100644 --- a/eth/api_backend.go +++ b/eth/api_backend.go @@ -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" @@ -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) }