diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-05-26 16:50:35 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2019-05-26 17:11:32 +0000 |
commit | 35da33bea939ec965efe4bd721b8b32efcc3d619 (patch) | |
tree | d11698d60c3b76078a80942c50d88e6b75e143e4 /src/cryptonote_core/blockchain.cpp | |
parent | core: do not commit half constructed batch db txn (diff) | |
download | monero-35da33bea939ec965efe4bd721b8b32efcc3d619.tar.xz |
blockchain: do not try to pop blocks down to the genesis block
Diffstat (limited to 'src/cryptonote_core/blockchain.cpp')
-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(); |