MCPcopy Create free account
hub / github.com/ElementsProject/elements / estimateRawFee

Method estimateRawFee

src/policy/fees.cpp:669–703  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

667}
668
669CFeeRate CBlockPolicyEstimator::estimateRawFee(int confTarget, double successThreshold, FeeEstimateHorizon horizon, EstimationResult* result) const
670{
671 TxConfirmStats* stats = nullptr;
672 double sufficientTxs = SUFFICIENT_FEETXS;
673 switch (horizon) {
674 case FeeEstimateHorizon::SHORT_HALFLIFE: {
675 stats = shortStats.get();
676 sufficientTxs = SUFFICIENT_TXS_SHORT;
677 break;
678 }
679 case FeeEstimateHorizon::MED_HALFLIFE: {
680 stats = feeStats.get();
681 break;
682 }
683 case FeeEstimateHorizon::LONG_HALFLIFE: {
684 stats = longStats.get();
685 break;
686 }
687 } // no default case, so the compiler can warn about missing cases
688 assert(stats);
689
690 LOCK(m_cs_fee_estimator);
691 // Return failure if trying to analyze a target we're not tracking
692 if (confTarget <= 0 || (unsigned int)confTarget > stats->GetMaxConfirms())
693 return CFeeRate(0);
694 if (successThreshold > 1)
695 return CFeeRate(0);
696
697 double median = stats->EstimateMedianVal(confTarget, sufficientTxs, successThreshold, nBestSeenHeight, result);
698
699 if (median < 0)
700 return CFeeRate(0);
701
702 return CFeeRate(llround(median));
703}
704
705unsigned int CBlockPolicyEstimator::HighestTargetTracked(FeeEstimateHorizon horizon) const
706{

Callers 2

FUZZ_TARGET_INITFunction · 0.80
estimaterawfeeFunction · 0.80

Calls 4

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

Tested by 1

FUZZ_TARGET_INITFunction · 0.64