diff options
-rw-r--r-- | src/cryptonote_core/blockchain.cpp | 3 |
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(); |