Page MenuHomePhabricator

[avalanche] Down-rank rejected contenders
ClosedPublic

Authored by roqqit on Fri, Feb 28, 18:21.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC601acac03dc6: [avalanche] Down-rank rejected contenders
Summary

Since D17710, we no longer remove invalidated contenders from the winner set. However, if other contenders finalized, we do not want to select the invalidated winner as the preferred stake winner for mining even if it has the highest rank. This patch down-ranks rejected contenders so that they do not occupy the preferred slot.

Depends on D17700

Test Plan
ninja check
for I in {0..10}; do ./test/functional/test_runner.py abc_p2p_avalanche_contender_voting || break ; done

Diff Detail

Repository
rABC Bitcoin ABC
Branch
sc-downrank-rejected-contenders
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 32570
Build 64628: Build Difflint-circular-dependencies · build-debug · build-diff · build-clang · build-without-wallet · build-clang-tidy
Build 64627: arc lint + arc unit

Event Timeline

roqqit requested review of this revision.Fri, Feb 28, 18:21
Fabien requested changes to this revision.Mon, Mar 3, 08:50
Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/avalanche/stakecontendercache.cpp
227 ↗(On Diff #52857)

This is making assumptions about the rank computation, which could be easily avoided by sorting by isAccepted first then by rank.
Note that this sort is still not deterministic: if the ranks are equal then both contenders are equal. You should avoid this (e.g. using the contender id).

test/functional/abc_p2p_avalanche_contender_voting.py
302 ↗(On Diff #52857)

Can you check gbt as well here ?

This revision now requires changes to proceed.Mon, Mar 3, 08:50
This revision is now accepted and ready to land.Mon, Mar 3, 19:31
This revision was automatically updated to reflect the committed changes.