Re-add canonical_root
methods to block & state
Turns out they were pretty useful
This commit is contained in:
parent
dad140a338
commit
e448882102
@ -44,6 +44,11 @@ impl BeaconBlock {
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns the `hash_tree_root` of the block.
|
||||
pub fn canonical_root(&self) -> Hash256 {
|
||||
Hash256::from_slice(&self.hash_tree_root()[..])
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
@ -233,6 +233,11 @@ impl BeaconState {
|
||||
Ok(genesis_state)
|
||||
}
|
||||
|
||||
/// Returns the `hash_tree_root` of the state.
|
||||
pub fn canonical_root(&self) -> Hash256 {
|
||||
Hash256::from_slice(&self.hash_tree_root()[..])
|
||||
}
|
||||
|
||||
/// Build an epoch cache, unless it is has already been built.
|
||||
pub fn build_epoch_cache(
|
||||
&mut self,
|
||||
|
Loading…
Reference in New Issue
Block a user