Page MenuHomePhabricator

[avalanche] Add the concept of inconclusive votes
ClosedPublic

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

Details

Reviewers
jasonbcox
Group Reviewers
Restricted Project
Commits
rABC7f7f55cc7216: [avalanche] Add the concept of inconclusive votes
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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Fri, Nov 30, 15:37
Herald added a reviewer: Restricted Project. · View Herald TranscriptFri, Nov 30, 15:37
Herald added a subscriber: schancel. · View Herald Transcript
jasonbcox requested changes to this revision.Fri, Nov 30, 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.Fri, Nov 30, 21:23
jasonbcox added inline comments.Fri, Nov 30, 21:45
src/avalanche.cpp
114 ↗(On Diff #6196)

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

deadalnix updated this revision to Diff 6236.Sun, Dec 2, 23:00
deadalnix marked an inline comment as done.

Add explaination about error codes

jasonbcox added inline comments.Sun, Dec 2, 23:17
src/avalanche.cpp
36 ↗(On Diff #6236)

erro -> error

deadalnix updated this revision to Diff 6260.Mon, Dec 3, 12:20

Fix typo

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