Plumb reward cache through reward calc

This commit is contained in:
Michael Sproul
2022-07-18 16:02:42 +10:00
parent 830f8032f0
commit 092d228078
7 changed files with 28 additions and 13 deletions

View File

@@ -3,7 +3,7 @@ use itertools::Itertools;
use std::collections::HashMap;
use types::{
AggregateSignature, Attestation, AttestationData, BeaconState, BitList, Checkpoint, Epoch,
EthSpec, Hash256, IndexedAttestation, Slot,
EthSpec, Hash256, Slot,
};
#[derive(Debug, PartialEq, Eq, Hash, Clone, Copy)]
@@ -188,7 +188,7 @@ impl<T: EthSpec> AttestationMap<T> {
}
/// Iterate all attestations in the map.
pub fn iter<'a>(&'a self) -> impl Iterator<Item = AttestationRef<'a, T>> + 'a {
pub fn iter(&self) -> impl Iterator<Item = AttestationRef<T>> {
self.checkpoint_map
.iter()
.flat_map(|(checkpoint_key, attestation_map)| attestation_map.iter(checkpoint_key))

View File

@@ -30,7 +30,7 @@ use std::ptr;
use types::{
sync_aggregate::Error as SyncAggregateError, typenum::Unsigned, Attestation, AttestationData,
AttesterSlashing, BeaconState, BeaconStateError, ChainSpec, Epoch, EthSpec, Fork, ForkVersion,
Hash256, ProposerSlashing, SignedVoluntaryExit, Slot, SyncAggregate, SyncCommitteeContribution,
ProposerSlashing, SignedVoluntaryExit, Slot, SyncAggregate, SyncCommitteeContribution,
Validator,
};
@@ -206,6 +206,7 @@ impl<T: EthSpec> OperationPool<T> {
}
/// Return all valid attestations for the given epoch, for use in max cover.
#[allow(clippy::too_many_arguments)]
fn get_valid_attestations_for_epoch<'a>(
&'a self,
checkpoint_key: &'a CheckpointKey,