aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/policy/fees.cpp')
-rw-r--r--src/policy/fees.cpp21
1 files changed, 8 insertions, 13 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index 52d0e5c5e5..ac2d7edaec 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -327,13 +327,6 @@ void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, boo
if (!fCurrentEstimate)
return;
- if (!entry.WasClearAtEntry()) {
- // This transaction depends on other transactions in the mempool to
- // be included in a block before it will be able to be included, so
- // we shouldn't include it in our calculations
- return;
- }
-
// Feerates are stored and reported as BTC-per-kb:
CFeeRate feeRate(entry.GetFee(), entry.GetTxSize());
@@ -343,10 +336,8 @@ void CBlockPolicyEstimator::processTransaction(const CTxMemPoolEntry& entry, boo
void CBlockPolicyEstimator::processBlockTx(unsigned int nBlockHeight, const CTxMemPoolEntry& entry)
{
- if (!entry.WasClearAtEntry()) {
- // This transaction depended on other transactions in the mempool to
- // be included in a block before it was able to be included, so
- // we shouldn't include it in our calculations
+ if (!removeTx(entry.GetTx().GetHash())) {
+ // This transaction wasn't being tracked for fee estimation
return;
}
@@ -378,14 +369,18 @@ void CBlockPolicyEstimator::processBlock(unsigned int nBlockHeight,
// transaction fees."
return;
}
- nBestSeenHeight = nBlockHeight;
// Only want to be updating estimates when our blockchain is synced,
// otherwise we'll miscalculate how many blocks its taking to get included.
if (!fCurrentEstimate)
return;
- // Clear the current block state
+ // Must update nBestSeenHeight in sync with ClearCurrent so that
+ // calls to removeTx (via processBlockTx) correctly calculate age
+ // of unconfirmed txs to remove from tracking.
+ nBestSeenHeight = nBlockHeight;
+
+ // Clear the current block state and update unconfirmed circular buffer
feeStats.ClearCurrent(nBlockHeight);
// Repopulate the current block states