mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-04 00:41:36 +02:00
Merge bitcoin/bitcoin#28224: shutdown: Destroy kernel last, make test shutdown order consistent
c1144f0076339c775f41d4b5fcfdc72191440d96 tests: Reset node context members on ~BasicTestingSetup (TheCharlatan) 9759af17ff7c28eb909cb73f62b78c90851ab74d 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](https://github.com/bitcoin/bitcoin/pull/25065#discussion_r890161249) in response to the [original pull request](https://github.com/bitcoin/bitcoin/pull/25065) introducing the `kernel::Context`. ACKs for top commit: maflcko: ACK c1144f0076339c775f41d4b5fcfdc72191440d96 🗣 achow101: ACK c1144f0076339c775f41d4b5fcfdc72191440d96 ryanofsky: Code review ACK c1144f0076339c775f41d4b5fcfdc72191440d96. No code changes since last review, just updated commits and descriptions Tree-SHA512: 819bb85ff82a5c6c60e429674d5684f3692fe9062500d00a87b361cc59e6bda145be21b5a4466dee6791faed910cbde4d26baab325bf6daa1813af13a63588ff
This commit is contained in:
commit
c981771bc3
@ -343,11 +343,11 @@ void Shutdown(NodeContext& node)
|
|||||||
node.chain_clients.clear();
|
node.chain_clients.clear();
|
||||||
UnregisterAllValidationInterfaces();
|
UnregisterAllValidationInterfaces();
|
||||||
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
GetMainSignals().UnregisterBackgroundSignalScheduler();
|
||||||
node.kernel.reset();
|
|
||||||
node.mempool.reset();
|
node.mempool.reset();
|
||||||
node.fee_estimator.reset();
|
node.fee_estimator.reset();
|
||||||
node.chainman.reset();
|
node.chainman.reset();
|
||||||
node.scheduler.reset();
|
node.scheduler.reset();
|
||||||
|
node.kernel.reset();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!fs::remove(GetPidFile(*node.args))) {
|
if (!fs::remove(GetPidFile(*node.args))) {
|
||||||
|
@ -147,6 +147,7 @@ BasicTestingSetup::BasicTestingSetup(const ChainType chainType, const std::vecto
|
|||||||
|
|
||||||
BasicTestingSetup::~BasicTestingSetup()
|
BasicTestingSetup::~BasicTestingSetup()
|
||||||
{
|
{
|
||||||
|
m_node.kernel.reset();
|
||||||
SetMockTime(0s); // Reset mocktime for following tests
|
SetMockTime(0s); // Reset mocktime for following tests
|
||||||
LogInstance().DisconnectTestLogger();
|
LogInstance().DisconnectTestLogger();
|
||||||
fs::remove_all(m_path_root);
|
fs::remove_all(m_path_root);
|
||||||
@ -205,8 +206,9 @@ ChainTestingSetup::~ChainTestingSetup()
|
|||||||
m_node.netgroupman.reset();
|
m_node.netgroupman.reset();
|
||||||
m_node.args = nullptr;
|
m_node.args = nullptr;
|
||||||
m_node.mempool.reset();
|
m_node.mempool.reset();
|
||||||
m_node.scheduler.reset();
|
m_node.fee_estimator.reset();
|
||||||
m_node.chainman.reset();
|
m_node.chainman.reset();
|
||||||
|
m_node.scheduler.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChainTestingSetup::LoadVerifyActivateChainstate()
|
void ChainTestingSetup::LoadVerifyActivateChainstate()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user