Merge pull request #273 from mjkeating/tree_hash_container_fix

Brought algorithm in TreeHash macro up to spec
This commit is contained in:
Paul Hauner 2019-03-03 20:01:47 +13:00 committed by GitHub
commit ef549aa38b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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<u8> {
let mut result: Vec<u8> = vec![];
let mut list: Vec<Vec<u8>> = 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)
}
}
};