aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-12-18 18:46:07 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-12-18 18:47:54 +0000
commitb8342dd52cdc75592de19a92b01f2094d5b4ba8b (patch)
tree44b97bcfee0077790daf09a6c5179de1c4528225 /src
parentMerge pull request #4927 (diff)
downloadmonero-b8342dd52cdc75592de19a92b01f2094d5b4ba8b.tar.xz
blockchain: fix block rate check for empty blockchains
Diffstat (limited to '')
-rw-r--r--src/cryptonote_core/blockchain.cpp4
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;