Skip to content

Commit

Permalink
Use potential inputs to satisfy collateral amount
Browse files Browse the repository at this point in the history
  • Loading branch information
nielstron committed Oct 19, 2023
1 parent 0a95536 commit 6f42c91
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pycardano/txbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,13 @@ def _add_collateral_input(cur_total, candidate_inputs):
)
_add_collateral_input(tmp_val, sorted_inputs)

if tmp_val.coin < collateral_amount:
sorted_inputs = sorted(
self.potential_inputs,
key=lambda i: (len(i.output.to_cbor_hex()), -i.output.amount.coin),
)
_add_collateral_input(tmp_val, sorted_inputs)

if tmp_val.coin < collateral_amount:
sorted_inputs = sorted(
self.context.utxos(collateral_return_address),
Expand Down

0 comments on commit 6f42c91

Please sign in to comment.