Addressed Paul's comments regarding head_state.

This commit is contained in:
Luke Anderson
2019-09-13 18:58:08 +10:00
parent c254ac8c2e
commit b0e3ce7885
5 changed files with 21 additions and 24 deletions

View File

@@ -182,16 +182,6 @@ pub fn get_beacon_chain_from_request<T: BeaconChainTypes + 'static>(
Ok(beacon_chain.clone())
}
pub fn get_head_state<T: BeaconChainTypes + 'static>(
bc: Arc<BeaconChain<T>>,
) -> Result<BeaconState<T::EthSpec>, ApiError> {
let mut head_state = bc.head().beacon_state;
head_state
.build_all_caches(&bc.spec)
.map_err(|e| ApiError::ServerError(format!("Unable to build state cache: {:?}", e)))?;
Ok(head_state)
}
pub fn get_logger_from_request(req: &Request<Body>) -> slog::Logger {
let log = req
.extensions()