pub struct ConsensusState {Show 13 fields
pub validator_id: ValidatorId,
pub validator_set: ValidatorSet,
pub chain_id_hash: [u8; 32],
pub current_view: ViewNumber,
pub role: ViewRole,
pub step: ViewStep,
pub locked_qc: Option<QuorumCertificate>,
pub highest_double_cert: Option<DoubleCertificate>,
pub highest_qc: Option<QuorumCertificate>,
pub last_committed_height: Height,
pub last_app_hash: BlockHash,
pub current_epoch: Epoch,
pub pending_vote_extensions: Vec<(ValidatorId, Vec<u8>)>,
}Expand description
Mutable consensus state for a single validator
Fields§
§validator_id: ValidatorId§validator_set: ValidatorSet§chain_id_hash: [u8; 32]Blake3 hash of the chain identifier — included in all signing bytes to prevent cross-chain signature replay.
current_view: ViewNumber§role: ViewRole§step: ViewStep§locked_qc: Option<QuorumCertificate>§highest_double_cert: Option<DoubleCertificate>§highest_qc: Option<QuorumCertificate>§last_committed_height: Height§last_app_hash: BlockHashApplication state root from the most recently committed block’s execution. Included in the next proposed block for cross-node state divergence detection.
current_epoch: Epoch§pending_vote_extensions: Vec<(ValidatorId, Vec<u8>)>Vote extensions from the most recent DoubleCertificate’s Vote2 round.
Set when a DC triggers a view advance; consumed by the next create_payload.
Implementations§
Source§impl ConsensusState
impl ConsensusState
pub fn new(validator_id: ValidatorId, validator_set: ValidatorSet) -> Self
pub fn with_chain_id( validator_id: ValidatorId, validator_set: ValidatorSet, chain_id: &str, ) -> Self
pub fn is_leader(&self) -> bool
pub fn update_highest_qc(&mut self, qc: &QuorumCertificate)
pub fn update_locked_qc(&mut self, qc: &QuorumCertificate)
Auto Trait Implementations§
impl Freeze for ConsensusState
impl RefUnwindSafe for ConsensusState
impl Send for ConsensusState
impl Sync for ConsensusState
impl Unpin for ConsensusState
impl UnsafeUnpin for ConsensusState
impl UnwindSafe for ConsensusState
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