Fix failing tree hash tests

This commit is contained in:
Paul Hauner
2019-03-29 14:37:27 +11:00
parent e0104e6199
commit fc17d5fea4
3 changed files with 68 additions and 46 deletions

View File

@@ -4,8 +4,8 @@ use crate::{ssz_encode, Encodable};
impl CachedTreeHash for u64 {
type Item = Self;
fn leaves_and_subtrees(&self) -> Vec<u8> {
merkleize(ssz_encode(self))
fn build_tree_hash_cache(&self) -> Result<TreeHashCache, Error> {
Ok(TreeHashCache::from_bytes(merkleize(ssz_encode(self)))?)
}
fn num_bytes(&self) -> usize {