diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-02-16 14:24:22 +0100 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-02-16 14:24:22 +0100 |
commit | 24d8f9237ffac857a6f11362e03ee9a78dac9f60 (patch) | |
tree | 863571ff007101a54b9cb47ff92839af71c1e486 /src | |
parent | Merge pull request #3232 (diff) | |
parent | blockchain: don't try to use hash check array after it's freed (diff) | |
download | monero-24d8f9237ffac857a6f11362e03ee9a78dac9f60.tar.xz |
Merge pull request #3248
d6a0ae96 blockchain: don't try to use hash check array after it's freed (moneromooo-monero)
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 7ee9ade80..f165aa46c 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -3754,6 +3754,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; |