tinterface: Fix gettransaction. - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit e0a7f86247dbacccaab12fc4159bec6071058b78 DIR parent 8c84ffe6af24cf3bf1c08ee67413965ad7c58a1d HTML Author: parazyd <parazyd@dyne.org> Date: Fri, 12 Mar 2021 23:01:19 +0100 interface: Fix gettransaction. Diffstat: M electrum/interface.py | 6 ++++-- M electrum/zeromq.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) --- DIR diff --git a/electrum/interface.py b/electrum/interface.py t@@ -703,8 +703,10 @@ class Interface(Logger): if not is_hash256_str(tx_hash): raise Exception(f"{repr(tx_hash)} is not a txid") # ORIG: raw = await self.session.send_request('blockchain.transaction.get', [tx_hash], timeout=timeout) - raw = self.client.mempool_transaction(tx_hash) - # raw = self.client.transaction(tx_hash) + #_ec, raw = await self.client.transaction(tx_hash) + _ec, raw = await self.client.mempool_transaction(tx_hash) + if _ec is not None and _ec != 0: + raise RequestCorrupted(f"got error: {_ec!r}") # validate response if not is_hex_str(raw): raise RequestCorrupted(f"received garbage (non-hex) as tx data (txid {tx_hash}): {raw!r}") DIR diff --git a/electrum/zeromq.py b/electrum/zeromq.py t@@ -37,6 +37,8 @@ import zmq.asyncio from .logging import Logger from .libbitcoin_errors import make_error_code, ErrorCode +from .util import bh2u + from datetime import datetime def __(msg): t@@ -398,7 +400,7 @@ class Client: command, bytes.fromhex(hash_)[::-1]) if error_code: return error_code, None - return None, data + return None, bh2u(data) async def broadcast_transaction(self, rawtx): __("Zeromq Client: broadcast_transaction")