From ac9d3d25f77a25359f362661b0a07afc68b95136 Mon Sep 17 00:00:00 2001 From: Alex Morcos Date: Fri, 13 Jan 2017 16:19:25 -0500 Subject: Change fee estimation bucket limit variable names --- src/policy/fees.cpp | 8 ++++---- src/policy/fees.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 5407aefb45..89d5003540 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -301,10 +301,10 @@ bool CBlockPolicyEstimator::removeTx(uint256 hash) CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee) : nBestSeenHeight(0), trackedTxs(0), untrackedTxs(0) { - static_assert(MIN_FEERATE > 0, "Min feerate must be nonzero"); - minTrackedFee = _minRelayFee < CFeeRate(MIN_FEERATE) ? CFeeRate(MIN_FEERATE) : _minRelayFee; + static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero"); + minTrackedFee = _minRelayFee < CFeeRate(MIN_BUCKET_FEERATE) ? CFeeRate(MIN_BUCKET_FEERATE) : _minRelayFee; std::vector vfeelist; - for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) { + for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) { vfeelist.push_back(bucketBoundary); } vfeelist.push_back(INF_FEERATE); @@ -492,7 +492,7 @@ FeeFilterRounder::FeeFilterRounder(const CFeeRate& minIncrementalFee) { CAmount minFeeLimit = std::max(CAmount(1), minIncrementalFee.GetFeePerK() / 2); feeset.insert(0); - for (double bucketBoundary = minFeeLimit; bucketBoundary <= MAX_FEERATE; bucketBoundary *= FEE_SPACING) { + for (double bucketBoundary = minFeeLimit; bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) { feeset.insert(bucketBoundary); } } diff --git a/src/policy/fees.h b/src/policy/fees.h index 064466afe4..fbb7816329 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -179,8 +179,8 @@ static const double MIN_SUCCESS_PCT = .95; static const double SUFFICIENT_FEETXS = 1; // Minimum and Maximum values for tracking feerates -static constexpr double MIN_FEERATE = 10; -static const double MAX_FEERATE = 1e7; +static constexpr double MIN_BUCKET_FEERATE = 10; +static const double MAX_BUCKET_FEERATE = 1e7; static const double INF_FEERATE = MAX_MONEY; static const double INF_PRIORITY = 1e9 * MAX_MONEY; -- cgit v1.2.3 From 2a7b56cc0e33d74b548e38aa987e003a9801c8bd Mon Sep 17 00:00:00 2001 From: Alex Morcos Date: Fri, 13 Jan 2017 16:25:15 -0500 Subject: CBlockPolicyEstimator now uses hard coded minimum bucket feerate --- src/policy/fees.cpp | 4 ++-- src/policy/fees.h | 9 +++++++-- src/txmempool.cpp | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/policy/fees.cpp b/src/policy/fees.cpp index 89d5003540..5586cf45b1 100644 --- a/src/policy/fees.cpp +++ b/src/policy/fees.cpp @@ -298,11 +298,11 @@ bool CBlockPolicyEstimator::removeTx(uint256 hash) } } -CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee) +CBlockPolicyEstimator::CBlockPolicyEstimator() : nBestSeenHeight(0), trackedTxs(0), untrackedTxs(0) { static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero"); - minTrackedFee = _minRelayFee < CFeeRate(MIN_BUCKET_FEERATE) ? CFeeRate(MIN_BUCKET_FEERATE) : _minRelayFee; + minTrackedFee = CFeeRate(MIN_BUCKET_FEERATE); std::vector vfeelist; for (double bucketBoundary = minTrackedFee.GetFeePerK(); bucketBoundary <= MAX_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) { vfeelist.push_back(bucketBoundary); diff --git a/src/policy/fees.h b/src/policy/fees.h index fbb7816329..6dc167de2f 100644 --- a/src/policy/fees.h +++ b/src/policy/fees.h @@ -179,7 +179,12 @@ static const double MIN_SUCCESS_PCT = .95; static const double SUFFICIENT_FEETXS = 1; // Minimum and Maximum values for tracking feerates -static constexpr double MIN_BUCKET_FEERATE = 10; +// The MIN_BUCKET_FEERATE should just be set to the lowest reasonable feerate we +// might ever want to track. Historically this has been 1000 since it was +// inheriting DEFAULT_MIN_RELAY_TX_FEE and changing it is disruptive as it +// invalidates old estimates files. So leave it at 1000 unless it becomes +// necessary to lower it, and then lower it substantially. +static constexpr double MIN_BUCKET_FEERATE = 1000; static const double MAX_BUCKET_FEERATE = 1e7; static const double INF_FEERATE = MAX_MONEY; static const double INF_PRIORITY = 1e9 * MAX_MONEY; @@ -199,7 +204,7 @@ class CBlockPolicyEstimator { public: /** Create new BlockPolicyEstimator and initialize stats tracking classes with default values */ - CBlockPolicyEstimator(const CFeeRate& minRelayFee); + CBlockPolicyEstimator(); /** Process all the transactions that have been included in a block */ void processBlock(unsigned int nBlockHeight, diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 5b085f492d..e3d4eff600 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -358,7 +358,7 @@ CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) : // of transactions in the pool nCheckFrequency = 0; - minerPolicyEstimator = new CBlockPolicyEstimator(_minReasonableRelayFee); + minerPolicyEstimator = new CBlockPolicyEstimator(); } CTxMemPool::~CTxMemPool() -- cgit v1.2.3 From ad82cb06cecf84c4f9e5647b404b7eb19f1e9bf3 Mon Sep 17 00:00:00 2001 From: Alex Morcos Date: Fri, 13 Jan 2017 16:53:21 -0500 Subject: Remove unnecessary min fee argument in CTxMemPool constructor --- src/bench/mempool_eviction.cpp | 2 +- src/test/blockencodings_tests.cpp | 8 ++++---- src/test/mempool_tests.cpp | 8 ++++---- src/test/policyestimator_tests.cpp | 2 +- src/txmempool.cpp | 2 +- src/txmempool.h | 2 +- src/validation.cpp | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/bench/mempool_eviction.cpp b/src/bench/mempool_eviction.cpp index 5790d51a82..1b2d23862d 100644 --- a/src/bench/mempool_eviction.cpp +++ b/src/bench/mempool_eviction.cpp @@ -97,7 +97,7 @@ static void MempoolEviction(benchmark::State& state) tx7.vout[1].scriptPubKey = CScript() << OP_7 << OP_EQUAL; tx7.vout[1].nValue = 10 * COIN; - CTxMemPool pool(CFeeRate(1000)); + CTxMemPool pool; while (state.KeepRunning()) { AddTx(tx1, 10000LL, pool); diff --git a/src/test/blockencodings_tests.cpp b/src/test/blockencodings_tests.cpp index e3876e9695..09fab59bac 100644 --- a/src/test/blockencodings_tests.cpp +++ b/src/test/blockencodings_tests.cpp @@ -55,7 +55,7 @@ static CBlock BuildBlockTestCase() { BOOST_AUTO_TEST_CASE(SimpleRoundTripTest) { - CTxMemPool pool(CFeeRate(0)); + CTxMemPool pool; TestMemPoolEntryHelper entry; CBlock block(BuildBlockTestCase()); @@ -154,7 +154,7 @@ public: BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest) { - CTxMemPool pool(CFeeRate(0)); + CTxMemPool pool; TestMemPoolEntryHelper entry; CBlock block(BuildBlockTestCase()); @@ -220,7 +220,7 @@ BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest) BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest) { - CTxMemPool pool(CFeeRate(0)); + CTxMemPool pool; TestMemPoolEntryHelper entry; CBlock block(BuildBlockTestCase()); @@ -270,7 +270,7 @@ BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest) BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest) { - CTxMemPool pool(CFeeRate(0)); + CTxMemPool pool; CMutableTransaction coinbase; coinbase.vin.resize(1); coinbase.vin[0].scriptSig.resize(10); diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp index 91f549fe48..54298b16f9 100644 --- a/src/test/mempool_tests.cpp +++ b/src/test/mempool_tests.cpp @@ -54,7 +54,7 @@ BOOST_AUTO_TEST_CASE(MempoolRemoveTest) } - CTxMemPool testPool(CFeeRate(0)); + CTxMemPool testPool; // Nothing in pool, remove should do nothing: unsigned int poolSize = testPool.size(); @@ -118,7 +118,7 @@ void CheckSort(CTxMemPool &pool, std::vector &sortedOrder) BOOST_AUTO_TEST_CASE(MempoolIndexingTest) { - CTxMemPool pool(CFeeRate(0)); + CTxMemPool pool; TestMemPoolEntryHelper entry; /* 3rd highest fee */ @@ -320,7 +320,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest) BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest) { - CTxMemPool pool(CFeeRate(0)); + CTxMemPool pool; TestMemPoolEntryHelper entry; /* 3rd highest fee */ @@ -432,7 +432,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest) BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest) { - CTxMemPool pool(CFeeRate(1000)); + CTxMemPool pool; TestMemPoolEntryHelper entry; entry.dPriority = 10.0; diff --git a/src/test/policyestimator_tests.cpp b/src/test/policyestimator_tests.cpp index 0c060801bc..f74fddf53d 100644 --- a/src/test/policyestimator_tests.cpp +++ b/src/test/policyestimator_tests.cpp @@ -16,7 +16,7 @@ BOOST_FIXTURE_TEST_SUITE(policyestimator_tests, BasicTestingSetup) BOOST_AUTO_TEST_CASE(BlockPolicyEstimates) { - CTxMemPool mpool(CFeeRate(1000)); + CTxMemPool mpool; TestMemPoolEntryHelper entry; CAmount basefee(2000); CAmount deltaFee(100); diff --git a/src/txmempool.cpp b/src/txmempool.cpp index e3d4eff600..ac0cb60442 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -348,7 +348,7 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, CAmount modifyFee, assert(int(nSigOpCostWithAncestors) >= 0); } -CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) : +CTxMemPool::CTxMemPool() : nTransactionsUpdated(0) { _clear(); //lock free clear diff --git a/src/txmempool.h b/src/txmempool.h index ffb1c1309b..394337fe84 100644 --- a/src/txmempool.h +++ b/src/txmempool.h @@ -502,7 +502,7 @@ public: /** Create a new CTxMemPool. */ - CTxMemPool(const CFeeRate& _minReasonableRelayFee); + CTxMemPool(); ~CTxMemPool(); /** diff --git a/src/validation.cpp b/src/validation.cpp index 2ad3dadeb6..a9b8d1b92e 100644 --- a/src/validation.cpp +++ b/src/validation.cpp @@ -83,7 +83,7 @@ uint256 hashAssumeValid; CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; -CTxMemPool mempool(::minRelayTxFee); +CTxMemPool mempool; static void CheckBlockIndex(const Consensus::Params& consensusParams); -- cgit v1.2.3