Skip to content

Commit 4323137

Browse files
committed
fix(utils): include UTxOs with datum in tx inputs
Updated `get_tx_inputs` to include UTxOs with datum as spendable reference inputs. Improved error logging in `return_funds_to_faucet` to use `LOGGER.exception` for better traceability.
1 parent cc69ec7 commit 4323137

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

cardano_node_tests/utils/testnet_cleanup.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,17 @@ def retire_drep(
160160
def get_tx_inputs(
161161
cluster_obj: clusterlib.ClusterLib, src_addrs: list[clusterlib.AddressRecord]
162162
) -> TxInputGroup:
163-
"""Return signing keys and transaction inputs for given addresses."""
163+
"""Return signing keys and transaction inputs for given addresses.
164+
165+
Exclude UTxOs that contain tokens.
166+
Don't exclude UTxOs with datum. All the UTxOs here has 'skey', and so the UTxOs with datum
167+
are spendable reference inputs.
168+
"""
164169
recs = []
165170
for a in src_addrs:
166171
utxos = cluster_obj.g_query.get_utxo(address=a.address)
167172
utxos_ids_excluded = {
168-
f"{u.utxo_hash}#{u.utxo_ix}"
169-
for u in utxos
170-
if u.coin != clusterlib.DEFAULT_COIN or u.datum_hash
173+
f"{u.utxo_hash}#{u.utxo_ix}" for u in utxos if u.coin != clusterlib.DEFAULT_COIN
171174
}
172175
txins_ok = [u for u in utxos if f"{u.utxo_hash}#{u.utxo_ix}" not in utxos_ids_excluded]
173176
if txins_ok:
@@ -258,7 +261,7 @@ def return_funds_to_faucet(
258261
verify_tx=False,
259262
)
260263
except clusterlib.CLIError:
261-
LOGGER.error(f"Failed to return funds from addresses for '{tx_name}'") # noqa: TRY400
264+
LOGGER.exception(f"Failed to return funds from addresses for '{tx_name}'")
262265
else:
263266
LOGGER.debug(f"Returned funds from addresses '{tx_name}'")
264267

0 commit comments

Comments
 (0)