mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 09:16:00 +00:00
Use ok_or instead of if let else
This commit is contained in:
@@ -122,7 +122,10 @@ pub mod attesting_indices_electra {
|
|||||||
let committee_count_per_slot = committees.len() as u64;
|
let committee_count_per_slot = committees.len() as u64;
|
||||||
let mut participant_count = 0;
|
let mut participant_count = 0;
|
||||||
for index in committee_indices {
|
for index in committee_indices {
|
||||||
if let Some(&beacon_committee) = committees_map.get(&index) {
|
let beacon_committee = committees_map
|
||||||
|
.get(&index)
|
||||||
|
.ok_or(Error::NoCommitteeFound(index))?;
|
||||||
|
|
||||||
// This check is new to the spec's `process_attestation` in Electra.
|
// This check is new to the spec's `process_attestation` in Electra.
|
||||||
if index >= committee_count_per_slot {
|
if index >= committee_count_per_slot {
|
||||||
return Err(BeaconStateError::InvalidCommitteeIndex(index));
|
return Err(BeaconStateError::InvalidCommitteeIndex(index));
|
||||||
@@ -145,9 +148,6 @@ pub mod attesting_indices_electra {
|
|||||||
output.extend(committee_attesters);
|
output.extend(committee_attesters);
|
||||||
|
|
||||||
committee_offset.safe_add_assign(beacon_committee.committee.len())?;
|
committee_offset.safe_add_assign(beacon_committee.committee.len())?;
|
||||||
} else {
|
|
||||||
return Err(Error::NoCommitteeFound(index));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This check is new to the spec's `process_attestation` in Electra.
|
// This check is new to the spec's `process_attestation` in Electra.
|
||||||
|
|||||||
Reference in New Issue
Block a user