From 2d950316749ca89a89df3a3e0e98cb82e8a06535 Mon Sep 17 00:00:00 2001 From: Bobbin Threadbare Date: Sun, 30 Jun 2024 18:23:54 -0700 Subject: [PATCH] feat: implement InputNoteCommitment::is_authenticated() method --- objects/src/transaction/proven_tx.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/objects/src/transaction/proven_tx.rs b/objects/src/transaction/proven_tx.rs index a6f11aa6b..8d2de14cb 100644 --- a/objects/src/transaction/proven_tx.rs +++ b/objects/src/transaction/proven_tx.rs @@ -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 for InputNoteCommitment {