Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 1,687 Lines • ▼ Show 20 Lines | def wait_for_getdata(self, timeout=60): | ||||
def test_function(): return self.last_message.get("getdata") | def test_function(): return self.last_message.get("getdata") | ||||
assert wait_until(test_function, timeout=timeout) | assert wait_until(test_function, timeout=timeout) | ||||
def wait_for_getheaders(self, timeout=60): | def wait_for_getheaders(self, timeout=60): | ||||
def test_function(): return self.last_message.get("getheaders") | def test_function(): return self.last_message.get("getheaders") | ||||
assert wait_until(test_function, timeout=timeout) | assert wait_until(test_function, timeout=timeout) | ||||
def wait_for_inv(self, expected_inv, timeout=60): | def wait_for_inv(self, expected_inv, timeout=60): | ||||
def test_function(): return self.last_message.get( | """Waits for an INV message and checks that the first inv object in the message was as expected.""" | ||||
"inv") and self.last_message["inv"] != expected_inv | if len(expected_inv) > 1: | ||||
raise NotImplementedError( | |||||
"wait_for_inv() will only verify the first inv object") | |||||
def test_function(): return 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) | assert wait_until(test_function, timeout=timeout) | ||||
def wait_for_verack(self, timeout=60): | def wait_for_verack(self, timeout=60): | ||||
def test_function(): return self.message_count["verack"] | def test_function(): return self.message_count["verack"] | ||||
assert wait_until(test_function, timeout=timeout) | assert wait_until(test_function, timeout=timeout) | ||||
# Message sending helper functions | # Message sending helper functions | ||||
▲ Show 20 Lines • Show All 253 Lines • Show Last 20 Lines |