pub trait UtxoSource: BlockSource + 'static {
// Required methods
fn get_block_hash_by_height<'a>(
&'a self,
block_height: u32,
) -> AsyncBlockSourceResult<'a, BlockHash>;
fn is_output_unspent<'a>(
&'a self,
outpoint: OutPoint,
) -> AsyncBlockSourceResult<'a, bool>;
}
Expand description
A trait which extends BlockSource
and can be queried to fetch the block at a given height
as well as whether a given output is unspent (i.e. a member of the current UTXO set).
Note that while this is implementable for a BlockSource
which returns filtered block data
(i.e. BlockData::HeaderOnly
for BlockSource::get_block
requests), such an
implementation will reject all gossip as it is not fully able to verify the UTXOs referenced.
Required Methods§
Sourcefn get_block_hash_by_height<'a>(
&'a self,
block_height: u32,
) -> AsyncBlockSourceResult<'a, BlockHash>
fn get_block_hash_by_height<'a>( &'a self, block_height: u32, ) -> AsyncBlockSourceResult<'a, BlockHash>
Fetches the block hash of the block at the given height.
This will, in turn, be passed to to BlockSource::get_block
to fetch the block needed
for gossip validation.
Sourcefn is_output_unspent<'a>(
&'a self,
outpoint: OutPoint,
) -> AsyncBlockSourceResult<'a, bool>
fn is_output_unspent<'a>( &'a self, outpoint: OutPoint, ) -> AsyncBlockSourceResult<'a, bool>
Returns true if the given output has not been spent, i.e. is a member of the current UTXO set.
Implementors§
impl UtxoSource for RestClient
Available on crate feature
rest-client
only.impl UtxoSource for RpcClient
Available on crate feature
rpc-client
only.