From a8224aa4ec05fe467abaf21d7b1a6f1a9239f584 Mon Sep 17 00:00:00 2001 From: Michael Sproul Date: Wed, 20 Mar 2019 10:14:31 +1100 Subject: [PATCH] Operation pool: add prune_all --- eth2/operation_pool/src/lib.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eth2/operation_pool/src/lib.rs b/eth2/operation_pool/src/lib.rs index 7a647450c..93ff74652 100644 --- a/eth2/operation_pool/src/lib.rs +++ b/eth2/operation_pool/src/lib.rs @@ -351,6 +351,16 @@ impl OperationPool { .filter(|transfer| transfer.slot > finalized_state.slot) .collect(); } + + /// Prune all types of transactions given the latest finalized state. + pub fn prune_all(&mut self, finalized_state: &BeaconState, spec: &ChainSpec) { + self.prune_attestations(finalized_state, spec); + self.prune_deposits(finalized_state); + self.prune_proposer_slashings(finalized_state, spec); + // FIXME: add attester slashings + self.prune_voluntary_exits(finalized_state, spec); + self.prune_transfers(finalized_state); + } } /// Filter up to a maximum number of operations out of a slice.