rippled
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
ripple::TrustedVotes Class Reference

TrustedVotes records the most recent votes from trusted validators. More...

Collaboration diagram for ripple::TrustedVotes:
Collaboration graph
[legend]

Classes

struct  UpvotesAndTimeout
 

Public Member Functions

 TrustedVotes ()=default
 
 TrustedVotes (TrustedVotes const &rhs)=delete
 
TrustedVotesoperator= (TrustedVotes const &rhs)=delete
 
void trustChanged (hash_set< PublicKey > const &allTrusted, std::lock_guard< std::mutex > const &lock)
 
void recordVotes (Rules const &rules, std::vector< std::shared_ptr< STValidation > > const &valSet, NetClock::time_point const closeTime, beast::Journal j, std::lock_guard< std::mutex > const &lock)
 
std::pair< int, hash_map< uint256, int > > getVotes (Rules const &rules, std::lock_guard< std::mutex > const &lock) const
 

Private Attributes

hash_map< PublicKey, UpvotesAndTimeoutrecordedVotes_
 

Detailed Description

TrustedVotes records the most recent votes from trusted validators.

We keep a record in an effort to avoid "flapping" while amendment voting is in process.

If a trusted validator loses synchronization near a flag ledger their amendment votes may be lost during that round. If the validator is a bit flaky, then this can cause an amendment to appear to repeatedly gain and lose support.

TrustedVotes addresses the problem by holding on to the last vote seen from every trusted validator. So if any given validator is off line near a flag ledger we can assume that they did not change their vote.

If we haven't seen any STValidations from a validator for several hours we lose confidence that the validator hasn't changed their position. So there's a timeout. We remove upVotes if they haven't been updated in several hours.

Definition at line 93 of file AmendmentTable.cpp.

Constructor & Destructor Documentation

◆ TrustedVotes() [1/2]

ripple::TrustedVotes::TrustedVotes ( )
default

◆ TrustedVotes() [2/2]

ripple::TrustedVotes::TrustedVotes ( TrustedVotes const &  rhs)
delete

Member Function Documentation

◆ operator=()

TrustedVotes & ripple::TrustedVotes::operator= ( TrustedVotes const &  rhs)
delete

◆ trustChanged()

void ripple::TrustedVotes::trustChanged ( hash_set< PublicKey > const &  allTrusted,
std::lock_guard< std::mutex > const &  lock 
)

Definition at line 120 of file AmendmentTable.cpp.

◆ recordVotes()

void ripple::TrustedVotes::recordVotes ( Rules const &  rules,
std::vector< std::shared_ptr< STValidation > > const &  valSet,
NetClock::time_point const  closeTime,
beast::Journal  j,
std::lock_guard< std::mutex > const &  lock 
)

Definition at line 153 of file AmendmentTable.cpp.

◆ getVotes()

std::pair< int, hash_map< uint256, int > > ripple::TrustedVotes::getVotes ( Rules const &  rules,
std::lock_guard< std::mutex > const &  lock 
) const

Definition at line 267 of file AmendmentTable.cpp.

Member Data Documentation

◆ recordedVotes_

hash_map<PublicKey, UpvotesAndTimeout> ripple::TrustedVotes::recordedVotes_
private

Definition at line 108 of file AmendmentTable.cpp.