async fn fetch_verify_and_deserialize_catch_up_package(
        &self,
        url: Url,
        param: Option<CatchUpPackageParam>,
        subnet_id: SubnetId,
    ) -> Option<CUPWithOriginalProtobuf> {
        let protobuf = self.fetch_catch_up_package(url.clone(), param).await?;
        let cup = CUPWithOriginalProtobuf {
            cup: CatchUpPackage::try_from(&protobuf)
                .map_err(|e| {
                    warn!(
                        self.logger,
                        "Failed to read CUP from peer at url {}: {:?}", url, e
                    )
                })
                .ok()?,
            protobuf,
        };
        self.crypto
            .verify_combined_threshold_sig_by_public_key(
                &CombinedThresholdSigOf::new(CombinedThresholdSig(cup.protobuf.signature.clone())),
                &CatchUpContentProtobufBytes(cup.protobuf.content.clone()),
                subnet_id,
                cup.cup.content.block.get_value().context.registry_version,
            )
            .map_err(|e| {
                warn!(
                    self.logger,
                    "Failed to verify cup signature at: {:?} with: {:?}", url, e
                )
            })
            .ok()?;
        Some(cup)
    }
// Download CUP from the given URL.
//
// If `param` is given, download only CUPs that are newer than the
// given CUP. This avoids unnecessary CUP downloads and hence reduces
// network bandwidth requirements.
//
// Also checks the signature of the downloaded catch up package.
Download CUP from the given URL.
If `param` is given, download only CUPs that are newer than the
given CUP. This avoids unnecessary CUP downloads and hence reduces
network bandwidth requirements.

Also checks the signature of the downloaded catch up package.
Download CUP from the given URL . If ` param ` is given download only CUPs that are newer than the given CUP . This avoids unnecessary CUP downloads and hence reduces network bandwidth requirements . Also checks the signature of the downloaded catch up package .
async fn fetch_verify_and_deserialize_catch_up_package(
        &self,
        url: Url,
        param: Option<CatchUpPackageParam>,
        subnet_id: SubnetId,
    ) -> Option<CUPWithOriginalProtobuf> {
        let protobuf = self.fetch_catch_up_package(url.clone(), param).await?;
        let cup = CUPWithOriginalProtobuf {
            cup: CatchUpPackage::try_from(&protobuf)
                .map_err(|e| {
                    warn!(
                        self.logger,
                        "Failed to read CUP from peer at url {}: {:?}", url, e
                    )
                })
                .ok()?,
            protobuf,
        };
        self.crypto
            .verify_combined_threshold_sig_by_public_key(
                &CombinedThresholdSigOf::new(CombinedThresholdSig(cup.protobuf.signature.clone())),
                &CatchUpContentProtobufBytes(cup.protobuf.content.clone()),
                subnet_id,
                cup.cup.content.block.get_value().context.registry_version,
            )
            .map_err(|e| {
                warn!(
                    self.logger,
                    "Failed to verify cup signature at: {:?} with: {:?}", url, e
                )
            })
            .ok()?;
        Some(cup)
    }
async fn fetch_verify_and_deserialize_catch_up_package ( & self , url : Url , param : Option < CatchUpPackageParam > , subnet_id : SubnetId , ) -> Option < CUPWithOriginalProtobuf > { let protobuf = self . fetch_catch_up_package ( url . clone ( ) , param ) . await ? ; let cup = CUPWithOriginalProtobuf { cup : CatchUpPackage :: try_from ( & protobuf ) . map_err ( | e | { warn ! ( self logger " " url e ) } ) . ok ( ) ? , protobuf , } ; self . crypto . verify_combined_threshold_sig_by_public_key ( & CombinedThresholdSigOf :: new ( CombinedThresholdSig ( cup . protobuf . signature . clone ( ) ) ) , & CatchUpContentProtobufBytes ( cup . protobuf . content . clone ( ) ) , subnet_id , cup . cup . content . block . get_value ( ) . context . registry_version , ) . map_err ( | e | { warn ! ( self logger " " url e ) } ) . ok ( ) ? ; Some ( cup ) }
Download CUP from the given URL.
Download CUP from the given URL .
&self
url
Url
param
Option<CatchUpPackageParam>
subnet_id
SubnetId
&self
url
Url
param
Option<CatchUpPackageParam>
subnet_id
SubnetId