diff --git a/data/nodes.json b/data/nodes.json index 79da3b0..c5604e6 100644 --- a/data/nodes.json +++ b/data/nodes.json @@ -16,6 +16,7 @@ "eu-west-5.wow.xmr.pm:34568", "eu-west-6.wow.xmr.pm:34568", "na-west-1.wow.xmr.pm:34568", + "wowbux.org:34568", "169.119.33.174:34568", "wow.bot.tips:34568", "idontwanttogototoronto.wow.fail:34568" diff --git a/wowlet_backend/tasks/rpc_nodes.py b/wowlet_backend/tasks/rpc_nodes.py index bdee002..2d44b2c 100644 --- a/wowlet_backend/tasks/rpc_nodes.py +++ b/wowlet_backend/tasks/rpc_nodes.py @@ -41,19 +41,26 @@ class RPCNodeCheckTask(WowletTask): for network_type, _nodes in _.items(): for node in _nodes: - try: - blob = await self.node_check(node, network_type=network_type) - data.append(blob) - except Exception as ex: - app.logger.warning(f"node {node} not reachable; {ex}") + for scheme in ["https", "http"]: + try: + blob = await self.node_check(f"{scheme}://{node}", network_type=network_type) + blob['tls'] = True if scheme == "https" else False + data.append(blob) + break + except Exception as ex: + continue + + if not data: + app.logger.warning(f"node {node} not reachable") data.append(self._bad_node({ "address": node, "nettype": network_type_coin, "type": network_type, - "height": 0 + "height": 0, + "tls": False }, reason="unreachable")) - # not neccesary for stagenet/testnet nodes to be validated + # not necessary for stagenet/testnet nodes to be validated if network_type_coin != "mainnet": nodes += data continue @@ -82,14 +89,15 @@ class RPCNodeCheckTask(WowletTask): """Call /get_info on the RPC, return JSON""" opts = { "timeout": self._http_timeout, - "json": True + "json": True, + "verify_tls": False } if network_type == "tor": opts["socks5"] = settings.TOR_SOCKS_PROXY opts["timeout"] = self._http_timeout_onion - blob = await httpget(f"http://{node}/get_info", **opts) + blob = await httpget(f"{node}/get_info", **opts) for expect in ["nettype", "height", "target_height"]: if expect not in blob: raise Exception(f"Invalid JSON response from RPC; expected key '{expect}'") diff --git a/wowlet_backend/utils.py b/wowlet_backend/utils.py index 151c742..f3c8af4 100644 --- a/wowlet_backend/utils.py +++ b/wowlet_backend/utils.py @@ -54,14 +54,14 @@ def collect_websocket(func): return wrapper -async def httpget(url: str, json=True, timeout: int = 5, socks5: str = None, raise_for_status=True): +async def httpget(url: str, json=True, timeout: int = 5, socks5: str = None, raise_for_status=True, verify_tls=True): headers = {"User-Agent": random_agent()} opts = {"timeout": aiohttp.ClientTimeout(total=timeout)} if socks5: opts['connector'] = ProxyConnector.from_url(socks5) async with aiohttp.ClientSession(**opts) as session: - async with session.get(url, headers=headers) as response: + async with session.get(url, headers=headers, ssl=verify_tls) as response: if raise_for_status: response.raise_for_status()