mempool: Make GetMinFee() with custom size protected
The version of GetMinFee() with a custom size specification is and should only be used by tests. Mark it as protected and use a derived class exposing GetMinFee() as public in tests.
This commit is contained in:
1 parent
82f00de7a6
commit
386c9472c8
2 files changed
+9
-2
No files matched your search
@@ -16,6 +16,12 @@ BOOST_FIXTURE_TEST_SUITE(mempool_tests, TestingSetup)
|
|||||||
|
|
||||||
static constexpr auto REMOVAL_REASON_DUMMY = MemPoolRemovalReason::REPLACED;
|
static constexpr auto REMOVAL_REASON_DUMMY = MemPoolRemovalReason::REPLACED;
|
||||||
|
|
||||||
|
class MemPoolTest final : public CTxMemPool
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using CTxMemPool::GetMinFee;
|
||||||
|
};
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
|
BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
|
||||||
{
|
{
|
||||||
// Test CTxMemPool::remove functionality
|
// Test CTxMemPool::remove functionality
|
||||||
@@ -423,7 +429,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
|
|||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
|
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
|
||||||
{
|
{
|
||||||
CTxMemPool& pool = *Assert(m_node.mempool);
|
auto& pool = static_cast<MemPoolTest&>(*Assert(m_node.mempool));
|
||||||
LOCK2(cs_main, pool.cs);
|
LOCK2(cs_main, pool.cs);
|
||||||
TestMemPoolEntryHelper entry;
|
TestMemPoolEntryHelper entry;
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -453,6 +453,8 @@ protected:
|
|||||||
|
|
||||||
bool m_is_loaded GUARDED_BY(cs){false};
|
bool m_is_loaded GUARDED_BY(cs){false};
|
||||||
|
|
||||||
|
CFeeRate GetMinFee(size_t sizelimit) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static const int ROLLING_FEE_HALFLIFE = 60 * 60 * 12; // public only for testing
|
static const int ROLLING_FEE_HALFLIFE = 60 * 60 * 12; // public only for testing
|
||||||
@@ -707,7 +709,6 @@ public:
|
|||||||
CFeeRate GetMinFee() const {
|
CFeeRate GetMinFee() const {
|
||||||
return GetMinFee(m_max_size_bytes);
|
return GetMinFee(m_max_size_bytes);
|
||||||
}
|
}
|
||||||
CFeeRate GetMinFee(size_t sizelimit) const;
|
|
||||||
|
|
||||||
/** Remove transactions from the mempool until its dynamic size is <= sizelimit.
|
/** Remove transactions from the mempool until its dynamic size is <= sizelimit.
|
||||||
* pvNoSpendsRemaining, if set, will be populated with the list of outpoints
|
* pvNoSpendsRemaining, if set, will be populated with the list of outpoints
|
||||||
|
|||||||
Reference in new issue
Block a user