aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.cpp
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2016-11-29 12:18:44 -0500
committerAlex Morcos <morcos@chaincode.com>2016-11-29 12:18:44 -0500
commitd824ad030e70bc72e0c63e1b0d00b08413024b55 (patch)
tree4edc345a21147e3f4d69987db095857a2e3c1738 /src/policy/fees.cpp
parente56cf67e6b3f2e87bee42aaa5ab709f479c9e6ca (diff)
downloadbitcoin-d824ad030e70bc72e0c63e1b0d00b08413024b55.tar.xz
Disable fee estimates for a confirm target of 1 block
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 7113390cdf..9eb831bc17 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -404,7 +404,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);
@@ -423,6 +424,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);