From 168fd15674486f3fba033c4896d23a93eb6e68eb Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Mon, 25 Jul 2022 20:12:45 -0600 Subject: [PATCH] Use batch decryption in wallet scanning. This modifies wallet scanning to perform per-block batched decryption. It also alters the structure of the `ScanningKey` trait to correctly include internal (change) keys in the scan process. Extracted from: https://github.com/zcash/librustzcash/commit/73314dc68202cfae14745b9af600b5734a409bce --- src/batch.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/batch.rs b/src/batch.rs index 656726d..9742277 100644 --- a/src/batch.rs +++ b/src/batch.rs @@ -47,6 +47,10 @@ fn batch_note_decryption, F, FR, c where F: Fn(&D, &D::IncomingViewingKey, &EphemeralKeyBytes, &Output, &D::SymmetricKey) -> Option, { + if ivks.is_empty() { + return (0..outputs.len()).map(|_| None).collect(); + }; + // Fetch the ephemeral keys for each output and batch-parse them. let ephemeral_keys = D::batch_epk(outputs.iter().map(|(_, output)| output.ephemeral_key()));