Skip to content

Commit fa448c2

Browse files
author
MarcoFalke
committed
test: Return fee from MiniWallet
1 parent faec09f commit fa448c2

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/functional/test_framework/wallet.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,9 @@ def create_self_transfer_multi(
298298
inputs_value_total = sum([int(COIN * utxo['value']) for utxo in utxos_to_spend])
299299
outputs_value_total = inputs_value_total - fee_per_output * num_outputs
300300
amount_per_output = amount_per_output or (outputs_value_total // num_outputs)
301+
assert amount_per_output > 0
302+
outputs_value_total = amount_per_output * num_outputs
303+
fee = Decimal(inputs_value_total - outputs_value_total) / COIN
301304

302305
# create tx
303306
tx = CTransaction()
@@ -320,6 +323,7 @@ def create_self_transfer_multi(
320323
coinbase=False,
321324
confirmations=0,
322325
) for i in range(len(tx.vout))],
326+
"fee": fee,
323327
"txid": txid,
324328
"wtxid": tx.getwtxid(),
325329
"hex": tx.serialize().hex(),
@@ -339,7 +343,6 @@ def create_self_transfer(self, *, fee_rate=Decimal("0.003"), fee=Decimal("0"), u
339343
else:
340344
assert False
341345
send_value = utxo_to_spend["value"] - (fee or (fee_rate * vsize / 1000))
342-
assert send_value > 0
343346

344347
# create tx
345348
tx = self.create_self_transfer_multi(utxos_to_spend=[utxo_to_spend], locktime=locktime, sequence=sequence, amount_per_output=int(COIN * send_value), target_weight=target_weight)

0 commit comments

Comments
 (0)