Trait polkadot_service::BlockImport

source ·
pub trait BlockImport<B>
where B: Block,
{ type Error: Error + Send + 'static; // Required methods fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; }
Expand description

Block import trait.

Required Associated Types§

source

type Error: Error + Send + 'static

The error type.

Required Methods§

source

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Check block preconditions.

source

fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Import a block.

Trait Implementations§

source§

impl<B> BlockImport<B> for Box<dyn BlockImport<B, Error = Error> + Send + Sync>
where B: Block,

source§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Box<dyn BlockImport<B, Error = Error> + Send + Sync> as BlockImport<B>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Box<dyn BlockImport<B, Error = Error> + Send + Sync>: 'async_trait,

Check block preconditions.

source§

fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Box<dyn BlockImport<B, Error = Error> + Send + Sync> as BlockImport<B>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Box<dyn BlockImport<B, Error = Error> + Send + Sync>: 'async_trait,

Import a block.

§

type Error = Error

The error type.

Implementations on Foreign Types§

source§

impl<B> BlockImport<B> for Box<dyn BlockImport<B, Error = Error> + Send + Sync>
where B: Block,

source§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Box<dyn BlockImport<B, Error = Error> + Send + Sync> as BlockImport<B>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Box<dyn BlockImport<B, Error = Error> + Send + Sync>: 'async_trait,

Check block preconditions.

source§

fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Box<dyn BlockImport<B, Error = Error> + Send + Sync> as BlockImport<B>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Box<dyn BlockImport<B, Error = Error> + Send + Sync>: 'async_trait,

Import a block.

§

type Error = Error

§

impl<B, E, Block, RA> BlockImport<Block> for &Client<B, E, Block, RA>
where B: Backend<Block>, E: CallExecutor<Block> + Send + Sync, Block: Block, Client<B, E, Block, RA>: ProvideRuntimeApi<Block>, <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block> + ApiExt<Block>, RA: Sync + Send,

NOTE: only use this implementation when you are sure there are NO consensus-level BlockImport objects. Otherwise, importing blocks directly into the client would be bypassing important verification work.

§

fn import_block<'life0, 'async_trait>( &'life0 self, import_block: BlockImportParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <&Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, &Client<B, E, Block, RA>: 'async_trait,

Import a checked and validated block.

NOTE: only use this implementation when there are NO consensus-level BlockImport objects. Otherwise, importing blocks directly into the client would be bypassing important verification work.

If you are not sure that there are no BlockImport objects provided by the consensus algorithm, don’t use this function.

§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <&Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, &Client<B, E, Block, RA>: 'async_trait,

Check block preconditions.

§

type Error = Error

§

impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA>
where B: Backend<Block>, E: CallExecutor<Block> + Send + Sync, Block: Block, Client<B, E, Block, RA>: ProvideRuntimeApi<Block>, <Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: Core<Block> + ApiExt<Block>, RA: Sync + Send,

§

type Error = Error

§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Client<B, E, Block, RA>: 'async_trait,

§

fn import_block<'life0, 'async_trait>( &'life0 self, import_block: BlockImportParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Client<B, E, Block, RA> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Client<B, E, Block, RA>: 'async_trait,

source§

impl<B, T, E> BlockImport<B> for Arc<T>
where B: Block, E: Error + Send + 'static, &'r T: for<'r> BlockImport<B, Error = E>, T: Send + Sync,

§

type Error = E

source§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Arc<T> as BlockImport<B>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Arc<T>: 'async_trait,

source§

fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<B>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <Arc<T> as BlockImport<B>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, Arc<T>: 'async_trait,

source§

impl<BE, Block, Client, SC> BlockImport<Block> for GrandpaBlockImport<BE, Block, Client, SC>
where Block: Block, <<Block as Block>::Header as Header>::Number: BlockNumberOps, BE: Backend<Block>, Client: ClientForGrandpa<Block, BE>, <Client as ProvideRuntimeApi<Block>>::Api: GrandpaApi<Block>, &'a Client: for<'a> BlockImport<Block, Error = Error>, SC: Send + Sync,

§

type Error = Error

source§

fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <GrandpaBlockImport<BE, Block, Client, SC> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, GrandpaBlockImport<BE, Block, Client, SC>: 'async_trait,

source§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <GrandpaBlockImport<BE, Block, Client, SC> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, GrandpaBlockImport<BE, Block, Client, SC>: 'async_trait,

source§

impl<Block, BE, Runtime, I, AuthorityId> BlockImport<Block> for BeefyBlockImport<Block, BE, Runtime, I, AuthorityId>
where Block: Block, BE: Backend<Block>, I: BlockImport<Block, Error = Error> + Send + Sync, Runtime: ProvideRuntimeApi<Block> + Send + Sync, <Runtime as ProvideRuntimeApi<Block>>::Api: BeefyApi<Block, AuthorityId>, AuthorityId: AuthorityIdBound,

§

type Error = Error

source§

fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <BeefyBlockImport<Block, BE, Runtime, I, AuthorityId> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BeefyBlockImport<Block, BE, Runtime, I, AuthorityId>: 'async_trait,

source§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <BeefyBlockImport<Block, BE, Runtime, I, AuthorityId> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BeefyBlockImport<Block, BE, Runtime, I, AuthorityId>: 'async_trait,

source§

impl<Block, Client, Inner> BlockImport<Block> for BabeBlockImport<Block, Client, Inner>
where Block: Block, Inner: BlockImport<Block> + Send + Sync, <Inner as BlockImport<Block>>::Error: Into<Error>, Client: HeaderBackend<Block> + HeaderMetadata<Block, Error = Error> + AuxStore + ProvideRuntimeApi<Block> + Send + Sync, <Client as ProvideRuntimeApi<Block>>::Api: BabeApi<Block> + ApiExt<Block>,

§

type Error = Error

source§

fn import_block<'life0, 'async_trait>( &'life0 self, block: BlockImportParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <BabeBlockImport<Block, Client, Inner> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BabeBlockImport<Block, Client, Inner>: 'async_trait,

source§

fn check_block<'life0, 'async_trait>( &'life0 self, block: BlockCheckParams<Block>, ) -> Pin<Box<dyn Future<Output = Result<ImportResult, <BabeBlockImport<Block, Client, Inner> as BlockImport<Block>>::Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, BabeBlockImport<Block, Client, Inner>: 'async_trait,

Implementors§