aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorluigi1111 <luigi1111w@gmail.com>2018-06-16 14:05:53 -0500
committerluigi1111 <luigi1111w@gmail.com>2018-06-16 14:05:53 -0500
commitfb2b16f10a92b4c2008d74cee339ceee9093fa0b (patch)
tree452c3915e17eef444a9e8353c051daf4d1375183
parentMerge pull request #3737 (diff)
parentEnsure m_timestamps has the correct number for computing difficulty. (diff)
downloadmonero-fb2b16f10a92b4c2008d74cee339ceee9093fa0b.tar.xz
Merge pull request #3732
fa0839f Ensure m_timestamps has the correct number for computing difficulty. (thaerkh)
-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 ae2b47570..38f7f94e1 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -827,7 +827,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));