Improve attester errors, move info -> helpers

- Ensured one can distingush between a committee error and an invalid
validator index when using `validator_attesation_slot_and_shard`.
- Renamed the `info.rs` file to `getters.rs`, for clarity.
This commit is contained in:
Paul Hauner
2019-02-01 17:50:19 +11:00
parent a71e1031ce
commit 865919e398
6 changed files with 116 additions and 88 deletions

View File

@@ -53,9 +53,12 @@ impl<T: ClientDB, U: SlotClock> AttesterDutiesReader for DirectDuties<T, U> {
.beacon_chain
.validator_attestion_slot_and_shard(validator_index as usize)
{
Some((attest_slot, attest_shard)) if attest_slot == slot => Ok(Some(attest_shard)),
Some(_) => Ok(None),
None => Err(AttesterDutiesReaderError::UnknownEpoch),
Ok(Some((attest_slot, attest_shard))) if attest_slot == slot => {
Ok(Some(attest_shard))
}
Ok(Some(_)) => Ok(None),
Ok(None) => Err(AttesterDutiesReaderError::UnknownEpoch),
Err(_) => panic!("Error when getting validator attestation shard."),
}
} else {
Err(AttesterDutiesReaderError::UnknownValidator)