blockchain: add a missing validity check to rollback_blockchain_switching

It was present in the original code
This commit is contained in:
moneromooo-monero 2015-12-25 22:01:21 +00:00
parent 3cabdb5ef2
commit 5cec076e13
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 6 additions and 0 deletions

View File

@ -717,6 +717,12 @@ bool Blockchain::rollback_blockchain_switching(std::list<block>& original_chain,
LOG_PRINT_L3("Blockchain::" << __func__);
CRITICAL_REGION_LOCAL(m_blockchain_lock);
// fail if rollback_height passed is too high
if (rollback_height > m_db->height())
{
return true;
}
m_timestamps_and_difficulties_height = 0;
// remove blocks from blockchain until we get back to where we should be.