Skip to content

Commit

Permalink
Make EstimateMedianVal smarter about small failures.
Browse files Browse the repository at this point in the history
Instead of stopping if it encounters a "sufficient" number of transactions which don't meet the threshold for being confirmed within the target, it keeps looking to add more transactions to see if there is a temporary blip in the data.  This allows a smaller number of required data points.
  • Loading branch information
morcos committed May 10, 2017
1 parent d3e30bc commit 1ba43cc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions src/policy/fees.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,11 +231,9 @@ double TxConfirmStats::EstimateMedianVal(int confTarget, double sufficientTxVal,
double curPct = nConf / (totalNum + extraNum);

// Check to see if we are no longer getting confirmed at the success rate
if (requireGreater && curPct < successBreakPoint)
break;
if (!requireGreater && curPct > successBreakPoint)
break;

if ((requireGreater && curPct < successBreakPoint) || (!requireGreater && curPct > successBreakPoint)) {
continue;
}
// Otherwise update the cumulative stats, and the bucket variables
// and reset the counters
else {
Expand Down
4 changes: 2 additions & 2 deletions src/policy/fees.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class CBlockPolicyEstimator
static constexpr double SUCCESS_PCT = .85;
static constexpr double DOUBLE_SUCCESS_PCT = .95;

/** Require an avg of 1 tx in the combined feerate bucket per block to have stat significance */
static constexpr double SUFFICIENT_FEETXS = 1;
/** Require an avg of 0.1 tx in the combined feerate bucket per block to have stat significance */
static constexpr double SUFFICIENT_FEETXS = 0.1;

/** Minimum and Maximum values for tracking feerates
* The MIN_BUCKET_FEERATE should just be set to the lowest reasonable feerate we
Expand Down

0 comments on commit 1ba43cc

Please sign in to comment.