From 87ff219d37b59c8e3cd8ab7f8629af4b9fd12dd1 Mon Sep 17 00:00:00 2001 From: David Burkett Date: Thu, 18 Mar 2021 12:09:59 -0400 Subject: [PATCH] Removing verifier caches (#3597) --- core/src/core/transaction.rs | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/core/src/core/transaction.rs b/core/src/core/transaction.rs index ca5a4e04d0..932e664471 100644 --- a/core/src/core/transaction.rs +++ b/core/src/core/transaction.rs @@ -1246,42 +1246,23 @@ impl TransactionBody { pub fn validate( &self, weighting: Weighting, - verifier: Arc>, + _verifier: Arc>, ) -> Result<(), Error> { self.validate_read(weighting)?; - // Find all the outputs that have not had their rangeproofs verified. - let outputs = { - let mut verifier = verifier.write(); - verifier.filter_rangeproof_unverified(&self.outputs) - }; - // Now batch verify all those unverified rangeproofs - if !outputs.is_empty() { + if !self.outputs.is_empty() { let mut commits = vec![]; let mut proofs = vec![]; - for x in &outputs { + for x in &self.outputs { commits.push(x.commitment()); proofs.push(x.proof); } Output::batch_verify_proofs(&commits, &proofs)?; } - // Find all the kernels that have not yet been verified. - let kernels = { - let mut verifier = verifier.write(); - verifier.filter_kernel_sig_unverified(&self.kernels) - }; - // Verify the unverified tx kernels. - TxKernel::batch_sig_verify(&kernels)?; - - // Cache the successful verification results for the new outputs and kernels. - { - let mut verifier = verifier.write(); - verifier.add_rangeproof_verified(outputs); - verifier.add_kernel_sig_verified(kernels); - } + TxKernel::batch_sig_verify(&self.kernels)?; Ok(()) } }