diff options
author | Riccardo Spagni <ric@spagni.net> | 2019-01-16 19:07:54 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2019-01-16 19:07:55 +0200 |
commit | 1f71bfc8d04fa3182212d99595c21975312df83e (patch) | |
tree | 917d04dd6794f1a45b22f84e68ee9acddee23471 /src/cryptonote_core | |
parent | Merge pull request #4987 (diff) | |
parent | blockchain: fix block rate check for empty blockchains (diff) | |
download | monero-1f71bfc8d04fa3182212d99595c21975312df83e.tar.xz |
Merge pull request #4993
b8342dd5 blockchain: fix block rate check for empty blockchains (moneromooo-monero)
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 ad946069b..4f033d4c9 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -921,8 +921,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; |