aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2013-08-02 02:47:22 +0200
committerGavin Andresen <gavinandresen@gmail.com>2013-08-21 09:13:49 +1000
commitd7fdc5fac34814b71b2b539ebf6d9b8fdae5b50c (patch)
treecb83bcd3be159b1ebe0c9fef5c4ac85bec583f96 /src
parent5e18c6ccbcf98e242d534b8ef3f166e079ad3c99 (diff)
Fix non-standard disconnected transactions causing mempool orphans
Conflicts: src/main.cpp
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 36471d7d98..4584fbab19 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -837,15 +837,15 @@ bool CTxMemPool::remove(const CTransaction &tx, bool fRecursive)
{
LOCK(cs);
uint256 hash = tx.GetHash();
+ if (fRecursive) {
+ for (unsigned int i = 0; i < tx.vout.size(); i++) {
+ std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i));
+ if (it != mapNextTx.end())
+ remove(*it->second.ptx, true);
+ }
+ }
if (mapTx.count(hash))
{
- if (fRecursive) {
- for (unsigned int i = 0; i < tx.vout.size(); i++) {
- std::map<COutPoint, CInPoint>::iterator it = mapNextTx.find(COutPoint(hash, i));
- if (it != mapNextTx.end())
- remove(*it->second.ptx, true);
- }
- }
BOOST_FOREACH(const CTxIn& txin, tx.vin)
mapNextTx.erase(txin.prevout);
mapTx.erase(hash);
@@ -1853,7 +1853,8 @@ bool SetBestChain(CValidationState &state, CBlockIndex* pindexNew)
BOOST_FOREACH(CTransaction& tx, vResurrect) {
// ignore validation errors in resurrected transactions
CValidationState stateDummy;
- tx.AcceptToMemoryPool(stateDummy, true, false);
+ if (!tx.AcceptToMemoryPool(stateDummy, true, false))
+ mempool.remove(tx, true);
}
// Delete redundant memory transactions that are in the connected branch