From 42e59246622a0cf2f750acfdd0bc7c169fb3a847 Mon Sep 17 00:00:00 2001 From: Sam Kleinman Date: Sat, 14 May 2022 08:27:53 -0400 Subject: [PATCH] mempool: do not continue checking transactions if context was cacneled (#8549) --- internal/mempool/reactor.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/internal/mempool/reactor.go b/internal/mempool/reactor.go index ae578e70a..3c22988ee 100644 --- a/internal/mempool/reactor.go +++ b/internal/mempool/reactor.go @@ -153,6 +153,15 @@ func (r *Reactor) handleMempoolMessage(ctx context.Context, envelope *p2p.Envelo // problem. continue } + if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + // Do not propagate context + // cancellation errors, but do + // not continue to check + // transactions from this + // message if we are shutting down. + return nil + } + logger.Error("checktx failed for tx", "tx", fmt.Sprintf("%X", types.Tx(tx).Hash()), "err", err)