zcash_client_backend: Count `tags` in `impl DynamicUsage for Batch`

This commit is contained in:
Jack Grigg 2022-09-24 13:06:04 +00:00
parent f78c91fd0c
commit fe258ca120
1 changed files with 7 additions and 3 deletions

View File

@ -124,15 +124,19 @@ where
Output: ShieldedOutput<D, COMPACT_NOTE_SIZE>,
{
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<usize>) {
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,