diff --git a/storage/blockchain/src/ops/block.rs b/storage/blockchain/src/ops/block.rs index 2dc88aa4..347e3dbe 100644 --- a/storage/blockchain/src/ops/block.rs +++ b/storage/blockchain/src/ops/block.rs @@ -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::>()?; Ok(BlockCompleteEntry { diff --git a/storage/blockchain/src/service/read.rs b/storage/blockchain/src/service/read.rs index 84b1b921..09c8379c 100644 --- a/storage/blockchain/src/service/read.rs +++ b/storage/blockchain/src/service/read.rs @@ -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)) })