change usages of get_range

This commit is contained in:
Boog900 2024-12-18 16:55:16 +00:00
parent 72c9db39db
commit 9475f3f541
No known key found for this signature in database
GPG key ID: 42AB1287CB0041C2
2 changed files with 13 additions and 12 deletions

View file

@ -9,7 +9,7 @@ use monero_serai::{
};
use cuprate_database::{
DbResult, RuntimeError, StorableVec, {DatabaseIter, DatabaseRo, DatabaseRw},
DbResult, RuntimeError, StorableVec, {DatabaseRo, DatabaseRw},
};
use cuprate_helper::cast::usize_to_u64;
use cuprate_helper::{
@ -268,10 +268,13 @@ pub fn get_block_complete_entry(
let first_tx_idx = miner_tx_idx + 1;
let tx_blobs = tables
.tx_blobs_iter()
.get_range(first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))?
.map(|tx_blob| Ok(Bytes::from(tx_blob?.0)))
let tx_blobs = (first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))
.into_iter()
.map(|idx| {
let tx_blob = tables.tx_blobs().get(&idx)?.0;
Ok(Bytes::from(tx_blob))
})
.collect::<Result<_, RuntimeError>>()?;
Ok(BlockCompleteEntry {

View file

@ -22,9 +22,7 @@ use rayon::{
};
use thread_local::ThreadLocal;
use cuprate_database::{
ConcreteEnv, DatabaseIter, DatabaseRo, DbResult, Env, EnvInner, RuntimeError,
};
use cuprate_database::{ConcreteEnv, DatabaseRo, DbResult, Env, EnvInner, RuntimeError};
use cuprate_database_service::{init_thread_pool, DatabaseReadService, ReaderThreads};
use cuprate_helper::map::combine_low_high_bits_to_u128;
use cuprate_types::{
@ -616,10 +614,10 @@ fn next_chain_entry(
let chain_height = crate::ops::blockchain::chain_height(table_block_heights)?;
let last_height_in_chain_entry = min(first_known_height + next_entry_size, chain_height);
let (block_ids, block_weights) = table_block_infos
.get_range(first_known_height..last_height_in_chain_entry)?
.map(|block_info| {
let block_info = block_info?;
let (block_ids, block_weights) = (first_known_height..last_height_in_chain_entry)
.into_iter()
.map(|height| {
let block_info = table_block_infos.get(&height)?;
Ok((block_info.block_hash, block_info.weight))
})