Fix error in /consensus/individual_votes (#859)

* Add patch and commented-out tests

* Delete commented-out tests
This commit is contained in:
Paul Hauner
2020-04-01 17:39:28 +11:00
committed by GitHub
parent 5a6e90428b
commit 5c397c49d8
3 changed files with 55 additions and 4 deletions

View File

@@ -156,12 +156,16 @@ pub fn post_individual_votes<T: BeaconChainTypes>(
// This is the last slot of the given epoch (one prior to the first slot of the next epoch).
let target_slot = (epoch + 1).start_slot(T::EthSpec::slots_per_epoch()) - 1;
let (_root, state) = state_at_slot(&beacon_chain, target_slot)?;
let (_root, mut state) = state_at_slot(&beacon_chain, target_slot)?;
let spec = &beacon_chain.spec;
let mut validator_statuses = ValidatorStatuses::new(&state, spec)?;
validator_statuses.process_attestations(&state, spec)?;
state.update_pubkey_cache().map_err(|e| {
ApiError::ServerError(format!("Unable to build pubkey cache: {:?}", e))
})?;
body.pubkeys
.into_iter()
.map(|pubkey| {

View File

@@ -45,6 +45,7 @@ pub use beacon::{
ValidatorRequest, ValidatorResponse,
};
pub use config::Config;
pub use consensus::{IndividualVote, IndividualVotesRequest, IndividualVotesResponse};
pub use validator::{ValidatorDutiesRequest, ValidatorDuty};
pub type BoxFut = Box<dyn Future<Item = Response<Body>, Error = ApiError> + Send>;