mirror of
https://github.com/sigp/lighthouse.git
synced 2026-04-08 10:40:08 +00:00
Add search for TTD block
This commit is contained in:
@@ -2,7 +2,9 @@ use async_trait::async_trait;
|
||||
use eth1::http::RpcError;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use types::{Address, EthSpec, ExecutionPayload, Hash256};
|
||||
pub const LATEST_TAG: &str = "latest";
|
||||
|
||||
pub use types::{Address, EthSpec, ExecutionPayload, Hash256, Uint256};
|
||||
|
||||
pub mod http;
|
||||
|
||||
@@ -37,6 +39,13 @@ impl From<serde_json::Error> for Error {
|
||||
pub trait EngineApi {
|
||||
async fn upcheck(&self) -> Result<(), Error>;
|
||||
|
||||
async fn get_block_by_number<'a>(
|
||||
&self,
|
||||
block_by_number: BlockByNumberQuery<'a>,
|
||||
) -> Result<ExecutionBlock, Error>;
|
||||
|
||||
async fn get_block_by_hash<'a>(&self, block_hash: Hash256) -> Result<ExecutionBlock, Error>;
|
||||
|
||||
async fn prepare_payload(
|
||||
&self,
|
||||
parent_hash: Hash256,
|
||||
@@ -82,3 +91,18 @@ pub enum ConsensusStatus {
|
||||
Valid,
|
||||
Invalid,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum BlockByNumberQuery<'a> {
|
||||
Tag(&'a str),
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ExecutionBlock {
|
||||
pub block_hash: Hash256,
|
||||
pub block_number: u64,
|
||||
pub parent_hash: Hash256,
|
||||
pub total_difficulty: Uint256,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user