Trait sc_client_api::client::BlockBackend

source ·
pub trait BlockBackend<Block: BlockT> {
    // Required methods
    fn block_body(
        &self,
        hash: Block::Hash,
    ) -> Result<Option<Vec<<Block as BlockT>::Extrinsic>>>;
    fn block_indexed_body(
        &self,
        hash: Block::Hash,
    ) -> Result<Option<Vec<Vec<u8>>>>;
    fn block(&self, hash: Block::Hash) -> Result<Option<SignedBlock<Block>>>;
    fn block_status(&self, hash: Block::Hash) -> Result<BlockStatus>;
    fn justifications(
        &self,
        hash: Block::Hash,
    ) -> Result<Option<Justifications>>;
    fn block_hash(
        &self,
        number: NumberFor<Block>,
    ) -> Result<Option<Block::Hash>>;
    fn indexed_transaction(&self, hash: Block::Hash) -> Result<Option<Vec<u8>>>;
    fn requires_full_sync(&self) -> bool;

    // Provided method
    fn has_indexed_transaction(&self, hash: Block::Hash) -> Result<bool> { ... }
}
Expand description

Interface for fetching block data.

Required Methods§

source

fn block_body( &self, hash: Block::Hash, ) -> Result<Option<Vec<<Block as BlockT>::Extrinsic>>>

Get block body by ID. Returns None if the body is not stored.

source

fn block_indexed_body(&self, hash: Block::Hash) -> Result<Option<Vec<Vec<u8>>>>

Get all indexed transactions for a block, including renewed transactions.

Note that this will only fetch transactions that are indexed by the runtime with storage_index_transaction.

source

fn block(&self, hash: Block::Hash) -> Result<Option<SignedBlock<Block>>>

Get full block by hash.

source

fn block_status(&self, hash: Block::Hash) -> Result<BlockStatus>

Get block status by block hash.

source

fn justifications(&self, hash: Block::Hash) -> Result<Option<Justifications>>

Get block justifications for the block with the given hash.

source

fn block_hash(&self, number: NumberFor<Block>) -> Result<Option<Block::Hash>>

Get block hash by number.

source

fn indexed_transaction(&self, hash: Block::Hash) -> Result<Option<Vec<u8>>>

Get single indexed transaction by content hash.

Note that this will only fetch transactions that are indexed by the runtime with storage_index_transaction.

source

fn requires_full_sync(&self) -> bool

Tells whether the current client configuration requires full-sync mode.

Provided Methods§

source

fn has_indexed_transaction(&self, hash: Block::Hash) -> Result<bool>

Check if transaction index exists.

Implementors§