aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/mininode.py
diff options
context:
space:
mode:
authorDanny Lee <robot-visions@protonmail.com>2020-04-17 02:23:02 -0700
committerDanny Lee <robot-visions@protonmail.com>2020-04-22 10:46:08 -0700
commit9f5608c2893f89cd56c7c548b748996199e0da1d (patch)
treebc2b9b73d6dc16533591f5252f409fe123811766 /test/functional/test_framework/mininode.py
parenta7a6f1ff417abc2452a2a2b9edcd2f12d6c14441 (diff)
test: check for matching object hashes in wait_for_getdata
Diffstat (limited to 'test/functional/test_framework/mininode.py')
-rwxr-xr-xtest/functional/test_framework/mininode.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py
index ea078fd81c..6aa73623e6 100755
--- a/test/functional/test_framework/mininode.py
+++ b/test/functional/test_framework/mininode.py
@@ -406,17 +406,17 @@ class P2PInterface(P2PConnection):
wait_until(test_function, timeout=timeout, lock=mininode_lock)
- def wait_for_getdata(self, timeout=60):
+ def wait_for_getdata(self, hash_list, timeout=60):
"""Waits for a getdata message.
- Receiving any getdata message will satisfy the predicate. the last_message["getdata"]
- value must be explicitly cleared before calling this method, or this will return
- immediately with success. TODO: change this method to take a hash value and only
- return true if the correct block/tx has been requested."""
+ The object hashes in the inventory vector must match the provided hash_list."""
def test_function():
assert self.is_connected
- return self.last_message.get("getdata")
+ last_data = self.last_message.get("getdata")
+ if not last_data:
+ return False
+ return [x.hash for x in last_data.inv] == hash_list
wait_until(test_function, timeout=timeout, lock=mininode_lock)