Skip to content
Bitcoin Roots

v29.4-roots.3 · Commit 23: [PATCH 23/30] 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 4ecc15041cc5c8ac577efa4eb55800e28cb560a0..840fc52e2f77bcad50e14381bea795ae1f63f327 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
@@ -117,4 +117,33 @@ BOOST_AUTO_TEST_CASE(num_chain_tx_max)
117
  BOOST_CHECK_EQUAL(block_index.m_chain_tx_count, std::numeric_limits<uint64_t>::max());
118
  }
119
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
  BOOST_AUTO_TEST_SUITE_END()
 
117
  BOOST_CHECK_EQUAL(block_index.m_chain_tx_count, std::numeric_limits<uint64_t>::max());
118
  }
119
 
120
+ BOOST_AUTO_TEST_CASE(scan_reservation_lifecycle)
121
+ {
122
+ using namespace rpc::scan;
123
+ g_in_progress = false;
124
+ g_progress = 0;
125
+ g_should_abort = false;
126
+ {
127
+ Reserver owner;
128
+ BOOST_REQUIRE(owner.reserve());
129
+ Reserver competitor;
130
+ BOOST_CHECK(!competitor.reserve());
131
+ BOOST_CHECK(g_in_progress);
132
+ g_should_abort = true;
133
+ BOOST_CHECK(g_should_abort);
134
+ }
135
+ BOOST_CHECK(!g_in_progress);
136
+ BOOST_CHECK_EQUAL(g_progress, 0);
137
+ { Reserver after_release; BOOST_CHECK(after_release.reserve()); }
138
+ try {
139
+ Reserver interrupted;
140
+ BOOST_REQUIRE(interrupted.reserve());
141
+ CheckInterruption(8192, [] { throw std::runtime_error{"shutdown"}; });
142
+ BOOST_FAIL("shutdown interruption was not propagated");
143
+ } catch (const std::runtime_error&) {
144
+ }
145
+ Reserver after_shutdown;
146
+ BOOST_CHECK(after_shutdown.reserve());
147
+ }
148
+
149
  BOOST_AUTO_TEST_SUITE_END()