aboutsummaryrefslogtreecommitdiff
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>2019-02-12 12:16:25 +0000
commit4a7917ef6b09417fd4e263573c8e8cc059c04873 (patch)
tree27ae28d05b672dd6edf0c9641d34c9841af28bdb
parentignore child process when exec (diff)
downloadmonero-4a7917ef6b09417fd4e263573c8e8cc059c04873.tar.xz
blockchain: fix block rate check for empty blockchains
-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 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<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;