mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-14 15:13:26 +01:00
Merge pull request #3732
fa0839f
Ensure m_timestamps has the correct number for computing difficulty. (thaerkh)
This commit is contained in:
commit
fb2b16f10a
@ -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
|
// 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
|
// pop the oldest one from the list. This only requires 1x read per height instead
|
||||||
// of doing 735 (DIFFICULTY_BLOCKS_COUNT).
|
// 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;
|
uint64_t index = height - 1;
|
||||||
m_timestamps.push_back(m_db->get_block_timestamp(index));
|
m_timestamps.push_back(m_db->get_block_timestamp(index));
|
||||||
|
Loading…
Reference in New Issue
Block a user