db_lmdb: catch attempt to remove block from an empty blockchain

It would probably have thrown when not finding a block at
height 2^64-1, but better make things clear.
release-v0.4.0.1
moneromooo-monero 10 years ago committed by warptangent
parent eaaaada797
commit 4c2a45288a

@ -207,6 +207,9 @@ void BlockchainLMDB::remove_block()
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
check_open();
if (m_height == 0)
throw0(BLOCK_DNE ("Attempting to remove block from an empty blockchain"));
MDB_val_copy<uint64_t> k(m_height - 1);
MDB_val h;
if (mdb_get(*m_write_txn, m_block_hashes, &k, &h))

Loading…
Cancel
Save