diff --git a/test/functional/abc-p2p-avalanche.py b/test/functional/abc-p2p-avalanche.py --- a/test/functional/abc-p2p-avalanche.py +++ b/test/functional/abc-p2p-avalanche.py @@ -12,7 +12,11 @@ msg_avapoll, ) from test_framework.test_framework import BitcoinTestFramework -from test_framework.util import assert_equal, wait_until +from test_framework.util import ( + assert_equal, + sync_blocks, + wait_until, +) from test_framework import schnorr @@ -84,6 +88,10 @@ address = node.get_deterministic_priv_key().address node.generatetoaddress(100, address) + fork_node = self.nodes[1] + # Make sure the fork node has synced the blocks + sync_blocks([node, fork_node]) + # Get the key so we can verify signatures. avakey = bytes.fromhex(node.getavalanchekey()) @@ -167,9 +175,8 @@ node.addavalanchepeer(nodeid, pubkey.hex()) - # Sanity check - fork_node = self.nodes[1] - assert_equal(node.getbestblockhash(), fork_node.getbestblockhash()) + # Make sure the fork node has synced the blocks + sync_blocks([node, fork_node]) # Create a fork 2 blocks deep. This should trigger polling. fork_node.invalidateblock(fork_node.getblockhash(100))