|
|
|
@ -6,6 +6,7 @@
@@ -6,6 +6,7 @@
|
|
|
|
|
#include "txmempool.h" |
|
|
|
|
|
|
|
|
|
#include "clientversion.h" |
|
|
|
|
#include "main.h" // for COINBASE_MATURITY |
|
|
|
|
#include "streams.h" |
|
|
|
|
#include "util.h" |
|
|
|
|
#include "utilmoneystr.h" |
|
|
|
@ -453,6 +454,31 @@ void CTxMemPool::remove(const CTransaction &tx, std::list<CTransaction>& removed
@@ -453,6 +454,31 @@ void CTxMemPool::remove(const CTransaction &tx, std::list<CTransaction>& removed
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CTxMemPool::removeCoinbaseSpends(const CCoinsViewCache *pcoins, unsigned int nMemPoolHeight) |
|
|
|
|
{ |
|
|
|
|
// Remove transactions spending a coinbase which are now immature
|
|
|
|
|
LOCK(cs); |
|
|
|
|
list<CTransaction> transactionsToRemove; |
|
|
|
|
for (std::map<uint256, CTxMemPoolEntry>::const_iterator it = mapTx.begin(); it != mapTx.end(); it++) { |
|
|
|
|
const CTransaction& tx = it->second.GetTx(); |
|
|
|
|
BOOST_FOREACH(const CTxIn& txin, tx.vin) { |
|
|
|
|
std::map<uint256, CTxMemPoolEntry>::const_iterator it2 = mapTx.find(txin.prevout.hash); |
|
|
|
|
if (it2 != mapTx.end()) |
|
|
|
|
continue; |
|
|
|
|
const CCoins *coins = pcoins->AccessCoins(txin.prevout.hash); |
|
|
|
|
if (fSanityCheck) assert(coins); |
|
|
|
|
if (!coins || (coins->IsCoinBase() && nMemPoolHeight - coins->nHeight < COINBASE_MATURITY)) { |
|
|
|
|
transactionsToRemove.push_back(tx); |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
BOOST_FOREACH(const CTransaction& tx, transactionsToRemove) { |
|
|
|
|
list<CTransaction> removed; |
|
|
|
|
remove(tx, removed, true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void CTxMemPool::removeConflicts(const CTransaction &tx, std::list<CTransaction>& removed) |
|
|
|
|
{ |
|
|
|
|
// Remove transactions which depend on inputs of tx, recursively
|
|
|
|
|