Move offset_handler construction into self

This commit is contained in:
Paul Hauner
2019-03-29 13:04:01 +11:00
parent 267c978abb
commit e0104e6199
3 changed files with 35 additions and 32 deletions

View File

@@ -4,15 +4,15 @@ use crate::{ssz_encode, Encodable};
impl CachedTreeHash for u64 {
type Item = Self;
fn build_cache(&self) -> Result<TreeHashCache, Error> {
TreeHashCache::from_bytes(merkleize(ssz_encode(self)))
fn leaves_and_subtrees(&self) -> Vec<u8> {
merkleize(ssz_encode(self))
}
fn num_bytes(&self) -> usize {
8
}
fn offset_handler(&self, _initial_offset: usize) -> Result<OffsetHandler, Error> {
fn offsets(&self) -> Result<Vec<usize>, Error> {
Err(Error::ShouldNotProduceOffsetHandler)
}