diff options
author | Chris Moore <dooglus@gmail.com> | 2012-02-09 05:21:41 -0800 |
---|---|---|
committer | Chris Moore <dooglus@gmail.com> | 2012-02-09 05:21:41 -0800 |
commit | 74f28bf1fdf4a22bbdf3c894132e47d01cd108ed (patch) | |
tree | 73fb54db58c992a4265c12664d2949a047c990c6 | |
parent | 328b26d40b2ea046144a487a6b4927a630e91fb9 (diff) | |
download | bitcoin-74f28bf1fdf4a22bbdf3c894132e47d01cd108ed.tar.xz |
Fix #794. Only remove transactions from memory pool when they're actually in the memory pool.
-rw-r--r-- | src/main.cpp | 14 |
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; } |