From 7c7089a011ac9c7a3e61c3a2503d59d134d856f0 Mon Sep 17 00:00:00 2001 From: Jeffrey Ryan Date: Fri, 12 Mar 2021 14:53:51 -0600 Subject: [PATCH] Fix output_indices bug (#94) When I wrote the output code, I made the assumption that if a transaction was not in the transaction pool then its "output_indices" atrribute would be present. However, upon further testing I found that for transactions with 0 outputs, such as at height 202612, the Monero daemon returns a JSON object with no "output_indices" attribute. This PR should keep a KeyError from occurring. --- monero/backends/jsonrpc/daemon.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/monero/backends/jsonrpc/daemon.py b/monero/backends/jsonrpc/daemon.py index 07905d5..1569770 100644 --- a/monero/backends/jsonrpc/daemon.py +++ b/monero/backends/jsonrpc/daemon.py @@ -163,7 +163,7 @@ class JSONRPCDaemon(object): timestamp=datetime.fromtimestamp( tx['block_timestamp']) if 'block_timestamp' in tx else None, blob=binascii.unhexlify(tx['as_hex']) or None, - output_indices=None if tx['in_pool'] else tx['output_indices'], + output_indices=tx['output_indices'] if ('output_indices' in tx) else None, json=as_json)) return txs