Kagome
Polkadot Runtime Engine in C++17
kagome::consensus::grandpa::VoteTracker Class Referenceabstract

#include <vote_tracker.hpp>

Inheritance diagram for kagome::consensus::grandpa::VoteTracker:
Collaboration diagram for kagome::consensus::grandpa::VoteTracker:

Public Types

enum  PushResult { PushResult::SUCCESS, PushResult::DUPLICATED, PushResult::EQUIVOCATED }
 

Public Member Functions

virtual ~VoteTracker ()=default
 
virtual PushResult push (const SignedMessage &vote, size_t weight)=0
 
virtual void unpush (const SignedMessage &vote, size_t weight)=0
 
virtual std::vector< VoteVariantgetMessages () const =0
 
virtual size_t getTotalWeight () const =0
 

Detailed Description

Stores voting messages (such as prevotes and precommits) during a round, reports if a messages that is being put into it is a duplicate or an equivote (which is the case when a node votes for two different blocks during a round)

Definition at line 19 of file vote_tracker.hpp.

Member Enumeration Documentation

Enumerator
SUCCESS 
DUPLICATED 
EQUIVOCATED 

Definition at line 21 of file vote_tracker.hpp.

Constructor & Destructor Documentation

virtual kagome::consensus::grandpa::VoteTracker::~VoteTracker ( )
virtualdefault

Member Function Documentation

virtual std::vector<VoteVariant> kagome::consensus::grandpa::VoteTracker::getMessages ( ) const
pure virtual
Returns
all accepted (non-duplicate) messages

Implemented in kagome::consensus::grandpa::VoteTrackerImpl.

virtual size_t kagome::consensus::grandpa::VoteTracker::getTotalWeight ( ) const
pure virtual
Returns
total weight of all accepted (non-duplicate) messages

Implemented in kagome::consensus::grandpa::VoteTrackerImpl.

virtual PushResult kagome::consensus::grandpa::VoteTracker::push ( const SignedMessage vote,
size_t  weight 
)
pure virtual

Attempts to push a vote to a tracker

Parameters
votethe voting message being pushed
weightweight of this vote
Returns
SUCCESS if it is the first pushed vote of the voter, EQUIVOCATED if the voting peer already voted for a different block, DUPLICATE if the peer already voted for another block more than once or voted for the same block

Implemented in kagome::consensus::grandpa::VoteTrackerImpl.

virtual void kagome::consensus::grandpa::VoteTracker::unpush ( const SignedMessage vote,
size_t  weight 
)
pure virtual

Unpush a vote from a tracker (i.e. at wrong vote)

Parameters
votethe voting message was pushed before
weightweight of this vote

Implemented in kagome::consensus::grandpa::VoteTrackerImpl.


The documentation for this class was generated from the following file: