Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_invalid_locator.py
Show All 40 Lines | def run_test(self): | ||||
node.disconnect_p2ps() | node.disconnect_p2ps() | ||||
self.log.info( | self.log.info( | ||||
'Wait for response when sending {} hashes in locator'.format(MAX_LOCATOR_SZ)) | 'Wait for response when sending {} hashes in locator'.format(MAX_LOCATOR_SZ)) | ||||
node.add_p2p_connection(P2PInterface()) | node.add_p2p_connection(P2PInterface()) | ||||
msg.locator.vHave = [int(node.getblockhash( | msg.locator.vHave = [int(node.getblockhash( | ||||
i - 1), 16) for i in range(block_count, block_count - (MAX_LOCATOR_SZ), -1)] | i - 1), 16) for i in range(block_count, block_count - (MAX_LOCATOR_SZ), -1)] | ||||
node.p2p.send_message(msg) | node.p2p.send_message(msg) | ||||
if type(msg) == msg_getheaders: | if isinstance(msg, msg_getheaders): | ||||
node.p2p.wait_for_header(int(node.getbestblockhash(), 16)) | node.p2p.wait_for_header(int(node.getbestblockhash(), 16)) | ||||
else: | else: | ||||
node.p2p.wait_for_block(int(node.getbestblockhash(), 16)) | node.p2p.wait_for_block(int(node.getbestblockhash(), 16)) | ||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
InvalidLocatorTest().main() | InvalidLocatorTest().main() |