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§
sourcefn block_exists(&self, bitcoin_block_hash: BlockHash) -> bool
fn block_exists(&self, bitcoin_block_hash: BlockHash) -> bool
Whether the specified Bitcoin block exists in the system.
sourcefn block_number(&self, bitcoin_block_hash: BlockHash) -> Option<u32>
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.
sourcefn block_hash(&self, block_number: u32) -> Option<BlockHash>
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.
sourcefn block_header(&self, bitcoin_block_hash: BlockHash) -> Option<BitcoinHeader>
fn block_header(&self, bitcoin_block_hash: BlockHash) -> Option<BitcoinHeader>
Returns the header for given bitcoin block hash.
sourcefn bitcoin_block_hash_for(
&self,
substrate_block_hash: <Block as BlockT>::Hash,
) -> Option<BlockHash>
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
.
sourcefn substrate_block_hash_for(
&self,
bitcoin_block_hash: BlockHash,
) -> Option<<Block as BlockT>::Hash>
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
.