Skip to content

Commit a7dccab

Browse files
committed
feat(txgroup): add byron witness and ref script size params
Extend the TransactionGroup fee calculation to accept optional parameters for the number of Byron witnesses and the size of reference scripts. This allows for more precise fee estimation in transactions involving Byron witnesses or reference scripts.
1 parent c1a883e commit a7dccab

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cardano_clusterlib/transaction_group.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,8 @@ def calculate_tx_fee(
647647
invalid_before: int | None = None,
648648
src_addr_utxos: list[structs.UTXOData] | None = None,
649649
witness_count_add: int = 0,
650+
byron_witness_count: int = 0,
651+
reference_script_size: int = 0,
650652
join_txouts: bool = True,
651653
destination_dir: itp.FileType = ".",
652654
) -> int:
@@ -690,6 +692,8 @@ def calculate_tx_fee(
690692
src_addr_utxos: A list of UTxOs for the source address (optional).
691693
witness_count_add: A number of witnesses to add - workaround to make the fee
692694
calculation more precise.
695+
byron_witness_count: A number of Byron witnesses (optional).
696+
reference_script_size: A size in bytes of transaction reference scripts (optional).
693697
join_txouts: A bool indicating whether to aggregate transaction outputs
694698
by payment address (True by default).
695699
destination_dir: A path to directory for storing artifacts (optional).
@@ -744,6 +748,8 @@ def calculate_tx_fee(
744748
txin_count=len(tx_raw_output.txins) + 1,
745749
txout_count=len(tx_raw_output.txouts),
746750
witness_count=len(tx_files.signing_key_files) + witness_count_add,
751+
byron_witness_count=byron_witness_count,
752+
reference_script_size=reference_script_size,
747753
)
748754

749755
return fee

0 commit comments

Comments
 (0)