pub mod block; pub mod genesis; pub mod hardforks; mod helper; pub mod miner_tx; #[cfg(feature = "binaries")] pub mod rpc; pub mod verifier; #[derive(Debug, thiserror::Error)] pub enum ConsensusError { #[error("Block has a timestamp outside of the valid range")] BlockTimestampInvalid, #[error("Block is too large")] BlockIsTooLarge, #[error("Invalid hard fork version: {0}")] InvalidHardForkVersion(&'static str), #[error("The block has a different previous hash than expected")] BlockIsNotApartOfChain, #[error("Database error: {0}")] Database(#[from] tower::BoxError), } pub trait Database: tower::Service { } impl> Database for T { } #[derive(Debug, Clone)] pub enum DatabaseRequest { BlockHFInfo(cuprate_common::BlockID), BlockPOWInfo(cuprate_common::BlockID), BlockWeights(cuprate_common::BlockID), BlockHash(u64), BlockHfInfoInRange(std::ops::Range), BlockWeightsInRange(std::ops::Range), BlockPOWInfoInRange(std::ops::Range), ChainHeight, #[cfg(feature = "binaries")] BlockBatchInRange(std::ops::Range), } #[derive(Debug)] pub enum DatabaseResponse { BlockHFInfo(hardforks::BlockHFInfo), BlockPOWInfo(block::BlockPOWInfo), BlockWeights(block::weight::BlockWeightInfo), BlockHash([u8; 32]), BlockHfInfoInRange(Vec), BlockWeightsInRange(Vec), BlockPOWInfoInRange(Vec), ChainHeight(u64), #[cfg(feature = "binaries")] BlockBatchInRange( Vec<( monero_serai::block::Block, Vec, )>, ), }