1
0

Option to send only confirmed coins (fix #2395)

This commit is contained in:
ThomasV
2017-07-01 22:20:10 +02:00
parent 255458da0a
commit faa17f9818
4 changed files with 24 additions and 9 deletions

View File

@@ -578,7 +578,7 @@ class ElectrumWindow(App):
self.status = '[size=15dp]%s[/size]\n%s' %(n, status)
def get_max_amount(self):
inputs = self.wallet.get_spendable_coins(None)
inputs = self.wallet.get_spendable_coins(None, self.electrum_config)
addr = str(self.send_screen.screen.address) or self.wallet.dummy_address()
outputs = [(TYPE_ADDRESS, addr, '!')]
tx = self.wallet.make_unsigned_transaction(inputs, outputs, self.electrum_config)

View File

@@ -1165,8 +1165,12 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
self.not_enough_funds = False
except NotEnoughFunds:
self.not_enough_funds = True
if not freeze_fee:
self.fee_e.setAmount(None)
return
except BaseException:
return
if not freeze_fee:
fee = None if self.not_enough_funds else tx.get_fee()
self.fee_e.setAmount(fee)
@@ -1572,8 +1576,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
if self.pay_from:
return self.pay_from
else:
domain = self.wallet.get_addresses()
return self.wallet.get_spendable_coins(domain)
return self.wallet.get_spendable_coins(None, self.config)
def spend_coins(self, coins):
self.set_pay_from(coins)
@@ -2625,6 +2628,15 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, PrintError):
chooser_combo.currentIndexChanged.connect(on_chooser)
tx_widgets.append((chooser_label, chooser_combo))
def on_unconf(x):
self.config.set_key('confirmed_only', bool(x))
conf_only = self.config.get('confirmed_only', True)
unconf_cb = QCheckBox(_('Spend only confirmed coins'))
unconf_cb.setToolTip(_('Spend only confirmed inputs.'))
unconf_cb.setChecked(conf_only)
unconf_cb.stateChanged.connect(on_unconf)
tx_widgets.append((unconf_cb, None))
# Fiat Currency
hist_checkbox = QCheckBox()
ccy_combo = QComboBox()