1
0

interface.get_transaction: stricter sanitisation

in particular, Transaction.__init__ allows leading/trailing whitespaces
This commit is contained in:
SomberNight
2021-01-27 20:14:55 +01:00
parent 7294613447
commit 338adf05ba

View File

@@ -917,6 +917,8 @@ class Interface(Logger):
raise Exception(f"{repr(tx_hash)} is not a txid")
raw = await self.session.send_request('blockchain.transaction.get', [tx_hash], timeout=timeout)
# validate response
if not is_hex_str(raw):
raise RequestCorrupted(f"received garbage (non-hex) as tx data (txid {tx_hash}): {raw!r}")
tx = Transaction(raw)
try:
tx.deserialize() # see if raises