From 5c44f97fba4fb93433b757f50f6557ea41e9412d Mon Sep 17 00:00:00 2001 From: Paul Hauner Date: Thu, 31 Jan 2019 16:42:53 +1100 Subject: [PATCH] Fix bug with committee index for attester duties It was returning the validator_index instead of the `committee_index`. --- eth2/types/src/beacon_state/slot_processing.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/eth2/types/src/beacon_state/slot_processing.rs b/eth2/types/src/beacon_state/slot_processing.rs index ab5311d21..9501083f0 100644 --- a/eth2/types/src/beacon_state/slot_processing.rs +++ b/eth2/types/src/beacon_state/slot_processing.rs @@ -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))); } } }