electrum

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

commit ea64b2af64a29d4f640714e60a136cf4e00d6d61
parent ef5ad5f22f3d42d0dc7e1e81eaacaad84b3fcda2
Author: SomberNight <somber.night@protonmail.com>
Date:   Thu, 16 Apr 2020 17:31:58 +0200

interface.get_certificate: use public asyncio APIs

Diffstat:
Melectrum/interface.py | 13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/electrum/interface.py b/electrum/interface.py @@ -463,13 +463,12 @@ class Interface(Logger): async def get_certificate(self): sslc = ssl.SSLContext() - try: - async with _RSClient(session_factory=RPCSession, - host=self.host, port=self.port, - ssl=sslc, proxy=self.proxy) as session: - return session.transport._asyncio_transport._ssl_protocol._sslpipe._sslobj.getpeercert(True) - except ValueError: - return None + async with _RSClient(session_factory=RPCSession, + host=self.host, port=self.port, + ssl=sslc, proxy=self.proxy) as session: + asyncio_transport = session.transport._asyncio_transport # type: asyncio.BaseTransport + ssl_object = asyncio_transport.get_extra_info("ssl_object") # type: ssl.SSLObject + return ssl_object.getpeercert(binary_form=True) async def get_block_header(self, height, assert_mode): self.logger.info(f'requesting block header {height} in mode {assert_mode}')