Merge pull request #129 from zcash/nonempty-0.7

nonempty 0.7
This commit is contained in:
str4d 2021-06-28 22:30:27 +01:00 committed by GitHub
commit 51f1c9197d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 4 deletions

View File

@ -31,7 +31,7 @@ lazy_static = "1"
pasta_curves = "0.1"
proptest = { version = "1.0.0", optional = true }
rand = "0.8"
nonempty = "0.6"
nonempty = "0.7"
serde = { version = "1.0", features = ["derive"] }
subtle = "2.3"
zcash_note_encryption = "0.0"

View File

@ -360,9 +360,7 @@ impl<V> Bundle<Authorized, V> {
/// Returns the amount of heap-allocated memory used by this bundle.
pub fn dynamic_usage(&self) -> usize {
// NonEmpty<T> stores its head element separately from its tail Vec<T>.
// TODO: This underestimates the dynamic usage; switch to NonEmpty::capacity once
// https://github.com/cloudhead/nonempty/issues/33 is closed.
(self.actions.len() - 1) * mem::size_of::<Action<redpallas::Signature<SpendAuth>>>()
(self.actions.capacity() - 1) * mem::size_of::<Action<redpallas::Signature<SpendAuth>>>()
+ self.authorization.proof.dynamic_usage()
}