Merge pull request #6526

5d882f4f1 blockchain: fix theoretical race getting bulk timestamps (moneromooo-monero)
This commit is contained in:
Alexander Blair 2020-07-19 03:34:52 -07:00
commit 814e617117
No known key found for this signature in database
GPG Key ID: C64552D877C32479

View File

@ -962,6 +962,7 @@ start:
//------------------------------------------------------------------ //------------------------------------------------------------------
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;