Fix canonical_root fns

Fixes #92
This commit is contained in:
Paul Hauner 2019-01-25 17:39:46 +11:00
parent ad62e1e35c
commit 73d86bcc3b
No known key found for this signature in database
GPG Key ID: D362883A9218FCC6
2 changed files with 2 additions and 6 deletions

View File

@ -20,9 +20,7 @@ pub struct BeaconBlock {
impl BeaconBlock { impl BeaconBlock {
pub fn canonical_root(&self) -> Hash256 { pub fn canonical_root(&self) -> Hash256 {
// TODO: implement tree hashing. Hash256::from(&self.hash_tree_root()[..])
// https://github.com/sigp/lighthouse/issues/70
Hash256::from(&canonical_hash(&ssz_encode(self))[..])
} }
} }

View File

@ -64,9 +64,7 @@ pub struct BeaconState {
impl BeaconState { impl BeaconState {
pub fn canonical_root(&self) -> Hash256 { pub fn canonical_root(&self) -> Hash256 {
// TODO: implement tree hashing. Hash256::from(&self.hash_tree_root()[..])
// https://github.com/sigp/lighthouse/issues/70
Hash256::from(&canonical_hash(&ssz_encode(self))[..])
} }
} }