mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-23 05:14:19 +00:00
Merge #9288: Fix a bug if the min fee is 0 for FeeFilterRounder
f8d43b8 Avoid rollingMinimumFeeRate never being able to decay below half (Alex Morcos) eab8e1b fix a bug if the min fee is 0 for FeeFilterRounder (Alex Morcos)
This commit is contained in:
commit
1ce7ede2a9
@ -299,6 +299,7 @@ void CBlockPolicyEstimator::removeTx(uint256 hash)
|
|||||||
CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee)
|
CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee)
|
||||||
: nBestSeenHeight(0)
|
: nBestSeenHeight(0)
|
||||||
{
|
{
|
||||||
|
static_assert(MIN_FEERATE > 0, "Min feerate must be nonzero");
|
||||||
minTrackedFee = _minRelayFee < CFeeRate(MIN_FEERATE) ? CFeeRate(MIN_FEERATE) : _minRelayFee;
|
minTrackedFee = _minRelayFee < CFeeRate(MIN_FEERATE) ? CFeeRate(MIN_FEERATE) : _minRelayFee;
|
||||||
std::vector<double> vfeelist;
|
std::vector<double> vfeelist;
|
||||||
for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) {
|
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)
|
FeeFilterRounder::FeeFilterRounder(const CFeeRate& minIncrementalFee)
|
||||||
{
|
{
|
||||||
CAmount minFeeLimit = minIncrementalFee.GetFeePerK() / 2;
|
CAmount minFeeLimit = std::max(CAmount(1), minIncrementalFee.GetFeePerK() / 2);
|
||||||
feeset.insert(0);
|
feeset.insert(0);
|
||||||
for (double bucketBoundary = minFeeLimit; bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) {
|
for (double bucketBoundary = minFeeLimit; bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) {
|
||||||
feeset.insert(bucketBoundary);
|
feeset.insert(bucketBoundary);
|
||||||
|
@ -179,7 +179,7 @@ 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 const double MIN_FEERATE = 10;
|
static constexpr double MIN_FEERATE = 10;
|
||||||
static const double MAX_FEERATE = 1e7;
|
static const double MAX_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;
|
||||||
|
@ -1077,7 +1077,7 @@ CFeeRate CTxMemPool::GetMinFee(size_t sizelimit) const {
|
|||||||
rollingMinimumFeeRate = rollingMinimumFeeRate / pow(2.0, (time - lastRollingFeeUpdate) / halflife);
|
rollingMinimumFeeRate = rollingMinimumFeeRate / pow(2.0, (time - lastRollingFeeUpdate) / halflife);
|
||||||
lastRollingFeeUpdate = time;
|
lastRollingFeeUpdate = time;
|
||||||
|
|
||||||
if (rollingMinimumFeeRate < minReasonableRelayFee.GetFeePerK() / 2) {
|
if (rollingMinimumFeeRate < (double)minReasonableRelayFee.GetFeePerK() / 2) {
|
||||||
rollingMinimumFeeRate = 0;
|
rollingMinimumFeeRate = 0;
|
||||||
return CFeeRate(0);
|
return CFeeRate(0);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user