Browse Source

channel_establishment_flow: do not save wallet file backup in the background.

Instead, display a popup everytime, if the channel is not recoverable.
patch-4
ThomasV 3 years ago
parent
commit
a15dac2b8c
  1. 17
      electrum/gui/qt/main_window.py
  2. 3
      electrum/lnworker.py
  3. 2
      electrum/simple_config.py

17
electrum/gui/qt/main_window.py

@ -1895,16 +1895,13 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
chan, funding_tx = args
lnworker = self.wallet.lnworker
if not chan.has_onchain_backup():
backup_dir = self.config.get_backup_dir()
if backup_dir is not None:
self.show_message(_(f'Your wallet backup has been updated in {backup_dir}'))
else:
data = lnworker.export_channel_backup(chan.channel_id)
help_text = _(messages.MSG_CREATED_NON_RECOVERABLE_CHANNEL)
self.show_qrcode(
data, _('Save channel backup'),
help_text=help_text,
show_copy_text_btn=True)
data = lnworker.export_channel_backup(chan.channel_id)
help_text = _(messages.MSG_CREATED_NON_RECOVERABLE_CHANNEL)
help_text += '\n\n' + _('Alternatively, you can save a backup of your wallet file from the File menu')
self.show_qrcode(
data, _('Save channel backup'),
help_text=help_text,
show_copy_text_btn=True)
n = chan.constraints.funding_txn_minimum_depth
message = '\n'.join([
_('Channel established.'),

3
electrum/lnworker.py

@ -1025,9 +1025,6 @@ class LNWallet(LNWorker):
self.wallet.set_reserved_state_of_address(addr, reserved=True)
try:
self.save_channel(chan)
backup_dir = self.config.get_backup_dir()
if backup_dir is not None:
self.wallet.save_backup(backup_dir)
except:
chan.set_state(ChannelState.REDEEMED)
self.remove_channel(chan.channel_id)

2
electrum/simple_config.py

@ -277,7 +277,7 @@ class SimpleConfig(Logger):
raise
def get_backup_dir(self):
# this is used to save a backup everytime a channel is created
# this is used to save wallet file backups (without active lightning channels)
# on Android, the export backup button uses android_backup_dir()
if 'ANDROID_DATA' in os.environ:
return None

Loading…
Cancel
Save