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§
sourcefn block_body(
&self,
hash: Block::Hash,
) -> Result<Option<Vec<<Block as BlockT>::Extrinsic>>>
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.
sourcefn block_indexed_body(&self, hash: Block::Hash) -> Result<Option<Vec<Vec<u8>>>>
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
.
sourcefn block(&self, hash: Block::Hash) -> Result<Option<SignedBlock<Block>>>
fn block(&self, hash: Block::Hash) -> Result<Option<SignedBlock<Block>>>
Get full block by hash.
sourcefn block_status(&self, hash: Block::Hash) -> Result<BlockStatus>
fn block_status(&self, hash: Block::Hash) -> Result<BlockStatus>
Get block status by block hash.
sourcefn justifications(&self, hash: Block::Hash) -> Result<Option<Justifications>>
fn justifications(&self, hash: Block::Hash) -> Result<Option<Justifications>>
Get block justifications for the block with the given hash.
sourcefn block_hash(&self, number: NumberFor<Block>) -> Result<Option<Block::Hash>>
fn block_hash(&self, number: NumberFor<Block>) -> Result<Option<Block::Hash>>
Get block hash by number.
sourcefn indexed_transaction(&self, hash: Block::Hash) -> Result<Option<Vec<u8>>>
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
.
sourcefn requires_full_sync(&self) -> bool
fn requires_full_sync(&self) -> bool
Tells whether the current client configuration requires full-sync mode.
Provided Methods§
sourcefn has_indexed_transaction(&self, hash: Block::Hash) -> Result<bool>
fn has_indexed_transaction(&self, hash: Block::Hash) -> Result<bool>
Check if transaction index exists.