From 1b409527542895b3c94607bfaf37cc213514673c Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Fri, 13 Nov 2015 09:23:25 +0000 Subject: [PATCH] Revert "db_bdb: record numbers for recno databases start at 1" It looks like some of the indices passed to the DB access functions are already bumped by 1. Moreover, the existing code was not throwing DB errors with 0 keys, and this is unlikely if it really was using 0 keys. Last, this patch broke sync from scratch in at least one case. So I'm calling it bad and reverting it. This reverts commit bfc97401ae81bb30278a318de7f048c653bf6582. --- src/blockchain_db/berkeleydb/db_bdb.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/blockchain_db/berkeleydb/db_bdb.cpp b/src/blockchain_db/berkeleydb/db_bdb.cpp index a980703e..da68ff40 100644 --- a/src/blockchain_db/berkeleydb/db_bdb.cpp +++ b/src/blockchain_db/berkeleydb/db_bdb.cpp @@ -1516,7 +1516,7 @@ output_data_t BlockchainBDB::get_output_key(const uint64_t& global_index) const LOG_PRINT_L3("BlockchainBDB::" << __func__); check_open(); - Dbt_copy k(global_index + 1); + Dbt_copy k(global_index); Dbt_copy v; auto get_result = m_output_keys->get(DB_DEFAULT_TX, &k, &v, 0); if (get_result == DB_NOTFOUND) @@ -1652,7 +1652,7 @@ tx_out_index BlockchainBDB::get_output_tx_and_index_from_global(const uint64_t& LOG_PRINT_L3("BlockchainBDB::" << __func__); check_open(); - Dbt_copy k(index + 1); + Dbt_copy k(index); Dbt_copy v; auto get_result = m_output_txs->get(DB_DEFAULT_TX, &k, &v, 0); @@ -2011,7 +2011,7 @@ void BlockchainBDB::get_output_key(const uint64_t &amount, const std::vector k(index + 1); + Dbt_copy k(index); Dbt_copy v; auto get_result = m_output_keys->get(DB_DEFAULT_TX, &k, &v, 0);