aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-29 15:49:49 +0100
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-06-29 15:50:34 +0100
commitd95bc44c6ba2a1096ca95d1565851e5827f48e4f (patch)
treeb6d6b4c17080ff67c1223de01b10fb2540f39164
parentMerge pull request #4067 (diff)
downloadmonero-d95bc44c6ba2a1096ca95d1565851e5827f48e4f.tar.xz
blockchain: fix getting invalid block data on failure
-rw-r--r--src/cryptonote_core/blockchain.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 73ce98366..87f5c165d 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -2217,7 +2217,8 @@ bool Blockchain::find_blockchain_supplement(const std::list<crypto::hash>& 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(resp.total_height - 1);
+ if (result)
+ resp.cumulative_difficulty = m_db->get_block_cumulative_difficulty(resp.total_height - 1);
return result;
}