From fe258ca1205e09017bf6f8a23d26823d79d8b5c0 Mon Sep 17 00:00:00 2001 From: Jack Grigg Date: Sat, 24 Sep 2022 13:06:04 +0000 Subject: [PATCH] zcash_client_backend: Count `tags` in `impl DynamicUsage for Batch` --- zcash_client_backend/src/scan.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/zcash_client_backend/src/scan.rs b/zcash_client_backend/src/scan.rs index 0752f99b1..b6aaec4ac 100644 --- a/zcash_client_backend/src/scan.rs +++ b/zcash_client_backend/src/scan.rs @@ -124,15 +124,19 @@ where Output: ShieldedOutput, { fn dynamic_usage(&self) -> usize { - // We don't have a `DynamicUsage` bound on `D::IncomingViewingKey`, `D`, or + // We don't have a `DynamicUsage` bound on `A`, `D::IncomingViewingKey`, `D`, or // `Output`, and we can't use newtypes because the batch decryption API takes // slices. But we know that we don't allocate memory inside either of these, so we // just compute the size directly. - base_vec_usage(&self.ivks) + base_vec_usage(&self.outputs) + self.repliers.dynamic_usage() + base_vec_usage(&self.tags) + + base_vec_usage(&self.ivks) + + base_vec_usage(&self.outputs) + + self.repliers.dynamic_usage() } fn dynamic_usage_bounds(&self) -> (usize, Option) { - let base_usage = base_vec_usage(&self.ivks) + base_vec_usage(&self.outputs); + let base_usage = + base_vec_usage(&self.tags) + base_vec_usage(&self.ivks) + base_vec_usage(&self.outputs); let bounds = self.repliers.dynamic_usage_bounds(); ( base_usage + bounds.0,