From 88350f05502131e800207c73a01fb0d91dcac619 Mon Sep 17 00:00:00 2001 From: Wo Jake <87929946+wojake@users.noreply.github.com> Date: Sat, 3 Sep 2022 13:21:57 +0000 Subject: [PATCH] Optimize result's output --- .../submit-and-verify/py/submit-and-verify.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/content/_code-samples/submit-and-verify/py/submit-and-verify.py b/content/_code-samples/submit-and-verify/py/submit-and-verify.py index a3fbd6e50a..643adea7ea 100644 --- a/content/_code-samples/submit-and-verify/py/submit-and-verify.py +++ b/content/_code-samples/submit-and-verify/py/submit-and-verify.py @@ -24,8 +24,15 @@ tx = AccountSet( # Sign the transaction locally & submit transaction and verify its validity on the ledger my_tx_payment_signed = safe_sign_and_submit_transaction(transaction=tx, wallet=wallet_from_seed, client=client) +my_tx_payment_signed = my_tx_payment_signed.result -if my_tx_payment_signed.is_successful(): +result = my_tx_payment_signed["engine_result"] + +if result == "tesSUCCESS": print("Transaction successful!") +elif result == "tefMAX_LEDGER": + print("Transaction failed to achieve consensus") +elif result == "unknown": + print("Transaction status unknown") else: - print("Transaction failed") + print(f"Transaction failed with code {result}")