Call RemoveConflictedTx from BlockConnected instead of ProcessNewTransaction

This commit is contained in:
Alexander Block 2019-05-27 13:40:18 +02:00
parent b36f0a324f
commit b645757be9

View File

@ -962,17 +962,6 @@ void CInstantSendManager::ProcessNewTransaction(const CTransactionRef& tx, const
bool inMempool = mempool.get(tx->GetHash()) != nullptr; 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; uint256 islockHash;
{ {
LOCK(cs); LOCK(cs);
@ -1019,6 +1008,13 @@ void CInstantSendManager::BlockConnected(const std::shared_ptr<const CBlock>& pb
return; return;
} }
if (!vtxConflicted.empty()) {
LOCK(cs);
for (const auto& tx : vtxConflicted) {
RemoveConflictedTx(*tx);
}
}
for (const auto& tx : pblock->vtx) { for (const auto& tx : pblock->vtx) {
ProcessNewTransaction(tx, pindex); ProcessNewTransaction(tx, pindex);
} }