aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-02-20 17:49:16 +0200
committerRiccardo Spagni <ric@spagni.net>2018-02-20 17:49:16 +0200
commit0d530bd04ef436e6075b96d0bb6191bcb90b0b71 (patch)
tree38f6bcf6d4d9d826b061cba60489f4d3c35c2df1
parentMerge pull request #3294 (diff)
parentdb_lmdb: fix return code mixup in for_all_* (diff)
downloadmonero-0d530bd04ef436e6075b96d0bb6191bcb90b0b71.tar.xz
Merge pull request #3295
6514f0ed db_lmdb: fix return code mixup in for_all_* (moneromooo-monero)
-rw-r--r--src/blockchain_db/lmdb/db_lmdb.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/blockchain_db/lmdb/db_lmdb.cpp b/src/blockchain_db/lmdb/db_lmdb.cpp
index fd8aad31d..bdec846d1 100644
--- a/src/blockchain_db/lmdb/db_lmdb.cpp
+++ b/src/blockchain_db/lmdb/db_lmdb.cpp
@@ -2440,7 +2440,7 @@ bool BlockchainLMDB::for_all_key_images(std::function<bool(const crypto::key_ima
RCURSOR(spent_keys);
MDB_val k, v;
- bool ret = true;
+ bool fret = true;
k = zerokval;
MDB_cursor_op op = MDB_FIRST;
@@ -2454,14 +2454,14 @@ bool BlockchainLMDB::for_all_key_images(std::function<bool(const crypto::key_ima
throw0(DB_ERROR("Failed to enumerate key images"));
const crypto::key_image k_image = *(const crypto::key_image*)v.mv_data;
if (!f(k_image)) {
- ret = false;
+ fret = false;
break;
}
}
TXN_POSTFIX_RDONLY();
- return ret;
+ return fret;
}
bool BlockchainLMDB::for_blocks_range(const uint64_t& h1, const uint64_t& h2, std::function<bool(uint64_t, const crypto::hash&, const cryptonote::block&)> f) const
@@ -2474,7 +2474,7 @@ bool BlockchainLMDB::for_blocks_range(const uint64_t& h1, const uint64_t& h2, st
MDB_val k;
MDB_val v;
- bool ret = true;
+ bool fret = true;
MDB_cursor_op op;
if (h1)
@@ -2503,7 +2503,7 @@ bool BlockchainLMDB::for_blocks_range(const uint64_t& h1, const uint64_t& h2, st
if (!get_block_hash(b, hash))
throw0(DB_ERROR("Failed to get block hash from blob retrieved from the db"));
if (!f(height, hash, b)) {
- ret = false;
+ fret = false;
break;
}
if (height >= h2)
@@ -2512,7 +2512,7 @@ bool BlockchainLMDB::for_blocks_range(const uint64_t& h1, const uint64_t& h2, st
TXN_POSTFIX_RDONLY();
- return ret;
+ return fret;
}
bool BlockchainLMDB::for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)> f) const
@@ -2526,7 +2526,7 @@ bool BlockchainLMDB::for_all_transactions(std::function<bool(const crypto::hash&
MDB_val k;
MDB_val v;
- bool ret = true;
+ bool fret = true;
MDB_cursor_op op = MDB_FIRST;
while (1)
@@ -2553,14 +2553,14 @@ bool BlockchainLMDB::for_all_transactions(std::function<bool(const crypto::hash&
if (!parse_and_validate_tx_from_blob(bd, tx))
throw0(DB_ERROR("Failed to parse tx from blob retrieved from the db"));
if (!f(hash, tx)) {
- ret = false;
+ fret = false;
break;
}
}
TXN_POSTFIX_RDONLY();
- return ret;
+ return fret;
}
bool BlockchainLMDB::for_all_outputs(std::function<bool(uint64_t amount, const crypto::hash &tx_hash, size_t tx_idx)> f) const
@@ -2573,7 +2573,7 @@ bool BlockchainLMDB::for_all_outputs(std::function<bool(uint64_t amount, const c
MDB_val k;
MDB_val v;
- bool ret = true;
+ bool fret = true;
MDB_cursor_op op = MDB_FIRST;
while (1)
@@ -2588,14 +2588,14 @@ bool BlockchainLMDB::for_all_outputs(std::function<bool(uint64_t amount, const c
outkey *ok = (outkey *)v.mv_data;
tx_out_index toi = get_output_tx_and_index_from_global(ok->output_id);
if (!f(amount, toi.first, toi.second)) {
- ret = false;
+ fret = false;
break;
}
}
TXN_POSTFIX_RDONLY();
- return ret;
+ return fret;
}
// batch_num_blocks: (optional) Used to check if resize needed before batch transaction starts.