From e4bbcd333aa45b7b96d75f4f1f7ecd0e708d2480 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 15 May 2019 13:18:15 +1000 Subject: [PATCH] state_processing: delete get_attestation_participants --- .../get_attestation_participants.rs | 38 ------------------- 1 file changed, 38 deletions(-) delete mode 100644 eth2/state_processing/src/per_epoch_processing/get_attestation_participants.rs diff --git a/eth2/state_processing/src/per_epoch_processing/get_attestation_participants.rs b/eth2/state_processing/src/per_epoch_processing/get_attestation_participants.rs deleted file mode 100644 index 7f5504c56..000000000 --- a/eth2/state_processing/src/per_epoch_processing/get_attestation_participants.rs +++ /dev/null @@ -1,38 +0,0 @@ -use crate::common::verify_bitfield_length; -use types::*; - -/// Returns validator indices which participated in the attestation. -/// -/// Spec v0.5.1 -pub fn get_attestation_participants( - state: &BeaconState, - attestation_data: &AttestationData, - bitfield: &Bitfield, - spec: &ChainSpec, -) -> Result, BeaconStateError> { - let epoch = attestation_data.slot.epoch(spec.slots_per_epoch); - - let crosslink_committee = - state.get_crosslink_committee_for_shard(epoch, attestation_data.shard, spec)?; - - if crosslink_committee.slot != attestation_data.slot { - return Err(BeaconStateError::NoCommitteeForShard); - } - - let committee = &crosslink_committee.committee; - - if !verify_bitfield_length(&bitfield, committee.len()) { - return Err(BeaconStateError::InvalidBitfield); - } - - let mut participants = Vec::with_capacity(committee.len()); - for (i, validator_index) in committee.iter().enumerate() { - match bitfield.get(i) { - Ok(bit) if bit => participants.push(*validator_index), - _ => {} - } - } - participants.shrink_to_fit(); - - Ok(participants) -}