testimate fee using number of outputs - electrum - Electrum Bitcoin wallet HTML git clone https://git.parazyd.org/electrum DIR Log DIR Files DIR Refs DIR Submodules --- DIR commit 029e0b8b0d788463feb56cb34540d9dcc9f31e93 DIR parent 05dba32315d7d9ec7a50c7ea3c8d5dcc69462f0d HTML Author: ThomasV <thomasv@gitorious> Date: Thu, 26 Jun 2014 10:40:33 +0200 estimate fee using number of outputs Diffstat: M gui/qt/main_window.py | 19 ++++++++++++------- M gui/qt/paytoedit.py | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) --- DIR diff --git a/gui/qt/main_window.py b/gui/qt/main_window.py t@@ -876,16 +876,21 @@ class ElectrumWindow(QMainWindow): amount = self.amount_e.get_amount() fee = self.fee_e.get_amount() + outputs = self.payto_e.get_outputs() + + if not is_fee: + fee = None - if not is_fee: fee = None if amount is None: self.fee_e.setAmount(None) - return - # assume that there will be 2 outputs (one for change) - inputs, total, fee = self.wallet.choose_tx_inputs(amount, fee, 2, coins = self.get_coins()) - if not is_fee: - self.fee_e.setAmount(fee) - if inputs: + not_enough_funds = False + else: + inputs, total, fee = self.wallet.choose_tx_inputs(amount, fee, len(outputs), coins = self.get_coins()) + not_enough_funds = len(inputs) == 0 + if not is_fee: + self.fee_e.setAmount(fee) + + if not not_enough_funds: palette = QPalette() palette.setColor(self.amount_e.foregroundRole(), QColor('black')) text = "" DIR diff --git a/gui/qt/paytoedit.py b/gui/qt/paytoedit.py t@@ -47,6 +47,7 @@ class PayToEdit(QRTextEdit): self.is_pr = False self.scan_f = self.win.pay_from_URI self.update_size() + self.payto_address = None def lock_amount(self): self.amount_edit.setFrozen(True)