CBlockPolicyEstimator now uses hard coded minimum bucket feerate

This commit is contained in:
Alex Morcos 2017-01-13 16:25:15 -05:00
parent ac9d3d25f7
commit 2a7b56cc0e
3 changed files with 10 additions and 5 deletions

View file

@ -298,11 +298,11 @@ bool CBlockPolicyEstimator::removeTx(uint256 hash)
} }
} }
CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee) CBlockPolicyEstimator::CBlockPolicyEstimator()
: nBestSeenHeight(0), trackedTxs(0), untrackedTxs(0) : nBestSeenHeight(0), trackedTxs(0), untrackedTxs(0)
{ {
static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero"); static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero");
minTrackedFee = _minRelayFee < CFeeRate(MIN_BUCKET_FEERATE) ? CFeeRate(MIN_BUCKET_FEERATE) : _minRelayFee; minTrackedFee = CFeeRate(MIN_BUCKET_FEERATE);
std::vector<double> vfeelist; std::vector<double> vfeelist;
for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) { for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) {
vfeelist.push_back(bucketBoundary); vfeelist.push_back(bucketBoundary);

View file

@ -179,7 +179,12 @@ static const double MIN_SUCCESS_PCT = .95;
static const double SUFFICIENT_FEETXS = 1; static const double SUFFICIENT_FEETXS = 1;
// Minimum and Maximum values for tracking feerates // Minimum and Maximum values for tracking feerates
static constexpr double MIN_BUCKET_FEERATE = 10; // The MIN_BUCKET_FEERATE should just be set to the lowest reasonable feerate we
// might ever want to track. Historically this has been 1000 since it was
// inheriting DEFAULT_MIN_RELAY_TX_FEE and changing it is disruptive as it
// invalidates old estimates files. So leave it at 1000 unless it becomes
// necessary to lower it, and then lower it substantially.
static constexpr double MIN_BUCKET_FEERATE = 1000;
static const double MAX_BUCKET_FEERATE = 1e7; static const double MAX_BUCKET_FEERATE = 1e7;
static const double INF_FEERATE = MAX_MONEY; static const double INF_FEERATE = MAX_MONEY;
static const double INF_PRIORITY = 1e9 * MAX_MONEY; static const double INF_PRIORITY = 1e9 * MAX_MONEY;
@ -199,7 +204,7 @@ class CBlockPolicyEstimator
{ {
public: public:
/** Create new BlockPolicyEstimator and initialize stats tracking classes with default values */ /** Create new BlockPolicyEstimator and initialize stats tracking classes with default values */
CBlockPolicyEstimator(const CFeeRate& minRelayFee); CBlockPolicyEstimator();
/** Process all the transactions that have been included in a block */ /** Process all the transactions that have been included in a block */
void processBlock(unsigned int nBlockHeight, void processBlock(unsigned int nBlockHeight,

View file

@ -358,7 +358,7 @@ CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) :
// of transactions in the pool // of transactions in the pool
nCheckFrequency = 0; nCheckFrequency = 0;
minerPolicyEstimator = new CBlockPolicyEstimator(_minReasonableRelayFee); minerPolicyEstimator = new CBlockPolicyEstimator();
} }
CTxMemPool::~CTxMemPool() CTxMemPool::~CTxMemPool()