| 671 | } |
| 672 | |
| 673 | CFeeRate CBlockPolicyEstimator::estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon, EstimationResult* result) const |
| 674 | { |
| 675 | TxConfirmStats* stats; |
| 676 | double sufficientTxs = SUFFICIENT_FEETXS; |
| 677 | switch (horizon) { |
| 678 | case FeeEstimateHorizon::SHORT_HALFLIFE: { |
| 679 | stats = shortStats.get(); |
| 680 | sufficientTxs = SUFFICIENT_TXS_SHORT; |
| 681 | break; |
| 682 | } |
| 683 | case FeeEstimateHorizon::MED_HALFLIFE: { |
| 684 | stats = feeStats.get(); |
| 685 | break; |
| 686 | } |
| 687 | case FeeEstimateHorizon::LONG_HALFLIFE: { |
| 688 | stats = longStats.get(); |
| 689 | break; |
| 690 | } |
| 691 | default: { |
| 692 | throw std::out_of_range("CBlockPolicyEstimator::estimateRawFee unknown FeeEstimateHorizon"); |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | LOCK(cs_feeEstimator); |
| 697 | // Return failure if trying to analyze a target we're not tracking |
| 698 | if (confTarget <= 0 || (unsigned int)confTarget > stats->GetMaxConfirms()) |
| 699 | return CFeeRate(0); |
| 700 | if (successThreshold > 1) |
| 701 | return CFeeRate(0); |
| 702 | |
| 703 | double median = stats->EstimateMedianVal(confTarget, sufficientTxs, successThreshold, true, nBestSeenHeight, result); |
| 704 | |
| 705 | if (median < 0) |
| 706 | return CFeeRate(0); |
| 707 | |
| 708 | return CFeeRate(llround(median)); |
| 709 | } |
| 710 | |
| 711 | unsigned int CBlockPolicyEstimator::HighestTargetTracked(FeeEstimateHorizon horizon) const |
| 712 | { |
no test coverage detected