db_lmdb: fix return code mixup in for_all_*
This commit is contained in:
parent
4f80c50730
commit
6514f0ed7b
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue