mirror of
https://github.com/mimblewimble/grin.git
synced 2025-02-01 17:01:09 +03:00
batch verify proofs during validation (#1412)
* batch verify proofs during validation * don't attempt to batch verify proofs with empty vec
This commit is contained in:
parent
7dd2888b71
commit
2251a82404
1 changed files with 11 additions and 2 deletions
|
@ -457,9 +457,18 @@ impl TransactionBody {
|
|||
/// Verify all the output rangeproofs.
|
||||
/// Note: this is expensive.
|
||||
fn verify_rangeproofs(&self) -> Result<(), Error> {
|
||||
for x in &self.outputs {
|
||||
x.verify_proof()?;
|
||||
let mut commits: Vec<Commitment> = vec![];
|
||||
let mut proofs: Vec<RangeProof> = vec![];
|
||||
if self.outputs.len() == 0 {
|
||||
return Ok(());
|
||||
}
|
||||
// unfortunately these have to be aligned in memory for the underlying
|
||||
// libsecp call
|
||||
for x in &self.outputs {
|
||||
commits.push(x.commit.clone());
|
||||
proofs.push(x.proof.clone());
|
||||
}
|
||||
Output::batch_verify_proofs(&commits, &proofs)?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue