mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 05:44:44 +00:00
Implement liveness BeaconAPI (#4343)
## Issue Addressed #4243 ## Proposed Changes - create a new endpoint for liveness/{endpoint} ## Additional Info This is my first PR.
This commit is contained in:
@@ -1636,6 +1636,24 @@ impl BeaconNodeHttpClient {
|
||||
.await
|
||||
}
|
||||
|
||||
/// `POST validator/liveness/{epoch}`
|
||||
pub async fn post_validator_liveness_epoch(
|
||||
&self,
|
||||
epoch: Epoch,
|
||||
indices: Vec<u64>,
|
||||
) -> Result<GenericResponse<Vec<StandardLivenessResponseData>>, Error> {
|
||||
let mut path = self.eth_path(V1)?;
|
||||
|
||||
path.path_segments_mut()
|
||||
.map_err(|()| Error::InvalidUrl(self.server.clone()))?
|
||||
.push("validator")
|
||||
.push("liveness")
|
||||
.push(&epoch.to_string());
|
||||
|
||||
self.post_with_timeout_and_response(path, &indices, self.timeouts.liveness)
|
||||
.await
|
||||
}
|
||||
|
||||
/// `POST validator/duties/attester/{epoch}`
|
||||
pub async fn post_validator_duties_attester(
|
||||
&self,
|
||||
|
||||
@@ -1225,6 +1225,13 @@ impl FromStr for Accept {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(PartialEq, Debug, Serialize, Deserialize)]
|
||||
pub struct StandardLivenessResponseData {
|
||||
#[serde(with = "serde_utils::quoted_u64")]
|
||||
pub index: u64,
|
||||
pub is_live: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct LivenessRequestData {
|
||||
pub epoch: Epoch,
|
||||
|
||||
Reference in New Issue
Block a user