Kagome
Polkadot Runtime Engine in C++17
kagome::consensus::grandpa::VoteTrackerImpl Class Reference

#include <vote_tracker_impl.hpp>

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

Public Member Functions

PushResult push (const SignedMessage &vote, size_t weight) override
 
void unpush (const SignedMessage &vote, size_t weight) override
 
std::vector< VoteVariantgetMessages () const override
 
size_t getTotalWeight () const override
 
- Public Member Functions inherited from kagome::consensus::grandpa::VoteTracker
virtual ~VoteTracker ()=default
 

Private Attributes

std::map< Id, VoteVariantmessages_
 
size_t total_weight_ = 0
 

Additional Inherited Members

- Public Types inherited from kagome::consensus::grandpa::VoteTracker
enum  PushResult { PushResult::SUCCESS, PushResult::DUPLICATED, PushResult::EQUIVOCATED }
 

Detailed Description

Definition at line 13 of file vote_tracker_impl.hpp.

Member Function Documentation

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

Implements kagome::consensus::grandpa::VoteTracker.

Definition at line 59 of file vote_tracker_impl.cpp.

size_t kagome::consensus::grandpa::VoteTrackerImpl::getTotalWeight ( ) const
overridevirtual
Returns
total weight of all accepted (non-duplicate) messages

Implements kagome::consensus::grandpa::VoteTracker.

Definition at line 69 of file vote_tracker_impl.cpp.

VoteTracker::PushResult kagome::consensus::grandpa::VoteTrackerImpl::push ( const SignedMessage vote,
size_t  weight 
)
overridevirtual

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

Implements kagome::consensus::grandpa::VoteTracker.

Definition at line 13 of file vote_tracker_impl.cpp.

void kagome::consensus::grandpa::VoteTrackerImpl::unpush ( const SignedMessage vote,
size_t  weight 
)
overridevirtual

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

Parameters
votethe voting message was pushed before
weightweight of this vote

Implements kagome::consensus::grandpa::VoteTracker.

Definition at line 42 of file vote_tracker_impl.cpp.

Member Data Documentation

std::map<Id, VoteVariant> kagome::consensus::grandpa::VoteTrackerImpl::messages_
private

Definition at line 24 of file vote_tracker_impl.hpp.

size_t kagome::consensus::grandpa::VoteTrackerImpl::total_weight_ = 0
private

Definition at line 25 of file vote_tracker_impl.hpp.


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