5#ifndef BITCOIN_AVALANCHE_VOTERECORD_H
6#define BITCOIN_AVALANCHE_VOTERECORD_H
69 std::array<uint16_t, 8>
nodeFilter{{0, 0, 0, 0, 0, 0, 0, 0}};
130 friend struct ::avalanche::TestVoteRecord;
bool error(const char *fmt, const Args &...args)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
uint16_t getConfidence() const
void clearInflightRequest(uint8_t count=1)
Clear count inflight requests.
VoteRecord(bool accepted)
bool hasFinalized() const
std::atomic< uint8_t > inflight
bool shouldPoll() const
Return if this item is in condition to be polled at the moment.
bool registerVote(NodeId nodeid, uint32_t error)
Register a new vote for an item and update confidence accordingly.
std::array< uint16_t, 8 > nodeFilter
bool isStale(uint32_t staleThreshold=AVALANCHE_VOTE_STALE_THRESHOLD, uint32_t staleFactor=AVALANCHE_VOTE_STALE_FACTOR) const
VoteRecord(const VoteRecord &other)
Copy semantic.
bool addNodeToQuorum(NodeId nodeid)
Add the node to the quorum.
bool registerPoll() const
Register that a request is being made regarding that item.
bool isAccepted() const
Vote accounting facilities.
static constexpr uint32_t AVALANCHE_VOTE_STALE_FACTOR
Scaling factor applied to confidence to determine staleness threshold.
static constexpr int AVALANCHE_MAX_INFLIGHT_POLL
How many inflight requests can exist for one item.
static constexpr uint32_t AVALANCHE_VOTE_STALE_MIN_THRESHOLD
Lowest configurable staleness threshold (finalization score + necessary votes to increase confidence ...
static constexpr uint32_t AVALANCHE_VOTE_STALE_THRESHOLD
Number of votes before a record may be considered as stale.
static constexpr int AVALANCHE_FINALIZATION_SCORE
Finalization score.