From 74f28bf1fdf4a22bbdf3c894132e47d01cd108ed Mon Sep 17 00:00:00 2001 From: Chris Moore Date: Thu, 9 Feb 2012 05:21:41 -0800 Subject: [PATCH] Fix #794. Only remove transactions from memory pool when they're actually in the memory pool. --- src/main.cpp | 14 +++++++++----- 1 file 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; }