// Gets all shares from the certification pool at a given height and
// aggregates into full certification artifacts if possible.
Gets all shares from the certification pool at a given height and
aggregates into full certification artifacts if possible.
Gets all shares from the certification pool at a given height and aggregates into full certification artifacts if possible .
fn aggregate(
        &self,
        consensus_cache: &dyn ConsensusPoolCache,
        certification_pool: &dyn CertificationPool,
        height: Height,
    ) -> Vec<CertificationMessage> {
        // A struct defined to morph `Certification` into a format that can be
        // accepted by `utils::aggregate`.
        #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
        struct CertificationTuple(Height, CertificationContent);
        impl HasHeight for CertificationTuple {
            fn height(&self) -> Height {
                self.0
            }
        }
        impl HasCommittee for CertificationTuple {
            fn committee() -> Committee {
                Certification::committee()
            }
        }
        let shares = certification_pool.shares_at_height(height).map(|s| Signed {
            content: CertificationTuple(s.height, s.signed.content),
            signature: s.signed.signature,
        });
        utils::aggregate(
            &self.log,
            self.membership.as_ref(),
            self.crypto.as_aggregate(),
            Box::new(|cert: &CertificationTuple| {
                Some(
                    utils::active_high_threshold_transcript(consensus_cache, cert.height())?.dkg_id,
                )
            }),
            shares,
        )
        .into_iter()
        .map(|signed_cert_tuple| {
            CertificationMessage::Certification(Certification {
                height: signed_cert_tuple.content.0,
                signed: Signed {
                    content: signed_cert_tuple.content.1,
                    signature: signed_cert_tuple.signature,
                },
            })
        })
        .collect()
    }
fn aggregate ( & self , consensus_cache : & dyn ConsensusPoolCache , certification_pool : & dyn CertificationPool , height : Height , ) -> Vec < CertificationMessage > { // A struct defined to morph `Certification` into a format that can be // accepted by `utils::aggregate`. # [ derive ( Clone Debug PartialEq Eq PartialOrd Ord Hash ) ] struct CertificationTuple ( Height , CertificationContent ) ; impl HasHeight for CertificationTuple { fn height ( & self ) -> Height { self . 0 } } impl HasCommittee for CertificationTuple { fn committee ( ) -> Committee { Certification :: committee ( ) } } let shares = certification_pool . shares_at_height ( height ) . map ( | s | Signed { content : CertificationTuple ( s . height , s . signed . content ) , signature : s . signed . signature , } ) ; utils :: aggregate ( & self . log , self . membership . as_ref ( ) , self . crypto . as_aggregate ( ) , Box :: new ( | cert : & CertificationTuple | { Some ( utils :: active_high_threshold_transcript ( consensus_cache , cert . height ( ) ) ? . dkg_id , ) } ) , shares , ) . into_iter ( ) . map ( | signed_cert_tuple | { CertificationMessage :: Certification ( Certification { height : signed_cert_tuple . content . 0 , signed : Signed { content : signed_cert_tuple . content . 1 , signature : signed_cert_tuple . signature , } , } ) } ) . collect ( ) }
Gets all shares from the certification pool at a given height and
aggregates into full certification artifacts if possible.
Gets all shares from the certification pool at a given height and aggregates into full certification artifacts if possible .
&self
consensus_cache
&dyn ConsensusPoolCache
certification_pool
&dyn CertificationPool
height
Height