From 8876af53d8dcf173ecceaefba4ac375228ce2862 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Thu, 26 Jan 2023 21:42:15 +0100 Subject: [PATCH] SideChain: fixed potential division by 0 --- src/side_chain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/side_chain.cpp b/src/side_chain.cpp index d7f3868..671440f 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -890,7 +890,7 @@ void SideChain::print_status(bool obtain_sidechain_lock) const // "block_depth <= window_size - 1" here (see the check below), so window_index will be <= N - 1 // This will map the range [0, window_size - 1] into [0, N - 1] - const size_t window_index = block_depth * (N - 1) / (window_size - 1); + const size_t window_index = (window_size > 1) ? (block_depth * (N - 1) / (window_size - 1)) : 0; if (cur->m_minerWallet == w) { ++our_blocks_in_window[window_index];