Fix SSZ encode impl for fixed_len_vec

This commit is contained in:
Paul Hauner 2019-05-12 09:33:47 +10:00
parent 02afc6ef24
commit 349d33052b
No known key found for this signature in database
GPG Key ID: 303E4494BB28068C

View File

@ -59,6 +59,14 @@ where
true
}
fn ssz_fixed_len() -> usize {
if <Self as ssz::Encodable>::is_ssz_fixed_len() {
T::ssz_fixed_len() * N::to_usize()
} else {
ssz::BYTES_PER_LENGTH_OFFSET
}
}
fn ssz_append(&self, buf: &mut Vec<u8>) {
if T::is_ssz_fixed_len() {
buf.reserve(T::ssz_fixed_len() * self.len());