MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / estimateRawFee

Method estimateRawFee

src/policy/fees.cpp:673–709  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

671}
672
673CFeeRate 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
711unsigned int CBlockPolicyEstimator::HighestTargetTracked(FeeEstimateHorizon horizon) const
712{

Callers 1

estimaterawfeeFunction · 0.80

Calls 4

getMethod · 0.80
GetMaxConfirmsMethod · 0.80
EstimateMedianValMethod · 0.80
CFeeRateClass · 0.70

Tested by

no test coverage detected