Struct finality_grandpa::vote_graph::VoteGraph[][src]

pub struct VoteGraph<H: Hash + Eq, V> { /* fields omitted */ }

Maintains a DAG of blocks in the chain which have votes attached to them, and vote data which is accumulated along edges.

Methods

impl<H, V> VoteGraph<H, V> where
    H: Hash + Eq + Clone + Ord + Debug,
    V: AddAssign + Default + Clone + Debug
[src]

Create a new VoteGraph with base node as given.

Get the base block.

Insert a vote with given value into the graph at given hash and number.

Find the highest block which is either an ancestor of or equal to the given, which fulfills a condition.

Find the best GHOST descendent of the given block. Pass a closure used to evaluate the cumulative vote value.

The GHOST (hash, number) returned will be the block with highest number for which the cumulative votes of descendents and itself causes the closure to evaluate to true.

This assumes that the evaluation closure is one which returns true for at most a single descendent of a block, in that only one fork of a block can be "heavy" enough to trigger the threshold.

Returns None when the given current_best does not fulfill the condition.

Auto Trait Implementations

impl<H, V> Send for VoteGraph<H, V> where
    H: Send,
    V: Send

impl<H, V> Sync for VoteGraph<H, V> where
    H: Sync,
    V: Sync