mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-19 21:04:41 +00:00
Remove unwraps in Attestation construction
This commit is contained in:
@@ -386,25 +386,23 @@ impl<T: SlotClock + 'static, E: EthSpec> AttestationService<T, E> {
|
||||
return None;
|
||||
}
|
||||
|
||||
let mut attestation = if fork_name >= ForkName::Electra {
|
||||
let mut committee_bits: BitVector<E::MaxCommitteesPerSlot> = BitVector::default();
|
||||
committee_bits
|
||||
.set(duty.committee_index as usize, true)
|
||||
.unwrap();
|
||||
Attestation::Electra(AttestationElectra {
|
||||
aggregation_bits: BitList::with_capacity(duty.committee_length as usize)
|
||||
.unwrap(),
|
||||
data: attestation_data.clone(),
|
||||
committee_bits,
|
||||
signature: AggregateSignature::infinity(),
|
||||
})
|
||||
} else {
|
||||
Attestation::Base(AttestationBase {
|
||||
aggregation_bits: BitList::with_capacity(duty.committee_length as usize)
|
||||
.unwrap(),
|
||||
data: attestation_data.clone(),
|
||||
signature: AggregateSignature::infinity(),
|
||||
})
|
||||
let mut attestation = match Attestation::<E>::empty_for_signing(
|
||||
duty.committee_index as usize,
|
||||
duty.committee_length as usize,
|
||||
attestation_data.clone(),
|
||||
&self.context.eth2_config.spec,
|
||||
) {
|
||||
Ok(attestation) => attestation,
|
||||
Err(err) => {
|
||||
crit!(
|
||||
log,
|
||||
"Invalid validator duties during signing";
|
||||
"validator" => ?duty.pubkey,
|
||||
"duty" => ?duty,
|
||||
"err" => ?err,
|
||||
);
|
||||
return None;
|
||||
}
|
||||
};
|
||||
|
||||
match self
|
||||
|
||||
Reference in New Issue
Block a user