def get_block_hashes(settings, max_blocks_per_call=10000):
    rpc = BitcoinRPC(settings['host'], settings['port'], settings['rpcuser'], settings['rpcpassword'])
    height = settings['min_height']
    while (height < (settings['max_height'] + 1)):
        num_blocks = min(((settings['max_height'] + 1) - height), max_blocks_per_call)
        batch = []
        for x in range(num_blocks):
            batch.append(rpc.build_request(x, 'getblockhash', [(height + x)]))
        reply = rpc.execute(batch)
        for (x, resp_obj) in enumerate(reply):
            if rpc.response_is_error(resp_obj):
                print('JSON-RPC: error at height', (height + x), ': ', resp_obj['error'], file=sys.stderr)
                exit(1)
            assert (resp_obj['id'] == x)
            print(resp_obj['result'])
        height += num_blocks
def get_block_hashes(settings, max_blocks_per_call=10000):
    rpc = BitcoinRPC(settings['host'], settings['port'], settings['rpcuser'], settings['rpcpassword'])
    height = settings['min_height']
    while (height < (settings['max_height'] + 1)):
        num_blocks = min(((settings['max_height'] + 1) - height), max_blocks_per_call)
        batch = []
        for x in range(num_blocks):
            batch.append(rpc.build_request(x, 'getblockhash', [(height + x)]))
        reply = rpc.execute(batch)
        for (x, resp_obj) in enumerate(reply):
            if rpc.response_is_error(resp_obj):
                print('JSON-RPC: error at height', (height + x), ': ', resp_obj['error'], file=sys.stderr)
                exit(1)
            assert (resp_obj['id'] == x)
            print(resp_obj['result'])
        height += num_blocks