From aba9a9c27777cd0649e9946566d87030f78d8bec Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 30 Nov 2018 14:53:38 +0000 Subject: [PATCH] daemon: stop miner before we bring the whole thing down This avoids the miner erroring out trying to submit blocks to a core that's already shut down (and avoids pegging the CPU while we're busy shutting down). --- src/cryptonote_core/cryptonote_core.cpp | 1 + src/daemon/daemon.cpp | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index 10ab3fe65..dd79c0e67 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -247,6 +247,7 @@ namespace cryptonote //----------------------------------------------------------------------------------- void core::stop() { + m_miner.stop(); m_blockchain_storage.cancel(); tools::download_async_handle handle; diff --git a/src/daemon/daemon.cpp b/src/daemon/daemon.cpp index 49d6d49cf..85b8780f0 100644 --- a/src/daemon/daemon.cpp +++ b/src/daemon/daemon.cpp @@ -198,7 +198,6 @@ bool t_daemon::run(bool interactive) for(auto& rpc : mp_internals->rpcs) rpc->stop(); - mp_internals->core.get().get_miner().stop(); MGINFO("Node stopped."); return true; } @@ -220,7 +219,6 @@ void t_daemon::stop() { throw std::runtime_error{"Can't stop stopped daemon"}; } - mp_internals->core.get().get_miner().stop(); mp_internals->p2p.stop(); for(auto& rpc : mp_internals->rpcs) rpc->stop();