From 20c26a6bde3291bd97b7c72ce6264c4d8a8f89ef Mon Sep 17 00:00:00 2001 From: mecampbellsoup Date: Mon, 23 Oct 2017 11:53:50 -0400 Subject: [PATCH] Catch IndexError when deserializing wallet transactions --- wallet-tool.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/wallet-tool.py b/wallet-tool.py index a9be89d2..3da1e71c 100644 --- a/wallet-tool.py +++ b/wallet-tool.py @@ -459,12 +459,17 @@ def skip_n1_btc(v): try: wallet_tx = jm_single().bc_interface.rpc('gettransaction', [ins['outpoint']['hash']]) + input_dict = btc.deserialize(str(wallet_tx['hex']))['outs'][ins[ + 'outpoint']['index']] + rpc_inputs.append(input_dict) except JsonRpcError: continue - input_dict = btc.deserialize(str(wallet_tx['hex']))['outs'][ins[ - 'outpoint']['index']] - rpc_inputs.append(input_dict) - + except IndexError: + print("\n") + print(ins) + print("\n") + print(btc.deserialize(str(wallet_tx['hex']))) + print("\n") rpc_input_addrs = set((btc.script_to_address(ind['script'], get_p2pk_vbyte()) for ind in rpc_inputs)) our_input_addrs = wallet_addr_set.intersection(rpc_input_addrs)