aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorChris Moore <dooglus@gmail.com>2012-02-09 05:21:41 -0800
committerChris Moore <dooglus@gmail.com>2012-02-09 05:21:41 -0800
commit74f28bf1fdf4a22bbdf3c894132e47d01cd108ed (patch)
tree73fb54db58c992a4265c12664d2949a047c990c6 /src/main.cpp
parent328b26d40b2ea046144a487a6b4927a630e91fb9 (diff)
downloadbitcoin-74f28bf1fdf4a22bbdf3c894132e47d01cd108ed.tar.xz
Fix #794. Only remove transactions from memory pool when they're actually in the memory pool.
Diffstat (limited to 'src/main.cpp')
-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;
}