cuprate-hinto-janai/consensus/src/lib.rs
Boog900 a56d8ea87f
fetch block headers in parallel and support multiple rpc endpoints
this significantly speeds up initiating the hardfork struct
2023-09-05 19:13:46 +01:00

38 lines
764 B
Rust

pub mod genesis;
pub mod hardforks;
#[cfg(feature = "rpc")]
pub mod rpc;
#[derive(Debug, thiserror::Error)]
pub enum Error {
#[error("Invalid hard fork version: {0}")]
InvalidHardForkVersion(&'static str),
#[error("Database error: {0}")]
Database(#[from] tower::BoxError),
}
pub trait Database:
tower::Service<DatabaseRequest, Response = DatabaseResponse, Error = tower::BoxError>
{
}
impl<T: tower::Service<DatabaseRequest, Response = DatabaseResponse, Error = tower::BoxError>>
Database for T
{
}
#[derive(Debug, Clone)]
pub enum DatabaseRequest {
BlockHeader(cuprate_common::BlockID),
ChainHeight,
}
#[derive(Debug)]
pub enum DatabaseResponse {
BlockHeader(monero_serai::block::BlockHeader),
ChainHeight(u64),
}