mirror of
https://github.com/monero-project/monero.git
synced 2024-12-14 20:36:31 +02: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
@ -207,6 +207,9 @@ void BlockchainLMDB::remove_block()
|
|||||||
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
|
||||||
check_open();
|
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_copy<uint64_t> k(m_height - 1);
|
||||||
MDB_val h;
|
MDB_val h;
|
||||||
if (mdb_get(*m_write_txn, m_block_hashes, &k, &h))
|
if (mdb_get(*m_write_txn, m_block_hashes, &k, &h))
|
||||||
|
Loading…
Reference in New Issue
Block a user