Separated acquisition of BeaconChain and BeaconState.

This commit is contained in:
Luke Anderson
2019-09-12 01:44:45 +10:00
parent d9b7e684c9
commit c254ac8c2e
6 changed files with 32 additions and 39 deletions

View File

@@ -1,4 +1,4 @@
use crate::helpers::get_beacon_chain_from_request;
use crate::helpers::*;
use crate::{success_response, ApiResult};
use beacon_chain::BeaconChainTypes;
use hyper::{Body, Request};
@@ -15,7 +15,8 @@ pub fn get_version(_req: Request<Body>) -> ApiResult {
/// Read the genesis time from the current beacon chain state.
pub fn get_genesis_time<T: BeaconChainTypes + 'static>(req: Request<Body>) -> ApiResult {
let (_beacon_chain, head_state) = 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)?;
let gen_time: u64 = head_state.genesis_time;
let body = Body::from(
serde_json::to_string(&gen_time)