Skip to content

Commit d726ae7

Browse files
committed
Move execution unit estimation to the very last part of tx building
Redeemer index will change during txbuilding. If execution unit estimation is performed before the final redeemer index is finalized, there could be mismatch between the index returned from estimation and the index stored locally in txbuilder.
1 parent b015d61 commit d726ae7

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pycardano/txbuilder.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -865,9 +865,6 @@ def build(
865865
Returns:
866866
TransactionBody: A transaction body.
867867
"""
868-
self._update_execution_units(
869-
change_address, merge_change, collateral_change_address
870-
)
871868
self._ensure_no_input_exclusion_conflict()
872869
selected_utxos = []
873870
selected_amount = Value()
@@ -1000,6 +997,10 @@ def build(
1000997

1001998
self._set_collateral_return(collateral_change_address or change_address)
1002999

1000+
self._update_execution_units(
1001+
change_address, merge_change, collateral_change_address
1002+
)
1003+
10031004
self._add_change_and_fee(change_address, merge_change=merge_change)
10041005

10051006
tx_body = self._build_tx_body()

0 commit comments

Comments
 (0)