From 8a768819b0a832f323a6dc00c7e1f5149902aa14 Mon Sep 17 00:00:00 2001 From: mjkeating Date: Sat, 2 Mar 2019 09:59:01 -0800 Subject: [PATCH] brought algorithm in TreeHash macro to spec --- eth2/utils/ssz_derive/src/lib.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/eth2/utils/ssz_derive/src/lib.rs b/eth2/utils/ssz_derive/src/lib.rs index ac66526fe..f71bff709 100644 --- a/eth2/utils/ssz_derive/src/lib.rs +++ b/eth2/utils/ssz_derive/src/lib.rs @@ -147,12 +147,12 @@ pub fn ssz_tree_hash_derive(input: TokenStream) -> TokenStream { let output = quote! { impl ssz::TreeHash for #name { fn hash_tree_root_internal(&self) -> Vec { - let mut result: Vec = vec![]; + let mut list: Vec> = Vec::new(); #( - result.append(&mut self.#field_idents.hash_tree_root_internal()); + list.push(self.#field_idents.hash_tree_root_internal()); )* - ssz::hash(&result) + ssz::merkle_hash(&mut list) } } };