Skip to content

Commit

Permalink
commit: support committing to optionals
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-orlovsky committed Feb 18, 2024
1 parent 49345a1 commit d81288a
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions commit_verify/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,15 @@ impl CommitEngine {
self.inner_commit_to::<_, COMMIT_MAX_LEN>(&value);
}

pub fn commit_to_option<T: StrictEncode + StrictDumb>(&mut self, value: &Option<T>) {
let fqn = commitment_fqn::<T>();
self.layout
.push(CommitStep::Serialized(fqn))
.expect("too many fields for commitment");

self.inner_commit_to::<_, COMMIT_MAX_LEN>(&value);
}

pub fn commit_to_hash<T: CommitEncode<CommitmentId = StrictHash> + StrictType>(
&mut self,
value: T,
Expand Down

0 comments on commit d81288a

Please sign in to comment.