Trait sc_finality_grandpa::VotingRule [−][src]
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]
&self,
backend: &B,
base: &Block::Header,
best_target: &Block::Header,
current_target: &Block::Header
) -> Option<(Block::Hash, NumberFor<Block>)>
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 VotingRule
s 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
impl<Block, B> VotingRule<Block, B> for () where
Block: BlockT,
B: HeaderBackend<Block>,
[src]
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>)>
[src]
&self,
_backend: &B,
_base: &Block::Header,
_best_target: &Block::Header,
_current_target: &Block::Header
) -> Option<(Block::Hash, NumberFor<Block>)>
impl<Block, B> VotingRule<Block, B> for Box<dyn VotingRule<Block, B>> where
Block: BlockT,
B: HeaderBackend<Block>,
[src]
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>)>
[src]
&self,
backend: &B,
base: &Block::Header,
best_target: &Block::Header,
current_target: &Block::Header
) -> Option<(Block::Hash, NumberFor<Block>)>
Implementors
impl<Block, B> VotingRule<Block, B> for BeforeBestBlockBy<NumberFor<Block>> where
Block: BlockT,
B: HeaderBackend<Block>,
[src]
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>)>
[src]
&self,
backend: &B,
_base: &Block::Header,
best_target: &Block::Header,
current_target: &Block::Header
) -> Option<(Block::Hash, NumberFor<Block>)>
impl<Block, B> VotingRule<Block, B> for ThreeQuartersOfTheUnfinalizedChain where
Block: BlockT,
B: HeaderBackend<Block>,
[src]
Block: BlockT,
B: HeaderBackend<Block>,