aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-12-03 11:57:48 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-12-03 11:58:04 +0100
commit0a4aa876230c602427aa40b47a84698a3fd28e85 (patch)
tree388395d3688edf836441aad19f2e77e6e5d04429 /src/policy/fees.cpp
parent29435db6a4b5ddfca3b83d49a03643439d8f254f (diff)
parent3688866880decdbe9c2b551a1b701c752f8013d2 (diff)
Merge #9267: Disable fee estimates for a confirm target of 1 block
3688866 Disable fee estimates for a confirm target of 1 block (Alex Morcos)
Diffstat (limited to 'src/policy/fees.cpp')
-rw-r--r--src/policy/fees.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index 7b0e8b7d08..453b4a57d9 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -495,7 +495,8 @@ void CBlockPolicyEstimator::processBlock(unsigned int nBlockHeight,
CFeeRate CBlockPolicyEstimator::estimateFee(int confTarget)
{
// Return failure if trying to analyze a target we're not tracking
- if (confTarget <= 0 || (unsigned int)confTarget > feeStats.GetMaxConfirms())
+ // It's not possible to get reasonable estimates for confTarget of 1
+ if (confTarget <= 1 || (unsigned int)confTarget > feeStats.GetMaxConfirms())
return CFeeRate(0);
double median = feeStats.EstimateMedianVal(confTarget, SUFFICIENT_FEETXS, MIN_SUCCESS_PCT, true, nBestSeenHeight);
@@ -514,6 +515,10 @@ CFeeRate CBlockPolicyEstimator::estimateSmartFee(int confTarget, int *answerFoun
if (confTarget <= 0 || (unsigned int)confTarget > feeStats.GetMaxConfirms())
return CFeeRate(0);
+ // It's not possible to get reasonable estimates for confTarget of 1
+ if (confTarget == 1)
+ confTarget = 2;
+
double median = -1;
while (median < 0 && (unsigned int)confTarget <= feeStats.GetMaxConfirms()) {
median = feeStats.EstimateMedianVal(confTarget++, SUFFICIENT_FEETXS, MIN_SUCCESS_PCT, true, nBestSeenHeight);