pub trait BlockImportOperation<Block: BlockT> {
    type State: StateBackend<HashFor<Block>>;
    fn state(&self) -> Result<Option<&Self::State>>;
fn set_block_data(
        &mut self,
        header: Block::Header,
        body: Option<Vec<Block::Extrinsic>>,
        justification: Option<Justification>,
        state: NewBlockState
    ) -> Result<()>;
fn update_cache(&mut self, cache: HashMap<Id, Vec<u8>>);
fn update_db_storage(
        &mut self,
        update: TransactionForSB<Self::State, Block>
    ) -> Result<()>;
fn reset_storage(&mut self, storage: Storage) -> Result<Block::Hash>;
fn update_storage(
        &mut self,
        update: StorageCollection,
        child_update: ChildStorageCollection
    ) -> Result<()>;
fn update_changes_trie(
        &mut self,
        update: ChangesTrieTransaction<HashFor<Block>, NumberFor<Block>>
    ) -> Result<()>;
fn insert_aux<I>(&mut self, ops: I) -> Result<()>
    where
        I: IntoIterator<Item = (Vec<u8>, Option<Vec<u8>>)>
;
fn mark_finalized(
        &mut self,
        id: BlockId<Block>,
        justification: Option<Justification>
    ) -> Result<()>;
fn mark_head(&mut self, id: BlockId<Block>) -> Result<()>; fn update_offchain_storage(
        &mut self,
        _offchain_update: OffchainChangesCollection
    ) -> Result<()> { ... } }
Expand description

Block insertion operation.

Keeps hold if the inserted block state and data.

Associated Types

Associated state backend type.

Required methods

Returns pending state.

Returns None for backends with locally-unavailable state data.

Append block data to the transaction.

Update cached data.

Inject storage data into the database.

Inject storage data into the database replacing any existing data.

Set storage changes.

Inject changes trie data into the database.

Insert auxiliary keys.

Values are None if should be deleted.

Mark a block as finalized.

Mark a block as new head. If both block import and set head are specified, set head overrides block import’s best block rule.

Provided methods

Write offchain storage changes to the database.

Implementors