Skip to content

Commit 2681153

Browse files
committed
minor refactor: explicitly track start of new bucket range and don't update curNearBucket on final loop.
1 parent 1ba43cc commit 2681153

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/policy/fees.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,14 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal,
214214

215215
bool foundAnswer = false;
216216
unsigned int bins = unconfTxs.size();
217+
bool newBucketRange = true;
217218

218219
// Start counting from highest(default) or lowest feerate transactions
219220
for (int bucket = startbucket; bucket >= 0 && bucket <= maxbucketindex; bucket += step) {
221+
if (newBucketRange) {
222+
curNearBucket = bucket;
223+
newBucketRange = false;
224+
}
220225
curFarBucket = bucket;
221226
nConf += confAvg[confTarget - 1][bucket];
222227
totalNum += txCtAvg[bucket];
@@ -243,7 +248,7 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal,
243248
extraNum = 0;
244249
bestNearBucket = curNearBucket;
245250
bestFarBucket = curFarBucket;
246-
curNearBucket = bucket + step;
251+
newBucketRange = true;
247252
}
248253
}
249254
}

0 commit comments

Comments
 (0)