[][src]Trait sr_primitives::traits::Header

pub trait Header: Clone + Send + Sync + Codec + Eq + MaybeSerializeDebugButNotDeserialize + 'static {
    type Number: Member + MaybeSerializeDebug + Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec;
    type Hash: Member + MaybeSerializeDebug + Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>;
    type Hashing: Hash<Output = Self::Hash>;
    fn new(
        number: Self::Number,
        extrinsics_root: Self::Hash,
        state_root: Self::Hash,
        parent_hash: Self::Hash,
        digest: Digest<Self::Hash>
    ) -> Self;
fn number(&self) -> &Self::Number;
fn set_number(&mut self, number: Self::Number);
fn extrinsics_root(&self) -> &Self::Hash;
fn set_extrinsics_root(&mut self, root: Self::Hash);
fn state_root(&self) -> &Self::Hash;
fn set_state_root(&mut self, root: Self::Hash);
fn parent_hash(&self) -> &Self::Hash;
fn set_parent_hash(&mut self, hash: Self::Hash);
fn digest(&self) -> &Digest<Self::Hash>;
fn digest_mut(&mut self) -> &mut Digest<Self::Hash>; fn hash(&self) -> Self::Hash { ... } }

Something which fulfills the abstract idea of a Substrate header. It has types for a Number, a Hash and a Hashing. It provides access to an extrinsics_root, state_root and parent_hash, as well as a digest and a block number.

You can also create a new one from those fields.

Associated Types

type Number: Member + MaybeSerializeDebug + Hash + Copy + MaybeDisplay + SimpleArithmetic + Codec

Header number.

type Hash: Member + MaybeSerializeDebug + Hash + Copy + MaybeDisplay + Default + SimpleBitOps + Codec + AsRef<[u8]> + AsMut<[u8]>

Header hash type

type Hashing: Hash<Output = Self::Hash>

Hashing algorithm

Loading content...

Required methods

fn new(
    number: Self::Number,
    extrinsics_root: Self::Hash,
    state_root: Self::Hash,
    parent_hash: Self::Hash,
    digest: Digest<Self::Hash>
) -> Self

Creates new header.

fn number(&self) -> &Self::Number

Returns a reference to the header number.

fn set_number(&mut self, number: Self::Number)

Sets the header number.

fn extrinsics_root(&self) -> &Self::Hash

Returns a reference to the extrinsics root.

fn set_extrinsics_root(&mut self, root: Self::Hash)

Sets the extrinsic root.

fn state_root(&self) -> &Self::Hash

Returns a reference to the state root.

fn set_state_root(&mut self, root: Self::Hash)

Sets the state root.

fn parent_hash(&self) -> &Self::Hash

Returns a reference to the parent hash.

fn set_parent_hash(&mut self, hash: Self::Hash)

Sets the parent hash.

fn digest(&self) -> &Digest<Self::Hash>

Returns a reference to the digest.

fn digest_mut(&mut self) -> &mut Digest<Self::Hash>

Get a mutable reference to the digest.

Loading content...

Provided methods

fn hash(&self) -> Self::Hash

Returns the hash of the header.

Loading content...

Implementors

impl Header for sr_primitives::testing::Header[src]

type Number = u64

type Hashing = BlakeTwo256

type Hash = H256

impl<Number, Hash> Header for sr_primitives::generic::Header<Number, Hash> where
    Number: Member + MaybeSerializeDebug + Hash + MaybeDisplay + SimpleArithmetic + Codec + Copy + Into<U256> + TryFrom<U256>,
    Hash: HashT,
    Hash::Output: Default + Hash + Copy + Member + MaybeSerializeDebugButNotDeserialize + MaybeDisplay + SimpleBitOps + Codec
[src]

type Number = Number

type Hash = <Hash as HashT>::Output

type Hashing = Hash

Loading content...