From 5ce80332ec6e87cf704855b47463ba68a70e4240 Mon Sep 17 00:00:00 2001 From: ThomasV Date: Wed, 26 Feb 2025 12:22:25 +0100 Subject: [PATCH] Qt: do not expose watchtower in settings running a watchtower requires to be able to run a daemon with the watchtower plugin enabled. If users succeed at doing that, we can expect them to be able to configure theclient using the command line. (that would not work with QML, though. maybe QML could use an advanced config editor) --- electrum/gui/qt/settings_dialog.py | 17 ----------------- electrum/plugins/watchtower/__init__.py | 10 ++++++++-- electrum/simple_config.py | 9 --------- 3 files changed, 8 insertions(+), 28 deletions(-) diff --git a/electrum/gui/qt/settings_dialog.py b/electrum/gui/qt/settings_dialog.py index fbade2e87..92c639e56 100644 --- a/electrum/gui/qt/settings_dialog.py +++ b/electrum/gui/qt/settings_dialog.py @@ -144,22 +144,6 @@ class SettingsDialog(QDialog, QtEventListener): self.config.LIGHTNING_LEGACY_ADD_TRAMPOLINE = legacy_add_trampoline_cb.isChecked() legacy_add_trampoline_cb.stateChanged.connect(on_legacy_add_trampoline_checked) - remote_wt_cb = checkbox_from_configvar(self.config.cv.WATCHTOWER_CLIENT_ENABLED) - remote_wt_cb.setChecked(self.config.WATCHTOWER_CLIENT_ENABLED) - - def on_remote_wt_checked(_x): - self.config.WATCHTOWER_CLIENT_ENABLED = remote_wt_cb.isChecked() - self.watchtower_url_e.setEnabled(remote_wt_cb.isChecked()) - remote_wt_cb.stateChanged.connect(on_remote_wt_checked) - watchtower_url = self.config.WATCHTOWER_CLIENT_URL - self.watchtower_url_e = QLineEdit(watchtower_url) - self.watchtower_url_e.setEnabled(self.config.WATCHTOWER_CLIENT_ENABLED) - - def on_wt_url(): - url = self.watchtower_url_e.text() or None - self.config.WATCHTOWER_CLIENT_URL = url - self.watchtower_url_e.editingFinished.connect(on_wt_url) - lnfee_hlabel = HelpLabel.from_configvar(self.config.cv.LIGHTNING_PAYMENT_FEE_MAX_MILLIONTHS) lnfee_map = [500, 1_000, 3_000, 5_000, 10_000, 20_000, 30_000, 50_000] @@ -411,7 +395,6 @@ class SettingsDialog(QDialog, QtEventListener): lightning_widgets = [] lightning_widgets.append((trampoline_cb, None)) lightning_widgets.append((legacy_add_trampoline_cb, None)) - lightning_widgets.append((remote_wt_cb, self.watchtower_url_e)) lightning_widgets.append((lnfee_hlabel, lnfee_hbox_w)) fiat_widgets = [] fiat_widgets.append((QLabel(_('Fiat currency')), ccy_combo)) diff --git a/electrum/plugins/watchtower/__init__.py b/electrum/plugins/watchtower/__init__.py index 8cc2c72e0..2619271f4 100644 --- a/electrum/plugins/watchtower/__init__.py +++ b/electrum/plugins/watchtower/__init__.py @@ -2,9 +2,11 @@ from electrum.i18n import _ fullname = _('Watchtower') description = """ -Watchtower for Electrum. +A watchtower is a daemon that watches your channels and prevents the other party from stealing funds by broadcasting an old state. -Example setup: +Example: + +daemon setup: electrum -o setconfig enable_plugin_watchtower True electrum -o setconfig watchtower_user wtuser @@ -12,6 +14,10 @@ Example setup: electrum -o setconfig watchtower_port 12345 electrum daemon -v +client setup: + + electrum -o setconfig watchtower_url http://wtuser:wtpassword@127.0.0.1:12345 + """ available_for = ['cmdline'] diff --git a/electrum/simple_config.py b/electrum/simple_config.py index 9ff67f99f..5834a1a65 100644 --- a/electrum/simple_config.py +++ b/electrum/simple_config.py @@ -1212,15 +1212,6 @@ Warning: setting this to too low will result in lots of payment failures."""), ZEROCONF_MIN_OPENING_FEE = ConfigVar('zeroconf_min_opening_fee', default=5000, type_=int) # connect to remote WT - WATCHTOWER_CLIENT_ENABLED = ConfigVar( - 'use_watchtower', default=False, type_=bool, - short_desc=lambda: _("Use a remote watchtower"), - long_desc=lambda: ' '.join([ - _("A watchtower is a daemon that watches your channels and prevents the other party from stealing funds by broadcasting an old state."), - _("If you have private a watchtower, enter its URL here."), - _("Check our online documentation if you want to configure Electrum as a watchtower."), - ]), - ) WATCHTOWER_CLIENT_URL = ConfigVar('watchtower_url', default=None, type_=str) # run WT locally