Vote history.
More...
#include <voterecord.h>
Vote history.
Definition at line 49 of file voterecord.h.
◆ VoteRecord() [1/2]
avalanche::VoteRecord::VoteRecord |
( |
bool |
accepted | ) |
|
|
inlineexplicit |
◆ VoteRecord() [2/2]
avalanche::VoteRecord::VoteRecord |
( |
const VoteRecord & |
other | ) |
|
|
inline |
◆ addNodeToQuorum()
bool avalanche::VoteRecord::addNodeToQuorum |
( |
NodeId |
nodeid | ) |
|
|
private |
Add the node to the quorum.
Returns true if the node was added, false if the node already was in the quorum.
Check if the node is in the filter.
Add the node which just voted to the filter.
Definition at line 61 of file voterecord.cpp.
◆ clearInflightRequest()
void avalanche::VoteRecord::clearInflightRequest |
( |
uint8_t |
count = 1 | ) |
|
|
inline |
Clear count
inflight requests.
Definition at line 120 of file voterecord.h.
◆ getConfidence()
uint16_t avalanche::VoteRecord::getConfidence |
( |
| ) |
const |
|
inline |
◆ hasFinalized()
bool avalanche::VoteRecord::hasFinalized |
( |
| ) |
const |
|
inline |
◆ isAccepted()
bool avalanche::VoteRecord::isAccepted |
( |
| ) |
const |
|
inline |
◆ isStale()
◆ registerPoll()
bool avalanche::VoteRecord::registerPoll |
( |
| ) |
const |
Register that a request is being made regarding that item.
The method is made const so that it can be accessed via a read only view of blockVoteRecords. It's not a problem as it is made thread safe.
Definition at line 87 of file voterecord.cpp.
◆ registerVote()
bool avalanche::VoteRecord::registerVote |
( |
NodeId |
nodeid, |
|
|
uint32_t |
error |
|
) |
| |
Register a new vote for an item and update confidence accordingly.
Returns true if the acceptance or finalization state changed.
The result of the vote is determined from the error code. If the error code is 0, there is no error and therefore the vote is yes. If there is an error, we check the most significant bit to decide if the vote is a no (for instance, the block is invalid) or is the vote inconclusive (for instance, the queried node does not have the block yet).
We compute the number of yes and/or no votes as follow:
votes: 1010 consider: 1100
yes votes: 1000 using votes & consider no votes: 0100 using ~votes & consider
Definition at line 13 of file voterecord.cpp.
◆ shouldPoll()
bool avalanche::VoteRecord::shouldPoll |
( |
| ) |
const |
|
inline |
Return if this item is in condition to be polled at the moment.
Definition at line 115 of file voterecord.h.
◆ ::avalanche::TestVoteRecord
◆ confidence
uint16_t avalanche::VoteRecord::confidence = 0 |
|
private |
◆ consider
uint8_t avalanche::VoteRecord::consider = 0 |
|
private |
◆ inflight
std::atomic<uint8_t> avalanche::VoteRecord::inflight {0} |
|
mutableprivate |
◆ nodeFilter
std::array<uint16_t, 8> avalanche::VoteRecord::nodeFilter {{0, 0, 0, 0, 0, 0, 0, 0}} |
|
private |
◆ seed
const uint32_t avalanche::VoteRecord::seed = 0 |
|
private |
◆ successfulVotes
uint32_t avalanche::VoteRecord::successfulVotes = 0 |
|
private |
◆ votes
uint8_t avalanche::VoteRecord::votes = 0 |
|
private |
The documentation for this struct was generated from the following files: