Page MenuHomePhabricator

[avalanche] Add the concept of inconclusive votes
ClosedPublic

Authored by deadalnix on Nov 30 2018, 15:37.

Details

Summary

Any error code starting with a the bit 1 will be considered as an inconclusive vote. The node is not for or against.

Depends on D2148

Test Plan

Added test cases to make sure this is handled properly.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jasonbcox requested changes to this revision.Nov 30 2018, 21:23
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
src/avalanche.cpp
29 ↗(On Diff #6196)

This section had me confused. Calling this error is only accurate for values <= 0. It wasn't clear that error could be the full range of int values until I ran this over a few times.

There needs to be function-level documentation of the expected/supported values:

/**
 * registerVote() adds a vote for consideration.
 * Vote values are calculated as follows:
 *    > 0 for "no" votes
 *    0 for "yes" votes
 *    < 0 for error states.
 */

This information is not covered sufficiently by the comment below this one since it primarily covers calculating of the yes/no/error votes from votes and consider, rather than how yes/no/error votes are input'd into the function.

This revision now requires changes to proceed.Nov 30 2018, 21:23
src/avalanche.cpp
114 ↗(On Diff #6196)

int -> uint16_t unless there is a good reason to abstract away the size

deadalnix marked an inline comment as done.

Add explaination about error codes

src/avalanche.cpp
36 ↗(On Diff #6236)

erro -> error

This revision is now accepted and ready to land.Dec 3 2018, 17:58
This revision was automatically updated to reflect the committed changes.