electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 8c5601a17263d5e29aeba2b83facd5386d3baed1
parent 6273b4808fc6748d1957e837c736665ce70b5295
Author: SomberNight <somber.night@protonmail.com>
Date:   Wed,  9 Dec 2020 09:04:04 +0100

dnspython: fix deprecation warnings when using dnspython 2.0

related: #6828

Diffstat:
Melectrum/dns_hacks.py | 4++--
Melectrum/dnssec.py | 3+--
Melectrum/lnworker.py | 2+-
Melectrum/util.py | 2+-
4 files changed, 5 insertions(+), 6 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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))