aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-25 22:01:21 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-25 22:01:21 +0000
commit5cec076e130f4ae2d1b704086715d59625358feb (patch)
tree1bdb3e7ab3601c4c99abb6d4773eb5f5cf9a05bb /src
parentcore: catch exceptions from get_output_key (diff)
downloadmonero-5cec076e130f4ae2d1b704086715d59625358feb.tar.xz
blockchain: add a missing validity check to rollback_blockchain_switching
It was present in the original code
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/blockchain.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 64b7a5b2f..f3111a966 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -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.