Getting regular endpoint functions to return futures.

- Wrapped endpoint functions in new into_boxfut function
 - Undid changes to Network API service, now returning ApiResult again.
 - Cleaning up of functions, and removal of success_response functions in updated endpoints.
 - A bunch of other clean-ups.
This commit is contained in:
Luke Anderson
2019-09-12 15:20:31 +10:00
parent 82f4303787
commit cd8f40b4b7
7 changed files with 50 additions and 52 deletions

View File

@@ -191,13 +191,7 @@ pub fn get_state<T: BeaconChainTypes + 'static>(req: Request<Body>) -> ApiResult
Ok(query) => {
// We have *some* parameters, just check them.
let query_params = ["root", "slot"];
match query.first_of(&query_params) {
Ok((k, v)) => (k, v),
Err(e) => {
// Wrong parameters provided, or another error, return the error.
return Err(e);
}
}
query.first_of(&query_params)?
}
Err(ApiError::InvalidQueryParams(_)) => {
// No parameters provided at all, use current slot.