Skip to content

Commit

Permalink
[FIX] lcc_comchain_base: manage error case when transaction data is e…
Browse files Browse the repository at this point in the history
…mpty
  • Loading branch information
Stéphan Sainléger committed Oct 23, 2024
1 parent 2374c3b commit 60b87ef
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lcc_comchain_base/models/wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,9 +205,9 @@ def credit_wallet(self, amount=0):

retry = 0
while True:
tx_data = None
try:
received = transaction.data["recieved"]
break
tx_data = transaction.data
except APIError as e:
if not e.args[0].startswith("API Call failed without message"):
_logger.error(tools.format_last_exception())
Expand All @@ -216,6 +216,14 @@ def credit_wallet(self, amount=0):
"response": response,
"error": "Failure when trying to get transaction info: %s" % e,
}
if tx_data is not None:
received = tx_data.get("recieved")
if received is None:
_logger.error(
"Received incomplete transaction data. Missing 'recieved' field."
)
else:
break
retry += 1
if retry >= 10:
return {
Expand Down

0 comments on commit 60b87ef

Please sign in to comment.