mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-08-15 01:03:23 +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__);
|
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 a new issue