Trait lightning_block_sync::poll::Poll
source · [−]pub trait Poll {
fn poll_chain_tip<'a>(
&'a mut self,
best_known_chain_tip: ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ChainTip>;
fn look_up_previous_header<'a>(
&'a mut self,
header: &'a ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ValidatedBlockHeader>;
fn fetch_block<'a>(
&'a mut self,
header: &'a ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ValidatedBlock>;
}
Expand description
The Poll
trait defines behavior for polling block sources for a chain tip and retrieving
related chain data. It serves as an adapter for BlockSource
.
ChainPoller
adapts a single BlockSource
, while any other implementations of Poll
are
required to be built in terms of it to ensure chain data validity.
Required methods
fn poll_chain_tip<'a>(
&'a mut self,
best_known_chain_tip: ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ChainTip>
fn poll_chain_tip<'a>(
&'a mut self,
best_known_chain_tip: ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ChainTip>
Returns a chain tip in terms of its relationship to the provided chain tip.
fn look_up_previous_header<'a>(
&'a mut self,
header: &'a ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ValidatedBlockHeader>
fn look_up_previous_header<'a>(
&'a mut self,
header: &'a ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ValidatedBlockHeader>
Returns the header that preceded the given header in the chain.
fn fetch_block<'a>(
&'a mut self,
header: &'a ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ValidatedBlock>
fn fetch_block<'a>(
&'a mut self,
header: &'a ValidatedBlockHeader
) -> AsyncBlockSourceResult<'a, ValidatedBlock>
Returns the block associated with the given header.