diff --git a/src/init.cpp b/src/init.cpp index e4b65fbfa9..03969b00bb 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -296,10 +296,11 @@ void Shutdown(NodeContext& node) StopTorControl(); - // After everything has been shut down, but before things get flushed, stop the - // scheduler and load block thread. - if (node.scheduler) node.scheduler->stop(); if (node.chainman && node.chainman->m_thread_load.joinable()) node.chainman->m_thread_load.join(); + // After everything has been shut down, but before things get flushed, stop the + // the scheduler. After this point, SyncWithValidationInterfaceQueue() should not be called anymore + // as this would prevent the shutdown from completing. + if (node.scheduler) node.scheduler->stop(); // After the threads that potentially access these pointers have been stopped, // destruct and reset all to nullptr.