Trait sc_finality_grandpa::VotingRule[][src]

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>)>; }

A trait for custom voting rules in GRANDPA.

Required methods

fn restrict_vote(
    &self,
    backend: &B,
    base: &Block::Header,
    best_target: &Block::Header,
    current_target: &Block::Header
) -> Option<(Block::Hash, NumberFor<Block>)>
[src]

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.

Loading content...

Implementations on Foreign Types

impl<Block, B> VotingRule<Block, B> for () where
    Block: BlockT,
    B: HeaderBackend<Block>, 
[src]

impl<Block, B> VotingRule<Block, B> for Box<dyn VotingRule<Block, B>> where
    Block: BlockT,
    B: HeaderBackend<Block>, 
[src]

Loading content...

Implementors

impl<Block, B> VotingRule<Block, B> for BeforeBestBlockBy<NumberFor<Block>> where
    Block: BlockT,
    B: HeaderBackend<Block>, 
[src]

impl<Block, B> VotingRule<Block, B> for ThreeQuartersOfTheUnfinalizedChain where
    Block: BlockT,
    B: HeaderBackend<Block>, 
[src]

Loading content...