cuprate/consensus/src/lib.rs

39 lines
764 B
Rust
Raw Normal View History

2023-09-03 22:50:38 +00:00
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)]
2023-09-03 22:50:38 +00:00
pub enum DatabaseRequest {
BlockHeader(cuprate_common::BlockID),
ChainHeight,
}
#[derive(Debug)]
pub enum DatabaseResponse {
BlockHeader(monero_serai::block::BlockHeader),
ChainHeight(u64),
}