From 6d3cfa2c7abf1acf9f4f3aee7a7ed57dde466711 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 23 Aug 2021 23:08:46 +0200 Subject: [PATCH] Couple more sanity checks --- src/side_chain.cpp | 5 +++++ src/stratum_server.cpp | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/src/side_chain.cpp b/src/side_chain.cpp index 8198da4..6f9efb8 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -1118,6 +1118,11 @@ void SideChain::update_chain_tip(PoolBlock* block) return; } + if (block->m_depth >= m_chainWindowSize) { + LOGINFO(5, "Trying to update chain tip to a block with depth " << block->m_depth << ". Ignoring it."); + return; + } + if (is_longer_chain(m_chainTip, block)) { difficulty_type diff; if (get_difficulty(block, m_difficultyData, diff)) { diff --git a/src/stratum_server.cpp b/src/stratum_server.cpp index f6ec25f..7cf38ee 100644 --- a/src/stratum_server.cpp +++ b/src/stratum_server.cpp @@ -100,6 +100,10 @@ void StratumServer::on_block(const BlockTemplate& block) m_blobsQueue.push_back(blobs_data); } + if (uv_is_closing(reinterpret_cast(&m_blobsAsync))) { + return; + } + const int err = uv_async_send(&m_blobsAsync); if (err) { LOGERR(1, "uv_async_send failed, error " << uv_err_name(err));