| 512 | } |
| 513 | |
| 514 | CBlockPolicyEstimator::CBlockPolicyEstimator() |
| 515 | : nBestSeenHeight(0), firstRecordedHeight(0), historicalFirst(0), historicalBest(0), trackedTxs(0), untrackedTxs(0) |
| 516 | { |
| 517 | static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero"); |
| 518 | size_t bucketIndex = 0; |
| 519 | |
| 520 | for (double bucketBoundary = MIN_BUCKET_FEERATE; bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING, bucketIndex++) { |
| 521 | buckets.push_back(bucketBoundary); |
| 522 | bucketMap[bucketBoundary] = bucketIndex; |
| 523 | } |
| 524 | buckets.push_back(INF_FEERATE); |
| 525 | bucketMap[INF_FEERATE] = bucketIndex; |
| 526 | assert(bucketMap.size() == buckets.size()); |
| 527 | |
| 528 | feeStats = std::unique_ptr<TxConfirmStats>(new TxConfirmStats(buckets, bucketMap, MED_BLOCK_PERIODS, MED_DECAY, MED_SCALE)); |
| 529 | shortStats = std::unique_ptr<TxConfirmStats>(new TxConfirmStats(buckets, bucketMap, SHORT_BLOCK_PERIODS, SHORT_DECAY, SHORT_SCALE)); |
| 530 | longStats = std::unique_ptr<TxConfirmStats>(new TxConfirmStats(buckets, bucketMap, LONG_BLOCK_PERIODS, LONG_DECAY, LONG_SCALE)); |
| 531 | |
| 532 | // If the fee estimation file is present, read recorded estimations |
| 533 | fs::path est_filepath = gArgs.GetDataDirNet() / FEE_ESTIMATES_FILENAME; |
| 534 | CAutoFile est_file(fsbridge::fopen(est_filepath, "rb"), SER_DISK, CLIENT_VERSION); |
| 535 | if (est_file.IsNull() || !Read(est_file)) { |
| 536 | LogPrintf("Failed to read fee estimates from %s. Continue anyway.\n", fs::PathToString(est_filepath)); |
| 537 | } |
| 538 | } |
| 539 | |
| 540 | CBlockPolicyEstimator::~CBlockPolicyEstimator() |
| 541 | { |
nothing calls this directly
no test coverage detected