Always update fee estimates on new blocks.

All decisions about whether the transactions are valid data points are made at the time the transaction arrives. Updating on blocks all the time will now cause stale fee estimates to decay quickly when we restart a node.
This commit is contained in:
Alex Morcos
2016-11-11 13:14:45 -05:00
parent 6f06b268c1
commit d825838e64
5 changed files with 6 additions and 13 deletions

View File

@@ -591,8 +591,7 @@ void CTxMemPool::removeConflicts(const CTransaction &tx)
/**
* Called when a block is connected. Removes from mempool and updates the miner fee estimator.
*/
void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight,
bool fCurrentEstimate)
void CTxMemPool::removeForBlock(const std::vector<CTransactionRef>& vtx, unsigned int nBlockHeight)
{
LOCK(cs);
std::vector<CTxMemPoolEntry> entries;
@@ -605,7 +604,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, fCurrentEstimate);
minerPolicyEstimator->processBlock(nBlockHeight, entries);
for (const auto& tx : vtx)
{
txiter it = mapTx.find(tx->GetHash());