Skip to content

Commit 1e0f19b

Browse files
authored
Use potential inputs to satisfy collateral amount (#275)
1 parent cd975db commit 1e0f19b

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

pycardano/txbuilder.py

+7
Original file line numberDiff line numberDiff line change
@@ -1133,6 +1133,13 @@ def _add_collateral_input(cur_total, candidate_inputs):
11331133
)
11341134
_add_collateral_input(tmp_val, sorted_inputs)
11351135

1136+
if tmp_val.coin < collateral_amount:
1137+
sorted_inputs = sorted(
1138+
self.potential_inputs,
1139+
key=lambda i: (len(i.output.to_cbor_hex()), -i.output.amount.coin),
1140+
)
1141+
_add_collateral_input(tmp_val, sorted_inputs)
1142+
11361143
if tmp_val.coin < collateral_amount:
11371144
sorted_inputs = sorted(
11381145
self.context.utxos(collateral_return_address),

0 commit comments

Comments
 (0)