Refine op pool pruning (#1805)

## Issue Addressed

Closes #1769
Closes #1708

## Proposed Changes

Tweaks the op pool pruning so that the attestation pool is pruned against the wall-clock epoch instead of the finalized state's epoch. This should reduce the unbounded growth that we've seen during periods without finality.

Also fixes up the voluntary exit pruning as raised in #1708.
This commit is contained in:
Michael Sproul
2020-10-22 04:47:29 +00:00
parent a3704b971e
commit 7f73dccebc
2 changed files with 27 additions and 19 deletions

View File

@@ -1959,6 +1959,7 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
|| is_reorg
{
self.persist_head_and_fork_choice()?;
self.op_pool.prune_attestations(self.epoch()?);
}
let update_head_timer = metrics::start_timer(&metrics::UPDATE_HEAD_TIMES);
@@ -2097,8 +2098,12 @@ impl<T: BeaconChainTypes> BeaconChain<T> {
.get_state(&new_finalized_state_root, None)?
.ok_or_else(|| Error::MissingBeaconState(new_finalized_state_root))?;
self.op_pool
.prune_all(&finalized_state, self.head_info()?.fork);
self.op_pool.prune_all(
&finalized_state,
self.epoch()?,
self.head_info()?.fork,
&self.spec,
);
self.store_migrator.process_finalization(
new_finalized_state_root.into(),