diff --git a/mithril-client/src/certificate_client/verify.rs b/mithril-client/src/certificate_client/verify.rs
index 04fbeb3de8..a1b95d3e4b 100644
--- a/mithril-client/src/certificate_client/verify.rs
+++ b/mithril-client/src/certificate_client/verify.rs
@@ -104,7 +104,7 @@ impl MithrilCertificateVerifier {
Ok(None)
}
- async fn verify_one(
+ async fn verify_with_cache(
&self,
certificate_chain_validation_id: &str,
certificate: CertificateToVerify,
@@ -123,23 +123,25 @@ impl MithrilCertificateVerifier {
hash: previous_hash,
}))
} else {
- self.verify_not_cached_certificate(certificate_chain_validation_id, certificate)
- .await
+ let certificate = match certificate {
+ CertificateToVerify::Downloaded { certificate } => certificate,
+ CertificateToVerify::ToDownload { hash } => {
+ self.retriever.get_certificate_details(&hash).await?
+ }
+ };
+
+ let previous_certificate = self
+ .verify_without_cache(certificate_chain_validation_id, certificate)
+ .await?;
+ Ok(previous_certificate.map(Into::into))
}
}
- async fn verify_not_cached_certificate(
+ async fn verify_without_cache(
&self,
certificate_chain_validation_id: &str,
- certificate: CertificateToVerify,
- ) -> MithrilResult