aboutsummaryrefslogtreecommitdiff
path: root/src/txmempool.cpp
diff options
context:
space:
mode:
authorSuhas Daftuar <sdaftuar@gmail.com>2015-10-29 14:06:13 -0400
committerSuhas Daftuar <sdaftuar@gmail.com>2015-11-30 13:12:53 -0500
commit7e49f5f8b4e237d7212d027a7bea4bbd52c9e7b6 (patch)
tree43ad2997b024e53c22b81c7d585e0a752c134167 /src/txmempool.cpp
parentbb8ea1f6304d7ed3f5fe0a01c060ac9f94629349 (diff)
downloadbitcoin-7e49f5f8b4e237d7212d027a7bea4bbd52c9e7b6.tar.xz
Track coinbase spends in CTxMemPoolEntry
This allows us to optimize CTxMemPool::removeForReorg.
Diffstat (limited to 'src/txmempool.cpp')
-rw-r--r--src/txmempool.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/txmempool.cpp b/src/txmempool.cpp
index a2a53b0180..5a3062291f 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -21,9 +21,11 @@ using namespace std;
CTxMemPoolEntry::CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee,
int64_t _nTime, double _entryPriority, unsigned int _entryHeight,
- bool poolHasNoInputsOf, CAmount _inChainInputValue):
+ bool poolHasNoInputsOf, CAmount _inChainInputValue,
+ bool _spendsCoinbase):
tx(_tx), nFee(_nFee), nTime(_nTime), entryPriority(_entryPriority), entryHeight(_entryHeight),
- hadNoDependencies(poolHasNoInputsOf), inChainInputValue(_inChainInputValue)
+ hadNoDependencies(poolHasNoInputsOf), inChainInputValue(_inChainInputValue),
+ spendsCoinbase(_spendsCoinbase)
{
nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
nModSize = tx.CalculateModifiedSize(nTxSize);
@@ -488,7 +490,7 @@ void CTxMemPool::removeForReorg(const CCoinsViewCache *pcoins, unsigned int nMem
const CTransaction& tx = it->GetTx();
if (!IsFinalTx(tx, nMemPoolHeight, GetAdjustedTime())) {
transactionsToRemove.push_back(tx);
- } else {
+ } else if (it->GetSpendsCoinbase()) {
BOOST_FOREACH(const CTxIn& txin, tx.vin) {
indexed_transaction_set::const_iterator it2 = mapTx.find(txin.prevout.hash);
if (it2 != mapTx.end())