aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core/blockchain.cpp
diff options
context:
space:
mode:
authorThaer Khawaja <thaer.khawaja@gmail.com>2018-04-29 19:31:40 -0700
committerThaer Khawaja <thaer.khawaja@gmail.com>2018-04-29 19:50:55 -0700
commitfa0839f2f58ec84bbfe619aec25a6393277681c8 (patch)
treed46478db379bdce5ac2105083de5957d83bc6a5c /src/cryptonote_core/blockchain.cpp
parentMerge pull request #3719 (diff)
downloadmonero-fa0839f2f58ec84bbfe619aec25a6393277681c8.tar.xz
Ensure m_timestamps has the correct number for computing difficulty.
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-rw-r--r--src/cryptonote_core/blockchain.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 25e97f71f..a059e4d6e 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -760,7 +760,7 @@ difficulty_type Blockchain::get_difficulty_for_next_block()
// then when the next block difficulty is queried, push the latest height data and
// pop the oldest one from the list. This only requires 1x read per height instead
// of doing 735 (DIFFICULTY_BLOCKS_COUNT).
- if (m_timestamps_and_difficulties_height != 0 && ((height - m_timestamps_and_difficulties_height) == 1))
+ if (m_timestamps_and_difficulties_height != 0 && ((height - m_timestamps_and_difficulties_height) == 1) && m_timestamps.size() >= DIFFICULTY_BLOCKS_COUNT)
{
uint64_t index = height - 1;
m_timestamps.push_back(m_db->get_block_timestamp(index));