Skip to content

Commit fac3800

Browse files
author
MacroFake
committed
test: Allow amount_per_output in MiniWallet create_self_transfer_multi
1 parent 2222842 commit fac3800

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/functional/test_framework/wallet.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -232,12 +232,14 @@ def create_self_transfer_multi(
232232
*,
233233
utxos_to_spend: Optional[List[dict]] = None,
234234
num_outputs=1,
235+
amount_per_output=0,
235236
sequence=0,
236237
fee_per_output=1000,
237238
):
238239
"""
239240
Create and return a transaction that spends the given UTXOs and creates a
240-
certain number of outputs with equal amounts.
241+
certain number of outputs with equal amounts. The output amounts can be
242+
set by amount_per_output or automatically calculated with a fee_per_output.
241243
"""
242244
utxos_to_spend = utxos_to_spend or [self.get_utxo()]
243245
# create simple tx template (1 input, 1 output)
@@ -258,7 +260,7 @@ def create_self_transfer_multi(
258260
inputs_value_total = sum([int(COIN * utxo['value']) for utxo in utxos_to_spend])
259261
outputs_value_total = inputs_value_total - fee_per_output * num_outputs
260262
for o in tx.vout:
261-
o.nValue = outputs_value_total // num_outputs
263+
o.nValue = amount_per_output or (outputs_value_total // num_outputs)
262264
txid = tx.rehash()
263265
return {
264266
"new_utxos": [self._create_utxo(

0 commit comments

Comments
 (0)