Browse Source

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
0.15
Wladimir J. van der Laan 8 years ago
parent
commit
47510ad3dd
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 2
      src/bench/mempool_eviction.cpp
  2. 10
      src/policy/fees.cpp
  3. 11
      src/policy/fees.h
  4. 8
      src/test/blockencodings_tests.cpp
  5. 8
      src/test/mempool_tests.cpp
  6. 2
      src/test/policyestimator_tests.cpp
  7. 4
      src/txmempool.cpp
  8. 2
      src/txmempool.h
  9. 2
      src/validation.cpp

2
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].scriptPubKey = CScript() << OP_7 << OP_EQUAL;
tx7.vout[1].nValue = 10 * COIN; tx7.vout[1].nValue = 10 * COIN;
CTxMemPool pool(CFeeRate(1000)); CTxMemPool pool;
while (state.KeepRunning()) { while (state.KeepRunning()) {
AddTx(tx1, 10000LL, pool); AddTx(tx1, 10000LL, pool);

10
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) : nBestSeenHeight(0), trackedTxs(0), untrackedTxs(0)
{ {
static_assert(MIN_FEERATE > 0, "Min feerate must be nonzero"); static_assert(MIN_BUCKET_FEERATE > 0, "Min feerate must be nonzero");
minTrackedFee = _minRelayFee < CFeeRate(MIN_FEERATE) ? CFeeRate(MIN_FEERATE) : _minRelayFee; minTrackedFee = CFeeRate(MIN_BUCKET_FEERATE);
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_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) {
vfeelist.push_back(bucketBoundary); vfeelist.push_back(bucketBoundary);
} }
vfeelist.push_back(INF_FEERATE); vfeelist.push_back(INF_FEERATE);
@ -471,7 +471,7 @@ FeeFilterRounder::FeeFilterRounder(const CFeeRate& minIncrementalFee)
{ {
CAmount minFeeLimit = std::max(CAmount(1), 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_BUCKET_FEERATE; bucketBoundary *= FEE_SPACING) {
feeset.insert(bucketBoundary); feeset.insert(bucketBoundary);
} }
} }

11
src/policy/fees.h

@ -179,8 +179,13 @@ 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 constexpr double MIN_FEERATE = 10; // The MIN_BUCKET_FEERATE should just be set to the lowest reasonable feerate we
static const double MAX_FEERATE = 1e7; // 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_FEERATE = MAX_MONEY;
// We have to lump transactions into buckets based on feerate, but we want to be able // We have to lump transactions into buckets based on feerate, but we want to be able
@ -198,7 +203,7 @@ class CBlockPolicyEstimator
{ {
public: public:
/** Create new BlockPolicyEstimator and initialize stats tracking classes with default values */ /** 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 */ /** Process all the transactions that have been included in a block */
void processBlock(unsigned int nBlockHeight, void processBlock(unsigned int nBlockHeight,

8
src/test/blockencodings_tests.cpp

@ -57,7 +57,7 @@ static CBlock BuildBlockTestCase() {
BOOST_AUTO_TEST_CASE(SimpleRoundTripTest) BOOST_AUTO_TEST_CASE(SimpleRoundTripTest)
{ {
CTxMemPool pool(CFeeRate(0)); CTxMemPool pool;
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;
CBlock block(BuildBlockTestCase()); CBlock block(BuildBlockTestCase());
@ -156,7 +156,7 @@ public:
BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest) BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
{ {
CTxMemPool pool(CFeeRate(0)); CTxMemPool pool;
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;
CBlock block(BuildBlockTestCase()); CBlock block(BuildBlockTestCase());
@ -222,7 +222,7 @@ BOOST_AUTO_TEST_CASE(NonCoinbasePreforwardRTTest)
BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest) BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
{ {
CTxMemPool pool(CFeeRate(0)); CTxMemPool pool;
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;
CBlock block(BuildBlockTestCase()); CBlock block(BuildBlockTestCase());
@ -272,7 +272,7 @@ BOOST_AUTO_TEST_CASE(SufficientPreforwardRTTest)
BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest) BOOST_AUTO_TEST_CASE(EmptyBlockRoundTripTest)
{ {
CTxMemPool pool(CFeeRate(0)); CTxMemPool pool;
CMutableTransaction coinbase; CMutableTransaction coinbase;
coinbase.vin.resize(1); coinbase.vin.resize(1);
coinbase.vin[0].scriptSig.resize(10); coinbase.vin[0].scriptSig.resize(10);

8
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: // Nothing in pool, remove should do nothing:
unsigned int poolSize = testPool.size(); unsigned int poolSize = testPool.size();
@ -118,7 +118,7 @@ void CheckSort(CTxMemPool &pool, std::vector<std::string> &sortedOrder)
BOOST_AUTO_TEST_CASE(MempoolIndexingTest) BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
{ {
CTxMemPool pool(CFeeRate(0)); CTxMemPool pool;
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;
/* 3rd highest fee */ /* 3rd highest fee */
@ -319,7 +319,7 @@ BOOST_AUTO_TEST_CASE(MempoolIndexingTest)
BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest) BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
{ {
CTxMemPool pool(CFeeRate(0)); CTxMemPool pool;
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;
/* 3rd highest fee */ /* 3rd highest fee */
@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest) BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
{ {
CTxMemPool pool(CFeeRate(1000)); CTxMemPool pool;
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;
CMutableTransaction tx1 = CMutableTransaction(); CMutableTransaction tx1 = CMutableTransaction();

2
src/test/policyestimator_tests.cpp

@ -16,7 +16,7 @@ BOOST_FIXTURE_TEST_SUITE(policyestimator_tests, BasicTestingSetup)
BOOST_AUTO_TEST_CASE(BlockPolicyEstimates) BOOST_AUTO_TEST_CASE(BlockPolicyEstimates)
{ {
CTxMemPool mpool(CFeeRate(1000)); CTxMemPool mpool;
TestMemPoolEntryHelper entry; TestMemPoolEntryHelper entry;
CAmount basefee(2000); CAmount basefee(2000);
CAmount deltaFee(100); CAmount deltaFee(100);

4
src/txmempool.cpp

@ -333,7 +333,7 @@ void CTxMemPoolEntry::UpdateAncestorState(int64_t modifySize, CAmount modifyFee,
assert(int(nSigOpCostWithAncestors) >= 0); assert(int(nSigOpCostWithAncestors) >= 0);
} }
CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) : CTxMemPool::CTxMemPool() :
nTransactionsUpdated(0) nTransactionsUpdated(0)
{ {
_clear(); //lock free clear _clear(); //lock free clear
@ -343,7 +343,7 @@ CTxMemPool::CTxMemPool(const CFeeRate& _minReasonableRelayFee) :
// of transactions in the pool // of transactions in the pool
nCheckFrequency = 0; nCheckFrequency = 0;
minerPolicyEstimator = new CBlockPolicyEstimator(_minReasonableRelayFee); minerPolicyEstimator = new CBlockPolicyEstimator();
} }
CTxMemPool::~CTxMemPool() CTxMemPool::~CTxMemPool()

2
src/txmempool.h

@ -496,7 +496,7 @@ public:
/** Create a new CTxMemPool. /** Create a new CTxMemPool.
*/ */
CTxMemPool(const CFeeRate& _minReasonableRelayFee); CTxMemPool();
~CTxMemPool(); ~CTxMemPool();
/** /**

2
src/validation.cpp

@ -81,7 +81,7 @@ uint256 hashAssumeValid;
CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE); CFeeRate minRelayTxFee = CFeeRate(DEFAULT_MIN_RELAY_TX_FEE);
CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE; CAmount maxTxFee = DEFAULT_TRANSACTION_MAXFEE;
CTxMemPool mempool(::minRelayTxFee); CTxMemPool mempool;
static void CheckBlockIndex(const Consensus::Params& consensusParams); static void CheckBlockIndex(const Consensus::Params& consensusParams);

Loading…
Cancel
Save