Updated another function for head_state (missing from previous commit).
This commit is contained in:
parent
b0e3ce7885
commit
0b2f3bbf00
@ -127,13 +127,7 @@ pub fn get_block_root<T: BeaconChainTypes + 'static>(req: Request<Body>) -> ApiR
|
|||||||
/// HTTP handler to return the `Fork` of the current head.
|
/// HTTP handler to return the `Fork` of the current head.
|
||||||
pub fn get_fork<T: BeaconChainTypes + 'static>(req: Request<Body>) -> ApiResult {
|
pub fn get_fork<T: BeaconChainTypes + 'static>(req: Request<Body>) -> ApiResult {
|
||||||
let beacon_chain = get_beacon_chain_from_request::<T>(&req)?;
|
let beacon_chain = get_beacon_chain_from_request::<T>(&req)?;
|
||||||
let head_state = get_head_state(beacon_chain)?;
|
ResponseBuilder::new(&req).body(&beacon_chain.head().beacon_state)
|
||||||
|
|
||||||
let json: String = serde_json::to_string(&head_state.fork).map_err(|e| {
|
|
||||||
ApiError::ServerError(format!("Unable to serialize BeaconState::Fork: {:?}", e))
|
|
||||||
})?;
|
|
||||||
|
|
||||||
Ok(success_response(Body::from(json)))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// HTTP handler to return the set of validators for an `Epoch`
|
/// HTTP handler to return the set of validators for an `Epoch`
|
||||||
|
Loading…
Reference in New Issue
Block a user