From e13f00059d8a092a4008f6c078d0c33624366ab2 Mon Sep 17 00:00:00 2001 From: Martin Kourim Date: Fri, 13 Nov 2026 18:30:32 +0100 Subject: [PATCH] fix(tests): retry disrupted transaction chains Return a retry message when the first transaction submission reports missing inputs, allowing the outer loop to regenerate the chain after a fork instead of aborting with a CLI error. Continue accepting spent-input errors on resubmission and raising unexpected CLI errors. Clarify the helper's retry behavior. Validation: make lint and the 1,000-transaction E2E test passed. The E2E run did not encounter a fork-triggered retry. --- .../tests/test_chain_transactions.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/cardano_node_tests/tests/test_chain_transactions.py b/cardano_node_tests/tests/test_chain_transactions.py index 36806576b..71153d490 100644 --- a/cardano_node_tests/tests/test_chain_transactions.py +++ b/cardano_node_tests/tests/test_chain_transactions.py @@ -72,21 +72,22 @@ def _gen_signed_tx( def _repeat_submit(cluster_obj: clusterlib.ClusterLib, tx_file: pl.Path) -> str: - """Submit the Tx and then re-submit it. + """Submit and re-submit the Tx to confirm it reached the mempool. - Expect and error on re-submit. This way we make sure the Tx made it to mempool. + Expect a spent-input error on re-submission. Return a retry message if inputs are + already missing on the first submission or no re-submission confirms acceptance. + Raise unexpected CLI errors. """ err_str = "" for r in range(5): try: cluster_obj.g_transaction.submit_tx_bare(tx_file=tx_file) except clusterlib.CLIError as exc: - inputs_spent = helpers.is_inputs_spent_err(str(exc)) - if r == 0 and inputs_spent: + if not helpers.is_inputs_spent_err(str(exc)): + raise + if r == 0: err_str = "Tx input is missing, maybe temporary fork happened?" - elif inputs_spent: - break - raise + break if r > 2: time.sleep(0.05) else: