blockchain: fix block rate check for empty blockchains

pull/200/head
moneromooo-monero 6 years ago
parent 6bc0c7e685
commit b8342dd52c
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

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

Loading…
Cancel
Save