Skip to content

Commit fa65a11

Browse files
author
MarcoFalke
committed
test: bugfix: Actually pick largest utxo
1 parent 564e1ab commit fa65a11

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

test/functional/test_framework/wallet.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ def generate(self, num_blocks):
4242

4343
def send_self_transfer(self, *, fee_rate, from_node):
4444
"""Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed."""
45-
self._utxos = sorted(self._utxos, key=lambda k: -k['value'])
45+
self._utxos = sorted(self._utxos, key=lambda k: k['value'])
4646
largest_utxo = self._utxos.pop() # Pick the largest utxo and hope it covers the fee
4747
vsize = Decimal(96)
4848
send_value = satoshi_round(largest_utxo['value'] - fee_rate * (vsize / 1000))
4949
fee = largest_utxo['value'] - send_value
50-
assert (send_value > 0)
50+
assert send_value > 0
5151

5252
tx = CTransaction()
5353
tx.vin = [CTxIn(COutPoint(int(largest_utxo['txid'], 16), largest_utxo['vout']))]

0 commit comments

Comments
 (0)