diff options
Diffstat (limited to 'src/policy')
-rw-r--r-- | src/policy/fees.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 7820d00fd6..47ff4a9cbf 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -141,11 +141,9 @@ TxConfirmStats::TxConfirmStats(const std::vector<double>& defaultBuckets, { assert(_scale != 0 && "_scale must be non-zero"); confAvg.resize(maxPeriods); - for (unsigned int i = 0; i < maxPeriods; i++) { - confAvg[i].resize(buckets.size()); - } failAvg.resize(maxPeriods); for (unsigned int i = 0; i < maxPeriods; i++) { + confAvg[i].resize(buckets.size()); failAvg[i].resize(buckets.size()); } @@ -190,11 +188,12 @@ void TxConfirmStats::Record(int blocksToConfirm, double feerate) void TxConfirmStats::UpdateMovingAverages() { + assert(confAvg.size() == failAvg.size()); for (unsigned int j = 0; j < buckets.size(); j++) { - for (unsigned int i = 0; i < confAvg.size(); i++) - confAvg[i][j] = confAvg[i][j] * decay; - for (unsigned int i = 0; i < failAvg.size(); i++) - failAvg[i][j] = failAvg[i][j] * decay; + for (unsigned int i = 0; i < confAvg.size(); i++) { + confAvg[i][j] *= decay; + failAvg[i][j] *= decay; + } m_feerate_avg[j] *= decay; txCtAvg[j] *= decay; } |