referrerpolicy=no-referrer-when-downgrade

Trait polkadot_service::BlockT

source ·
pub trait BlockT: HeaderProvider<HeaderT = Self::Header> + Clone + Send + Sync + Codec + Eq + MaybeSerialize + Debug + 'static {
    type Extrinsic: Member + Codec + ExtrinsicLike + MaybeSerialize;
    type Header: Header<Hash = Self::Hash> + MaybeSerializeDeserialize;
    type Hash: HashOutput;

    // Required methods
    fn header(&self) -> &Self::Header;
    fn extrinsics(&self) -> &[Self::Extrinsic];
    fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>);
    fn new(header: Self::Header, extrinsics: Vec<Self::Extrinsic>) -> Self;
    fn encode_from(
        header: &Self::Header,
        extrinsics: &[Self::Extrinsic],
    ) -> Vec<u8> ;

    // Provided method
    fn hash(&self) -> Self::Hash { ... }
}
Expand description

Something which fulfills the abstract idea of a Substrate block. It has types for Extrinsic pieces of information as well as a Header.

You can get an iterator over each of the extrinsics and retrieve the header.

Required Associated Types§

source

type Extrinsic: Member + Codec + ExtrinsicLike + MaybeSerialize

Type for extrinsics.

source

type Header: Header<Hash = Self::Hash> + MaybeSerializeDeserialize

Header type.

source

type Hash: HashOutput

Block hash type.

Required Methods§

source

fn header(&self) -> &Self::Header

Returns a reference to the header.

source

fn extrinsics(&self) -> &[Self::Extrinsic]

Returns a reference to the list of extrinsics.

source

fn deconstruct(self) -> (Self::Header, Vec<Self::Extrinsic>)

Split the block into header and list of extrinsics.

source

fn new(header: Self::Header, extrinsics: Vec<Self::Extrinsic>) -> Self

Creates new block from header and extrinsics.

source

fn encode_from(header: &Self::Header, extrinsics: &[Self::Extrinsic]) -> Vec<u8>

Creates an encoded block from the given header and extrinsics without requiring the creation of an instance.

Provided Methods§

source

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

Returns the hash of the block.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Header, Extrinsic> Block for polkadot_service::generic::Block<Header, Extrinsic>
where Extrinsic: MaybeSerialize + Member + Codec + ExtrinsicLike, Header: Header + MaybeSerializeDeserialize,

§

type Extrinsic = Extrinsic

§

type Header = Header

§

type Hash = <<Block<Header, Extrinsic> as Block>::Header as Header>::Hash

source§

impl<Xt> Block for sp_runtime::testing::Block<Xt>
where Xt: 'static + Codec + Send + Sync + Serialize + Clone + Eq + Debug + ExtrinsicLike,