Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure that an invalid tezos txhash will not halt the sync command #9699

Merged
merged 1 commit into from
Nov 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/dashboard/sync/tezos.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we switch this to ensure that txn_status is set to expired for this scenarios. ?
That way the txn isn't stuck in pending forever

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can, are we sure that after a tx is made it will appear on this API instantly? If there is a delay then we risk setting non-propagated tx's to expired?

tx_response = tx_response[0]
block_tip = requests.get(f'{BASE_URL}/head').json()['level']
confirmations = block_tip - tx_response['level']
Expand All @@ -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)

Expand Down