Skip to main content

TendermintHandle

Struct TendermintHandle 

Source
pub struct TendermintHandle<B: Blockchain> { /* private fields */ }
Available on crate feature std only.
Expand description

The handle for the Tendermint process.

Implementations§

Source§

impl<B: Blockchain> TendermintHandle<B>

Source

pub fn block_number(&self) -> BlockNumber

The number for the block we’re currently attempting to achieve consensus over.

This is implemented in a lock-free manner and MAY momentarily desynchronize from the block number internal to the Tendermint process, or the blockchain, accordingly.

Source

pub fn observed_block_number(&self) -> BlockNumber

The greatest block number we’ve observed validators attempting to achieve consensus over.

This is the greatest block number which f + 1 validators have been observed to be attempting to obtain consensus over, meaning there presumably is consensus over all prior blocks (or the amount of faulty validators exceeds the fault threshold). This is intended to be used to allow the larger application to realize it should explicitly sync up to this block (as this library does not implement a block sync loop itself).

This is implemented in a lock-free manner and MAY momentarily desynchronize from other representations of the state accordingly. A best-effort attempt is made to ensure this will always be greater than or equal to the value yielded by TendermintHandle::block_number but this is not guaranteed.

Source

pub async fn sync( &mut self, block: B::Block, commit: CommitFor<B>, ) -> Result<(), ProcessTerminated>

Sync a block by its commit.

The Tendermint implementation will validate the commit as necessary.

This function returns Ok(()) if the Tendermint process is still running and Err(()) otherwise. This function implements backpressure and will wait until the process has the capacity to receive this.

Source

pub async fn message( &mut self, message: MessageFor<B>, ) -> Result<(), ProcessTerminated>

Handle a message received from the network.

The Tendermint implementation will validate the message as necessary.

This function returns Ok(()) if the Tendermint process is still running and Err(()) otherwise. This function implements backpressure and will wait until the process has the capacity to receive this.

Auto Trait Implementations§

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.