Add 'has_onchain_backup' to channel storage, to fix the displayed icon.
Note that this will not fix the value for already existing channels that have been created with onchain backup; one would need a wallet_db upgrade in order to fix them (probably not worth the effort).
This commit is contained in:
@@ -211,7 +211,7 @@ class LightningOpenChannelDialog(Factory.Popup, Logger):
|
||||
self.app.show_error(_('Problem opening channel: ') + '\n' + repr(e))
|
||||
return
|
||||
# TODO: it would be nice to show this before broadcasting
|
||||
if lnworker.has_recoverable_channels():
|
||||
if chan.has_onchain_backup():
|
||||
self.maybe_show_funding_tx(chan, funding_tx)
|
||||
else:
|
||||
title = _('Save backup')
|
||||
|
||||
@@ -538,11 +538,13 @@ class ChannelFeatureIcons:
|
||||
feats = []
|
||||
if chan.is_backup():
|
||||
feats.append(ChanFeatBackup())
|
||||
if chan.is_imported:
|
||||
feats.append(ChanFeatNoOnchainBackup())
|
||||
else:
|
||||
feats.append(ChanFeatChannel())
|
||||
if chan.lnworker.is_trampoline_peer(chan.node_id):
|
||||
feats.append(ChanFeatTrampoline())
|
||||
if not chan.lnworker.has_recoverable_channels():
|
||||
if not chan.has_onchain_backup():
|
||||
feats.append(ChanFeatNoOnchainBackup())
|
||||
return ChannelFeatureIcons(feats)
|
||||
|
||||
|
||||
@@ -1840,7 +1840,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
|
||||
def on_open_channel_success(self, args):
|
||||
chan, funding_tx = args
|
||||
lnworker = self.wallet.lnworker
|
||||
if not lnworker.has_recoverable_channels():
|
||||
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}'))
|
||||
|
||||
@@ -553,6 +553,9 @@ class Channel(AbstractChannel):
|
||||
self.should_request_force_close = False
|
||||
self.force_close_detected = False # not a state, only for GUI
|
||||
|
||||
def has_onchain_backup(self):
|
||||
return self.storage.get('has_onchain_backup', False)
|
||||
|
||||
def can_be_deleted(self):
|
||||
return self.is_redeemed()
|
||||
|
||||
|
||||
@@ -687,7 +687,8 @@ class Peer(Logger):
|
||||
if dummy_output in funding_tx.outputs(): raise Exception("LN dummy output (err 2)")
|
||||
funding_tx.add_outputs([funding_output])
|
||||
# find and encrypt op_return data associated to funding_address
|
||||
if self.lnworker and self.lnworker.has_recoverable_channels():
|
||||
has_onchain_backup = self.lnworker and self.lnworker.has_recoverable_channels()
|
||||
if has_onchain_backup:
|
||||
backup_data = self.lnworker.cb_data(self.pubkey)
|
||||
dummy_scriptpubkey = make_op_return(backup_data)
|
||||
for o in funding_tx.outputs():
|
||||
@@ -713,15 +714,16 @@ class Peer(Logger):
|
||||
is_initiator=True,
|
||||
funding_txn_minimum_depth=funding_txn_minimum_depth
|
||||
)
|
||||
chan_dict = self.create_channel_storage(
|
||||
storage = self.create_channel_storage(
|
||||
channel_id, outpoint, local_config, remote_config, constraints)
|
||||
chan = Channel(
|
||||
chan_dict,
|
||||
storage,
|
||||
sweep_address=self.lnworker.sweep_address,
|
||||
lnworker=self.lnworker,
|
||||
initial_feerate=feerate
|
||||
)
|
||||
chan.storage['funding_inputs'] = [txin.prevout.to_json() for txin in funding_tx.inputs()]
|
||||
chan.storage['has_onchain_backup'] = has_onchain_backup
|
||||
if isinstance(self.transport, LNTransport):
|
||||
chan.add_or_update_peer_addr(self.transport.peer_addr)
|
||||
sig_64, _ = chan.sign_next_commitment()
|
||||
|
||||
Reference in New Issue
Block a user