Browse Source

move 'allow_instant_swaps' option from preferences dialog to swap_dialog toolbar

master
ThomasV 3 years ago
parent
commit
519926ade3
  1. 6
      electrum/gui/messages.py
  2. 11
      electrum/gui/qt/settings_dialog.py
  3. 10
      electrum/gui/qt/swap_dialog.py

6
electrum/gui/messages.py

@ -12,6 +12,12 @@ Note that static backups only allow you to request a force-close with the remote
If this is enabled, other nodes cannot open a channel to you. Channel recovery data is encrypted, so that only your wallet can decrypt it. However, blockchain analysis will be able to tell that the transaction was probably created by Electrum.
"""
MSG_CONFIG_INSTANT_SWAPS = """
If this option is checked, your client will complete reverse swaps before the funding transaction is confirmed.
Note you are at risk of losing the funds in the swap, if the funding transaction never confirms.
"""
MSG_COOPERATIVE_CLOSE = """
Your node will negotiate the transaction fee with the remote node. This method of closing the channel usually results in the lowest fees."""

11
electrum/gui/qt/settings_dialog.py

@ -122,16 +122,6 @@ class SettingsDialog(QDialog, QtEventListener):
util.trigger_callback('channels_updated', self.wallet)
trampoline_cb.stateChanged.connect(on_trampoline_checked)
help_instant_swaps = ' '.join([
_("If this option is checked, your client will complete reverse swaps before the funding transaction is confirmed."),
_("Note you are at risk of losing the funds in the swap, if the funding transaction never confirms.")
])
instant_swaps_cb = QCheckBox(_("Allow instant swaps"))
instant_swaps_cb.setToolTip(messages.to_rtf(help_instant_swaps))
instant_swaps_cb.setChecked(bool(self.config.get('allow_instant_swaps', False)))
def on_instant_swaps_checked(allow_instant_swaps):
self.config.set_key('allow_instant_swaps', bool(allow_instant_swaps))
instant_swaps_cb.stateChanged.connect(on_instant_swaps_checked)
help_remote_wt = ' '.join([
_("A watchtower is a daemon that watches your channels and prevents the other party from stealing funds by broadcasting an old state."),
@ -368,7 +358,6 @@ class SettingsDialog(QDialog, QtEventListener):
gui_widgets.append((thousandsep_cb, None))
lightning_widgets = []
lightning_widgets.append((trampoline_cb, None))
lightning_widgets.append((instant_swaps_cb, None))
lightning_widgets.append((remote_wt_cb, self.watchtower_url_e))
fiat_widgets = []
fiat_widgets.append((QLabel(_('Fiat currency')), ccy_combo))

10
electrum/gui/qt/swap_dialog.py

@ -8,6 +8,8 @@ from electrum.util import NotEnoughFunds, NoDynamicFeeEstimates
from electrum.lnutil import ln_dummy_address
from electrum.transaction import PartialTxOutput, PartialTransaction
from electrum.gui import messages
from . import util
from .util import (WindowModalDialog, Buttons, OkButton, CancelButton,
EnterButton, ColorScheme, WWLabel, read_QIcon, IconLabel, char_width_in_lineedit)
from .amountedit import BTCAmountEdit
@ -39,6 +41,12 @@ class SwapDialog(WindowModalDialog):
self.channels = channels
self.is_reverse = is_reverse if is_reverse is not None else True
vbox = QVBoxLayout(self)
toolbar, menu = util.create_toolbar_with_menu(self.config, '')
menu.addConfig(
_("Allow instant swaps"), 'allow_instant_swaps', False,
tooltip=messages.to_rtf(messages.MSG_CONFIG_INSTANT_SWAPS),
).setEnabled(self.lnworker.can_have_recoverable_channels())
vbox.addLayout(toolbar)
self.description_label = WWLabel(self.get_description())
self.send_amount_e = BTCAmountEdit(self.window.get_decimal_point)
self.recv_amount_e = BTCAmountEdit(self.window.get_decimal_point)
@ -302,7 +310,7 @@ class SwapDialog(WindowModalDialog):
onchain_funds = "onchain funds"
lightning_funds = "lightning funds"
return "Swap {fromType} for {toType}. This will increase your {capacityType} capacity. This service is powered by the Boltz backend.".format(
return "Swap {fromType} for {toType}.\nThis will increase your {capacityType} capacity.".format(
fromType=lightning_funds if self.is_reverse else onchain_funds,
toType=onchain_funds if self.is_reverse else lightning_funds,
capacityType="receiving" if self.is_reverse else "sending",

Loading…
Cancel
Save