mirror of
https://github.com/Cuprate/cuprate.git
synced 2025-01-10 04:44:53 +00:00
37 lines
777 B
Rust
37 lines
777 B
Rust
|
use tower::ServiceExt;
|
||
|
|
||
|
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)]
|
||
|
pub enum DatabaseRequest {
|
||
|
BlockHeader(cuprate_common::BlockID),
|
||
|
ChainHeight,
|
||
|
}
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub enum DatabaseResponse {
|
||
|
BlockHeader(monero_serai::block::BlockHeader),
|
||
|
ChainHeight(u64),
|
||
|
}
|