electrum

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

commit eaf203dbb566a555253e22dbd42affefad218869
parent 37da192bf57401ff04dd7635c67f8f993c2e0d62
Author: SomberNight <somber.night@protonmail.com>
Date:   Mon, 27 May 2019 19:09:54 +0200

interface: fix connecting to new servers using self-signed certs

got broken in 6ec1578a90916436b3bfabe90cafd9bfc804a332

Diffstat:
Melectrum/interface.py | 9+++++----
1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/electrum/interface.py b/electrum/interface.py @@ -177,7 +177,8 @@ class _Connector(aiorpcx.Connector): try: return await super().create_connection() except OSError as e: - raise ConnectError(e) + # note: using "from e" here will set __cause__ of ConnectError + raise ConnectError(e) from e def deserialize_server(server_str: str) -> Tuple[str, str, str]: @@ -254,11 +255,11 @@ class Interface(Logger): """ try: await self.open_session(ca_ssl_context, exit_early=True) - except ssl.SSLError as e: - if e.reason == 'CERTIFICATE_VERIFY_FAILED': + except ConnectError as e: + cause = e.__cause__ + if isinstance(cause, ssl.SSLError) and cause.reason == 'CERTIFICATE_VERIFY_FAILED': # failures due to self-signed certs are normal return False - # e.g. too weak crypto raise return True