pub struct TendermintHandle<B: Blockchain> { /* private fields */ }std only.Expand description
The handle for the Tendermint process.
Implementations§
Source§impl<B: Blockchain> TendermintHandle<B>
impl<B: Blockchain> TendermintHandle<B>
Sourcepub fn block_number(&self) -> BlockNumber
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.
Sourcepub fn observed_block_number(&self) -> BlockNumber
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.
Sourcepub async fn sync(
&mut self,
block: B::Block,
commit: CommitFor<B>,
) -> Result<(), ProcessTerminated>
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.
Sourcepub async fn message(
&mut self,
message: MessageFor<B>,
) -> Result<(), ProcessTerminated>
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.