From cff881656707997264bde39564f9a97cf618e900 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Sun, 29 Sep 2019 00:25:04 +0300 Subject: [PATCH 1/2] Ignore recent rejects filter for locked txes If we had a conflicting tx in the mempool before the locked tx arrived and the locked one arrived before the corresponding islock (i.e. we don't really know it's the one that should be included yet), the locked one is going to be rejected due to a mempool conflict. The old tx is going to be removed from the mempool by an incoming islock a bit later, however, we won't be able to re-request the locked tx until the tip changes because of the recentRejects filter. This patch fixes it. --- src/net_processing.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 2d3dc4e8d06f..0dad101fde30 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -955,7 +955,7 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) if (mapOrphanTransactions.count(inv.hash)) return true; } - return recentRejects->contains(inv.hash) || + return (recentRejects->contains(inv.hash) && !llmq::quorumInstantSendManager->IsLocked(inv.hash)) || mempool.exists(inv.hash) || pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 0)) || // Best effort: only try output 0 and 1 pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 1)); From c6d807ac5ea40efcfe131f0a86fd707e7faf54d1 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 30 Sep 2019 14:58:01 +0300 Subject: [PATCH 2/2] Add some explanation --- src/net_processing.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index 0dad101fde30..b6bb1ff1e57f 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -955,6 +955,11 @@ bool static AlreadyHave(const CInv& inv) EXCLUSIVE_LOCKS_REQUIRED(cs_main) if (mapOrphanTransactions.count(inv.hash)) return true; } + // When we receive an islock for a previously rejected transaction, we have to + // drop the first-seen tx (which such a locked transaction was conflicting with) + // and re-request the locked transaction (which did not make it into the mempool + // previously due to txn-mempool-conflict rule). This means that we must ignore + // recentRejects filter for such locked txes here. return (recentRejects->contains(inv.hash) && !llmq::quorumInstantSendManager->IsLocked(inv.hash)) || mempool.exists(inv.hash) || pcoinsTip->HaveCoinInCache(COutPoint(inv.hash, 0)) || // Best effort: only try output 0 and 1