This PR changes the sync_blocks test function to make it more reliable.
The change is based on #9196 to prevent a test failure that would otherwise start to happen.
This change is needed to prevent sync_blocks timeouts in the mempool_reorg
test after the sync_blocks update in the upcoming commit
"[qa] Change sync_blocks to pick smarter maxheight".
This change was initially suggested by Suhas Daftuar <sdaftuar@chaincode.com>
in https://github.com/bitcoin/bitcoin/pull/8680#r78209060
Instead of syncing to max height returned by the waitforblockheight RPC, sync
to the max height returned by the getblockcount RPC.
This change was suggested by Suhas Daftuar <sdaftuar@chaincode.com>.
128 | @@ -129,17 +129,19 @@ def sync_blocks(rpc_connections, *, wait=1, timeout=60):
129 | one node already synced to the latest, stable tip, otherwise there's a
130 | chance it might return before all nodes are stably synced.
Does this comment still apply, considering that you switched from 0 to getblockcount?
This change might make the problem less likely to happen, but it still could happen. If none of the nodes in the set are fully synced when the sync_blocks call is made, then maxheight will be set to some height less than the final stable height, and the call could return before the nodes are all synced.
Concept ACK
ACK
@ryanofsky The 60cf51c patch looks like a separate bugfix, not strictly related to tests. Would you mind submitting this as another pull request?