Skip to content

Commit e5d26e4

Browse files
author
MarcoFalke
committed
Merge #11025: qa: Fix inv race in example_test
faa76d1 qa: Fix inv race in example_test (MarcoFalke) Pull request description: There have been intermittent test failures on this script. ```py File "./test/functional/example_test.py", line 216, in run_test assert_equal(block, 1) AssertionError: not(2 == 1) ``` Probably the simplest way to fix them is overriding the `on_inv` method, so that no "colliding" getdata for the blocks are sent out. Additionally, all getdata are now sent in a single message. Tree-SHA512: 809c2bbfa90a67fc97905769fcbe90ba9abe1aac1f145530934f56a364835973b94d3302b6be68f4f2987acf333bce146bcc4c878c283301871ba5bb1a9bedb6
2 parents 96a63a3 + faa76d1 commit e5d26e4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

test/functional/example_test.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ def on_block(self, conn, message):
5858
message.block.calc_sha256()
5959
self.block_receive_map[message.block.sha256] += 1
6060

61+
def on_inv(self, conn, message):
62+
"""Override the standard on_inv callback"""
63+
pass
64+
6165
def custom_function():
6266
"""Do some custom behaviour
6367
@@ -198,10 +202,10 @@ def run_test(self):
198202

199203
self.log.info("Wait for node2 reach current tip. Test that it has propogated all the blocks to us")
200204

205+
getdata_request = msg_getdata()
201206
for block in blocks:
202-
getdata_request = msg_getdata()
203207
getdata_request.inv.append(CInv(2, block))
204-
node2.send_message(getdata_request)
208+
node2.send_message(getdata_request)
205209

206210
# wait_until() will loop until a predicate condition is met. Use it to test properties of the
207211
# NodeConnCB objects.

0 commit comments

Comments
 (0)