pub struct Consensus { /* private fields */ }
Expand description
The consensus module
Implementations§
Source§impl Consensus
impl Consensus
Sourcepub async fn new(
dms: Arc<RwLock<Dms<ConsensusMessage>>>,
state_storage: StorageImpl,
block_header: BlockHeader,
consensus_parameters: ConsensusParams,
round_zero_timestamp: Timestamp,
this_node_key: Option<PrivateKey>,
) -> Result<Self, Error>
pub async fn new( dms: Arc<RwLock<Dms<ConsensusMessage>>>, state_storage: StorageImpl, block_header: BlockHeader, consensus_parameters: ConsensusParams, round_zero_timestamp: Timestamp, this_node_key: Option<PrivateKey>, ) -> Result<Self, Error>
Creates a consensus instance.
It clears and re-initializes the DMS and the stroage if the block header is different from the last one.
pub async fn get_block_header(&self) -> Result<BlockHeader, Error>
Sourcepub async fn check_finalized(&self) -> Result<Option<Finalization>, Error>
pub async fn check_finalized(&self) -> Result<Option<Finalization>, Error>
Checks whether the consensus is finalized.
pub async fn register_verified_block_hash( &mut self, block_hash: Hash256, ) -> Result<(), Error>
Sourcepub async fn progress(
&mut self,
timestamp: Timestamp,
) -> Result<Vec<ProgressResult>, Error>
pub async fn progress( &mut self, timestamp: Timestamp, ) -> Result<Vec<ProgressResult>, Error>
Makes a progress in the consensus process.
pub async fn set_proposal_candidate( &mut self, block_hash: Hash256, timestamp: Timestamp, ) -> Result<(), Error>
pub async fn veto_block(&mut self, block_hash: Hash256) -> Result<(), Error>
pub async fn veto_round( &mut self, round: ConsensusRound, timestamp: Timestamp, ) -> Result<(), Error>
pub fn get_dms(&self) -> Arc<RwLock<Dms<ConsensusMessage>>>
pub async fn flush(&mut self) -> Result<(), Error>
pub async fn update(&mut self) -> Result<(), Error>
Auto Trait Implementations§
impl Freeze for Consensus
impl !RefUnwindSafe for Consensus
impl Send for Consensus
impl Sync for Consensus
impl Unpin for Consensus
impl !UnwindSafe for Consensus
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more