aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2017-03-07 19:38:49 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2017-03-07 19:49:00 +0100
commit47510ad3dd514e04caa364ff56ab2cc83569efb9 (patch)
treed49ac2078942d56a687b572e70c27cdc5a2d81cc /src
parent30ff3a2fc95ca6e5b87e6d0f86e54ed9069dae5e (diff)
parentad82cb06cecf84c4f9e5647b404b7eb19f1e9bf3 (diff)
downloadbitcoin-47510ad3dd514e04caa364ff56ab2cc83569efb9.tar.xz
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
Diffstat (limited to 'src')
-rw-r--r--src/bench/mempool_eviction.cpp2
-rw-r--r--src/policy/fees.cpp10
-rw-r--r--src/policy/fees.h11
-rw-r--r--src/test/blockencodings_tests.cpp8
-rw-r--r--src/test/mempool_tests.cpp8
-rw-r--r--src/test/policyestimator_tests.cpp2
-rw-r--r--src/txmempool.cpp4
-rw-r--r--src/txmempool.h2
-rw-r--r--src/validation.cpp2
9 files changed, 27 insertions, 22 deletions
diff --git a/src/bench/mempool_eviction.cpp b/src/bench/mempool_eviction.cpp
index 31a392ae7c..073bbde016 100644
--- a/src/bench/mempool_eviction.cpp
+++ b/src/bench/mempool_eviction.cpp
@@ -96,7 +96,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/policy/fees.cpp b/src/policy/fees.cpp
index 89220f26b6..da33e4100f 100644
--- a/src/policy/fees.cpp
+++ b/src/policy/fees.cpp
@@ -298,13 +298,13 @@ bool CBlockPolicyEstimator::removeTx(uint256 hash)
}
}
-CBlockPolicyEstimator::CBlockPolicyEstimator(const CFeeRate& _minRelayFee)
+CBlockPolicyEstimator::CBlockPolicyEstimator()
: 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 = CFeeRate(MIN_BUCKET_FEERATE);
std::vector<double> 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);
@@ -471,7 +471,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 f2f430861c..dd01c90c45 100644
--- a/src/policy/fees.h
+++ b/src/policy/fees.h
@@ -179,8 +179,13 @@ 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;
+// 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;
// We have to lump transactions into buckets based on feerate, but we want to be able
@@ -198,7 +203,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/test/blockencodings_tests.cpp b/src/test/blockencodings_tests.cpp
index 311ac024f3..9e4a56919d 100644
--- a/src/test/blockencodings_tests.cpp
+++ b/src/test/blockencodings_tests.cpp
@@ -57,7 +57,7 @@ static CBlock BuildBlockTestCase() {
BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
{
- CTxMemPool pool(CFeeRate(0));
+ CTxMemPool pool;
TestMemPoolEntryHelper entry;
CBlock block(BuildBlockTestCase());
@@ -156,7 +156,7 @@ public:
BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
{
- CTxMemPool pool(CFeeRate(0));
+ CTxMemPool pool;
TestMemPoolEntryHelper entry;
CBlock block(BuildBlockTestCase());
@@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
{
- CTxMemPool pool(CFeeRate(0));
+ CTxMemPool pool;
TestMemPoolEntryHelper entry;
CBlock block(BuildBlockTestCase());
@@ -272,7 +272,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 a3f706d9af..51b28d09fa 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<std::string> &sortedOrder)
BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
{
- CTxMemPool pool(CFeeRate(0));
+ CTxMemPool pool;
TestMemPoolEntryHelper entry;
/* 3rd highest fee */
@@ -319,7 +319,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
{
- CTxMemPool pool(CFeeRate(0));
+ CTxMemPool pool;
TestMemPoolEntryHelper entry;
/* 3rd highest fee */
@@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
{
- CTxMemPool pool(CFeeRate(1000));
+ CTxMemPool pool;
TestMemPoolEntryHelper entry;
CMutableTransaction tx1 = CMutableTransaction();
diff --git a/src/test/policyestimator_tests.cpp b/src/test/policyestimator_tests.cpp
index d01ef7c6ee..bc2f49ef3f 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 79dd0fb5f9..fb58208774 100644
--- a/src/txmempool.cpp
+++ b/src/txmempool.cpp
@@ -333,7 +333,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
@@ -343,7 +343,7 @@ CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) :
// of transactions in the pool
nCheckFrequency = 0;
- minerPolicyEstimator = new CBlockPolicyEstimator(_minReasonableRelayFee);
+ minerPolicyEstimator = new CBlockPolicyEstimator();
}
CTxMemPool::~CTxMemPool()
diff --git a/src/txmempool.h b/src/txmempool.h
index e919be91a9..f9a9d088d0 100644
--- a/src/txmempool.h
+++ b/src/txmempool.h
@@ -496,7 +496,7 @@ public:
/** Create a new CTxMemPool.
*/
- CTxMemPool(const CFeeRate& _minReasonableRelayFee);
+ CTxMemPool();
~CTxMemPool();
/**
diff --git a/src/validation.cpp b/src/validation.cpp
index 28013306d2..63918a3f30 100644
--- a/src/validation.cpp
+++ b/src/validation.cpp
@@ -81,7 +81,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);