Browse Source

minor refactor: explicitly track start of new bucket range and don't update curNearBucket on final loop.

0.15
Alex Morcos 8 years ago
parent
commit
2681153af3
  1. 7
      src/policy/fees.cpp

7
src/policy/fees.cpp

@ -214,9 +214,14 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal,
bool foundAnswer = false; bool foundAnswer = false;
unsigned int bins = unconfTxs.size(); unsigned int bins = unconfTxs.size();
bool newBucketRange = true;
// Start counting from highest(default) or lowest feerate transactions // Start counting from highest(default) or lowest feerate transactions
for (int bucket = startbucket; bucket >= 0 && bucket <= maxbucketindex; bucket += step) { for (int bucket = startbucket; bucket >= 0 && bucket <= maxbucketindex; bucket += step) {
if (newBucketRange) {
curNearBucket = bucket;
newBucketRange = false;
}
curFarBucket = bucket; curFarBucket = bucket;
nConf += confAvg[confTarget - 1][bucket]; nConf += confAvg[confTarget - 1][bucket];
totalNum += txCtAvg[bucket]; totalNum += txCtAvg[bucket];
@ -243,7 +248,7 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal,
extraNum = 0; extraNum = 0;
bestNearBucket = curNearBucket; bestNearBucket = curNearBucket;
bestFarBucket = curFarBucket; bestFarBucket = curFarBucket;
curNearBucket = bucket + step; newBucketRange = true;
} }
} }
} }

Loading…
Cancel
Save