Skip to content
Bitcoin Roots

v30.3-roots.1 · Commit 23: [PATCH 23/68] feat(wallet): add transient private-key sweep RPC

src/test/blockchain_tests.cpp

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

File metadata
index 5da2841c4dd931905bf7b8c1e23ef43770ac885a..8ac3b56141e24116b238dda40a0a96ebca795091 100644

Download original patch · Release notes

Diff rows 1–33 of 33. 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/blockchain_tests.cpp CHANGED
@@ -154,4 +154,33 @@ BOOST_FIXTURE_TEST_CASE(invalidate_block, TestChain100Setup)
154
  WITH_LOCK(::cs_main, assert((orig_tip->nStatus & BLOCK_FAILED_VALID) == 0));
155
  }
156
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
157
  BOOST_AUTO_TEST_SUITE_END()
 
154
  WITH_LOCK(::cs_main, assert((orig_tip->nStatus & BLOCK_FAILED_VALID) == 0));
155
  }
156
 
157
+ BOOST_AUTO_TEST_CASE(scan_reservation_lifecycle)
158
+ {
159
+ using namespace rpc::scan;
160
+ g_in_progress = false;
161
+ g_progress = 0;
162
+ g_should_abort = false;
163
+ {
164
+ Reserver owner;
165
+ BOOST_REQUIRE(owner.reserve());
166
+ Reserver competitor;
167
+ BOOST_CHECK(!competitor.reserve());
168
+ BOOST_CHECK(g_in_progress);
169
+ g_should_abort = true;
170
+ BOOST_CHECK(g_should_abort);
171
+ }
172
+ BOOST_CHECK(!g_in_progress);
173
+ BOOST_CHECK_EQUAL(g_progress, 0);
174
+ { Reserver after_release; BOOST_CHECK(after_release.reserve()); }
175
+ try {
176
+ Reserver interrupted;
177
+ BOOST_REQUIRE(interrupted.reserve());
178
+ CheckInterruption(8192, [] { throw std::runtime_error{"shutdown"}; });
179
+ BOOST_FAIL("shutdown interruption was not propagated");
180
+ } catch (const std::runtime_error&) {
181
+ }
182
+ Reserver after_shutdown;
183
+ BOOST_CHECK(after_shutdown.reserve());
184
+ }
185
+
186
  BOOST_AUTO_TEST_SUITE_END()