Skip to content
Bitcoin Roots

v31.1-roots.1 · Commit 7: [PATCH 07/17] feat(rpc): preserve Roots operator interfaces on v31

src/test/mempool_tests.cpp

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

File metadata
index 070e9b1c493e3c17fff363e6955b52b3818132bf..94e2f74ffd2b646df2f87118f0e367147c5383ad 100644

Download original patch · Release notes

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

+ Added− RemovedUnmarked lines are context.

Scroll the code area horizontally to read long lines. The two line-number columns refer to before and after.

src/test/mempool_tests.cpp CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  #include <common/system.h>
6
6
  #include <policy/policy.h>
7
+ #include <rpc/mempool.h>
7
8
  #include <test/util/txmempool.h>
8
9
  #include <txmempool.h>
9
10
  #include <util/time.h>
@@ -11,6 +12,7 @@
11
12
  #include <test/util/setup_common.h>
12
13
 
13
14
  #include <boost/test/unit_test.hpp>
15
+ #include <univalue.h>
14
16
  #include <limits>
15
17
  #include <vector>
16
18
  #include <thread>
@@ -83,6 +85,14 @@ BOOST_AUTO_TEST_CASE(DynamicDustPublication)
83
85
  for (int i = 0; i < 10000; ++i) {
84
86
  const auto fee = pool.GetStandardnessOptions().dust_relay_feerate.GetFeePerK();
85
87
  if (fee != 3000 && fee != 90000) valid = false;
88
+ if (i < 1000) {
89
+ // Exercise the reporting snapshot while the live rate is published.
90
+ // Each returned JSON value must own its data after the pool lock ends.
91
+ const auto report{MempoolInfoToJSON(pool)};
92
+ const auto reported_fee{report["policy"]["dust_relay_fee"].getValStr()};
93
+ if (reported_fee != "0.00003000" && reported_fee != "0.00090000") valid = false;
94
+ if (report["policy"]["require_standard"].get_bool() != options.require_standard) valid = false;
95
+ }
86
96
  }
87
97
  }};
88
98
  for (int i = 0; i < 10000; ++i) pool.UpdateDynamicDustFee(i % 2 ? estimate : std::nullopt);