/// Purges the entries no longer needed from the artifact pool
Purges the entries no longer needed from the artifact pool
Purges the entries no longer needed from the artifact pool
fn purge_artifacts(
        &self,
        ecdsa_pool: &dyn EcdsaPool,
        block_reader: &dyn EcdsaBlockReader,
    ) -> EcdsaChangeSet {
        let mut in_progress = BTreeSet::new();
        for (request_id, _) in block_reader.requested_signatures() {
            in_progress.insert(request_id.clone());
        }
        let mut ret = Vec::new();
        let current_height = block_reader.height();
        // Unvalidated signature shares.
        let mut action = ecdsa_pool
            .unvalidated()
            .signature_shares()
            .filter(|(_, share)| self.should_purge(share, current_height, &in_progress))
            .map(|(id, _)| EcdsaChangeAction::RemoveUnvalidated(id))
            .collect();
        ret.append(&mut action);
        // Validated signature shares.
        let mut action = ecdsa_pool
            .validated()
            .signature_shares()
            .filter(|(_, share)| self.should_purge(share, current_height, &in_progress))
            .map(|(id, _)| EcdsaChangeAction::RemoveValidated(id))
            .collect();
        ret.append(&mut action);
        ret
    }
fn purge_artifacts ( & self , ecdsa_pool : & dyn EcdsaPool , block_reader : & dyn EcdsaBlockReader , ) -> EcdsaChangeSet { let mut in_progress = BTreeSet :: new ( ) ; for ( request_id , _ ) in block_reader . requested_signatures ( ) { in_progress . insert ( request_id . clone ( ) ) ; } let mut ret = Vec :: new ( ) ; let current_height = block_reader . height ( ) ; // Unvalidated signature shares. let mut action = ecdsa_pool . unvalidated ( ) . signature_shares ( ) . filter ( | ( _ , share ) | self . should_purge ( share , current_height , & in_progress ) ) . map ( | ( id , _ ) | EcdsaChangeAction :: RemoveUnvalidated ( id ) ) . collect ( ) ; ret . append ( & mut action ) ; // Validated signature shares. let mut action = ecdsa_pool . validated ( ) . signature_shares ( ) . filter ( | ( _ , share ) | self . should_purge ( share , current_height , & in_progress ) ) . map ( | ( id , _ ) | EcdsaChangeAction :: RemoveValidated ( id ) ) . collect ( ) ; ret . append ( & mut action ) ; ret }
Purges the entries no longer needed from the artifact pool
Purges the entries no longer needed from the artifact pool
&self
ecdsa_pool
&dyn EcdsaPool
block_reader
&dyn EcdsaBlockReader