commit 6232a0b76cc041126af62b628394020115cbace0
parent 8a3e5032b1b0f65dc192c2f821a9fe8b8c9aef13
Author: ThomasV <thomasv@gitorious>
Date: Sat, 15 Aug 2015 10:02:47 +0200
speedup fee computation when collecting small inputs
Diffstat:
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/lib/wallet.py b/lib/wallet.py
@@ -893,9 +893,10 @@ class Abstract_Wallet(object):
fee_per_kb = self.fee_per_kb(config)
amount = sum(map(lambda x:x[2], outputs))
- total = fee = 0
+ total = 0
inputs = []
tx = Transaction.from_io(inputs, outputs)
+ fee = fixed_fee if fixed_fee is not None else 0
# add old inputs first
for item in coins:
v = item.get('value')
@@ -903,7 +904,7 @@ class Abstract_Wallet(object):
self.add_input_info(item)
tx.add_input(item)
# no need to estimate fee until we have reached desired amount
- if total < amount:
+ if total < amount + fee:
continue
fee = fixed_fee if fixed_fee is not None else self.estimated_fee(tx, fee_per_kb)
if total >= amount + fee: