blockchain: fix theoretical race getting bulk timestamps

This commit is contained in:
moneromooo-monero 2020-05-13 13:38:32 +00:00 committed by wowario
parent e74aff06c2
commit febb8df4bb
No known key found for this signature in database
GPG Key ID: 24DCBE762DE9C111
1 changed files with 1 additions and 0 deletions

View File

@ -916,6 +916,7 @@ 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> Blockchain::get_last_block_timestamps(unsigned int blocks) const
{ {
CRITICAL_REGION_LOCAL(m_blockchain_lock);
uint64_t height = m_db->height(); uint64_t height = m_db->height();
if (blocks > height) if (blocks > height)
blocks = height; blocks = height;