From 1208cc8fa4fc46f73d8963163a8815fde0a67927 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sun, 23 Aug 2015 11:20:56 +0100 Subject: [PATCH] blockchain: match original code early out in rollback_blockchain_switching --- src/cryptonote_core/blockchain.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp index 09f8f8d7f..830335ff4 100644 --- a/src/cryptonote_core/blockchain.cpp +++ b/src/cryptonote_core/blockchain.cpp @@ -690,6 +690,12 @@ bool Blockchain::rollback_blockchain_switching(std::list& 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.