Skip to content

Commit c981771

Browse files
committed
Merge bitcoin#28224: shutdown: Destroy kernel last, make test shutdown order consistent
c1144f0 tests: Reset node context members on ~BasicTestingSetup (TheCharlatan) 9759af1 shutdown: Destroy kernel last (TheCharlatan) Pull request description: The destruction/resetting of node context members in the tests should roughly follow the behavior of the `Shutdown` function in `init.cpp`. This was originally requested by MarcoFalke in this [comment](bitcoin#25065 (comment)) in response to the [original pull request](bitcoin#25065) introducing the `kernel::Context`. ACKs for top commit: maflcko: ACK c1144f0 🗣 achow101: ACK c1144f0 ryanofsky: Code review ACK c1144f0. No code changes since last review, just updated commits and descriptions Tree-SHA512: 819bb85ff82a5c6c60e429674d5684f3692fe9062500d00a87b361cc59e6bda145be21b5a4466dee6791faed910cbde4d26baab325bf6daa1813af13a63588ff
2 parents c8a883a + c1144f0 commit c981771

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/init.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ void Shutdown(NodeContext& node)
343343
node.chain_clients.clear();
344344
UnregisterAllValidationInterfaces();
345345
GetMainSignals().UnregisterBackgroundSignalScheduler();
346-
node.kernel.reset();
347346
node.mempool.reset();
348347
node.fee_estimator.reset();
349348
node.chainman.reset();
350349
node.scheduler.reset();
350+
node.kernel.reset();
351351

352352
try {
353353
if (!fs::remove(GetPidFile(*node.args))) {

src/test/util/setup_common.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, const std::vecto
147147

148148
BasicTestingSetup::~BasicTestingSetup()
149149
{
150+
m_node.kernel.reset();
150151
SetMockTime(0s); // Reset mocktime for following tests
151152
LogInstance().DisconnectTestLogger();
152153
fs::remove_all(m_path_root);
@@ -205,8 +206,9 @@ ChainTestingSetup::~ChainTestingSetup()
205206
m_node.netgroupman.reset();
206207
m_node.args = nullptr;
207208
m_node.mempool.reset();
208-
m_node.scheduler.reset();
209+
m_node.fee_estimator.reset();
209210
m_node.chainman.reset();
211+
m_node.scheduler.reset();
210212
}
211213

212214
void ChainTestingSetup::LoadVerifyActivateChainstate()

0 commit comments

Comments
 (0)