Further restructuring futures API.

- Adding try_future! macros where necessary
 - Returning ApiResult and mapping it to future instead
 - Upgrading POST publish block to return a future directly
This commit is contained in:
Luke Anderson
2019-09-11 18:02:00 +10:00
parent ebd97730d5
commit 2739ee83f9
5 changed files with 68 additions and 60 deletions

View File

@@ -203,7 +203,7 @@ pub fn get_state<T: BeaconChainTypes + 'static>(req: Request<Body>) -> BoxFut {
try_future!(parse_slot(&value))
)),
("root", value) => {
let root = &try_future!(parse_root(&value));
let root: &Hash256 = &try_future!(parse_root(&value));
let state = try_future!(try_future!(beacon_chain.store.get(root))
.ok_or_else(|| ApiError::NotFound(format!("No state for root: {:?}", root))));