Track coinbase spends in CTxMemPoolEntry
This allows us to optimize CTxMemPool::removeForReorg.
This commit is contained in:
committed by
Jack Grigg
parent
fe5cef0555
commit
a4b2518068
@@ -19,16 +19,19 @@
|
||||
using namespace std;
|
||||
|
||||
CTxMemPoolEntry::CTxMemPoolEntry():
|
||||
nFee(0), nTxSize(0), nModSize(0), nUsageSize(0), nTime(0), dPriority(0.0), hadNoDependencies(false)
|
||||
nFee(0), nTxSize(0), nModSize(0), nUsageSize(0), nTime(0), dPriority(0.0),
|
||||
hadNoDependencies(false), spendsCoinbase(false)
|
||||
{
|
||||
nHeight = MEMPOOL_HEIGHT;
|
||||
}
|
||||
|
||||
CTxMemPoolEntry::CTxMemPoolEntry(const CTransaction& _tx, const CAmount& _nFee,
|
||||
int64_t _nTime, double _dPriority,
|
||||
unsigned int _nHeight, bool poolHasNoInputsOf):
|
||||
unsigned int _nHeight, bool poolHasNoInputsOf,
|
||||
bool _spendsCoinbase):
|
||||
tx(_tx), nFee(_nFee), nTime(_nTime), dPriority(_dPriority), nHeight(_nHeight),
|
||||
hadNoDependencies(poolHasNoInputsOf)
|
||||
hadNoDependencies(poolHasNoInputsOf),
|
||||
spendsCoinbase(_spendsCoinbase)
|
||||
{
|
||||
nTxSize = ::GetSerializeSize(tx, SER_NETWORK, PROTOCOL_VERSION);
|
||||
nModSize = tx.CalculateModifiedSize(nTxSize);
|
||||
@@ -177,7 +180,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())
|
||||
|
||||
Reference in New Issue
Block a user