diff --git a/binaries/cuprated/src/p2p/request_handler.rs b/binaries/cuprated/src/p2p/request_handler.rs index 0bf6ee23..f2f39017 100644 --- a/binaries/cuprated/src/p2p/request_handler.rs +++ b/binaries/cuprated/src/p2p/request_handler.rs @@ -245,21 +245,13 @@ async fn new_fluffy_block( .take_normal() .ok_or(anyhow::anyhow!("Peer sent pruned txs in fluffy block"))?; - let mut txs_in_block = block.transactions.iter().copied().collect::>(); - // TODO: size check these tx blobs let txs = tx_blobs .into_iter() .map(|tx_blob| { let tx = Transaction::read(&mut tx_blob.as_ref())?; - let tx = new_tx_verification_data(tx)?; - - if !txs_in_block.remove(&tx.tx_hash) { - anyhow::bail!("Peer sent tx in fluffy block that wasn't actually in block") - } - - Ok((tx.tx_hash, tx)) + Ok(tx) }) .collect::>()?; diff --git a/storage/blockchain/src/service/read.rs b/storage/blockchain/src/service/read.rs index f7515ef2..f8642db2 100644 --- a/storage/blockchain/src/service/read.rs +++ b/storage/blockchain/src/service/read.rs @@ -22,12 +22,12 @@ use rayon::{ }; use thread_local::ThreadLocal; -use cuprate_database::{ConcreteEnv, DatabaseRo, Env, EnvInner, RuntimeError}; +use cuprate_database::{ConcreteEnv, DatabaseIter, DatabaseRo, 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::{ blockchain::{BlockchainReadRequest, BlockchainResponse}, - Chain, ChainId, ExtendedBlockHeader, OutputHistogramInput, OutputOnChain, + Chain, ChainId, ExtendedBlockHeader, MissingTxsInBlock, OutputHistogramInput, OutputOnChain, }; use crate::{ diff --git a/types/src/blockchain.rs b/types/src/blockchain.rs index 68cbca24..f908d894 100644 --- a/types/src/blockchain.rs +++ b/types/src/blockchain.rs @@ -11,9 +11,11 @@ use std::{ use monero_serai::block::Block; use crate::{ - types::{MissingTxsInBlock, Chain, ExtendedBlockHeader, OutputOnChain, VerifiedBlockInformation}, - BlockCompleteEntry, - AltBlockInformation, ChainId, CoinbaseTxSum, OutputHistogramEntry, OutputHistogramInput, + types::{ + Chain, ExtendedBlockHeader, MissingTxsInBlock, OutputOnChain, VerifiedBlockInformation, + }, + AltBlockInformation, BlockCompleteEntry, ChainId, CoinbaseTxSum, OutputHistogramEntry, + OutputHistogramInput, }; //---------------------------------------------------------------------------------------------------- ReadRequest @@ -130,7 +132,9 @@ pub enum BlockchainReadRequest { AltBlocksInChain(ChainId), /// Get a [`Block`] by its height. - Block { height: usize }, + Block { + height: usize, + }, /// Get a [`Block`] by its hash. BlockByHash([u8; 32]), @@ -150,7 +154,10 @@ pub enum BlockchainReadRequest { /// `N` last blocks starting at particular height. /// /// TODO: document fields after impl. - CoinbaseTxSum { height: usize, count: u64 }, + CoinbaseTxSum { + height: usize, + count: u64, + }, } //---------------------------------------------------------------------------------------------------- WriteRequest diff --git a/types/src/lib.rs b/types/src/lib.rs index 0fd1ec7b..b86bb20f 100644 --- a/types/src/lib.rs +++ b/types/src/lib.rs @@ -21,8 +21,9 @@ pub use transaction_verification_data::{ }; pub use types::{ AltBlockInformation, Chain, ChainId, ChainInfo, CoinbaseTxSum, ExtendedBlockHeader, - FeeEstimate, HardForkInfo, MinerData, MinerDataTxBacklogEntry, OutputHistogramEntry, - OutputHistogramInput, OutputOnChain, VerifiedBlockInformation, VerifiedTransactionInformation, + FeeEstimate, HardForkInfo, MinerData, MinerDataTxBacklogEntry, MissingTxsInBlock, + OutputHistogramEntry, OutputHistogramInput, OutputOnChain, VerifiedBlockInformation, + VerifiedTransactionInformation, }; //---------------------------------------------------------------------------------------------------- Feature-gated