commit 7dad17bb62218611454ba92cdd481511443d917b
parent 9f650e80a36925e96ce5f4740298c033c3e1ec85
Author: ThomasV <thomasv@gitorious>
Date: Thu, 8 Dec 2011 09:11:49 +0100
fix for empty wallets
Diffstat:
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/client/electrum.py b/client/electrum.py
@@ -493,7 +493,8 @@ class Wallet:
def choose_tx_inputs( self, amount, fixed_fee ):
""" todo: minimize tx size """
- total = fee = 0
+ total = 0
+ fee = self.fee if fixed_fee is None else fixed_fee
inputs = []
for addr in self.addresses:
h = self.history.get(addr)
@@ -502,10 +503,7 @@ class Wallet:
v = item.get('value')
total += v
inputs.append((addr, v, item['tx_hash'], item['pos'], item['raw_scriptPubKey'], None, None) )
- if fixed_fee is not None:
- fee = fixed_fee
- else:
- fee = self.fee * len(inputs)
+ fee = self.fee*len(inputs) if fixed_fee is None else fixed_fee
if total >= amount + fee: break
if total >= amount + fee: break
else: