Browse Source

Qt: remove the 'local watchtower' option from GUI.

It is not realistic to expect Electrum to be used as a watchtower
in GUI mode, and possibly counter-productive (may set wrong
expectations).

A proper watchtower should be configured as a daemon. The
documentation will be updated to reflect this change.
patch-4
ThomasV 4 years ago
parent
commit
a4210ce5e7
  1. 2
      electrum/gui/qt/__init__.py
  2. 3
      electrum/gui/qt/main_window.py
  3. 30
      electrum/gui/qt/settings_dialog.py
  4. 2
      electrum/network.py
  5. 2
      electrum/tests/regtest/regtest.sh

2
electrum/gui/qt/__init__.py

@ -370,8 +370,6 @@ class ElectrumGui(Logger):
with self._num_wizards_lock:
if self._num_wizards_in_progress > 0 or len(self.windows) > 0:
return
if self.config.get('persist_daemon'):
return
self.app.quit()
self.app.setQuitOnLastWindowClosed(False) # so _we_ can decide whether to quit
self.app.lastWindowClosed.connect(quit_after_last_window)

3
electrum/gui/qt/main_window.py

@ -746,7 +746,8 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
tools_menu.addAction(_("Electrum preferences"), self.settings_dialog)
tools_menu.addAction(_("&Network"), self.gui_object.show_network_dialog).setEnabled(bool(self.network))
tools_menu.addAction(_("Local &Watchtower"), self.gui_object.show_watchtower_dialog).setEnabled(bool(self.network and self.network.local_watchtower))
if self.network and self.network.local_watchtower:
tools_menu.addAction(_("Local &Watchtower"), self.gui_object.show_watchtower_dialog)
tools_menu.addAction(_("&Plugins"), self.plugins_dialog)
tools_menu.addSeparator()
tools_menu.addAction(_("&Sign/verify message"), self.sign_verify_message)

30
electrum/gui/qt/settings_dialog.py

@ -161,31 +161,13 @@ channels graph and compute payment path locally, instead of using trampoline pay
gossip_cb.stateChanged.connect(on_gossip_checked)
lightning_widgets.append((gossip_cb, None))
help_local_wt = _("""If this option is checked, Electrum will
run a local watchtower and protect your channels even if your wallet is not
open. For this to work, your computer needs to be online regularly.""")
local_wt_cb = QCheckBox(_("Run a local watchtower"))
local_wt_cb.setToolTip(help_local_wt)
local_wt_cb.setChecked(bool(self.config.get('run_local_watchtower', False)))
def on_local_wt_checked(x):
self.config.set_key('run_local_watchtower', bool(x))
local_wt_cb.stateChanged.connect(on_local_wt_checked)
lightning_widgets.append((local_wt_cb, None))
help_persist = _("""If this option is checked, Electrum will persist after
you close all your wallet windows, and the Electrum icon will be visible in the taskbar.
Use this if you want your local watchtower to keep running after you close your wallet.""")
persist_cb = QCheckBox(_("Persist after all windows are closed"))
persist_cb.setToolTip(help_persist)
persist_cb.setChecked(bool(self.config.get('persist_daemon', False)))
def on_persist_checked(x):
self.config.set_key('persist_daemon', bool(x))
persist_cb.stateChanged.connect(on_persist_checked)
lightning_widgets.append((persist_cb, None))
help_remote_wt = _("""To use a remote watchtower, enter the corresponding URL here""")
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."),
_("If you have private a watchtower, enter its URL here."),
_("Check our online documentation if you want to configure Electrum as a watchtower."),
])
remote_wt_cb = QCheckBox(_("Use a remote watchtower"))
remote_wt_cb.setToolTip(help_remote_wt)
remote_wt_cb.setToolTip('<p>'+help_remote_wt+'</p>')
remote_wt_cb.setChecked(bool(self.config.get('use_watchtower', False)))
def on_remote_wt_checked(x):
self.config.set_key('use_watchtower', bool(x))

2
electrum/network.py

@ -351,7 +351,7 @@ class Network(Logger, NetworkRetryManager[ServerAddr]):
# lightning network
self.channel_blacklist = ChannelBlackList()
if self.config.get('run_local_watchtower', False):
if self.config.get('run_watchtower', False):
from . import lnwatcher
self.local_watchtower = lnwatcher.WatchTower(self)
self.local_watchtower.start_network(self)

2
electrum/tests/regtest/regtest.sh

@ -316,7 +316,7 @@ fi
if [[ $1 == "configure_test_watchtower" ]]; then
# carol is the watchtower of bob
$carol setconfig -o run_local_watchtower true
$carol setconfig -o run_watchtower true
$carol setconfig -o watchtower_user wtuser
$carol setconfig -o watchtower_password wtpassword
$carol setconfig -o watchtower_address 127.0.0.1:12345

Loading…
Cancel
Save