Skip to content

Commit cf8c243

Browse files
committed
dnssec: log warning if dependency is missing
Calling dnssec.query() with missing "cryptography" dep behaves the same as if DNSSEC validation failed: validated=False will be returned. When used for openalias, we mandate validated=True.
1 parent cdcac8c commit cf8c243

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

electrum/dnssec.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
# http://backreference.org/2010/11/17/dnssec-verification-with-dig/
3131
# https://github.com/rthalley/dnspython/blob/master/tests/test_dnssec.py
3232

33+
import logging
3334

3435
import dns
3536
import dns.name
@@ -150,7 +151,8 @@ async def query(url: str, rtype: dns.rdatatype.RdataType) -> Tuple[dns.rrset.RRs
150151
out = await _get_and_validate(ns, url, rtype)
151152
validated = True
152153
except Exception as e:
153-
_logger.info(f"DNSSEC error: {repr(e)}")
154+
log_level = logging.WARNING if isinstance(e, ImportError) else logging.INFO
155+
_logger.log(log_level, f"DNSSEC error: {repr(e)}")
154156
out = await dns.asyncresolver.resolve(url, rtype)
155157
validated = False
156158
return out, validated

0 commit comments

Comments
 (0)