Skip to content

Commit e3551a8

Browse files
committed
Fix deprecated chrono function
Replace 'timestamp_nanos' with 'timestamp_nanos_opt'.
1 parent 2ceb186 commit e3551a8

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

mithril-common/src/entities/certificate_metadata.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,18 @@ impl CertificateMetadata {
5757
let mut hasher = Sha256::new();
5858
hasher.update(self.protocol_version.as_bytes());
5959
hasher.update(self.protocol_parameters.compute_hash().as_bytes());
60-
hasher.update(self.initiated_at.timestamp_nanos().to_be_bytes());
61-
hasher.update(self.sealed_at.timestamp_nanos().to_be_bytes());
60+
hasher.update(
61+
self.initiated_at
62+
.timestamp_nanos_opt()
63+
.unwrap_or_default()
64+
.to_be_bytes(),
65+
);
66+
hasher.update(
67+
self.sealed_at
68+
.timestamp_nanos_opt()
69+
.unwrap_or_default()
70+
.to_be_bytes(),
71+
);
6272
self.signers
6373
.iter()
6474
.for_each(|signer| hasher.update(signer.compute_hash().as_bytes()));

0 commit comments

Comments
 (0)