diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-02-19 10:31:26 +0000 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2018-02-19 14:55:58 +0000 |
commit | 6514f0ed7b20eaae5869bf4e14a0d77e093ddba6 (patch) | |
tree | fb20ed75e00efcd212ac6f9bd3aa56aa3d882462 /src/blockchain_db/lmdb/db_lmdb.cpp | |
parent | Merge pull request #3275 (diff) | |
download | monero-6514f0ed7b20eaae5869bf4e14a0d77e093ddba6.tar.xz |
db_lmdb: fix return code mixup in for_all_*
Diffstat (limited to '')
-rw-r--r-- | src/blockchain_db/lmdb/db_lmdb.cpp | 24 |
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. |