diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-09-09 10:07:05 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-09-09 10:38:50 +0200 |
commit | fa65a11d0c9a34ff7f4cc4efd53367794e751749 (patch) | |
tree | 065d1557e3136073dad7788461bf43984c20ddf5 /test | |
parent | 564e1ab0f3dc573bd3ea60a80f6649c361243df9 (diff) |
test: bugfix: Actually pick largest utxo
Diffstat (limited to 'test')
-rw-r--r-- | test/functional/test_framework/wallet.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/functional/test_framework/wallet.py b/test/functional/test_framework/wallet.py index c4a9d2138d..56ff69dc14 100644 --- a/test/functional/test_framework/wallet.py +++ b/test/functional/test_framework/wallet.py @@ -42,12 +42,12 @@ class MiniWallet: def send_self_transfer(self, *, fee_rate, from_node): """Create and send a tx with the specified fee_rate. Fee may be exact or at most one satoshi higher than needed.""" - self._utxos = sorted(self._utxos, key=lambda k: -k['value']) + self._utxos = sorted(self._utxos, key=lambda k: k['value']) largest_utxo = self._utxos.pop() # Pick the largest utxo and hope it covers the fee vsize = Decimal(96) send_value = satoshi_round(largest_utxo['value'] - fee_rate * (vsize / 1000)) fee = largest_utxo['value'] - send_value - assert (send_value > 0) + assert send_value > 0 tx = CTransaction() tx.vin = [CTxIn(COutPoint(int(largest_utxo['txid'], 16), largest_utxo['vout']))] |