Skip to content

Commit

Permalink
add commit and more time to sync federation block to avoid failure in…
Browse files Browse the repository at this point in the history
… debug builds
  • Loading branch information
Naviabheeman authored and azuchi committed Jul 21, 2023
1 parent 04c6621 commit 3ef3bc0
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions test/functional/p2p_sendheaders.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@
* peer sends response-type [expect headers if getheaders, getheaders/getdata if mining new block]
* node mines 1 block [expect: 1 header, peer responds with getdata]
Part 4: Test direct fetch behavior
Part 4a: Test direct fetch behavior
Part 4b: Test direct fetch behavior after federation block
a. Announce 2 old block headers.
Expect: no getdata requests.
b. Announce 3 new blocks via 1 headers message.
Expand Down Expand Up @@ -107,6 +108,7 @@
sync_blocks,
wait_until,
)
from time import sleep

DIRECT_FETCH_RESPONSE_TIME = 0.05

Expand Down Expand Up @@ -263,6 +265,8 @@ def mine_federation_block(self, test_node):
self.signblockprivkey = "aa2c70c4b85a09be514292d04b27bbb0cc3f86d306d58fe87743d10a095ada07"
self.signblockprivkey_wif = "cTHVmjaAwKtU75t89fg42SLx43nRxhsri6YY1Eynvs1V1tPRCfae"

return block.hash


def run_test(self):
# Setup the p2p connections
Expand Down Expand Up @@ -569,10 +573,14 @@ def test_nonnull_locators(self, test_node, inv_node):

# Setup the p2p connections again
inv_node = self.nodes[0].add_p2p_connection(BaseNode(self.nodes[0].time_to_connect))
inv_node.sync_with_ping()
inv_node.sync_with_ping(timeout=100)

test_node = self.nodes[0].add_p2p_connection(BaseNode(self.nodes[0].time_to_connect))
test_node.sync_with_ping()
test_node.sync_with_ping(timeout=100)

#wait for the federation block to sync
while self.nodes[0].getbestblockhash() != tip:
sleep(1)

#repeat sequence in 4a
tip = self.mine_blocks(1)
Expand Down

0 comments on commit 3ef3bc0

Please sign in to comment.