HomePhabricator

Fix a rare failure in the peermanager tests

Description

Fix a rare failure in the peermanager tests

Summary:
The randrange() method expects the range to be non zero.
In the peermanager_tests/select_peer_random case the max variable
can be 0 and fail the test. Since we still want to test slot 0, set slot = 0
when max == 0 without calling the randrange() method.

Test Plan:

ninja check-avalanche

Reviewers: #bitcoin_abc, PiRK

Reviewed By: #bitcoin_abc, PiRK

Subscribers: PiRK

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

Details

Provenance
FabienAuthored on Nov 10 2020, 08:19
FabienPushed on Nov 10 2020, 09:33
Reviewer
Restricted Project
Differential Revision
D8345: Fix a rare failure in the peermanager tests
Parents
rABCa37866bcc40a: test: Fix intermittent sync_blocks failures
Branches
Unknown
Tags
Unknown