[avalanche] Make sure each proof is added to contender cache before mining the next block in contender voting test
Summary:
As part of generating proofs, it is possible for the node to mine the next block before adding the proof to the contender cache because mining a block takes a lock on cs_main, for which addStakeContender() also requires a lock. This patch ensures the proof was added to the cache before generating the next proof and mining the block associated with that.
This should fix some flakiness with the contender voting test.
Test Plan:
./test/functional/test_runner.py abc_p2p_avalanche_contender_voting
Reviewers: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D17345