Trait tendermint_machine::ext::Weights

source ·
pub trait Weights: Send + Sync {
    type ValidatorId: ValidatorId;

    // Required methods
    fn total_weight(&self) -> u64;
    fn weight(&self, validator: Self::ValidatorId) -> u64;
    fn proposer(
        &self,
        block: BlockNumber,
        round: RoundNumber,
    ) -> Self::ValidatorId;

    // Provided methods
    fn threshold(&self) -> u64 { ... }
    fn fault_threshold(&self) -> u64 { ... }
}
Expand description

Weights for the validators present.

Required Associated Types§

Required Methods§

source

fn total_weight(&self) -> u64

Total weight of all validators.

source

fn weight(&self, validator: Self::ValidatorId) -> u64

Weight for a specific validator.

source

fn proposer(&self, block: BlockNumber, round: RoundNumber) -> Self::ValidatorId

Weighted round robin function.

Provided Methods§

source

fn threshold(&self) -> u64

Threshold needed for BFT consensus.

source

fn fault_threshold(&self) -> u64

Threshold preventing BFT consensus.

Implementations on Foreign Types§

source§

impl<W: Weights> Weights for Arc<W>

§

type ValidatorId = <W as Weights>::ValidatorId

source§

fn total_weight(&self) -> u64

source§

fn weight(&self, validator: Self::ValidatorId) -> u64

source§

fn proposer(&self, block: BlockNumber, round: RoundNumber) -> Self::ValidatorId

Implementors§