Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 631 Lines • ▼ Show 20 Lines | def send_blocks_and_test(self, blocks, node, *, success=True, force_send=False, | ||||
self.last_block_hash = block.sha256 | self.last_block_hash = block.sha256 | ||||
def test(): | def test(): | ||||
if force_send: | if force_send: | ||||
for b in blocks: | for b in blocks: | ||||
self.send_message(msg_block(block=b)) | self.send_message(msg_block(block=b)) | ||||
else: | else: | ||||
self.send_message(msg_headers([CBlockHeader(blocks[-1])])) | self.send_message( | ||||
msg_headers([CBlockHeader(block) for block in blocks])) | |||||
wait_until( | wait_until( | ||||
lambda: blocks[-1].sha256 in self.getdata_requests, timeout=timeout, lock=mininode_lock) | lambda: blocks[-1].sha256 in self.getdata_requests, timeout=timeout, lock=mininode_lock) | ||||
if expect_disconnect: | if expect_disconnect: | ||||
self.wait_for_disconnect(timeout=timeout) | self.wait_for_disconnect(timeout=timeout) | ||||
else: | else: | ||||
self.sync_with_ping(timeout=timeout) | self.sync_with_ping(timeout=timeout) | ||||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |