v29.4-roots.1 · Commit 10: [PATCH 10/13] fix: harden final Roots assurance
src/wallet/test/spend_tests.cpp
Before: src/wallet/test/spend_tests.cpp · After: src/wallet/test/spend_tests.cpp
File metadata
index ac76fe4dda0084460858a83336d71cab3bd22e9a..e295002a51f207aa95c04a30a87f57d9ed662a29 100644
Download original patch · Release notes
Diff rows 1–27 of 27. 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/wallet/test/spend_tests.cpp
CHANGED
|
@@ -5,6 +5,8 @@
|
|
| 5 |
#include <consensus/amount.h>
|
| 6 |
#include <key.h>
|
| 7 |
#include <policy/fees.h>
|
|
|
|
|
|
|
| 8 |
#include <script/solver.h>
|
| 9 |
#include <validation.h>
|
| 10 |
#include <wallet/coincontrol.h>
|
|
@@ -33,6 +35,19 @@ BOOST_AUTO_TEST_CASE(max_signed_input_size_uses_external_outpoint)
|
|
| 33 |
BOOST_CHECK_EQUAL(high_r, low_r + 1);
|
| 34 |
}
|
| 35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
BOOST_FIXTURE_TEST_CASE(SubtractFee, TestChain100Setup)
|
| 37 |
{
|
| 38 |
CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
|
|
|
|
| 5 |
#include <consensus/amount.h>
|
| 6 |
#include <key.h>
|
| 7 |
#include <policy/fees.h>
|
| 8 |
+
#include <policy/policy.h>
|
| 9 |
+
#include <random.h>
|
| 10 |
#include <script/solver.h>
|
| 11 |
#include <validation.h>
|
| 12 |
#include <wallet/coincontrol.h>
|
|
|
|
| 35 |
BOOST_CHECK_EQUAL(high_r, low_r + 1);
|
| 36 |
}
|
| 37 |
|
| 38 |
+
BOOST_AUTO_TEST_CASE(anti_fee_sniping_avoids_reserved_policy_locktime)
|
| 39 |
+
{
|
| 40 |
+
FastRandomContext rng{/*fDeterministic=*/true};
|
| 41 |
+
const int first_height{static_cast<int>(PARASITE_CAT21_LOCKTIME)};
|
| 42 |
+
for (int height{first_height}; height < first_height + 100; ++height) {
|
| 43 |
+
for (int sample = 0; sample < 1000; ++sample) {
|
| 44 |
+
const uint32_t lock_time{GetAntiFeeSnipingLockTime(height, rng)};
|
| 45 |
+
BOOST_CHECK_NE(lock_time, PARASITE_CAT21_LOCKTIME);
|
| 46 |
+
BOOST_CHECK_LE(lock_time, height);
|
| 47 |
+
}
|
| 48 |
+
}
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
BOOST_FIXTURE_TEST_CASE(SubtractFee, TestChain100Setup)
|
| 52 |
{
|
| 53 |
CreateAndProcessBlock({}, GetScriptForRawPubKey(coinbaseKey.GetPubKey()));
|