Restores seednode host/ip resolution via certificates.

pull/2873/head
Kieran R. Prasch 2022-03-22 17:08:09 -07:00
parent fc943eff92
commit cb49fd4c03
2 changed files with 11 additions and 2 deletions

View File

@ -1153,9 +1153,18 @@ class Ursula(Teacher, Character, Operator):
# Parse node URI
host, port, staking_provider_address = parse_node_uri(seed_uri)
# Fetch the hosts TLS certificate and read the common name
try:
certificate, _filepath = network_middleware.client.get_certificate(host=host, port=port)
except NodeSeemsToBeDown as e:
e.args += (f"While trying to load seednode {seed_uri}",)
e.crash_right_now = True
raise
real_host = certificate.subject.get_attributes_for_oid(NameOID.COMMON_NAME)[0].value
# Load the host as a potential seed node
potential_seed_node = cls.from_rest_url(
host=host,
host=real_host,
port=port,
network_middleware=network_middleware,
)

View File

@ -72,7 +72,7 @@ class NucypherMiddlewareClient:
except socket.timeout:
if current_attempt == retry_attempts:
message = f"No Response from {host}:{port} after {retry_attempts} attempts"
self.log.info(message)
SSL_LOGGER.info(message)
raise ConnectionRefusedError("No response from {}:{}".format(host, port))
SSL_LOGGER.info(f"No Response from {host}:{port}. Retrying in {retry_rate} seconds...")
time.sleep(retry_rate)