diff --git a/electrum/dns_hacks.py b/electrum/dns_hacks.py index f8260ed05..6f45459a7 100644 --- a/electrum/dns_hacks.py +++ b/electrum/dns_hacks.py @@ -69,8 +69,8 @@ def _fast_getaddrinfo(host, *args, **kwargs): addrs = [] expected_errors = (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, concurrent.futures.CancelledError, concurrent.futures.TimeoutError) - ipv6_fut = _dns_threads_executor.submit(dns.resolver.query, host, dns.rdatatype.AAAA) - ipv4_fut = _dns_threads_executor.submit(dns.resolver.query, host, dns.rdatatype.A) + ipv6_fut = _dns_threads_executor.submit(dns.resolver.resolve, host, dns.rdatatype.AAAA) + ipv4_fut = _dns_threads_executor.submit(dns.resolver.resolve, host, dns.rdatatype.A) # try IPv6 try: answers = ipv6_fut.result() diff --git a/electrum/dnssec.py b/electrum/dnssec.py index 331cac74d..934787d8c 100644 --- a/electrum/dnssec.py +++ b/electrum/dnssec.py @@ -151,7 +151,6 @@ def query(url, rtype): validated = True except BaseException as e: _logger.info(f"DNSSEC error: {repr(e)}") - resolver = dns.resolver.get_default_resolver() - out = resolver.query(url, rtype) + out = dns.resolver.resolve(url, rtype) validated = False return out, validated diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 8ffd825ae..a79380f8e 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -382,7 +382,7 @@ class LNWorker(Logger, NetworkRetryManager[LNPeerAddr]): for srv_ans in srv_answers: try: # note: this might block for several seconds - answers = dns.resolver.query(srv_ans['host']) + answers = dns.resolver.resolve(srv_ans['host']) except dns.exception.DNSException as e: self.logger.info(f'failed querying (2) dns seed "{dns_seed}" for ln peers: {repr(e)}') continue diff --git a/electrum/util.py b/electrum/util.py index 68ae69cf8..93ac3e7ab 100644 --- a/electrum/util.py +++ b/electrum/util.py @@ -1295,7 +1295,7 @@ def list_enabled_bits(x: int) -> Sequence[int]: def resolve_dns_srv(host: str): - srv_records = dns.resolver.query(host, 'SRV') + srv_records = dns.resolver.resolve(host, 'SRV') # priority: prefer lower # weight: tie breaker; prefer higher srv_records = sorted(srv_records, key=lambda x: (x.priority, -x.weight))