From fac3800d2c962420303ab5c61b2f02f35b9f693a Mon Sep 17 00:00:00 2001 From: MacroFake Date: Fri, 1 Jul 2022 12:09:56 +0200 Subject: test: Allow amount_per_output in MiniWallet create_self_transfer_multi --- test/functional/test_framework/wallet.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py index 8b5689c09e..6c83a40347 100644 --- a/test/functional/test_framework/wallet.py +++ b/test/functional/test_framework/wallet.py @@ -232,12 +232,14 @@ class MiniWallet: *, utxos_to_spend: Optional[List[dict]] = None, num_outputs=1, + amount_per_output=0, sequence=0, fee_per_output=1000, ): """ Create and return a transaction that spends the given UTXOs and creates a - certain number of outputs with equal amounts. + certain number of outputs with equal amounts. The output amounts can be + set by amount_per_output or automatically calculated with a fee_per_output. """ utxos_to_spend = utxos_to_spend or [self.get_utxo()] # create simple tx template (1 input, 1 output) @@ -258,7 +260,7 @@ class MiniWallet: inputs_value_total = sum([int(COIN * utxo['value']) for utxo in utxos_to_spend]) outputs_value_total = inputs_value_total - fee_per_output * num_outputs for o in tx.vout: - o.nValue = outputs_value_total // num_outputs + o.nValue = amount_per_output or (outputs_value_total // num_outputs) txid = tx.rehash() return { "new_utxos": [self._create_utxo( -- cgit v1.2.3