From e264377f0ef8612ee46e7355c0a35e57da5ccaa6 Mon Sep 17 00:00:00 2001 From: SChernykh Date: Mon, 6 Sep 2021 09:17:39 +0200 Subject: [PATCH] Added more checks --- src/side_chain.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/side_chain.cpp b/src/side_chain.cpp index 7e2314f..ff4911c 100644 --- a/src/side_chain.cpp +++ b/src/side_chain.cpp @@ -688,6 +688,11 @@ bool SideChain::split_reward(uint64_t reward, const std::vector& sha const uint64_t total_weight = std::accumulate(shares.begin(), shares.end(), 0ULL, [](uint64_t a, const MinerShare& b) { return a + b.m_weight; }); + if (total_weight == 0) { + LOGERR(1, "total_weight is 0. Check the code!"); + return false; + } + rewards.clear(); rewards.reserve(num_shares);