mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-17 03:42:46 +00:00
Refactor http router
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
use crate::helpers::get_beacon_chain_from_request;
|
||||
use crate::response_builder::ResponseBuilder;
|
||||
use crate::ApiResult;
|
||||
use beacon_chain::BeaconChainTypes;
|
||||
use beacon_chain::{BeaconChain, BeaconChainTypes};
|
||||
use hyper::{Body, Request};
|
||||
use std::sync::Arc;
|
||||
use version;
|
||||
|
||||
/// Read the version string from the current Lighthouse build.
|
||||
@@ -11,7 +11,9 @@ 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 = get_beacon_chain_from_request::<T>(&req)?;
|
||||
pub fn get_genesis_time<T: BeaconChainTypes + 'static>(
|
||||
req: Request<Body>,
|
||||
beacon_chain: Arc<BeaconChain<T>>,
|
||||
) -> ApiResult {
|
||||
ResponseBuilder::new(&req)?.body(&beacon_chain.head().beacon_state.genesis_time)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user