mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-16 03:12:41 +00:00
Add bones of execution_layer
This commit is contained in:
35
beacon_node/execution_layer/src/engine_api.rs
Normal file
35
beacon_node/execution_layer/src/engine_api.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
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>;
|
||||
}
|
||||
Reference in New Issue
Block a user