electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 8b68a742d175f77a4ec7a49b9311da971af136a0
parent 8392fa9504f431a44db21409e629b2b1c760ddff
Author: ThomasV <thomasv@electrum.org>
Date:   Wed,  3 Feb 2016 11:01:36 +0100

follow up to 2a507b91c138f6cf8310b22ff0d4f774a29f5d3b

Diffstat:
Mgui/kivy/main_window.py | 3++-
Mlib/commands.py | 10+---------
Mlib/wallet.py | 9+++++----
3 files changed, 8 insertions(+), 14 deletions(-)

diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py @@ -453,7 +453,8 @@ class ElectrumWindow(App): def get_max_amount(self): inputs = self.wallet.get_spendable_coins(None) - amount, fee = self.wallet.get_max_amount(self.electrum_config, inputs, None) + addr = str(self.send_screen.screen.address) or self.wallet.dummy_address() + amount, fee = self.wallet.get_max_amount(self.electrum_config, inputs, addr, None) return format_satoshis_plain(amount, self.decimal_point()) def format_amount(self, x, is_diff=False, whitespaces=False): diff --git a/lib/commands.py b/lib/commands.py @@ -394,18 +394,10 @@ class Commands: final_outputs = [] for address, amount in outputs: address = self._resolver(address) - #assert self.wallet.is_mine(address) if amount == '!': assert len(outputs) == 1 inputs = self.wallet.get_spendable_coins(domain) - amount = sum(map(lambda x:x['value'], inputs)) - if fee is None: - for i in inputs: - self.wallet.add_input_info(i) - output = (TYPE_ADDRESS, address, amount) - dummy_tx = Transaction.from_io(inputs, [output]) - fee = self.wallet.estimate_fee(self.config, dummy_tx.estimated_size()) - amount -= fee + amount, fee = self.wallet.get_max_amount(self.config, inputs, address, fee) else: amount = int(COIN*Decimal(amount)) final_outputs.append((TYPE_ADDRESS, address, amount)) diff --git a/lib/wallet.py b/lib/wallet.py @@ -655,15 +655,16 @@ class Abstract_Wallet(PrintError): return coins def dummy_address(self): + print "dummy" return self.addresses(False)[0] def get_max_amount(self, config, inputs, recipient, fee): sendable = sum(map(lambda x:x['value'], inputs)) - for i in inputs: - self.add_input_info(i) - outputs = [(TYPE_ADDRESS, recipient, sendable)] - dummy_tx = Transaction.from_io(inputs, outputs) if fee is None: + for i in inputs: + self.add_input_info(i) + outputs = [(TYPE_ADDRESS, recipient, sendable)] + dummy_tx = Transaction.from_io(inputs, outputs) fee = self.estimate_fee(config, dummy_tx.estimated_size()) amount = max(0, sendable - fee) return amount, fee