mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-08 01:05:47 +00:00
Simplify length methods on BeaconBlockBody (#7989)
Just the low-hanging fruit from: - https://github.com/sigp/lighthouse/pull/7988
This commit is contained in:
@@ -318,29 +318,17 @@ impl<'a, E: EthSpec, Payload: AbstractExecPayload<E>> BeaconBlockBodyRef<'a, E,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn attestations_len(&self) -> usize {
|
pub fn attestations_len(&self) -> usize {
|
||||||
match self {
|
map_beacon_block_body_ref!(&'a _, self, |inner, cons| {
|
||||||
Self::Base(body) => body.attestations.len(),
|
cons(inner);
|
||||||
Self::Altair(body) => body.attestations.len(),
|
inner.attestations.len()
|
||||||
Self::Bellatrix(body) => body.attestations.len(),
|
})
|
||||||
Self::Capella(body) => body.attestations.len(),
|
|
||||||
Self::Deneb(body) => body.attestations.len(),
|
|
||||||
Self::Electra(body) => body.attestations.len(),
|
|
||||||
Self::Fulu(body) => body.attestations.len(),
|
|
||||||
Self::Gloas(body) => body.attestations.len(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn attester_slashings_len(&self) -> usize {
|
pub fn attester_slashings_len(&self) -> usize {
|
||||||
match self {
|
map_beacon_block_body_ref!(&'a _, self, |inner, cons| {
|
||||||
Self::Base(body) => body.attester_slashings.len(),
|
cons(inner);
|
||||||
Self::Altair(body) => body.attester_slashings.len(),
|
inner.attester_slashings.len()
|
||||||
Self::Bellatrix(body) => body.attester_slashings.len(),
|
})
|
||||||
Self::Capella(body) => body.attester_slashings.len(),
|
|
||||||
Self::Deneb(body) => body.attester_slashings.len(),
|
|
||||||
Self::Electra(body) => body.attester_slashings.len(),
|
|
||||||
Self::Fulu(body) => body.attester_slashings.len(),
|
|
||||||
Self::Gloas(body) => body.attester_slashings.len(),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn attestations(&self) -> Box<dyn Iterator<Item = AttestationRef<'a, E>> + 'a> {
|
pub fn attestations(&self) -> Box<dyn Iterator<Item = AttestationRef<'a, E>> + 'a> {
|
||||||
|
|||||||
Reference in New Issue
Block a user