From 28c38522e089814f9e478ef0c1d2e3192628361d Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Fri, 10 Jun 2022 11:56:00 +0200 Subject: [PATCH] do not log an error for duplicate txs (#8732) --- internal/mempool/v0/reactor.go | 9 +++++++++ internal/mempool/v1/reactor.go | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/internal/mempool/v0/reactor.go b/internal/mempool/v0/reactor.go index e2cec0f04..1bc4ba9dd 100644 --- a/internal/mempool/v0/reactor.go +++ b/internal/mempool/v0/reactor.go @@ -156,6 +156,15 @@ func (r *Reactor) handleMempoolMessage(envelope p2p.Envelope) error { for _, tx := range protoTxs { if err := r.mempool.CheckTx(context.Background(), types.Tx(tx), nil, txInfo); err != nil { + if errors.Is(err, types.ErrTxInCache) { + // if the tx is in the cache, + // then we've been gossiped a + // Tx that we've already + // got. Gossip should be + // smarter, but it's not a + // problem. + continue + } logger.Error("checktx failed for tx", "tx", fmt.Sprintf("%X", types.Tx(tx).Hash()), "err", err) } } diff --git a/internal/mempool/v1/reactor.go b/internal/mempool/v1/reactor.go index 94d0580e9..747b35206 100644 --- a/internal/mempool/v1/reactor.go +++ b/internal/mempool/v1/reactor.go @@ -163,6 +163,15 @@ func (r *Reactor) handleMempoolMessage(envelope p2p.Envelope) error { for _, tx := range protoTxs { if err := r.mempool.CheckTx(context.Background(), types.Tx(tx), nil, txInfo); err != nil { + if errors.Is(err, types.ErrTxInCache) { + // if the tx is in the cache, + // then we've been gossiped a + // Tx that we've already + // got. Gossip should be + // smarter, but it's not a + // problem. + continue + } logger.Error("checktx failed for tx", "tx", fmt.Sprintf("%X", types.Tx(tx).Hash()), "err", err) } }