diff options
| author | Alex Morcos <[email protected]> | 2017-02-21 22:18:13 -0500 |
|---|---|---|
| committer | Alex Morcos <[email protected]> | 2017-05-10 11:45:26 -0400 |
| commit | 2681153af38324258dab8d1cf8e83c899324ece1 (patch) | |
| tree | b4b65d3f9e406b9888f589ef31316d87c08369e7 /src | |
| parent | Make EstimateMedianVal smarter about small failures. (diff) | |
| download | discoin-2681153af38324258dab8d1cf8e83c899324ece1.tar.xz discoin-2681153af38324258dab8d1cf8e83c899324ece1.zip | |
minor refactor: explicitly track start of new bucket range and don't update curNearBucket on final loop.
Diffstat (limited to 'src')
| -rw-r--r-- | src/policy/fees.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 03a0df461..a0e56d244 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -214,9 +214,14 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal, bool foundAnswer = false; unsigned int bins = unconfTxs.size(); + bool newBucketRange = true; // Start counting from highest(default) or lowest feerate transactions for (int bucket = startbucket; bucket >= 0 && bucket <= maxbucketindex; bucket += step) { + if (newBucketRange) { + curNearBucket = bucket; + newBucketRange = false; + } curFarBucket = bucket; nConf += confAvg[confTarget - 1][bucket]; totalNum += txCtAvg[bucket]; @@ -243,7 +248,7 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal, extraNum = 0; bestNearBucket = curNearBucket; bestFarBucket = curFarBucket; - curNearBucket = bucket + step; + newBucketRange = true; } } } |