aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-02-10 11:25:00 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-02-10 11:26:06 +0000
commitd6a0ae96c6a4fad9f71b38dc6cef134c4234d99c (patch)
treedca19982c20cdbf278633b80131499f34e447d58
parentMerge pull request #3198 (diff)
downloadmonero-d6a0ae96c6a4fad9f71b38dc6cef134c4234d99c.tar.xz
blockchain: don't try to use hash check array after it's freed
It's freed when we've synced past its end, but we might still find an old chain somewhere
-rw-r--r--src/cryptonote_core/blockchain.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 178479f3c..378e4684f 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -3753,6 +3753,10 @@ uint64_t Blockchain::prevalidate_block_hashes(uint64_t height, const std::list<c
if (height >= m_blocks_hash_of_hashes.size() * HASH_OF_HASHES_STEP)
return hashes.size();
+ // if we're getting old blocks, we might have jettisoned the hashes already
+ if (m_blocks_hash_check.empty())
+ return hashes.size();
+
// find hashes encompassing those block
size_t first_index = height / HASH_OF_HASHES_STEP;
size_t last_index = (height + hashes.size() - 1) / HASH_OF_HASHES_STEP;