diff --git a/contrib/requirements/requirements.txt b/contrib/requirements/requirements.txt index 7dfe07373..be58e5089 100644 --- a/contrib/requirements/requirements.txt +++ b/contrib/requirements/requirements.txt @@ -12,4 +12,4 @@ electrum_aionostr>=0.0.8,<0.1 # Note that we also need the dnspython[DNSSEC] extra which pulls in cryptography, # but as that is not pure-python it cannot be listed in this file! -dnspython>=2.0 +dnspython>=2.2 diff --git a/electrum/dns_hacks.py b/electrum/dns_hacks.py index 43e0c2613..08708be8d 100644 --- a/electrum/dns_hacks.py +++ b/electrum/dns_hacks.py @@ -14,6 +14,7 @@ import dns.asyncresolver from .logging import get_logger from .util import get_asyncio_loop +from . import util _logger = get_logger(__name__) @@ -63,6 +64,7 @@ def _fast_getaddrinfo(host, *args, **kwargs): expected_errors = (dns.resolver.NXDOMAIN, dns.resolver.NoAnswer, concurrent.futures.CancelledError, concurrent.futures.TimeoutError) loop = get_asyncio_loop() + assert util.get_running_loop() != loop, 'must not be called from asyncio thread' ipv6_fut = asyncio.run_coroutine_threadsafe( dns.asyncresolver.resolve(host, dns.rdatatype.AAAA), loop,