style: rename variables to match coding style

Rename the variables that were touched by the previous commit (split
logical from style changes).

minIncrementalFee -> min_incremental_fee
minFeeLimit -> min_fee_limit
bucketBoundary -> bucket_boundary
feeset -> fee_set
FeeFilterRounder::feeset -> FeeFilterRounder::m_fee_set
This commit is contained in:
Vasil Dimov 2022-03-15 16:57:05 +01:00
parent 8b4ad203d0
commit 8173f160e0
No known key found for this signature in database
GPG key ID: 54DF06F64B55CBBF
2 changed files with 16 additions and 13 deletions

View file

@ -998,31 +998,34 @@ void CBlockPolicyEstimator::FlushUnconfirmed() {
LogPrint(BCLog::ESTIMATEFEE, "Recorded %u unconfirmed txs from mempool in %gs\n", num_entries, (endclear - startclear)*0.000001);
}
static std::set<double> MakeFeeSet(const CFeeRate& minIncrementalFee,
static std::set<double> MakeFeeSet(const CFeeRate& min_incremental_fee,
double max_filter_fee_rate,
double fee_filter_spacing)
{
std::set<double> feeset;
std::set<double> fee_set;
const CAmount minFeeLimit{std::max(CAmount(1), minIncrementalFee.GetFeePerK() / 2)};
feeset.insert(0);
for (double bucketBoundary = minFeeLimit; bucketBoundary <= max_filter_fee_rate; bucketBoundary *= fee_filter_spacing) {
feeset.insert(bucketBoundary);
const CAmount min_fee_limit{std::max(CAmount(1), min_incremental_fee.GetFeePerK() / 2)};
fee_set.insert(0);
for (double bucket_boundary = min_fee_limit;
bucket_boundary <= max_filter_fee_rate;
bucket_boundary *= fee_filter_spacing) {
fee_set.insert(bucket_boundary);
}
return feeset;
return fee_set;
}
FeeFilterRounder::FeeFilterRounder(const CFeeRate& minIncrementalFee)
: feeset{MakeFeeSet(minIncrementalFee, MAX_FILTER_FEERATE, FEE_FILTER_SPACING)}
: m_fee_set{MakeFeeSet(minIncrementalFee, MAX_FILTER_FEERATE, FEE_FILTER_SPACING)}
{
}
CAmount FeeFilterRounder::round(CAmount currentMinFee)
{
std::set<double>::iterator it = feeset.lower_bound(currentMinFee);
if (it == feeset.end() ||
(it != feeset.begin() &&
std::set<double>::iterator it = m_fee_set.lower_bound(currentMinFee);
if (it == m_fee_set.end() ||
(it != m_fee_set.begin() &&
WITH_LOCK(m_insecure_rand_mutex, return insecure_rand.rand32()) % 3 != 0)) {
--it;
}

View file

@ -297,13 +297,13 @@ private:
public:
/** Create new FeeFilterRounder */
explicit FeeFilterRounder(const CFeeRate& minIncrementalFee);
explicit FeeFilterRounder(const CFeeRate& min_incremental_fee);
/** Quantize a minimum fee for privacy purpose before broadcast. */
CAmount round(CAmount currentMinFee);
private:
const std::set<double> feeset;
const std::set<double> m_fee_set;
Mutex m_insecure_rand_mutex;
FastRandomContext insecure_rand GUARDED_BY(m_insecure_rand_mutex);
};