mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-10 14:48:46 +02:00
Make feeEstimator its own global instance of CBlockPolicyEstimator
This commit is contained in:
@@ -333,8 +333,8 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, CAmount modifyFee,
|
||||
assert(int(nSigOpCostWithAncestors) >= 0);
|
||||
}
|
||||
|
||||
CTxMemPool::CTxMemPool() :
|
||||
nTransactionsUpdated(0)
|
||||
CTxMemPool::CTxMemPool(CBlockPolicyEstimator* estimator) :
|
||||
nTransactionsUpdated(0), minerPolicyEstimator(estimator)
|
||||
{
|
||||
_clear(); //lock free clear
|
||||
|
||||
@@ -342,13 +342,6 @@ CTxMemPool::CTxMemPool() :
|
||||
// accepting transactions becomes O(N^2) where N is the number
|
||||
// of transactions in the pool
|
||||
nCheckFrequency = 0;
|
||||
|
||||
minerPolicyEstimator = new CBlockPolicyEstimator();
|
||||
}
|
||||
|
||||
CTxMemPool::~CTxMemPool()
|
||||
{
|
||||
delete minerPolicyEstimator;
|
||||
}
|
||||
|
||||
void CTxMemPool::pruneSpent(const uint256 &hashTx, CCoins &coins)
|
||||
@@ -427,7 +420,7 @@ bool CTxMemPool::addUnchecked(const uint256& hash, const CTxMemPoolEntry &entry,
|
||||
|
||||
nTransactionsUpdated++;
|
||||
totalTxSize += entry.GetTxSize();
|
||||
minerPolicyEstimator->processTransaction(entry, validFeeEstimate);
|
||||
if (minerPolicyEstimator) {minerPolicyEstimator->processTransaction(entry, validFeeEstimate);}
|
||||
|
||||
vTxHashes.emplace_back(tx.GetWitnessHash(), newit);
|
||||
newit->vTxHashesIdx = vTxHashes.size() - 1;
|
||||
@@ -457,7 +450,7 @@ void CTxMemPool::removeUnchecked(txiter it, MemPoolRemovalReason reason)
|
||||
mapLinks.erase(it);
|
||||
mapTx.erase(it);
|
||||
nTransactionsUpdated++;
|
||||
minerPolicyEstimator->removeTx(hash);
|
||||
if (minerPolicyEstimator) {minerPolicyEstimator->removeTx(hash);}
|
||||
}
|
||||
|
||||
// Calculates descendants of entry that are not already in setDescendants, and adds to
|
||||
@@ -591,7 +584,7 @@ void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigne
|
||||
entries.push_back(&*i);
|
||||
}
|
||||
// Before the txs in the new block have been removed from the mempool, update policy estimates
|
||||
minerPolicyEstimator->processBlock(nBlockHeight, entries);
|
||||
if (minerPolicyEstimator) {minerPolicyEstimator->processBlock(nBlockHeight, entries);}
|
||||
for (const auto& tx : vtx)
|
||||
{
|
||||
txiter it = mapTx.find(tx->GetHash());
|
||||
|
||||
Reference in New Issue
Block a user