mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-21 22:04:44 +00:00
now using the Hashtree macro for most struct types
This commit is contained in:
@@ -32,6 +32,12 @@ impl TreeHash for usize {
|
||||
}
|
||||
}
|
||||
|
||||
impl TreeHash for bool {
|
||||
fn hash_tree_root_internal(&self) -> Vec<u8> {
|
||||
ssz_encode(self)
|
||||
}
|
||||
}
|
||||
|
||||
impl TreeHash for Address {
|
||||
fn hash_tree_root_internal(&self) -> Vec<u8> {
|
||||
ssz_encode(self)
|
||||
|
||||
@@ -7,9 +7,7 @@ pub trait TreeHash {
|
||||
fn hash_tree_root_internal(&self) -> Vec<u8>;
|
||||
fn hash_tree_root(&self) -> Vec<u8> {
|
||||
let mut result = self.hash_tree_root_internal();
|
||||
if result.len() < HASHSIZE {
|
||||
zpad(&mut result, HASHSIZE);
|
||||
}
|
||||
zpad(&mut result, HASHSIZE);
|
||||
result
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user