blockchain: fix theoretical race getting bulk timestamps

This commit is contained in:
moneromooo-monero 2020-05-13 13:38:32 +00:00
parent 77a008f714
commit 5d882f4f14
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -890,6 +890,7 @@ difficulty_type Blockchain::get_difficulty_for_next_block()
//------------------------------------------------------------------
std::vector<time_t> Blockchain::get_last_block_timestamps(unsigned int blocks) const
{
CRITICAL_REGION_LOCAL(m_blockchain_lock);
uint64_t height = m_db->height();
if (blocks > height)
blocks = height;