pub trait ChainOracle {
type Error: Debug;
// Required methods
fn is_block_in_chain(
&self,
block: BlockId,
chain_tip: BlockId,
) -> Result<Option<bool>, Self::Error>;
fn get_chain_tip(&self) -> Result<BlockId, Self::Error>;
}
Expand description
Represents a service that tracks the blockchain.
The main method is is_block_in_chain
which determines whether a given block of BlockId
is an ancestor of the chain_tip
.
Required Associated Types§
Required Methods§
Sourcefn is_block_in_chain(
&self,
block: BlockId,
chain_tip: BlockId,
) -> Result<Option<bool>, Self::Error>
fn is_block_in_chain( &self, block: BlockId, chain_tip: BlockId, ) -> Result<Option<bool>, Self::Error>
Determines whether block
of BlockId
exists as an ancestor of chain_tip
.
If None
is returned, it means the implementation cannot determine whether block
exists
under chain_tip
.
Sourcefn get_chain_tip(&self) -> Result<BlockId, Self::Error>
fn get_chain_tip(&self) -> Result<BlockId, Self::Error>
Get the best chain’s chain tip.