Skip to content

Commit

Permalink
feat: implement InputNoteCommitment::is_authenticated() method
Browse files Browse the repository at this point in the history
  • Loading branch information
bobbinth committed Jul 1, 2024
1 parent 861837b commit 2d95031
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions objects/src/transaction/proven_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,13 +402,27 @@ pub struct InputNoteCommitment {
}

impl InputNoteCommitment {
/// Returns the nullifier of the input note committed to by this commitment.
pub fn nullifier(&self) -> Nullifier {
self.nullifier
}

/// Returns the header of the input committed to by this commitment.
///
/// Note headers are present only for notes whose presence in the change has not yet been
/// authenticated.
pub fn header(&self) -> Option<&NoteHeader> {
self.header.as_ref()
}

/// Returns true if this commitment is for a note whose presence in the chain has been
/// authenticated.
///
/// Authenticated notes are represented solely by their nullifiers and are missing the note
/// header.
pub fn is_authenticated(&self) -> bool {
self.header.is_none()
}
}

impl From<InputNote> for InputNoteCommitment {
Expand Down

0 comments on commit 2d95031

Please sign in to comment.