aboutsummaryrefslogtreecommitdiff
path: root/src
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:37 +0000
commita663ccba71e66e51d43fbe5097c98b0f5dc9d8ea (patch)
treed11698d60c3b76078a80942c50d88e6b75e143e4 /src
parentcore: do not commit half constructed batch db txn (diff)
downloadmonero-a663ccba71e66e51d43fbe5097c98b0f5dc9d8ea.tar.xz
blockchain: do not try to pop blocks down to the genesis block
Diffstat (limited to 'src')
-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();