/// The function converts a `CertificationMessage` into an advert for a
/// `CertificationArtifact`.
The function converts a `CertificationMessage` into an advert for a
`CertificationArtifact`.
The function converts a ` CertificationMessage ` into an advert for a ` CertificationArtifact ` .
fn message_to_advert(msg: &CertificationMessage) -> Advert<CertificationArtifact> {
        use CertificationMessage::*;
        let (attribute, id) = match msg {
            Certification(cert) => (
                CertificationMessageAttribute::Certification(cert.height),
                CertificationMessageId {
                    height: cert.height,
                    hash: CertificationMessageHash::Certification(CryptoHashOf::from(
                        ic_crypto::crypto_hash(cert).get(),
                    )),
                },
            ),
            CertificationShare(share) => (
                CertificationMessageAttribute::CertificationShare(share.height),
                CertificationMessageId {
                    height: share.height,
                    hash: CertificationMessageHash::CertificationShare(CryptoHashOf::from(
                        ic_crypto::crypto_hash(share).get(),
                    )),
                },
            ),
        };
        Advert {
            id,
            attribute,
            size: bincode::serialize(msg).unwrap().len(),
            integrity_hash: ic_crypto::crypto_hash(msg).get(),
        }
    }
fn message_to_advert ( msg : & CertificationMessage ) -> Advert < CertificationArtifact > { use CertificationMessage :: * ; let ( attribute , id ) = match msg { Certification ( cert ) => ( CertificationMessageAttribute :: Certification ( cert . height ) , CertificationMessageId { height : cert . height , hash : CertificationMessageHash :: Certification ( CryptoHashOf :: from ( ic_crypto :: crypto_hash ( cert ) . get ( ) , ) ) , } , ) , CertificationShare ( share ) => ( CertificationMessageAttribute :: CertificationShare ( share . height ) , CertificationMessageId { height : share . height , hash : CertificationMessageHash :: CertificationShare ( CryptoHashOf :: from ( ic_crypto :: crypto_hash ( share ) . get ( ) , ) ) , } , ) , } ; Advert { id , attribute , size : bincode :: serialize ( msg ) . unwrap ( ) . len ( ) , integrity_hash : ic_crypto :: crypto_hash ( msg ) . get ( ) , } }
The function converts a `CertificationMessage` into an advert for a
`CertificationArtifact`.
The function converts a ` CertificationMessage ` into an advert for a ` CertificationArtifact ` .
msg
&CertificationMessage