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: ?Sized> RefUnwindSafe for ChainPoller<B, T>where B: RefUnwindSafe,

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.