Trait sc_consensus::block_import::BlockImport [−][src]
pub trait BlockImport<B: BlockT> { type Error: Error + Send + 'static; type Transaction: Send + 'static; fn check_block<'life0, 'async_trait>(
&'life0 mut 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 mut self,
block: BlockImportParams<B, Self::Transaction>,
cache: HashMap<CacheKeyId, Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>>
where
'life0: 'async_trait,
Self: 'async_trait; }
Expand description
Block import trait.
Associated Types
type Transaction: Send + 'static
type Transaction: Send + 'static
The transaction type used by the backend.
Required methods
fn check_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockCheckParams<B>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
fn check_block<'life0, 'async_trait>(
&'life0 mut 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.
fn import_block<'life0, 'async_trait>(
&'life0 mut self,
block: BlockImportParams<B, Self::Transaction>,
cache: HashMap<CacheKeyId, Vec<u8>>
) -> 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 mut self,
block: BlockImportParams<B, Self::Transaction>,
cache: HashMap<CacheKeyId, Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Import a block.
Cached data can be accessed through the blockchain cache.
Implementations on Foreign Types
type Error = E
type Transaction = Transaction
fn check_block<'life0, 'async_trait>(
&'life0 mut 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 mut self,
block: BlockImportParams<B, Transaction>,
cache: HashMap<CacheKeyId, Vec<u8>>
) -> Pin<Box<dyn Future<Output = Result<ImportResult, Self::Error>> + Send + 'async_trait>> where
'life0: 'async_trait,
Self: 'async_trait,
Implementors
impl<B: BlockT, Transaction> BlockImport<B> for BoxBlockImport<B, Transaction> where
Transaction: Send + 'static,
impl<Block, Client, Inner> BlockImport<Block> for BabeBlockImport<Block, Client, Inner> where
Block: BlockT,
Inner: BlockImport<Block, Transaction = TransactionFor<Client, Block>> + Send + Sync,
Inner::Error: Into<ConsensusError>,
Client: HeaderBackend<Block> + HeaderMetadata<Block, Error = Error> + AuxStore + ProvideRuntimeApi<Block> + ProvideCache<Block> + Send + Sync,
Client::Api: BabeApi<Block> + ApiExt<Block>,
impl<Block, Client, Inner> BlockImport<Block> for BabeBlockImport<Block, Client, Inner> where
Block: BlockT,
Inner: BlockImport<Block, Transaction = TransactionFor<Client, Block>> + Send + Sync,
Inner::Error: Into<ConsensusError>,
Client: HeaderBackend<Block> + HeaderMetadata<Block, Error = Error> + AuxStore + ProvideRuntimeApi<Block> + ProvideCache<Block> + Send + Sync,
Client::Api: BabeApi<Block> + ApiExt<Block>,
impl<B, I, C, S, Algorithm, CAW, CIDP> BlockImport<B> for PowBlockImport<B, I, C, S, Algorithm, CAW, CIDP> where
B: BlockT,
I: BlockImport<B, Transaction = TransactionFor<C, B>> + Send + Sync,
I::Error: Into<ConsensusError>,
S: SelectChain<B>,
C: ProvideRuntimeApi<B> + Send + Sync + HeaderBackend<B> + AuxStore + ProvideCache<B> + BlockOf,
C::Api: BlockBuilderApi<B>,
Algorithm: PowAlgorithm<B> + Send + Sync,
Algorithm::Difficulty: 'static + Send,
CAW: CanAuthorWith<B> + Send + Sync,
CIDP: CreateInherentDataProviders<B, ()> + Send + Sync,
impl<B, I, C, S, Algorithm, CAW, CIDP> BlockImport<B> for PowBlockImport<B, I, C, S, Algorithm, CAW, CIDP> where
B: BlockT,
I: BlockImport<B, Transaction = TransactionFor<C, B>> + Send + Sync,
I::Error: Into<ConsensusError>,
S: SelectChain<B>,
C: ProvideRuntimeApi<B> + Send + Sync + HeaderBackend<B> + AuxStore + ProvideCache<B> + BlockOf,
C::Api: BlockBuilderApi<B>,
Algorithm: PowAlgorithm<B> + Send + Sync,
Algorithm::Difficulty: 'static + Send,
CAW: CanAuthorWith<B> + Send + Sync,
CIDP: CreateInherentDataProviders<B, ()> + Send + Sync,
impl<BE, Block: BlockT, Client, SC> BlockImport<Block> for GrandpaBlockImport<BE, Block, Client, SC> where
NumberFor<Block>: BlockNumberOps,
DigestFor<Block>: Encode,
BE: Backend<Block>,
Client: ClientForGrandpa<Block, BE>,
Client::Api: GrandpaApi<Block>,
for<'a> &'a Client: BlockImport<Block, Error = ConsensusError, Transaction = TransactionFor<Client, Block>>,
TransactionFor<Client, Block>: 'static,
SC: Send,
impl<BE, Block: BlockT, Client, SC> BlockImport<Block> for GrandpaBlockImport<BE, Block, Client, SC> where
NumberFor<Block>: BlockNumberOps,
DigestFor<Block>: Encode,
BE: Backend<Block>,
Client: ClientForGrandpa<Block, BE>,
Client::Api: GrandpaApi<Block>,
for<'a> &'a Client: BlockImport<Block, Error = ConsensusError, Transaction = TransactionFor<Client, Block>>,
TransactionFor<Client, Block>: 'static,
SC: Send,
impl BlockImport<Block<Header<u64, BlakeTwo256>, Extrinsic>> for PeersClient
impl BlockImport<Block<Header<u64, BlakeTwo256>, Extrinsic>> for PeersClient
impl<I> BlockImport<Block<Header<u64, BlakeTwo256>, Extrinsic>> for BlockImportAdapter<I> where
I: BlockImport<Block, Error = ConsensusError> + Send + Sync,
I::Transaction: Send,
impl<I> BlockImport<Block<Header<u64, BlakeTwo256>, Extrinsic>> for BlockImportAdapter<I> where
I: BlockImport<Block, Error = ConsensusError> + Send + Sync,
I::Transaction: Send,
impl<'impl0, B, E, Block, RA> BlockImport<Block> for &'impl0 Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,
impl<'impl0, B, E, Block, RA> BlockImport<Block> for &'impl0 Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Client<B, E, Block, RA>: ProvideRuntimeApi<Block>,
<Client<B, E, Block, RA> as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,
impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Self: ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,
impl<B, E, Block, RA> BlockImport<Block> for Client<B, E, Block, RA> where
B: Backend<Block>,
E: CallExecutor<Block> + Send + Sync,
Block: BlockT,
Self: ProvideRuntimeApi<Block>,
<Self as ProvideRuntimeApi<Block>>::Api: CoreApi<Block> + ApiExt<Block, StateBackend = B::State>,
RA: Sync + Send,
TransactionFor<B, Block>: Send + 'static,