aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f78133b535..e4c6714eae 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -618,11 +618,15 @@ bool CTransaction::RemoveFromMemoryPool()
// Remove transaction from memory pool
CRITICAL_BLOCK(cs_mapTransactions)
{
- BOOST_FOREACH(const CTxIn& txin, vin)
- mapNextTx.erase(txin.prevout);
- mapTransactions.erase(GetHash());
- nTransactionsUpdated++;
- --nPooledTx;
+ uint256 hash = GetHash();
+ if (mapTransactions.count(hash))
+ {
+ BOOST_FOREACH(const CTxIn& txin, vin)
+ mapNextTx.erase(txin.prevout);
+ mapTransactions.erase(hash);
+ nTransactionsUpdated++;
+ --nPooledTx;
+ }
}
return true;
}