electrum

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

commit b8cd7eb8bd72acd9d6fa9012d04d46c7aa945bb7
parent 536a9aecde241493e92a66be939faccda00a5ab7
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 10 Jun 2016 05:49:22 +0200

Add RBF option to the kivy GUI

Diffstat:
Mgui/kivy/uix/dialogs/settings.py | 25++++++++++++++++++++++++-
Mgui/kivy/uix/screens.py | 2++
2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/gui/kivy/uix/dialogs/settings.py b/gui/kivy/uix/dialogs/settings.py @@ -103,6 +103,12 @@ Builder.load_string(''' action: partial(root.plugin_dialog, 'labels', self) CardSeparator SettingsItem: + status: root.rbf_status() + title: _('Replace-by-fee') + ': ' + self.status + description: _("Create replaceable transactions.") + action: partial(root.rbf_dialog, self) + CardSeparator + SettingsItem: status: root.coinselect_status() title: _('Coin selection') + ': ' + self.status description: "Coin selection method" @@ -123,6 +129,7 @@ class SettingsDialog(Factory.Popup): # cached dialogs self._fx_dialog = None self._fee_dialog = None + self._rbf_dialog = None self._network_dialog = None self._language_dialog = None self._unit_dialog = None @@ -203,7 +210,7 @@ class SettingsDialog(Factory.Popup): d.open() def fee_status(self): - if self.config.get('dynamic_fees'): + if self.config.get('dynamic_fees', True): from electrum.util import fee_levels return fee_levels[self.config.get('fee_level', 2)] else: @@ -218,6 +225,22 @@ class SettingsDialog(Factory.Popup): self._fee_dialog = FeeDialog(self.app, self.config, cb) self._fee_dialog.open() + def rbf_status(self): + return 'ON' if self.config.get('use_rbf') else 'OFF' + + def rbf_dialog(self, label, dt): + if self._rbf_dialog is None: + from checkbox_dialog import CheckBoxDialog + def cb(x): + self.config.set_key('use_rbf', x, True) + label.status = self.rbf_status() + msg = [_('If you check this box, your transactions will be marked as non-final,'), + _('and you will have the possiblity, while they are unconfirmed, to replace them with transactions that pays higher fees.'), + _('Note that some merchants do not accept non-final transactions until they are confirmed.')] + fullname = _('Replace by fee') + self._rbf_dialog = CheckBoxDialog(fullname, ' '.join(msg), self.config.get('use_rbf'), cb) + self._rbf_dialog.open() + def fx_status(self): p = self.plugins.get('exchange_rate') if p: diff --git a/gui/kivy/uix/screens.py b/gui/kivy/uix/screens.py @@ -276,6 +276,8 @@ class SendScreen(CScreen): traceback.print_exc(file=sys.stdout) self.app.show_error(str(e)) return + if self.app.electrum_config.get('use_rbf'): + tx.set_sequence(0) fee = tx.get_fee() msg = [ _("Amount to be sent") + ": " + self.app.format_amount_and_units(amount),