mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-09 20:40:01 +00:00
fix merge
This commit is contained in:
parent
bb7126bd96
commit
dc482558db
4 changed files with 18 additions and 18 deletions
|
@ -245,21 +245,13 @@ async fn new_fluffy_block(
|
||||||
.take_normal()
|
.take_normal()
|
||||||
.ok_or(anyhow::anyhow!("Peer sent pruned txs in fluffy block"))?;
|
.ok_or(anyhow::anyhow!("Peer sent pruned txs in fluffy block"))?;
|
||||||
|
|
||||||
let mut txs_in_block = block.transactions.iter().copied().collect::<HashSet<_>>();
|
|
||||||
|
|
||||||
// TODO: size check these tx blobs
|
// TODO: size check these tx blobs
|
||||||
let txs = tx_blobs
|
let txs = tx_blobs
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|tx_blob| {
|
.map(|tx_blob| {
|
||||||
let tx = Transaction::read(&mut tx_blob.as_ref())?;
|
let tx = Transaction::read(&mut tx_blob.as_ref())?;
|
||||||
|
|
||||||
let tx = new_tx_verification_data(tx)?;
|
Ok(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))
|
|
||||||
})
|
})
|
||||||
.collect::<Result<_, anyhow::Error>>()?;
|
.collect::<Result<_, anyhow::Error>>()?;
|
||||||
|
|
||||||
|
|
|
@ -22,12 +22,12 @@ use rayon::{
|
||||||
};
|
};
|
||||||
use thread_local::ThreadLocal;
|
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_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::{
|
||||||
blockchain::{BlockchainReadRequest, BlockchainResponse},
|
blockchain::{BlockchainReadRequest, BlockchainResponse},
|
||||||
Chain, ChainId, ExtendedBlockHeader, OutputHistogramInput, OutputOnChain,
|
Chain, ChainId, ExtendedBlockHeader, MissingTxsInBlock, OutputHistogramInput, OutputOnChain,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
|
|
|
@ -11,9 +11,11 @@ use std::{
|
||||||
use monero_serai::block::Block;
|
use monero_serai::block::Block;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
types::{MissingTxsInBlock, Chain, ExtendedBlockHeader, OutputOnChain, VerifiedBlockInformation},
|
types::{
|
||||||
BlockCompleteEntry,
|
Chain, ExtendedBlockHeader, MissingTxsInBlock, OutputOnChain, VerifiedBlockInformation,
|
||||||
AltBlockInformation, ChainId, CoinbaseTxSum, OutputHistogramEntry, OutputHistogramInput,
|
},
|
||||||
|
AltBlockInformation, BlockCompleteEntry, ChainId, CoinbaseTxSum, OutputHistogramEntry,
|
||||||
|
OutputHistogramInput,
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- ReadRequest
|
//---------------------------------------------------------------------------------------------------- ReadRequest
|
||||||
|
@ -130,7 +132,9 @@ pub enum BlockchainReadRequest {
|
||||||
AltBlocksInChain(ChainId),
|
AltBlocksInChain(ChainId),
|
||||||
|
|
||||||
/// Get a [`Block`] by its height.
|
/// Get a [`Block`] by its height.
|
||||||
Block { height: usize },
|
Block {
|
||||||
|
height: usize,
|
||||||
|
},
|
||||||
|
|
||||||
/// Get a [`Block`] by its hash.
|
/// Get a [`Block`] by its hash.
|
||||||
BlockByHash([u8; 32]),
|
BlockByHash([u8; 32]),
|
||||||
|
@ -150,7 +154,10 @@ pub enum BlockchainReadRequest {
|
||||||
/// `N` last blocks starting at particular height.
|
/// `N` last blocks starting at particular height.
|
||||||
///
|
///
|
||||||
/// TODO: document fields after impl.
|
/// TODO: document fields after impl.
|
||||||
CoinbaseTxSum { height: usize, count: u64 },
|
CoinbaseTxSum {
|
||||||
|
height: usize,
|
||||||
|
count: u64,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- WriteRequest
|
//---------------------------------------------------------------------------------------------------- WriteRequest
|
||||||
|
|
|
@ -21,8 +21,9 @@ pub use transaction_verification_data::{
|
||||||
};
|
};
|
||||||
pub use types::{
|
pub use types::{
|
||||||
AltBlockInformation, Chain, ChainId, ChainInfo, CoinbaseTxSum, ExtendedBlockHeader,
|
AltBlockInformation, Chain, ChainId, ChainInfo, CoinbaseTxSum, ExtendedBlockHeader,
|
||||||
FeeEstimate, HardForkInfo, MinerData, MinerDataTxBacklogEntry, OutputHistogramEntry,
|
FeeEstimate, HardForkInfo, MinerData, MinerDataTxBacklogEntry, MissingTxsInBlock,
|
||||||
OutputHistogramInput, OutputOnChain, VerifiedBlockInformation, VerifiedTransactionInformation,
|
OutputHistogramEntry, OutputHistogramInput, OutputOnChain, VerifiedBlockInformation,
|
||||||
|
VerifiedTransactionInformation,
|
||||||
};
|
};
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------- Feature-gated
|
//---------------------------------------------------------------------------------------------------- Feature-gated
|
||||||
|
|
Loading…
Reference in a new issue