Fix bug with committee index for attester duties

It was returning the validator_index instead of the `committee_index`.
This commit is contained in:
Paul Hauner 2019-01-31 16:42:53 +11:00
parent 48801e4674
commit 5c44f97fba
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6

View File

@ -47,8 +47,9 @@ impl BeaconState {
let mut result = None;
for slot in self.get_current_epoch_boundaries(spec.epoch_length) {
for (committee, shard) in self.get_crosslink_committees_at_slot(slot, spec)? {
if let Some(committee_index) = committee.iter().find(|i| **i == validator_index) {
result = Some(Ok((slot, shard, *committee_index as u64)));
if let Some(committee_index) = committee.iter().position(|&i| i == validator_index)
{
result = Some(Ok((slot, shard, committee_index as u64)));
}
}
}