diff --git a/components/zcash_encoding/CHANGELOG.md b/components/zcash_encoding/CHANGELOG.md index 7b5976256..9ee79287d 100644 --- a/components/zcash_encoding/CHANGELOG.md +++ b/components/zcash_encoding/CHANGELOG.md @@ -8,7 +8,7 @@ and this library adheres to Rust's notion of ## [Unreleased] ### Added - `zcash_encoding::CompactSize::serialized_size` -- `zcash_encoding::Vector::serialized_size` +- `zcash_encoding::Vector::serialized_size_of_u8_vec` ## [0.2.0] - 2022-10-19 ### Changed diff --git a/components/zcash_encoding/src/lib.rs b/components/zcash_encoding/src/lib.rs index c90751449..69f1c5c63 100644 --- a/components/zcash_encoding/src/lib.rs +++ b/components/zcash_encoding/src/lib.rs @@ -183,7 +183,7 @@ impl Vector { } /// Returns the serialized size of a vector of `u8` as written by `[Vector::write]`. - pub fn serialized_size(vec: &[u8]) -> usize { + pub fn serialized_size_of_u8_vec(vec: &[u8]) -> usize { let length = vec.len(); CompactSize::serialized_size(length) + length } @@ -341,7 +341,7 @@ mod tests { let mut data = vec![]; Vector::write(&mut data, &$value, |w, e| w.write_u8(*e)).unwrap(); assert_eq!(&data[..], &$expected[..]); - let serialized_size = Vector::serialized_size(&$value); + let serialized_size = Vector::serialized_size_of_u8_vec(&$value); assert_eq!(serialized_size, $expected.len()); match Vector::read(&data[..], |r| r.read_u8()) { Ok(v) => assert_eq!(v, $value), diff --git a/zcash_primitives/src/legacy.rs b/zcash_primitives/src/legacy.rs index 6992001d8..7160ee606 100644 --- a/zcash_primitives/src/legacy.rs +++ b/zcash_primitives/src/legacy.rs @@ -324,7 +324,7 @@ impl Script { /// Returns the length of this script as encoded (including the initial CompactSize). pub fn serialized_size(&self) -> usize { - Vector::serialized_size(&self.0) + Vector::serialized_size_of_u8_vec(&self.0) } /// Returns the address that this Script contains, if any.