Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche.h
Show First 20 Lines • Show All 53 Lines • ▼ Show 20 Lines | static uint32_t countBits(uint32_t value) { | ||||
// Clear the rightmost bit set. | // Clear the rightmost bit set. | ||||
value &= (value - 1); | value &= (value - 1); | ||||
} | } | ||||
return count; | return count; | ||||
} | } | ||||
public: | public: | ||||
VoteRecord() : votes(0xaaaa), confidence(0) {} | VoteRecord(bool accepted) : votes(0xaaaa), confidence(accepted) {} | ||||
bool isAccepted() const { return confidence & 0x01; } | bool isAccepted() const { return confidence & 0x01; } | ||||
uint16_t getConfidence() const { return confidence >> 1; } | uint16_t getConfidence() const { return confidence >> 1; } | ||||
bool hasFinalized() const { | bool hasFinalized() const { | ||||
return getConfidence() >= AVALANCHE_FINALIZATION_SCORE; | return getConfidence() >= AVALANCHE_FINALIZATION_SCORE; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 186 Lines • Show Last 20 Lines |