diff --git a/src/node/kernel_notifications.h b/src/node/kernel_notifications.h index 71947e5f98c..12017f2b2c2 100644 --- a/src/node/kernel_notifications.h +++ b/src/node/kernel_notifications.h @@ -58,7 +58,7 @@ public: bool m_shutdown_on_fatal_error{true}; Mutex m_tip_block_mutex; - std::condition_variable m_tip_block_cv; + std::condition_variable m_tip_block_cv GUARDED_BY(m_tip_block_mutex); //! The block for which the last blockTip notification was received for. uint256 m_tip_block GUARDED_BY(m_tip_block_mutex); diff --git a/src/rpc/server.cpp b/src/rpc/server.cpp index 086f609ac3e..ab2135a9193 100644 --- a/src/rpc/server.cpp +++ b/src/rpc/server.cpp @@ -305,7 +305,7 @@ void StopRPC(const std::any& context) DeleteAuthCookie(); node::NodeContext& node = EnsureAnyNodeContext(context); // The notifications interface doesn't exist between initialization step 4a and 7. - if (node.notifications) node.notifications->m_tip_block_cv.notify_all(); + if (node.notifications) WITH_LOCK(node.notifications->m_tip_block_mutex, node.notifications->m_tip_block_cv.notify_all()); LogDebug(BCLog::RPC, "RPC stopped.\n"); }); }