diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index aaefe6a98..711e27606 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -902,8 +902,10 @@ difficulty_type Blockchain::get_difficulty_for_next_block() //------------------------------------------------------------------ std::vector Blockchain::get_last_block_timestamps(unsigned int blocks) const { - std::vector timestamps(blocks); uint64_t height = m_db->height(); + if (blocks > height) + blocks = height; + std::vector timestamps(blocks); while (blocks--) timestamps[blocks] = m_db->get_block_timestamp(height - blocks - 1); return timestamps;