aboutsummaryrefslogtreecommitdiff
path: root/src/policy/fees.cpp
diff options
context:
space:
mode:
authorAlex Morcos <morcos@chaincode.com>2016-12-05 21:46:08 -0500
committerAlex Morcos <morcos@chaincode.com>2016-12-08 15:40:14 -0500
commiteab8e1b1725f7458e3db6f0ea0bc04ec603d8e9b (patch)
tree03da0f27850d474b28688153f934b484742262b8 /src/policy/fees.cpp
parent7d5d44969b4ab46a5146a46b4ed1ed7704d71c63 (diff)
fix a bug if the min fee is 0 for FeeFilterRounder
Diffstat (limited to 'src/policy/fees.cpp')
-rw-r--r--src/policy/fees.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp
index 9eb831bc17..9f01c24d2c 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -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)
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);