blockchain: fix block rate check for empty blockchains

release-v0.5.1
moneromooo-monero 5 years ago committed by wowario
parent ad6a732f24
commit 3974e40efa
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111

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

Loading…
Cancel
Save