Skip to content

Commit 386c947

Browse files
committed
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.
1 parent 82f00de commit 386c947

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/test/mempool_tests.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ BOOST_FIXTURE_TEST_SUITE(mempool_tests, TestingSetup)
1616

1717
static constexpr auto REMOVAL_REASON_DUMMY = MemPoolRemovalReason::REPLACED;
1818

19+
class MemPoolTest final : public CTxMemPool
20+
{
21+
public:
22+
using CTxMemPool::GetMinFee;
23+
};
24+
1925
BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
2026
{
2127
// Test CTxMemPool::remove functionality
@@ -423,7 +429,7 @@ BOOST_AUTO_TEST_CASE(MempoolAncestorIndexingTest)
423429

424430
BOOST_AUTO_TEST_CASE(MempoolSizeLimitTest)
425431
{
426-
CTxMemPool& pool = *Assert(m_node.mempool);
432+
auto& pool = static_cast<MemPoolTest&>(*Assert(m_node.mempool));
427433
LOCK2(cs_main, pool.cs);
428434
TestMemPoolEntryHelper entry;
429435

src/txmempool.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,8 @@ class CTxMemPool
453453

454454
bool m_is_loaded GUARDED_BY(cs){false};
455455

456+
CFeeRate GetMinFee(size_t sizelimit) const;
457+
456458
public:
457459

458460
static const int ROLLING_FEE_HALFLIFE = 60 * 60 * 12; // public only for testing
@@ -707,7 +709,6 @@ class CTxMemPool
707709
CFeeRate GetMinFee() const {
708710
return GetMinFee(m_max_size_bytes);
709711
}
710-
CFeeRate GetMinFee(size_t sizelimit) const;
711712

712713
/** Remove transactions from the mempool until its dynamic size is <= sizelimit.
713714
* pvNoSpendsRemaining, if set, will be populated with the list of outpoints

0 commit comments

Comments
 (0)