mirror of
https://gitlab.com/pulsechaincom/lighthouse-pulse.git
synced 2025-01-10 21:11:22 +00:00
Operation pool: prune attestations
This commit is contained in:
parent
a8224aa4ec
commit
9c2dfba843
@ -161,8 +161,18 @@ impl OperationPool {
|
|||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn prune_attestations(&self, _finalized_state: &BeaconState, _spec: &ChainSpec) {
|
/// Remove attestations which are too old to be included in a block.
|
||||||
// TODO
|
// TODO: we could probably prune other attestations here:
|
||||||
|
// - ones that are completely covered by attestations included in the state
|
||||||
|
// - maybe ones invalidated by the confirmation of one fork over another
|
||||||
|
pub fn prune_attestations(&mut self, finalized_state: &BeaconState, spec: &ChainSpec) {
|
||||||
|
self.attestations.retain(|_, attestations| {
|
||||||
|
// All the attestations in this bucket have the same data, so we only need to
|
||||||
|
// check the first one.
|
||||||
|
attestations.first().map_or(false, |att| {
|
||||||
|
finalized_state.slot < att.data.slot + spec.slots_per_epoch
|
||||||
|
})
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a deposit to the pool.
|
/// Add a deposit to the pool.
|
||||||
|
Loading…
Reference in New Issue
Block a user