Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/mininode.py
Show First 20 Lines • Show All 600 Lines • ▼ Show 20 Lines | def send_blocks_and_test(self, blocks, node, *, success=True, request_block=True, | ||||
with node.assert_debug_log(expected_msgs=reject_reason): | with node.assert_debug_log(expected_msgs=reject_reason): | ||||
self.send_message(msg_headers([CBlockHeader(blocks[-1])])) | self.send_message(msg_headers([CBlockHeader(blocks[-1])])) | ||||
if request_block: | if request_block: | ||||
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() | self.wait_for_disconnect(timeout=timeout) | ||||
else: | else: | ||||
self.sync_with_ping() | self.sync_with_ping(timeout=timeout) | ||||
if success: | if success: | ||||
wait_until(lambda: node.getbestblockhash() | wait_until(lambda: node.getbestblockhash() | ||||
== blocks[-1].hash, timeout=timeout) | == blocks[-1].hash, timeout=timeout) | ||||
else: | else: | ||||
assert node.getbestblockhash() != blocks[-1].hash | assert node.getbestblockhash() != blocks[-1].hash | ||||
def send_txs_and_test(self, txs, node, *, success=True, | def send_txs_and_test(self, txs, node, *, success=True, | ||||
Show All 34 Lines |