aboutsummaryrefslogtreecommitdiff
path: root/src/cryptonote_core
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-26 16:50:35 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2019-05-26 17:11:32 +0000
commit35da33bea939ec965efe4bd721b8b32efcc3d619 (patch)
treed11698d60c3b76078a80942c50d88e6b75e143e4 /src/cryptonote_core
parentcore: do not commit half constructed batch db txn (diff)
downloadmonero-35da33bea939ec965efe4bd721b8b32efcc3d619.tar.xz
blockchain: do not try to pop blocks down to the genesis block
Diffstat (limited to 'src/cryptonote_core')
-rw-r--r--src/cryptonote_core/blockchain.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 760d1ee81..520defc81 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -624,6 +624,9 @@ void Blockchain::pop_blocks(uint64_t nblocks)
try
{
+ const uint64_t blockchain_height = m_db->height();
+ if (blockchain_height > 0)
+ nblocks = std::min(nblocks, blockchain_height - 1);
for (i=0; i < nblocks; ++i)
{
pop_block_from_blockchain();