Skip to content

Commit

Permalink
Tidy endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
paulhauner committed Sep 5, 2020
1 parent ac1a668 commit 6324b56
Showing 1 changed file with 4 additions and 14 deletions.
18 changes: 4 additions & 14 deletions beacon_node/http_api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,13 @@ pub fn serve<T: BeaconChainTypes>(

index_opt
.and_then(|index| {
state
.validators
.get(index)
.map(|validator| (index, validator))
})
.and_then(|(index, validator)| {
state
.balances
.get(index)
.map(|balance| (index, validator, *balance))
})
.map(|(index, validator, balance)| {
let validator = state.validators.get(index)?;
let balance = *state.balances.get(index)?;
let epoch = state.current_epoch();
let finalized_epoch = state.finalized_checkpoint.epoch;
let far_future_epoch = chain.spec.far_future_epoch;

api_types::ValidatorData {
Some(api_types::ValidatorData {
index: index as u64,
balance,
status: api_types::ValidatorStatus::from_validator(
Expand All @@ -171,7 +161,7 @@ pub fn serve<T: BeaconChainTypes>(
far_future_epoch,
),
validator: validator.clone(),
}
})
})
.ok_or_else(|| warp::reject::not_found())
})
Expand Down

0 comments on commit 6324b56

Please sign in to comment.