Skip to content

Commit 47510ad

Browse files
committed
Merge #9548: Remove min reasonable fee
ad82cb0 Remove unnecessary min fee argument in CTxMemPool constructor (Alex Morcos) 2a7b56c CBlockPolicyEstimator now uses hard coded minimum bucket feerate (Alex Morcos) ac9d3d2 Change fee estimation bucket limit variable names (Alex Morcos) Tree-SHA512: 6e3bc7df3497ed60c7620845d222063e33a0238020f5c3316e61e0eff758078588ea8dd51196ceb59aa561ba106f8cdae62cebe521adb3247108bb49f15252d6
2 parents 30ff3a2 + ad82cb0 commit 47510ad

File tree

9 files changed

+27
-22
lines changed

9 files changed

+27
-22
lines changed

src/bench/mempool_eviction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ static void MempoolEviction(benchmark::State& state)
9696
tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL;
9797
tx7.vout[1].nValue = 10 * COIN;
9898

99-
CTxMemPool pool(CFeeRate(1000));
99+
CTxMemPool pool;
100100

101101
while (state.KeepRunning()) {
102102
AddTx(tx1, 10000LL, pool);

src/policy/fees.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,13 +298,13 @@ bool CBlockPolicyEstimator::removeTx(uint256 hash)
298298
}
299299
}
300300

301-
CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee)
301+
CBlockPolicyEstimator::CBlockPolicyEstimator()
302302
: nBestSeenHeight(0), trackedTxs(0), untrackedTxs(0)
303303
{
304-
static_assert(MIN_FEERATE > 0, "Min feerate must be nonzero");
305-
minTrackedFee = _minRelayFee < CFeeRate(MIN_FEERATE) ? CFeeRate(MIN_FEERATE) : _minRelayFee;
304+
static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero");
305+
minTrackedFee = CFeeRate(MIN_BUCKET_FEERATE);
306306
std::vector<double> vfeelist;
307-
for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) {
307+
for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) {
308308
vfeelist.push_back(bucketBoundary);
309309
}
310310
vfeelist.push_back(INF_FEERATE);
@@ -471,7 +471,7 @@ FeeFilterRounder::FeeFilterRounder(const CFeeRate& minIncrementalFee)
471471
{
472472
CAmount minFeeLimit = std::max(CAmount(1), minIncrementalFee.GetFeePerK() / 2);
473473
feeset.insert(0);
474-
for (double bucketBoundary = minFeeLimit; bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) {
474+
for (double bucketBoundary = minFeeLimit; bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) {
475475
feeset.insert(bucketBoundary);
476476
}
477477
}

src/policy/fees.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,13 @@ static const double MIN_SUCCESS_PCT = .95;
179179
static const double SUFFICIENT_FEETXS = 1;
180180

181181
// Minimum and Maximum values for tracking feerates
182-
static constexpr double MIN_FEERATE = 10;
183-
static const double MAX_FEERATE = 1e7;
182+
// The MIN_BUCKET_FEERATE should just be set to the lowest reasonable feerate we
183+
// might ever want to track. Historically this has been 1000 since it was
184+
// inheriting DEFAULT_MIN_RELAY_TX_FEE and changing it is disruptive as it
185+
// invalidates old estimates files. So leave it at 1000 unless it becomes
186+
// necessary to lower it, and then lower it substantially.
187+
static constexpr double MIN_BUCKET_FEERATE = 1000;
188+
static const double MAX_BUCKET_FEERATE = 1e7;
184189
static const double INF_FEERATE = MAX_MONEY;
185190

186191
// We have to lump transactions into buckets based on feerate, but we want to be able
@@ -198,7 +203,7 @@ class CBlockPolicyEstimator
198203
{
199204
public:
200205
/** Create new BlockPolicyEstimator and initialize stats tracking classes with default values */
201-
CBlockPolicyEstimator(const CFeeRate& minRelayFee);
206+
CBlockPolicyEstimator();
202207

203208
/** Process all the transactions that have been included in a block */
204209
void processBlock(unsigned int nBlockHeight,

src/test/blockencodings_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static CBlock BuildBlockTestCase() {
5757

5858
BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
5959
{
60-
CTxMemPool pool(CFeeRate(0));
60+
CTxMemPool pool;
6161
TestMemPoolEntryHelper entry;
6262
CBlock block(BuildBlockTestCase());
6363

@@ -156,7 +156,7 @@ class TestHeaderAndShortIDs {
156156

157157
BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
158158
{
159-
CTxMemPool pool(CFeeRate(0));
159+
CTxMemPool pool;
160160
TestMemPoolEntryHelper entry;
161161
CBlock block(BuildBlockTestCase());
162162

@@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
222222

223223
BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
224224
{
225-
CTxMemPool pool(CFeeRate(0));
225+
CTxMemPool pool;
226226
TestMemPoolEntryHelper entry;
227227
CBlock block(BuildBlockTestCase());
228228

@@ -272,7 +272,7 @@ BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
272272

273273
BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest)
274274
{
275-
CTxMemPool pool(CFeeRate(0));
275+
CTxMemPool pool;
276276
CMutableTransaction coinbase;
277277
coinbase.vin.resize(1);
278278
coinbase.vin[0].scriptSig.resize(10);

src/test/mempool_tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
5454
}
5555

5656

57-
CTxMemPool testPool(CFeeRate(0));
57+
CTxMemPool testPool;
5858

5959
// Nothing in pool, remove should do nothing:
6060
unsigned int poolSize = testPool.size();
@@ -118,7 +118,7 @@ void CheckSort(CTxMemPool &pool, std::vector<std::string> &sortedOrder)
118118

119119
BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
120120
{
121-
CTxMemPool pool(CFeeRate(0));
121+
CTxMemPool pool;
122122
TestMemPoolEntryHelper entry;
123123

124124
/* 3rd highest fee */
@@ -319,7 +319,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
319319

320320
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
321321
{
322-
CTxMemPool pool(CFeeRate(0));
322+
CTxMemPool pool;
323323
TestMemPoolEntryHelper entry;
324324

325325
/* 3rd highest fee */
@@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
430430

431431
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
432432
{
433-
CTxMemPool pool(CFeeRate(1000));
433+
CTxMemPool pool;
434434
TestMemPoolEntryHelper entry;
435435

436436
CMutableTransaction tx1 = CMutableTransaction();

src/test/policyestimator_tests.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ BOOST_FIXTURE_TEST_SUITE(policyestimator_tests, BasicTestingSetup)
1616

1717
BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
1818
{
19-
CTxMemPool mpool(CFeeRate(1000));
19+
CTxMemPool mpool;
2020
TestMemPoolEntryHelper entry;
2121
CAmount basefee(2000);
2222
CAmount deltaFee(100);

src/txmempool.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, CAmount modifyFee,
333333
assert(int(nSigOpCostWithAncestors) >= 0);
334334
}
335335

336-
CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) :
336+
CTxMemPool::CTxMemPool() :
337337
nTransactionsUpdated(0)
338338
{
339339
_clear(); //lock free clear
@@ -343,7 +343,7 @@ CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) :
343343
// of transactions in the pool
344344
nCheckFrequency = 0;
345345

346-
minerPolicyEstimator = new CBlockPolicyEstimator(_minReasonableRelayFee);
346+
minerPolicyEstimator = new CBlockPolicyEstimator();
347347
}
348348

349349
CTxMemPool::~CTxMemPool()

src/txmempool.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ class CTxMemPool
496496

497497
/** Create a new CTxMemPool.
498498
*/
499-
CTxMemPool(const CFeeRate& _minReasonableRelayFee);
499+
CTxMemPool();
500500
~CTxMemPool();
501501

502502
/**

src/validation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ uint256 hashAssumeValid;
8181
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
8282
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
8383

84-
CTxMemPool mempool(::minRelayTxFee);
84+
CTxMemPool mempool;
8585

8686
static void CheckBlockIndex(const Consensus::Params& consensusParams);
8787

0 commit comments

Comments
 (0)