aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2017-08-11 16:57:51 +0200
committerMarcoFalke <falke.marco@gmail.com>2017-08-11 16:58:28 +0200
commite5d26e47c7a482c072a7fe47bb84c56854734184 (patch)
treec4729903b783438df2c6ece1dab3e32e7dff3ae6 /test
parent96a63a3e0cefe920819bd42add0041837b1214a1 (diff)
parentfaa76d1b79cc63177c8e165c9a2dc761aac7ccf4 (diff)
Merge #11025: qa: Fix inv race in example_test
faa76d1b7 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
Diffstat (limited to 'test')
-rwxr-xr-xtest/functional/example_test.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/functional/example_test.py b/test/functional/example_test.py
index 1ba5f756cd..7709524f23 100755
--- a/test/functional/example_test.py
+++ b/test/functional/example_test.py
@@ -58,6 +58,10 @@ class BaseNode(NodeConnCB):
message.block.calc_sha256()
self.block_receive_map[message.block.sha256] += 1
+ def on_inv(self, conn, message):
+ """Override the standard on_inv callback"""
+ pass
+
def custom_function():
"""Do some custom behaviour
@@ -198,10 +202,10 @@ class ExampleTest(BitcoinTestFramework):
self.log.info("Wait for node2 reach current tip. Test that it has propogated all the blocks to us")
+ getdata_request = msg_getdata()
for block in blocks:
- getdata_request = msg_getdata()
getdata_request.inv.append(CInv(2, block))
- node2.send_message(getdata_request)
+ node2.send_message(getdata_request)
# wait_until() will loop until a predicate condition is met. Use it to test properties of the
# NodeConnCB objects.