From 8abe0f56584ff49ad250115eb1f0a9ac8f9cf0ca Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Wed, 14 Oct 2015 12:44:18 -0700 Subject: [PATCH] Undo GetMinFee-requires-extra-call-to-hit-0 --- src/test/mempool_tests.cpp | 1 - src/txmempool.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/mempool_tests.cpp b/src/test/mempool_tests.cpp index dce278d999..0cf906a259 100644 --- a/src/test/mempool_tests.cpp +++ b/src/test/mempool_tests.cpp @@ -428,7 +428,6 @@ BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest) // ... but feerate should never drop below 1000 SetMockTime(42 + 8*CTxMemPool::ROLLING_FEE_HALFLIFE + CTxMemPool::ROLLING_FEE_HALFLIFE/2 + CTxMemPool::ROLLING_FEE_HALFLIFE/4); - pool.GetMinFee(1); BOOST_CHECK_EQUAL(pool.GetMinFee(1).GetFeePerK(), 0); // ... unless it has gone all the way to 0 (after getting past 1000/2) diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 7563c07880..9a651049d5 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -879,8 +879,10 @@ CFeeRate CTxMemPool::GetMinFee(size_t sizelimit) const { rollingMinimumFeeRate = rollingMinimumFeeRate / pow(2.0, (time - lastRollingFeeUpdate) / halflife); lastRollingFeeUpdate = time; - if (rollingMinimumFeeRate < minReasonableRelayFee.GetFeePerK() / 2) + if (rollingMinimumFeeRate < minReasonableRelayFee.GetFeePerK() / 2) { rollingMinimumFeeRate = 0; + return CFeeRate(0); + } } return std::max(CFeeRate(rollingMinimumFeeRate), minReasonableRelayFee); }