mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-22 19:49:28 +00:00
change usages of get_range
This commit is contained in:
parent
72c9db39db
commit
9475f3f541
2 changed files with 13 additions and 12 deletions
|
@ -9,7 +9,7 @@ use monero_serai::{
|
||||||
};
|
};
|
||||||
|
|
||||||
use cuprate_database::{
|
use cuprate_database::{
|
||||||
DbResult, RuntimeError, StorableVec, {DatabaseIter, DatabaseRo, DatabaseRw},
|
DbResult, RuntimeError, StorableVec, {DatabaseRo, DatabaseRw},
|
||||||
};
|
};
|
||||||
use cuprate_helper::cast::usize_to_u64;
|
use cuprate_helper::cast::usize_to_u64;
|
||||||
use cuprate_helper::{
|
use cuprate_helper::{
|
||||||
|
@ -268,10 +268,13 @@ pub fn get_block_complete_entry(
|
||||||
|
|
||||||
let first_tx_idx = miner_tx_idx + 1;
|
let first_tx_idx = miner_tx_idx + 1;
|
||||||
|
|
||||||
let tx_blobs = tables
|
let tx_blobs = (first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))
|
||||||
.tx_blobs_iter()
|
.into_iter()
|
||||||
.get_range(first_tx_idx..(usize_to_u64(numb_non_miner_txs) + first_tx_idx))?
|
.map(|idx| {
|
||||||
.map(|tx_blob| Ok(Bytes::from(tx_blob?.0)))
|
let tx_blob = tables.tx_blobs().get(&idx)?.0;
|
||||||
|
|
||||||
|
Ok(Bytes::from(tx_blob))
|
||||||
|
})
|
||||||
.collect::<Result<_, RuntimeError>>()?;
|
.collect::<Result<_, RuntimeError>>()?;
|
||||||
|
|
||||||
Ok(BlockCompleteEntry {
|
Ok(BlockCompleteEntry {
|
||||||
|
|
|
@ -22,9 +22,7 @@ use rayon::{
|
||||||
};
|
};
|
||||||
use thread_local::ThreadLocal;
|
use thread_local::ThreadLocal;
|
||||||
|
|
||||||
use cuprate_database::{
|
use cuprate_database::{ConcreteEnv, DatabaseRo, DbResult, Env, EnvInner, RuntimeError};
|
||||||
ConcreteEnv, DatabaseIter, DatabaseRo, DbResult, Env, EnvInner, RuntimeError,
|
|
||||||
};
|
|
||||||
use cuprate_database_service::{init_thread_pool, DatabaseReadService, ReaderThreads};
|
use cuprate_database_service::{init_thread_pool, DatabaseReadService, ReaderThreads};
|
||||||
use cuprate_helper::map::combine_low_high_bits_to_u128;
|
use cuprate_helper::map::combine_low_high_bits_to_u128;
|
||||||
use cuprate_types::{
|
use cuprate_types::{
|
||||||
|
@ -616,10 +614,10 @@ fn next_chain_entry(
|
||||||
let chain_height = crate::ops::blockchain::chain_height(table_block_heights)?;
|
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 last_height_in_chain_entry = min(first_known_height + next_entry_size, chain_height);
|
||||||
|
|
||||||
let (block_ids, block_weights) = table_block_infos
|
let (block_ids, block_weights) = (first_known_height..last_height_in_chain_entry)
|
||||||
.get_range(first_known_height..last_height_in_chain_entry)?
|
.into_iter()
|
||||||
.map(|block_info| {
|
.map(|height| {
|
||||||
let block_info = block_info?;
|
let block_info = table_block_infos.get(&height)?;
|
||||||
|
|
||||||
Ok((block_info.block_hash, block_info.weight))
|
Ok((block_info.block_hash, block_info.weight))
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue