Skip to content

Commit 753e01d

Browse files
Merge pull request ethereum#80 from ethereum-optimism/handle-local-only-tx-pool-err
eth: when forwarding txs, silence local tx pool errors
2 parents 547f15b + 96a0140 commit 753e01d

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

eth/api_backend.go

+6
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"github.com/ethereum/go-ethereum/eth/tracers"
4040
"github.com/ethereum/go-ethereum/ethdb"
4141
"github.com/ethereum/go-ethereum/event"
42+
"github.com/ethereum/go-ethereum/log"
4243
"github.com/ethereum/go-ethereum/miner"
4344
"github.com/ethereum/go-ethereum/params"
4445
"github.com/ethereum/go-ethereum/rpc"
@@ -290,6 +291,11 @@ func (b *EthAPIBackend) SendTx(ctx context.Context, tx *types.Transaction) error
290291
if err := b.eth.seqRPCService.CallContext(ctx, nil, "eth_sendRawTransaction", hexutil.Encode(data)); err != nil {
291292
return err
292293
}
294+
// Retain tx in local tx pool after forwarding, for local RPC usage.
295+
if err := b.eth.txPool.AddLocal(tx); err != nil {
296+
log.Warn("successfully sent tx to sequencer, but failed to persist in local tx pool", "err", err, "tx", tx.Hash())
297+
}
298+
return nil
293299
}
294300
return b.eth.txPool.AddLocal(tx)
295301
}

0 commit comments

Comments
 (0)