@ignore_exceptions
@log_exceptions
async def sync_with_remote_watchtower(self):
    while True:
        (await asyncio.sleep(5))
        watchtower_url = self.config.get('watchtower_url')
        if (not watchtower_url):
            continue
        parsed_url = urllib.parse.urlparse(watchtower_url)
        if (not ((parsed_url.scheme == 'https') or is_private_netaddress(parsed_url.hostname))):
            self.logger.warning(f"got watchtower URL for remote tower but we won't use it! can only use HTTPS (except if private IP): not using {watchtower_url!r}")
            continue
        try:
            async with make_aiohttp_session(proxy=self.network.proxy) as session:
                watchtower = JsonRPCClient(session, watchtower_url)
                watchtower.add_method('get_ctn')
                watchtower.add_method('add_sweep_tx')
                for chan in self.channels.values():
                    (await self.sync_channel_with_watchtower(chan, watchtower))
        except aiohttp.client_exceptions.ClientConnectorError:
            self.logger.info(f'could not contact remote watchtower {watchtower_url}')
@ignore_exceptions
@log_exceptions
async def sync_with_remote_watchtower(self):
    while True:
        (await asyncio.sleep(5))
        watchtower_url = self.config.get('watchtower_url')
        if (not watchtower_url):
            continue
        parsed_url = urllib.parse.urlparse(watchtower_url)
        if (not ((parsed_url.scheme == 'https') or is_private_netaddress(parsed_url.hostname))):
            self.logger.warning(f"got watchtower URL for remote tower but we won't use it! can only use HTTPS (except if private IP): not using {watchtower_url!r}")
            continue
        try:
            async with make_aiohttp_session(proxy=self.network.proxy) as session:
                watchtower = JsonRPCClient(session, watchtower_url)
                watchtower.add_method('get_ctn')
                watchtower.add_method('add_sweep_tx')
                for chan in self.channels.values():
                    (await self.sync_channel_with_watchtower(chan, watchtower))
        except aiohttp.client_exceptions.ClientConnectorError:
            self.logger.info(f'could not contact remote watchtower {watchtower_url}')