From f9831500e42f65f8a1e1d090f7f764d2c280e855 Mon Sep 17 00:00:00 2001 From: SChernykh <15806605+SChernykh@users.noreply.github.com> Date: Fri, 16 May 2025 08:01:19 +0200 Subject: [PATCH] Fixed build --- src/merge_mining_client_tari.cpp | 3 +-- src/util.h | 11 ++++++++++- src/zmq_reader.cpp | 7 +------ 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/merge_mining_client_tari.cpp b/src/merge_mining_client_tari.cpp index 2c84fd8..8fd9503 100644 --- a/src/merge_mining_client_tari.cpp +++ b/src/merge_mining_client_tari.cpp @@ -212,12 +212,11 @@ void MergeMiningClientTari::on_external_block(const PoolBlock& block) if (std::find(a, b, *data.u64()) == b) { LOGINFO(4, "External aux job solution found, but it's for another miner"); + return; } else { LOGINFO(4, "External aux job solution found, but it's stale"); } - - return; } if (!diff.check_pow(block.m_powHash)) { diff --git a/src/util.h b/src/util.h index a222fc0..e5fa2e7 100644 --- a/src/util.h +++ b/src/util.h @@ -69,7 +69,16 @@ template struct ScopeGuard : public nocopy_nomove { explicit FORCEINLINE ScopeGuard(T&& handler) : m_handler(std::move(handler)) {} - FORCEINLINE ~ScopeGuard() { m_handler(); } + + FORCEINLINE ~ScopeGuard() + { + // Because the handler can throw an exception, and we don't want exceptions in a destructor + try { + m_handler(); + } + catch(...) { + } + } T m_handler; }; diff --git a/src/zmq_reader.cpp b/src/zmq_reader.cpp index 97b8dc0..736d1da 100644 --- a/src/zmq_reader.cpp +++ b/src/zmq_reader.cpp @@ -171,12 +171,7 @@ void ZMQReader::run() } ON_SCOPE_LEAVE([this]() { - try { - m_monitor->abort(); - } - catch(...) { - LOGERR(1, "m_monitor->abort() failed"); - } + m_monitor->abort(); uv_thread_join(&m_monitorThread); });