Struct ChainPoller

Source
pub struct ChainPoller<B: Deref<Target = T> + Sized + Send + Sync, T: BlockSource + ?Sized> { /* private fields */ }
Expand description

The canonical Poll implementation used for a single BlockSource.

Other Poll implementations should be built using ChainPoller as it provides the simplest way of validating chain data and checking consistency.

Implementations§

Source§

impl<B: Deref<Target = T> + Sized + Send + Sync, T: BlockSource + ?Sized> ChainPoller<B, T>

Source

pub fn new(block_source: B, network: Network) -> Self

Creates a new poller for the given block source.

If the network parameter is mainnet, then the difficulty between blocks is checked for validity.

Trait Implementations§

Source§

impl<B: Deref<Target = T> + Sized + Send + Sync, T: BlockSource + ?Sized> Poll for ChainPoller<B, T>

Source§

fn poll_chain_tip<'a>( &'a self, best_known_chain_tip: ValidatedBlockHeader, ) -> AsyncBlockSourceResult<'a, ChainTip>

Returns a chain tip in terms of its relationship to the provided chain tip.
Source§

fn look_up_previous_header<'a>( &'a self, header: &'a ValidatedBlockHeader, ) -> AsyncBlockSourceResult<'a, ValidatedBlockHeader>

Returns the header that preceded the given header in the chain.
Source§

fn fetch_block<'a>( &'a self, header: &'a ValidatedBlockHeader, ) -> AsyncBlockSourceResult<'a, ValidatedBlock>

Returns the block associated with the given header.

Auto Trait Implementations§

§

impl<B, T> Freeze for ChainPoller<B, T>
where B: Freeze, T: ?Sized,

§

impl<B, T> RefUnwindSafe for ChainPoller<B, T>
where B: RefUnwindSafe, T: ?Sized,

§

impl<B, T> Send for ChainPoller<B, T>
where T: ?Sized,

§

impl<B, T> Sync for ChainPoller<B, T>
where T: ?Sized,

§

impl<B, T> Unpin for ChainPoller<B, T>
where B: Unpin, T: ?Sized,

§

impl<B, T> UnwindSafe for ChainPoller<B, T>
where B: UnwindSafe, T: ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.