channel_establishment_flow: do not save wallet file backup in the background.
Instead, display a popup everytime, if the channel is not recoverable.
This commit is contained in:
@@ -1895,16 +1895,13 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
|||||||
chan, funding_tx = args
|
chan, funding_tx = args
|
||||||
lnworker = self.wallet.lnworker
|
lnworker = self.wallet.lnworker
|
||||||
if not chan.has_onchain_backup():
|
if not chan.has_onchain_backup():
|
||||||
backup_dir = self.config.get_backup_dir()
|
data = lnworker.export_channel_backup(chan.channel_id)
|
||||||
if backup_dir is not None:
|
help_text = _(messages.MSG_CREATED_NON_RECOVERABLE_CHANNEL)
|
||||||
self.show_message(_(f'Your wallet backup has been updated in {backup_dir}'))
|
help_text += '\n\n' + _('Alternatively, you can save a backup of your wallet file from the File menu')
|
||||||
else:
|
self.show_qrcode(
|
||||||
data = lnworker.export_channel_backup(chan.channel_id)
|
data, _('Save channel backup'),
|
||||||
help_text = _(messages.MSG_CREATED_NON_RECOVERABLE_CHANNEL)
|
help_text=help_text,
|
||||||
self.show_qrcode(
|
show_copy_text_btn=True)
|
||||||
data, _('Save channel backup'),
|
|
||||||
help_text=help_text,
|
|
||||||
show_copy_text_btn=True)
|
|
||||||
n = chan.constraints.funding_txn_minimum_depth
|
n = chan.constraints.funding_txn_minimum_depth
|
||||||
message = '\n'.join([
|
message = '\n'.join([
|
||||||
_('Channel established.'),
|
_('Channel established.'),
|
||||||
|
|||||||
@@ -1025,9 +1025,6 @@ class LNWallet(LNWorker):
|
|||||||
self.wallet.set_reserved_state_of_address(addr, reserved=True)
|
self.wallet.set_reserved_state_of_address(addr, reserved=True)
|
||||||
try:
|
try:
|
||||||
self.save_channel(chan)
|
self.save_channel(chan)
|
||||||
backup_dir = self.config.get_backup_dir()
|
|
||||||
if backup_dir is not None:
|
|
||||||
self.wallet.save_backup(backup_dir)
|
|
||||||
except:
|
except:
|
||||||
chan.set_state(ChannelState.REDEEMED)
|
chan.set_state(ChannelState.REDEEMED)
|
||||||
self.remove_channel(chan.channel_id)
|
self.remove_channel(chan.channel_id)
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ class SimpleConfig(Logger):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
def get_backup_dir(self):
|
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()
|
# on Android, the export backup button uses android_backup_dir()
|
||||||
if 'ANDROID_DATA' in os.environ:
|
if 'ANDROID_DATA' in os.environ:
|
||||||
return None
|
return None
|
||||||
|
|||||||
Reference in New Issue
Block a user