aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp2
-rw-r--r--src/cryptonote_core/blockchain.cpp8
2 files changed, 7 insertions, 3 deletions
diff --git a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
index 6275ae388..3c7b1a442 100644
--- a/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
+++ b/src/cryptonote_core/BlockchainDB_impl/db_lmdb.cpp
@@ -1022,7 +1022,7 @@ crypto::hash BlockchainLMDB::get_block_hash_from_height(const uint64_t& height)
if (get_result == MDB_NOTFOUND)
{
LOG_PRINT_L0("Attempted to get hash from height " << height << ", but no such hash exists");
- throw DB_ERROR("Attempt to get hash from height failed -- block size not in db");
+ throw BLOCK_DNE("Attempt to get hash from height failed -- hash not in db");
}
else if (get_result)
{
diff --git a/src/cryptonote_core/blockchain.cpp b/src/cryptonote_core/blockchain.cpp
index 0f5765281..25d1ae33c 100644
--- a/src/cryptonote_core/blockchain.cpp
+++ b/src/cryptonote_core/blockchain.cpp
@@ -1541,9 +1541,13 @@ void Blockchain::print_blockchain_index()
{
std::stringstream ss;
CRITICAL_REGION_LOCAL(m_blockchain_lock);
- for(uint64_t i = 0; i <= m_db->height(); i++)
+ auto height = m_db->height();
+ if (height != 0)
{
- ss << "height: " << i << ", hash: " << m_db->get_block_hash_from_height(i);
+ for(uint64_t i = 0; i <= height; i++)
+ {
+ ss << "height: " << i << ", hash: " << m_db->get_block_hash_from_height(i);
+ }
}
LOG_PRINT_L0("Current blockchain index:" << std::endl