diff options
author | Alex Morcos <morcos@chaincode.com> | 2017-06-28 10:03:00 -0400 |
---|---|---|
committer | Alex Morcos <morcos@chaincode.com> | 2017-07-10 20:07:17 -0400 |
commit | 1fafd704dac73594f69de5f9c15f697217653d7a (patch) | |
tree | fd914a07648e24c037a395ed3a355478a6a3c76b /src | |
parent | 9c85b91dc1566f7c27c5b8a1a9c7aebe0e3a83cf (diff) |
Add function to report highest estimate target tracked per horizon
Diffstat (limited to 'src')
-rw-r--r-- | src/policy/fees.cpp | 20 | ||||
-rw-r--r-- | src/policy/fees.h | 3 |
2 files changed, 22 insertions, 1 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 859a2e7804..51e11ea20e 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -684,7 +684,7 @@ CFeeRate CBlockPolicyEstimator::estimateRawFee(int confTarget, double successThr break; } default: { - return CFeeRate(0); + throw std::out_of_range("CBlockPoicyEstimator::estimateRawFee unknown FeeEstimateHorizon"); } } @@ -703,6 +703,24 @@ CFeeRate CBlockPolicyEstimator::estimateRawFee(int confTarget, double successThr return CFeeRate(median); } +unsigned int CBlockPolicyEstimator::HighestTargetTracked(FeeEstimateHorizon horizon) const +{ + switch (horizon) { + case FeeEstimateHorizon::SHORT_HALFLIFE: { + return shortStats->GetMaxConfirms(); + } + case FeeEstimateHorizon::MED_HALFLIFE: { + return feeStats->GetMaxConfirms(); + } + case FeeEstimateHorizon::LONG_HALFLIFE: { + return longStats->GetMaxConfirms(); + } + default: { + throw std::out_of_range("CBlockPoicyEstimator::HighestTargetTracked unknown FeeEstimateHorizon"); + } + } +} + unsigned int CBlockPolicyEstimator::BlockSpan() const { if (firstRecordedHeight == 0) return 0; diff --git a/src/policy/fees.h b/src/policy/fees.h index 86f143b233..a04dbe4924 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -216,6 +216,9 @@ public: /** Empty mempool transactions on shutdown to record failure to confirm for txs still in mempool */ void FlushUnconfirmed(CTxMemPool& pool); + /** Calculation of highest target that estimates are tracked for */ + unsigned int HighestTargetTracked(FeeEstimateHorizon horizon) const; + private: unsigned int nBestSeenHeight; unsigned int firstRecordedHeight; |