HomePhabricator

[avalanche] Fix stake contender unit test occasional failure

Description

[avalanche] Fix stake contender unit test occasional failure

Summary:
The sorting algo differs in the test from the node algo if the number of accepted contenders is > AVALANCHE_CONTENDER_MAX_POLLABLE, which is a rare event.

To reproduce you can reduce AVALANCHE_CONTENDER_MAX_POLLABLE to some small number (4 is a good value) and run the test in a loop, it should fail quickly without this patch.

Test Plan:

for i in {1..100}; do echo "Trial $i" && ./src/avalanche/test/test-avalanche -t processor_tests/stake_contender_local_winners || break; done

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Differential Revision: https://reviews.bitcoinabc.org/D17950

Details

Provenance
FabienAuthored on Fri, Apr 18, 14:44
FabienPushed on Fri, Apr 18, 22:01
Reviewer
Restricted Project
Differential Revision
D17950: [avalanche] Fix stake contender unit test occasional failure
Parents
rABC0eaa9c9c1589: [chronik-client] Added a mechanism for automatically selecting the fastest…
Branches
Unknown
Tags
Unknown