From 27c36a4dce7670701bb71a91e2d69cc0281697ab Mon Sep 17 00:00:00 2001 From: Lex Berezhny Date: Fri, 21 Jun 2019 02:34:05 -0400 Subject: [PATCH] fix get_spendable_utxos --- torba/torba/client/baseledger.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/torba/torba/client/baseledger.py b/torba/torba/client/baseledger.py index c6a5f8a68..f60125944 100644 --- a/torba/torba/client/baseledger.py +++ b/torba/torba/client/baseledger.py @@ -210,11 +210,9 @@ class BaseLedger(metaclass=LedgerRegistry): async def get_spendable_utxos(self, amount: int, funding_accounts): async with self._utxo_reservation_lock: txos = await self.get_effective_amount_estimators(funding_accounts) - selector = CoinSelector( - txos, amount, - self.transaction_class.output_class.pay_pubkey_hash(COIN, NULL_HASH32).get_fee(self) - ) - spendables = selector.select(self.coin_selection_strategy) + fee = self.transaction_class.output_class.pay_pubkey_hash(COIN, NULL_HASH32).get_fee(self) + selector = CoinSelector(amount, fee) + spendables = selector.select(txos, self.coin_selection_strategy) if spendables: await self.reserve_outputs(s.txo for s in spendables) return spendables