pub trait VotingRule<Block, B>: Send + Sync where
    Block: BlockT,
    B: HeaderBackend<Block>, 
{ fn restrict_vote(
        &self,
        backend: &B,
        base: &Block::Header,
        best_target: &Block::Header,
        current_target: &Block::Header
    ) -> Option<(Block::Hash, NumberFor<Block>)>; }
Expand description

A trait for custom voting rules in GRANDPA.

Required methods

Restrict the given current_target vote, returning the block hash and number of the block to vote on, and None in case the vote should not be restricted. base is the block that we’re basing our votes on in order to pick our target (e.g. last round estimate), and best_target is the initial best vote target before any vote rules were applied. When applying multiple VotingRules both base and best_target should remain unchanged.

The contract of this interface requires that when restricting a vote, the returned value must be an ancestor of the given current_target, this also means that a variant must be maintained throughout the execution of voting rules wherein current_target <= best_target.

Implementations on Foreign Types

Implementors