Kagome
Polkadot Runtime Engine in C++17
|
#include <vote_graph.hpp>
Classes | |
struct | Entry |
struct | Subchain |
Public Types | |
using | Condition = std::function< bool(const VoteWeight &)> |
using | Comparator = std::function< bool(const VoteWeight &, const VoteWeight &)> |
Public Member Functions | |
virtual | ~VoteGraph ()=default |
virtual const BlockInfo & | getBase () const =0 |
virtual void | adjustBase (const std::vector< BlockHash > &ancestry_proof)=0 |
virtual outcome::result< void > | insert (VoteType vote_type, const BlockInfo &block, const Id &voter)=0 |
Insert vote {. More... | |
virtual void | remove (VoteType vote_type, const Id &voter)=0 |
Remove vote {. More... | |
virtual std::optional< BlockInfo > | findAncestor (VoteType vote_type, const BlockInfo &block, const Condition &condition) const =0 |
virtual std::optional< BlockInfo > | findGhost (VoteType vote_type, const std::optional< BlockInfo > ¤t_best, const Condition &condition) const =0 |
Keeps track of obtained votes. Provides convenient interfaces for getting ancestry of the votes and calculating ghost vote
Definition at line 21 of file vote_graph.hpp.
struct kagome::consensus::grandpa::VoteGraph::Subchain |
Definition at line 54 of file vote_graph.hpp.
Class Members | ||
---|---|---|
BlockNumber | best_number | |
vector< BlockHash > | hashes |
using kagome::consensus::grandpa::VoteGraph::Comparator = std::function<bool(const VoteWeight &, const VoteWeight &)> |
Definition at line 63 of file vote_graph.hpp.
using kagome::consensus::grandpa::VoteGraph::Condition = std::function<bool(const VoteWeight &)> |
Definition at line 61 of file vote_graph.hpp.
|
virtualdefault |
|
pure virtual |
Adjust the base of the graph. The new base must be an ancestor of the old base.
Provide an ancestry proof from the old base to the new. The proof should be in reverse order from the old base's parent.
Implemented in kagome::consensus::grandpa::VoteGraphImpl.
|
pure virtual |
Find the highest block which is either an ancestor of or equal to the given, which fulfills a condition.
Implemented in kagome::consensus::grandpa::VoteGraphImpl.
|
pure virtual |
Find the best GHOST descendant 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 descendants 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 descendant 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.
Implemented in kagome::consensus::grandpa::VoteGraphImpl.
|
pure virtual |
Implemented in kagome::consensus::grandpa::VoteGraphImpl.
|
pure virtual |
Insert vote {.
vote_type} | of { |
voter} | for { |
block} |
Implemented in kagome::consensus::grandpa::VoteGraphImpl.
|
pure virtual |
Remove vote {.
vote_type} | of { |
voter} |
Implemented in kagome::consensus::grandpa::VoteGraphImpl.