aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2014-12-12 23:20:41 +0000
committerwarptangent <warptangent@inbox.com>2015-01-04 19:39:43 -0800
commit4c2a45288a6bc89ce2e48c2854943904dcd01bab (patch)
tree3116a04f280c36371fc1ae810fd815a4ff6da22a /src
parentMerge pull request #16 from moneromooo-monero/blockchain (diff)
downloadmonero-4c2a45288a6bc89ce2e48c2854943904dcd01bab.tar.xz
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.
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
index f53e5bac2..a4dbb1d88 100644
--- a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
+++ b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
@@ -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))