Skip to content

Commit

Permalink
Create functions to add spend and output to proving context indendently
Browse files Browse the repository at this point in the history
  • Loading branch information
CryptoForge committed Sep 23, 2023
1 parent ae1ebd1 commit 4f3c185
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
16 changes: 16 additions & 0 deletions zcash_proofs/src/sapling/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,22 @@ impl SaplingVerificationContextInner {
}
}

pub fn add_spend_to_context_inner(
&mut self,
cv: &ValueCommitment
) {
// Accumulate the value commitment in the context
self.cv_sum += cv;
}

pub fn add_output_to_context_inner(
&mut self,
cv: &ValueCommitment
) {
// Accumulate the value commitment in the context
self.cv_sum -= cv;
}

/// Perform consensus checks on a Sapling SpendDescription, while
/// accumulating its value commitment inside the context for later use.
#[allow(clippy::too_many_arguments)]
Expand Down
16 changes: 16 additions & 0 deletions zcash_proofs/src/sapling/verifier/single.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ impl SaplingVerificationContext {
}
}

pub fn add_spend_to_context(
&mut self,
cv: &ValueCommitment
) {
// Accumulate the value commitment in the context
self.inner.add_spend_to_context_inner(&cv);
}

pub fn add_output_to_context(
&mut self,
cv: &ValueCommitment
) {
// Accumulate the value commitment in the context
self.inner.add_output_to_context_inner(&cv);
}

/// Perform consensus checks on a Sapling SpendDescription, while
/// accumulating its value commitment inside the context for later use.
#[allow(clippy::too_many_arguments)]
Expand Down

0 comments on commit 4f3c185

Please sign in to comment.