mirror of
https://github.com/monero-project/monero.git
synced 2024-12-23 12:09:54 +00:00
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.
This commit is contained in:
parent
eaaaada797
commit
4c2a45288a
1 changed files with 3 additions and 0 deletions
|
@ -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…
Reference in a new issue