Skip to content
Bitcoin Roots

v29.4-roots.1 · Commit 10: [PATCH 10/13] fix: harden final Roots assurance

src/test/mempool_tests.cpp

Before: src/test/mempool_tests.cpp · After: src/test/mempool_tests.cpp

File metadata
index 9acdec12f4adee1184fd2636da95eb073db2a2ea..d2b848d5e56aacd223d7a2acaa612f4439c4e0c6 100644

Download original patch · Release notes

Diff rows 1–29 of 29. Line numbers refer to the original before/after files.

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. Before is on the left; after is on the right. Unified view fits narrow screens more easily.

src/test/mempool_tests.cpp CHANGED
@@ -11,6 +11,8 @@
11
  #include <test/util/setup_common.h>
12
 
13
  #include <boost/test/unit_test.hpp>
 
 
14
  #include <vector>
15
 
16
  BOOST_FIXTURE_TEST_SUITE(mempool_tests, TestingSetup)
@@ -23,6 +25,21 @@ public:
23
  using CTxMemPool::GetMinFee;
24
  };
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
27
  {
28
  // Test CTxMemPool::remove functionality
 
11
  #include <test/util/setup_common.h>
12
 
13
  #include <boost/test/unit_test.hpp>
14
+
15
+ #include <limits>
16
  #include <vector>
17
 
18
  BOOST_FIXTURE_TEST_SUITE(mempool_tests, TestingSetup)
 
25
  using CTxMemPool::GetMinFee;
26
  };
27
 
28
+ BOOST_AUTO_TEST_CASE(MempoolEntryMaxHeightTest)
29
+ {
30
+ CMutableTransaction mtx;
31
+ mtx.vin.resize(1);
32
+ mtx.vout.emplace_back(1, CScript{});
33
+ const auto tx{MakeTransactionRef(mtx)};
34
+ const auto max_height{std::numeric_limits<unsigned int>::max()};
35
+ const CoinAgeCache coin_age_cache{.inputs_coin_age = 100.0, .in_chain_input_value = 1};
36
+ const CTxMemPoolEntry entry{tx, /*fee=*/0, /*time=*/0, max_height, /*entry_sequence=*/0,
37
+ coin_age_cache, /*spends_coinbase=*/false, /*extra_weight=*/0,
38
+ /*sigops_cost=*/0, {}};
39
+
40
+ BOOST_CHECK_EQUAL(entry.GetPriority(max_height), entry.GetStartingPriority());
41
+ }
42
+
43
  BOOST_AUTO_TEST_CASE(MempoolRemoveTest)
44
  {
45
  // Test CTxMemPool::remove functionality