Merge pull request #4993

b8342dd5 blockchain: fix block rate check for empty blockchains (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2019-01-16 19:07:54 +02:00
commit 1f71bfc8d0
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD

View File

@ -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;