Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 581 Lines • ▼ Show 20 Lines | def on_getheaders(self, message): | ||||
# Truncate the list if there are too many headers | # Truncate the list if there are too many headers | ||||
headers_list = headers_list[:-maxheaders - 1:-1] | headers_list = headers_list[:-maxheaders - 1:-1] | ||||
response = msg_headers(headers_list) | response = msg_headers(headers_list) | ||||
if response is not None: | if response is not None: | ||||
self.send_message(response) | self.send_message(response) | ||||
def send_blocks_and_test(self, blocks, node, *, success=True, force_send=False, reject_reason=None, expect_disconnect=False, timeout=60): | def send_blocks_and_test(self, blocks, node, *, success=True, force_send=False, | ||||
reject_reason=None, expect_disconnect=False, timeout=60): | |||||
"""Send blocks to test node and test whether the tip advances. | """Send blocks to test node and test whether the tip advances. | ||||
- add all blocks to our block_store | - add all blocks to our block_store | ||||
- send a headers message for the final block | - send a headers message for the final block | ||||
- the on_getheaders handler will ensure that any getheaders are responded to | - the on_getheaders handler will ensure that any getheaders are responded to | ||||
- if force_send is False: wait for getdata for each of the blocks. The on_getdata handler will | - if force_send is False: wait for getdata for each of the blocks. The on_getdata handler will | ||||
ensure that any getdata messages are responded to. Otherwise send the full block unsolicited. | ensure that any getdata messages are responded to. Otherwise send the full block unsolicited. | ||||
- if success is True: assert that the node's tip advances to the most recent block | - if success is True: assert that the node's tip advances to the most recent block | ||||
▲ Show 20 Lines • Show All 75 Lines • Show Last 20 Lines |