Updated TreeHash logic as per revised spec

This commit is contained in:
mjkeating
2019-03-08 15:24:07 -08:00
parent 3cf2359244
commit d4f3bab68d
33 changed files with 126 additions and 143 deletions

View File

@@ -146,10 +146,10 @@ 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> {
fn hash_tree_root(&self) -> Vec<u8> {
let mut list: Vec<Vec<u8>> = Vec::new();
#(
list.push(self.#field_idents.hash_tree_root_internal());
list.push(self.#field_idents.hash_tree_root());
)*
ssz::merkle_hash(&mut list)
@@ -224,7 +224,7 @@ pub fn ssz_signed_root_derive(input: TokenStream) -> TokenStream {
fn signed_root(&self) -> Vec<u8> {
let mut list: Vec<Vec<u8>> = Vec::new();
#(
list.push(self.#field_idents.hash_tree_root_internal());
list.push(self.#field_idents.hash_tree_root());
)*
ssz::merkle_hash(&mut list)