electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit b06daaa6699a34416999a989b7abd430ee6811ba
parent ea329063bff80856673c04486accc0caed491cc3
Author: ThomasV <thomasv@electrum.org>
Date:   Fri, 19 Jun 2020 19:38:19 +0200

fix display of short_channel_id for channel backups

Diffstat:
Melectrum/gui/qt/channels_list.py | 6++----
Melectrum/lnchannel.py | 11++++++++++-
Melectrum/lnworker.py | 2+-
3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py @@ -209,9 +209,6 @@ class ChannelsList(MyTreeView): def do_update_single_row(self, wallet: Abstract_Wallet, chan: AbstractChannel): if wallet != self.parent.wallet: return - lnworker = wallet.lnworker - if not lnworker: - return for row in range(self.model().rowCount()): item = self.model().item(row, self.Columns.NODE_ALIAS) if item.data(ROLE_CHANNEL_ID) != chan.channel_id: @@ -220,7 +217,8 @@ class ChannelsList(MyTreeView): self.model().item(row, column).setData(v, QtCore.Qt.DisplayRole) items = [self.model().item(row, column) for column in self.Columns] self._update_chan_frozen_bg(chan=chan, items=items) - self.update_can_send(lnworker) + if wallet.lnworker: + self.update_can_send(wallet.lnworker) @QtCore.pyqtSlot() def on_gossip_db(self): diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py @@ -293,6 +293,9 @@ class AbstractChannel(Logger, ABC): closing_txid: str, closing_height: TxMinedInfo, keep_watching: bool) -> None: self.save_funding_height(txid=funding_txid, height=funding_height.height, timestamp=funding_height.timestamp) self.save_closing_height(txid=closing_txid, height=closing_height.height, timestamp=closing_height.timestamp) + if funding_height.conf>0: + self.set_short_channel_id(ShortChannelID.from_components( + funding_height.height, funding_height.txpos, self.funding_outpoint.output_index)) if self.get_state() < ChannelState.CLOSED: conf = closing_height.conf if conf > 0: @@ -435,9 +438,15 @@ class ChannelBackup(AbstractChannel): def is_initiator(self): return self.cb.is_initiator + def short_id_for_GUI(self) -> str: + if self.short_channel_id: + return 'BACKUP of ' + format_short_channel_id(self.short_channel_id) + else: + return 'BACKUP' + def get_state_for_GUI(self): cs = self.get_state() - return 'BACKUP, ' + cs.name + return cs.name def get_oldest_unrevoked_ctn(self, who): return -1 diff --git a/electrum/lnworker.py b/electrum/lnworker.py @@ -1436,7 +1436,7 @@ class LNBackups(Logger): pass async def on_channel_update(self, chan): - pass + util.trigger_callback('channel', self.wallet, chan) def channel_by_txo(self, txo): with self.lock: