pub trait HeaderProvider {
    // Required method
    fn get_header(&self, hash: &Byte32) -> Option<HeaderView>;

    // Provided methods
    fn timestamp_and_parent(
        &self,
        block_hash: &Byte32
    ) -> (u64, BlockNumber, Byte32) { ... }
    fn block_median_time(
        &self,
        block_hash: &Byte32,
        median_block_count: usize
    ) -> u64 { ... }
}
Expand description

Trait for header storage

Required Methods§

source

fn get_header(&self, hash: &Byte32) -> Option<HeaderView>

Get the header of the given block hash

Provided Methods§

source

fn timestamp_and_parent( &self, block_hash: &Byte32 ) -> (u64, BlockNumber, Byte32)

Get timestamp and block_number of the corresponding block_hash, and hash of parent block

source

fn block_median_time( &self, block_hash: &Byte32, median_block_count: usize ) -> u64

Get past block median time, including the timestamp of the given one

Implementations on Foreign Types§

source§

impl HeaderProvider for Box<dyn Fn(Byte32) -> Option<HeaderView>>

Implementors§