aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMacroFake <falke.marco@gmail.com>2022-07-01 12:09:56 +0200
committerMacroFake <falke.marco@gmail.com>2022-07-01 12:29:14 +0200
commitfac3800d2c962420303ab5c61b2f02f35b9f693a (patch)
tree82157fe4afe937dc1d6c72618037c6d961090150 /test
parent2222842ae73f85494797b14753bc18446e4817a2 (diff)
downloadbitcoin-fac3800d2c962420303ab5c61b2f02f35b9f693a.tar.xz
test: Allow amount_per_output in MiniWallet create_self_transfer_multi
Diffstat (limited to 'test')
-rw-r--r--test/functional/test_framework/wallet.py6
1 files changed, 4 insertions, 2 deletions
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(