Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche.cpp
Show All 38 Lines | #else | ||||
return (((v + (v >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; | return (((v + (v >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24; | ||||
#endif | #endif | ||||
} | } | ||||
bool VoteRecord::registerVote(uint32_t error) { | bool VoteRecord::registerVote(uint32_t error) { | ||||
// We just got a new vote, so there is one less inflight request. | // We just got a new vote, so there is one less inflight request. | ||||
clearInflightRequest(); | clearInflightRequest(); | ||||
// Keep track of how many votes were registered. | |||||
successfulVotes++; | |||||
/** | /** | ||||
* The result of the vote is determined from the error code. If the error | * 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 | * 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 | * 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 | * (for instance, the block is invalid) or is the vote inconclusive (for | ||||
* instance, the queried node does not have the block yet). | * instance, the queried node does not have the block yet). | ||||
*/ | */ | ||||
votes = (votes << 1) | (error == 0); | votes = (votes << 1) | (error == 0); | ||||
▲ Show 20 Lines • Show All 421 Lines • Show Last 20 Lines |