commit e0a7f86247dbacccaab12fc4159bec6071058b78
parent 8c84ffe6af24cf3bf1c08ee67413965ad7c58a1d
Author: parazyd <parazyd@dyne.org>
Date: Fri, 12 Mar 2021 23:01:19 +0100
interface: Fix gettransaction.
Diffstat:
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/electrum/interface.py b/electrum/interface.py
@@ -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}")
diff --git a/electrum/zeromq.py b/electrum/zeromq.py
@@ -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):
@@ -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")