From 7995d9d4d0f553e9f98599b07a2aebd6d2272592 Mon Sep 17 00:00:00 2001 From: Graham Dixon Date: Thu, 18 Nov 2021 00:37:32 +0000 Subject: [PATCH] fix: ensure that an invalid txhash will not halt the sync command --- app/dashboard/sync/tezos.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/dashboard/sync/tezos.py b/app/dashboard/sync/tezos.py index 258c7a9bc93..d2d8b3e1860 100644 --- a/app/dashboard/sync/tezos.py +++ b/app/dashboard/sync/tezos.py @@ -46,7 +46,8 @@ def get_tezos_txn_status(fulfillment): tx_response = requests.get(f'{BASE_URL}/operations/{txnid}').json() - if tx_response: + # a valid response will return a list whereas an invalid response will return a dict + if tx_response and isinstance(tx_response, list) and len(tx_response) > 0: tx_response = tx_response[0] block_tip = requests.get(f'{BASE_URL}/head').json()['level'] confirmations = block_tip - tx_response['level'] @@ -70,7 +71,7 @@ def sync_tezos_payout(fulfillment): if txn: fulfillment.payout_tx_id = txn['hash'] fulfillment.save() - + if fulfillment.payout_tx_id and fulfillment.payout_tx_id != "0x0": txn_status = get_tezos_txn_status(fulfillment)