diff --git a/base_layer/common_types/src/types/bullet_rangeproofs.rs b/base_layer/common_types/src/types/bullet_rangeproofs.rs index 178e8dd6f7..52b5b27769 100644 --- a/base_layer/common_types/src/types/bullet_rangeproofs.rs +++ b/base_layer/common_types/src/types/bullet_rangeproofs.rs @@ -48,6 +48,11 @@ impl BulletRangeProof { .expect("This should be 32 bytes for a Blake 256 hash") .into() } + + /// Get the range proof as a vector reference, which is useful to satisfy the verification API without cloning + pub fn as_vec(&self) -> &Vec { + &self.0 + } } impl ByteArray for BulletRangeProof { diff --git a/base_layer/core/src/transactions/transaction_components/transaction_output.rs b/base_layer/core/src/transactions/transaction_components/transaction_output.rs index 9211af456a..5b8331e187 100644 --- a/base_layer/core/src/transactions/transaction_components/transaction_output.rs +++ b/base_layer/core/src/transactions/transaction_components/transaction_output.rs @@ -49,7 +49,7 @@ use tari_crypto::{ extended_range_proof::{ExtendedRangeProofService, Statement}, keys::SecretKey, ristretto::bulletproofs_plus::RistrettoAggregatedPublicStatement, - tari_utilities::{hex::Hex, ByteArray}, + tari_utilities::hex::Hex, }; use tari_script::TariScript; @@ -545,9 +545,9 @@ pub fn batch_verify_range_proofs( minimum_value_promise: output.minimum_value_promise.into(), }], }); - proofs.push(output.proof_result()?.to_vec().clone()); + proofs.push(output.proof_result()?.as_vec()); } - if let Err(err_1) = prover.verify_batch(proofs.iter().collect(), statements.iter().collect()) { + if let Err(err_1) = prover.verify_batch(proofs, statements.iter().collect()) { for output in &bulletproof_plus_proofs { if let Err(err_2) = output.verify_range_proof(prover) { return Err(RangeProofError::InvalidRangeProof {