aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_db/lmdb/db_lmdb.cpp
diff options
context:
space:
mode:
authorKevin Barbour <kevinbarbourd@gmail.com>2021-01-23 10:38:50 +0100
committerKevin Barbour <kevinbarbourd@gmail.com>2021-02-09 08:05:05 +0100
commit85db1734e7dd456c1edb095a2c829527262b96c7 (patch)
tree988b4b80b55192462b33c1acc7210746c1e1f0a0 /src/blockchain_db/lmdb/db_lmdb.cpp
parentMerge pull request #7260 (diff)
downloadmonero-85db1734e7dd456c1edb095a2c829527262b96c7.tar.xz
Remove unused variables in monero codebase
There are quite a few variables in the code that are no longer (or perhaps never were) in use. These were discovered by enabling compiler warnings for unused variables and cleaning them up. In most cases where the unused variables were the result of a function call the call was left but the variable assignment removed, unless it was obvious that it was a simple getter with no side effects.
Diffstat (limited to 'src/blockchain_db/lmdb/db_lmdb.cpp')
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index 0aa2aee6f..5f3b495b0 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -897,7 +897,6 @@ uint64_t BlockchainLMDB::add_transaction_data(const crypto::hash& blk_hash, cons
throw0(DB_ERROR(lmdb_error("Failed to add tx data to db transaction: ", result).c_str()));
const cryptonote::blobdata_ref &blob = txp.second;
- MDB_val_sized(blobval, blob);
unsigned int unprunable_size = tx.unprunable_size;
if (unprunable_size == 0)
@@ -3190,9 +3189,8 @@ bool BlockchainLMDB::get_blocks_from(uint64_t start_height, size_t min_block_cou
uint64_t size = 0;
size_t num_txes = 0;
MDB_val_copy<uint64_t> key(start_height);
- MDB_val k, v, val_tx_id;
+ MDB_val v, val_tx_id;
uint64_t tx_id = ~0;
- MDB_cursor_op op = MDB_SET;
for (uint64_t h = start_height; h < blockchain_height && blocks.size() < max_block_count && (size < max_size || blocks.size() < min_block_count); ++h)
{
MDB_cursor_op op = h == start_height ? MDB_SET : MDB_NEXT;
@@ -3314,7 +3312,7 @@ bool BlockchainLMDB::get_prunable_tx_hash(const crypto::hash& tx_hash, crypto::h
RCURSOR(txs_prunable_hash);
MDB_val_set(v, tx_hash);
- MDB_val result, val_tx_prunable_hash;
+ MDB_val result;
auto get_result = mdb_cursor_get(m_cur_tx_indices, (MDB_val *)&zerokval, &v, MDB_GET_BOTH);
if (get_result == 0)
{
@@ -4311,7 +4309,6 @@ bool BlockchainLMDB::get_output_distribution(uint64_t amount, uint64_t from_heig
return false;
distribution.resize(db_height - from_height, 0);
- bool fret = true;
MDB_val_set(k, amount);
MDB_val v;
MDB_cursor_op op = MDB_SET;
@@ -5106,11 +5103,10 @@ void BlockchainLMDB::migrate_0_1()
void BlockchainLMDB::migrate_1_2()
{
LOG_PRINT_L3("BlockchainLMDB::" << __func__);
- uint64_t i, z;
+ uint64_t i;
int result;
mdb_txn_safe txn(false);
- MDB_val k, v;
- char *ptr;
+ MDB_val v;
MGINFO_YELLOW("Migrating blockchain from DB version 1 to 2 - this may take a while:");
MINFO("updating txs_pruned and txs_prunable tables...");
@@ -5311,7 +5307,6 @@ void BlockchainLMDB::migrate_2_3()
if (result)
throw0(DB_ERROR(lmdb_error("Failed to open a cursor for block_info: ", result).c_str()));
if (!i) {
- MDB_stat db_stat;
result = mdb_stat(txn, m_block_info, &db_stats);
if (result)
throw0(DB_ERROR(lmdb_error("Failed to query m_block_info: ", result).c_str()));
@@ -5443,7 +5438,6 @@ void BlockchainLMDB::migrate_3_4()
if (result)
throw0(DB_ERROR(lmdb_error("Failed to open a cursor for blocks: ", result).c_str()));
if (!i) {
- MDB_stat db_stat;
result = mdb_stat(txn, m_block_info, &db_stats);
if (result)
throw0(DB_ERROR(lmdb_error("Failed to query m_block_info: ", result).c_str()));
@@ -5597,7 +5591,6 @@ void BlockchainLMDB::migrate_4_5()
if (result)
throw0(DB_ERROR(lmdb_error("Failed to open a cursor for block_info: ", result).c_str()));
if (!i) {
- MDB_stat db_stat;
result = mdb_stat(txn, m_block_info, &db_stats);
if (result)
throw0(DB_ERROR(lmdb_error("Failed to query m_block_info: ", result).c_str()));