From b8342dd52cdc75592de19a92b01f2094d5b4ba8b Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Tue, 18 Dec 2018 18:46:07 +0000 Subject: blockchain: fix block rate check for empty blockchains --- src/cryptonote_core/blockchain.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/cryptonote_core') diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index c6a3c6180..0a9470fb6 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -918,8 +918,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; -- cgit v1.2.3