aboutsummaryrefslogtreecommitdiff
path: root/test/functional/test_framework/mininode.py
diff options
context:
space:
mode:
authorJohn Newbery <john@johnnewbery.com>2017-05-02 16:34:44 -0400
committerJohn Newbery <john@johnnewbery.com>2017-05-03 09:08:29 -0400
commit3e3c22f09d37169fa88327323c3755be6dbd9a62 (patch)
tree632303ea2e62d6a2f8a797ef0bf21e149c9f921a /test/functional/test_framework/mininode.py
parentdc8fc0c73bebbc1c48ac5540026030c9cc00ec23 (diff)
downloadbitcoin-3e3c22f09d37169fa88327323c3755be6dbd9a62.tar.xz
[tests] fix wait_for_inv()
Diffstat (limited to 'test/functional/test_framework/mininode.py')
-rwxr-xr-xtest/functional/test_framework/mininode.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/test/functional/test_framework/mininode.py b/test/functional/test_framework/mininode.py
index 03db0d1092..70bba566c7 100755
--- a/test/functional/test_framework/mininode.py
+++ b/test/functional/test_framework/mininode.py
@@ -1604,7 +1604,12 @@ class NodeConnCB(object):
assert wait_until(test_function, timeout=timeout)
def wait_for_inv(self, expected_inv, timeout=60):
- test_function = lambda: self.last_message.get("inv") and self.last_message["inv"] != expected_inv
+ """Waits for an INV message and checks that the first inv object in the message was as expected."""
+ if len(expected_inv) > 1:
+ raise NotImplementedError("wait_for_inv() will only verify the first inv object")
+ test_function = lambda: self.last_message.get("inv") and \
+ self.last_message["inv"].inv[0].type == expected_inv[0].type and \
+ self.last_message["inv"].inv[0].hash == expected_inv[0].hash
assert wait_until(test_function, timeout=timeout)
def wait_for_verack(self, timeout=60):