From 29b2c3384c38adbcde7110fca0963309ebd7d9c0 Mon Sep 17 00:00:00 2001 From: Antioch Peverell Date: Sat, 10 Nov 2018 15:48:45 +0100 Subject: [PATCH] refactor secp errors in transaction (#1955) * cleanup secp errors in transaction * rustfmt --- core/src/core/transaction.rs | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/core/src/core/transaction.rs b/core/src/core/transaction.rs index c94df17df..5a595ba80 100644 --- a/core/src/core/transaction.rs +++ b/core/src/core/transaction.rs @@ -1088,26 +1088,22 @@ impl Output { } /// 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 = secp.lock(); - match secp.verify_bullet_proof(self.commit, self.proof, None) { - Ok(_) => Ok(()), - Err(e) => Err(e), - } + secp.lock() + .verify_bullet_proof(self.commit, self.proof, None)?; + Ok(()) } /// Batch validates the range proofs using the commitments pub fn batch_verify_proofs( commits: &Vec, proofs: &Vec, - ) -> Result<(), secp::Error> { + ) -> Result<(), Error> { let secp = static_secp_instance(); - let secp = secp.lock(); - match secp.verify_bullet_proof_multi(commits.clone(), proofs.clone(), None) { - Ok(_) => Ok(()), - Err(e) => Err(e), - } + secp.lock() + .verify_bullet_proof_multi(commits.clone(), proofs.clone(), None)?; + Ok(()) } }