refactor secp errors in transaction (#1955)

* cleanup secp errors in transaction

* rustfmt
This commit is contained in:
Antioch Peverell 2018-11-10 15:48:45 +01:00 committed by GitHub
parent 9af9ca9518
commit 29b2c3384c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1088,26 +1088,22 @@ impl Output {
} }
/// Validates the range proof using the commitment /// Validates the range proof using the commitment
pub fn verify_proof(&self) -> Result<(), secp::Error> { pub fn verify_proof(&self) -> Result<(), Error> {
let secp = static_secp_instance(); let secp = static_secp_instance();
let secp = secp.lock(); secp.lock()
match secp.verify_bullet_proof(self.commit, self.proof, None) { .verify_bullet_proof(self.commit, self.proof, None)?;
Ok(_) => Ok(()), Ok(())
Err(e) => Err(e),
}
} }
/// Batch validates the range proofs using the commitments /// Batch validates the range proofs using the commitments
pub fn batch_verify_proofs( pub fn batch_verify_proofs(
commits: &Vec<Commitment>, commits: &Vec<Commitment>,
proofs: &Vec<RangeProof>, proofs: &Vec<RangeProof>,
) -> Result<(), secp::Error> { ) -> Result<(), Error> {
let secp = static_secp_instance(); let secp = static_secp_instance();
let secp = secp.lock(); secp.lock()
match secp.verify_bullet_proof_multi(commits.clone(), proofs.clone(), None) { .verify_bullet_proof_multi(commits.clone(), proofs.clone(), None)?;
Ok(_) => Ok(()), Ok(())
Err(e) => Err(e),
}
} }
} }