pub struct Engine { /* private fields */ }Expand description
The core consensus state machine.
Thread-safe: all mutable state is behind a Mutex.
Implementations§
Source§impl Engine
impl Engine
pub fn new( config: ChainConfig, validator_set: ValidatorSet, start_height: Height, ) -> Self
pub fn height(&self) -> Height
pub fn round(&self) -> Round
Sourcepub fn receive_proposal(&self, block: Block) -> Option<ConsensusEvent>
pub fn receive_proposal(&self, block: Block) -> Option<ConsensusEvent>
Set a received block proposal for the current round.
Sourcepub fn receive_vote(&self, vote: Vote) -> Option<ConsensusEvent>
pub fn receive_vote(&self, vote: Vote) -> Option<ConsensusEvent>
Process an incoming vote; returns an event if a threshold was crossed.
Sourcepub fn timeout(&self) -> ConsensusEvent
pub fn timeout(&self) -> ConsensusEvent
Advance to the next round (called on timeout).
pub fn committed_blocks(&self) -> Vec<(Height, Hash)>
Auto Trait Implementations§
impl !Freeze for Engine
impl !RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl UnwindSafe for Engine
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