diff --git a/mempool/clist_mempool.go b/mempool/clist_mempool.go index c88de1fde..3fd21ba8f 100644 --- a/mempool/clist_mempool.go +++ b/mempool/clist_mempool.go @@ -537,20 +537,23 @@ func (mem *CListMempool) resCbFirstTime( func (mem *CListMempool) resCbRecheck(req *abci.Request, res *abci.Response) { switch r := res.Value.(type) { case *abci.Response_CheckTx: - tx := req.GetCheckTx().Tx - txHash := TxKey(tx) - if e, ok := mem.txsMap.Load(txHash); ok { - celem := e.(*clist.CElement) - if r.CheckTx.Code == abci.CodeTypeOK { - // Good, nothing to do. - } else { + if r.CheckTx.Code == abci.CodeTypeOK { + // Good, nothing to do. + } else { + tx := req.GetCheckTx().Tx + txHash := TxKey(tx) + if e, ok := mem.txsMap.Load(txHash); ok { + celem := e.(*clist.CElement) // Tx became invalidated due to newly committed block. mem.logger.Debug("tx is no longer valid", "tx", txID(tx), "res", r) // NOTE: we remove tx from the cache because it might be good later mem.removeTx(tx, celem, true) + } else { + mem.logger.Debug( + "re-CheckTx transaction does not exist", + "expected", types.Tx(tx), + ) } - } else { - panic(fmt.Sprintf("unexpected tx response from proxy during recheck\ntxHash=%X, tx=%X", txHash, tx)) } default: // ignore other messages