Trait subcoin_primitives::BackendExt

source ·
pub trait BackendExt<Block: BlockT> {
    // Required methods
    fn block_exists(&self, bitcoin_block_hash: BlockHash) -> bool;
    fn block_number(&self, bitcoin_block_hash: BlockHash) -> Option<u32>;
    fn block_hash(&self, block_number: u32) -> Option<BlockHash>;
    fn block_header(
        &self,
        bitcoin_block_hash: BlockHash,
    ) -> Option<BitcoinHeader>;
    fn bitcoin_block_hash_for(
        &self,
        substrate_block_hash: <Block as BlockT>::Hash,
    ) -> Option<BlockHash>;
    fn substrate_block_hash_for(
        &self,
        bitcoin_block_hash: BlockHash,
    ) -> Option<<Block as BlockT>::Hash>;
}
Expand description

Trait for interfacing with the Bitcoin storage.

Th essence of this trait is the mapping of the hashes between the substrate block and the corresponding bitcoin block.

The mapping is stored in the client’s auxiliary database.

Required Methods§

source

fn block_exists(&self, bitcoin_block_hash: BlockHash) -> bool

Whether the specified Bitcoin block exists in the system.

source

fn block_number(&self, bitcoin_block_hash: BlockHash) -> Option<u32>

Returns the number for given bitcoin block hash.

Returns None if the header is not in the chain.

source

fn block_hash(&self, block_number: u32) -> Option<BlockHash>

Returns the bitcoin block hash for given block number.

Returns None if the header is not in the chain.

source

fn block_header(&self, bitcoin_block_hash: BlockHash) -> Option<BitcoinHeader>

Returns the header for given bitcoin block hash.

source

fn bitcoin_block_hash_for( &self, substrate_block_hash: <Block as BlockT>::Hash, ) -> Option<BlockHash>

Returns Some(BlockHash) if a corresponding Bitcoin block hash is found, otherwise returns None.

source

fn substrate_block_hash_for( &self, bitcoin_block_hash: BlockHash, ) -> Option<<Block as BlockT>::Hash>

Returns Some(Block::Hash) if a corresponding Substrate block hash is found, otherwise returns None.

Implementations on Foreign Types§

source§

impl<Block, Client> BackendExt<Block> for Arc<Client>
where Block: BlockT, Client: HeaderBackend<Block> + AuxStore,

source§

fn block_exists(&self, bitcoin_block_hash: BlockHash) -> bool

source§

fn block_number(&self, bitcoin_block_hash: BlockHash) -> Option<u32>

source§

fn block_hash(&self, number: u32) -> Option<BlockHash>

source§

fn block_header(&self, bitcoin_block_hash: BlockHash) -> Option<BitcoinHeader>

source§

fn bitcoin_block_hash_for( &self, substrate_block_hash: <Block as BlockT>::Hash, ) -> Option<BlockHash>

source§

fn substrate_block_hash_for( &self, bitcoin_block_hash: BlockHash, ) -> Option<<Block as BlockT>::Hash>

Implementors§