mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-26 09:24:47 +00:00
Merge pull request #3295
6514f0ed
db_lmdb: fix return code mixup in for_all_* (moneromooo-monero)
This commit is contained in:
commit
0d530bd04e
1 changed files with 12 additions and 12 deletions
|
@ -2440,7 +2440,7 @@ bool BlockchainLMDB::for_all_key_images(std::function<bool(const crypto::key_ima
|
||||||
RCURSOR(spent_keys);
|
RCURSOR(spent_keys);
|
||||||
|
|
||||||
MDB_val k, v;
|
MDB_val k, v;
|
||||||
bool ret = true;
|
bool fret = true;
|
||||||
|
|
||||||
k = zerokval;
|
k = zerokval;
|
||||||
MDB_cursor_op op = MDB_FIRST;
|
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"));
|
throw0(DB_ERROR("Failed to enumerate key images"));
|
||||||
const crypto::key_image k_image = *(const crypto::key_image*)v.mv_data;
|
const crypto::key_image k_image = *(const crypto::key_image*)v.mv_data;
|
||||||
if (!f(k_image)) {
|
if (!f(k_image)) {
|
||||||
ret = false;
|
fret = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TXN_POSTFIX_RDONLY();
|
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
|
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 k;
|
||||||
MDB_val v;
|
MDB_val v;
|
||||||
bool ret = true;
|
bool fret = true;
|
||||||
|
|
||||||
MDB_cursor_op op;
|
MDB_cursor_op op;
|
||||||
if (h1)
|
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))
|
if (!get_block_hash(b, hash))
|
||||||
throw0(DB_ERROR("Failed to get block hash from blob retrieved from the db"));
|
throw0(DB_ERROR("Failed to get block hash from blob retrieved from the db"));
|
||||||
if (!f(height, hash, b)) {
|
if (!f(height, hash, b)) {
|
||||||
ret = false;
|
fret = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (height >= h2)
|
if (height >= h2)
|
||||||
|
@ -2512,7 +2512,7 @@ bool BlockchainLMDB::for_blocks_range(const uint64_t& h1, const uint64_t& h2, st
|
||||||
|
|
||||||
TXN_POSTFIX_RDONLY();
|
TXN_POSTFIX_RDONLY();
|
||||||
|
|
||||||
return ret;
|
return fret;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BlockchainLMDB::for_all_transactions(std::function<bool(const crypto::hash&, const cryptonote::transaction&)> f) const
|
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 k;
|
||||||
MDB_val v;
|
MDB_val v;
|
||||||
bool ret = true;
|
bool fret = true;
|
||||||
|
|
||||||
MDB_cursor_op op = MDB_FIRST;
|
MDB_cursor_op op = MDB_FIRST;
|
||||||
while (1)
|
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))
|
if (!parse_and_validate_tx_from_blob(bd, tx))
|
||||||
throw0(DB_ERROR("Failed to parse tx from blob retrieved from the db"));
|
throw0(DB_ERROR("Failed to parse tx from blob retrieved from the db"));
|
||||||
if (!f(hash, tx)) {
|
if (!f(hash, tx)) {
|
||||||
ret = false;
|
fret = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TXN_POSTFIX_RDONLY();
|
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
|
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 k;
|
||||||
MDB_val v;
|
MDB_val v;
|
||||||
bool ret = true;
|
bool fret = true;
|
||||||
|
|
||||||
MDB_cursor_op op = MDB_FIRST;
|
MDB_cursor_op op = MDB_FIRST;
|
||||||
while (1)
|
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;
|
outkey *ok = (outkey *)v.mv_data;
|
||||||
tx_out_index toi = get_output_tx_and_index_from_global(ok->output_id);
|
tx_out_index toi = get_output_tx_and_index_from_global(ok->output_id);
|
||||||
if (!f(amount, toi.first, toi.second)) {
|
if (!f(amount, toi.first, toi.second)) {
|
||||||
ret = false;
|
fret = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TXN_POSTFIX_RDONLY();
|
TXN_POSTFIX_RDONLY();
|
||||||
|
|
||||||
return ret;
|
return fret;
|
||||||
}
|
}
|
||||||
|
|
||||||
// batch_num_blocks: (optional) Used to check if resize needed before batch transaction starts.
|
// batch_num_blocks: (optional) Used to check if resize needed before batch transaction starts.
|
||||||
|
|
Loading…
Reference in a new issue