diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-12-18 18:46:07 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-12-18 18:47:54 +0000 |
commit | b8342dd52cdc75592de19a92b01f2094d5b4ba8b (patch) | |
tree | 44b97bcfee0077790daf09a6c5179de1c4528225 /src/cryptonote_core | |
parent | Merge pull request #4927 (diff) | |
download | monero-b8342dd52cdc75592de19a92b01f2094d5b4ba8b.tar.xz |
blockchain: fix block rate check for empty blockchains
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
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<time_t> Blockchain::get_last_block_timestamps(unsigned int blocks) const { - std::vector<time_t> timestamps(blocks); uint64_t height = m_db->height(); + if (blocks > height) + blocks = height; + std::vector<time_t> timestamps(blocks); while (blocks--) timestamps[blocks] = m_db->get_block_timestamp(height - blocks - 1); return timestamps; |