Browse Source

fix a bug if the min fee is 0 for FeeFilterRounder

0.14
Alex Morcos 8 years ago
parent
commit
eab8e1b172
  1. 3
      src/policy/fees.cpp
  2. 2
      src/policy/fees.h

3
src/policy/fees.cpp

@ -299,6 +299,7 @@ void CBlockPolicyEstimator::removeTx(uint256 hash) @@ -299,6 +299,7 @@ void CBlockPolicyEstimator::removeTx(uint256 hash)
CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee)
: nBestSeenHeight(0)
{
static_assert(MIN_FEERATE > 0, "Min feerate must be nonzero");
minTrackedFee = _minRelayFee < CFeeRate(MIN_FEERATE) ? CFeeRate(MIN_FEERATE) : _minRelayFee;
std::vector<double> vfeelist;
for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) {
@ -485,7 +486,7 @@ void CBlockPolicyEstimator::Read(CAutoFile& filein, int nFileVersion) @@ -485,7 +486,7 @@ void CBlockPolicyEstimator::Read(CAutoFile& filein, int nFileVersion)
FeeFilterRounder::FeeFilterRounder(const CFeeRate& minIncrementalFee)
{
CAmount minFeeLimit = minIncrementalFee.GetFeePerK() / 2;
CAmount minFeeLimit = std::max(CAmount(1), minIncrementalFee.GetFeePerK() / 2);
feeset.insert(0);
for (double bucketBoundary = minFeeLimit; bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) {
feeset.insert(bucketBoundary);

2
src/policy/fees.h

@ -179,7 +179,7 @@ static const double MIN_SUCCESS_PCT = .95; @@ -179,7 +179,7 @@ static const double MIN_SUCCESS_PCT = .95;
static const double SUFFICIENT_FEETXS = 1;
// Minimum and Maximum values for tracking feerates
static const double MIN_FEERATE = 10;
static constexpr double MIN_FEERATE = 10;
static const double MAX_FEERATE = 1e7;
static const double INF_FEERATE = MAX_MONEY;
static const double INF_PRIORITY = 1e9 * MAX_MONEY;

Loading…
Cancel
Save