From b645757be9f83e7cfe5a3df2cda3b4509a868b8f Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Mon, 27 May 2019 13:40:18 +0200 Subject: [PATCH] Call RemoveConflictedTx from BlockConnected instead of ProcessNewTransaction --- src/llmq/quorums_instantsend.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/llmq/quorums_instantsend.cpp b/src/llmq/quorums_instantsend.cpp index dd16533ef4..05e2302542 100644 --- a/src/llmq/quorums_instantsend.cpp +++ b/src/llmq/quorums_instantsend.cpp @@ -962,17 +962,6 @@ void CInstantSendManager::ProcessNewTransaction(const CTransactionRef& tx, const bool inMempool = mempool.get(tx->GetHash()) != nullptr; - // Are we called from validation.cpp/MemPoolConflictRemovalTracker? - // TODO refactor this when we backport the BlockConnected signal from Bitcoin, as it gives better info about - // conflicted TXs - bool isConflictRemoved = pindex == nullptr && posInBlock == -1 && !inMempool; - - if (isConflictRemoved) { - LOCK(cs); - RemoveConflictedTx(*tx); - return; - } - uint256 islockHash; { LOCK(cs); @@ -1019,6 +1008,13 @@ void CInstantSendManager::BlockConnected(const std::shared_ptr& pb return; } + if (!vtxConflicted.empty()) { + LOCK(cs); + for (const auto& tx : vtxConflicted) { + RemoveConflictedTx(*tx); + } + } + for (const auto& tx : pblock->vtx) { ProcessNewTransaction(tx, pindex); }