[avalanche] Fix incomplete testing of contenders when staking rewards are active
Summary:
Version of D18003 rebased on D18033.
Depends on D18033.
D17997 erroneously asserts ACCEPTED for all contenders which is obviously wrong. I mistakenly assumed the contenders test was being run on the diff but it turns out contenders just barely exceeds the cutoff timing.
This diff does a few things:
- After the node is restarted, but before a new block is mined, check staking rewards status and use that to verify avalanche status of contenders.
- Activate staking rewards predictably and invalidate contenders for each block. This ensures the vote statuses are predictable and we get the same results on CI and local dev.
Test Plan:
Verify the test is not flaky:
for I in {0..20} do ; ./test/functional/test_runner.py abc_p2p_avalanche_contender_voting || break ; done
And have the bot run extended tests on this diff.
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: roqqit
Differential Revision: https://reviews.bitcoinabc.org/D18036