mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 03:42:46 +00:00
36 lines
671 B
Rust
36 lines
671 B
Rust
use async_trait::async_trait;
|
|
use eth1::http::RpcError;
|
|
|
|
pub use types::{Address, Hash256};
|
|
|
|
pub mod http;
|
|
|
|
pub type PayloadId = u64;
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
Reqwest(reqwest::Error),
|
|
BadResponse(String),
|
|
RequestFailed(String),
|
|
JsonRpc(RpcError),
|
|
}
|
|
|
|
impl From<reqwest::Error> for Error {
|
|
fn from(e: reqwest::Error) -> Self {
|
|
Error::Reqwest(e)
|
|
}
|
|
}
|
|
|
|
#[async_trait]
|
|
pub trait EngineApi {
|
|
async fn upcheck(&self) -> Result<(), Error>;
|
|
|
|
async fn prepare_payload(
|
|
&self,
|
|
parent_hash: Hash256,
|
|
timestamp: u64,
|
|
random: Hash256,
|
|
fee_recipient: Address,
|
|
) -> Result<PayloadId, Error>;
|
|
}
|