From fb64790f43c948cb9c3722f0fe379c3d8e1222f6 Mon Sep 17 00:00:00 2001 From: miltonf Date: Sat, 24 Nov 2018 17:28:23 +0200 Subject: [PATCH] Prevent getting invalid block data in blockchain --- src/cryptonote_core/blockchain.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 6f0d0de..2f3dd21 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -2186,7 +2186,8 @@ bool Blockchain::find_blockchain_supplement(const std::list& qbloc CRITICAL_REGION_LOCAL(m_blockchain_lock); bool result = find_blockchain_supplement(qblock_ids, resp.m_block_ids, resp.start_height, resp.total_height); - resp.cumulative_difficulty = m_db->get_block_cumulative_difficulty(m_db->height() - 1); + if (result) + resp.cumulative_difficulty = m_db->get_block_cumulative_difficulty(m_db->height() - 1); return result; }