1
0

qt history tab: fix "View Channel" in context menu

related: https://github.com/spesmilo/electrum/issues/7930
This commit is contained in:
SomberNight
2022-08-12 02:30:06 +00:00
parent ba72abdbf5
commit 767b058946
3 changed files with 5 additions and 3 deletions

View File

@@ -233,7 +233,7 @@ class ChannelsList(MyTreeView):
if not item:
return
channel_id = idx.sibling(idx.row(), self.Columns.NODE_ALIAS).data(ROLE_CHANNEL_ID)
chan = self.lnworker.channels.get(channel_id) or self.lnworker.channel_backups[channel_id]
chan = self.lnworker.get_channel_by_id(channel_id) or self.lnworker.channel_backups[channel_id]
menu.addAction(_("Details..."), lambda: self.parent.show_channel_details(chan))
menu.addSeparator()
cc = self.add_copy_menu(menu, idx)

View File

@@ -738,8 +738,8 @@ class HistoryList(MyTreeView, AcceptFileDragDrop):
menu.addAction(_("Edit {}").format(label), lambda p=persistent: self.edit(QModelIndex(p)))
menu.addAction(_("View Transaction"), lambda: self.show_transaction(tx_item, tx))
channel_id = tx_item.get('channel_id')
if channel_id:
menu.addAction(_("View Channel"), lambda: self.parent.show_channel(bytes.fromhex(channel_id)))
if channel_id and self.wallet.lnworker and (chan := self.wallet.lnworker.get_channel_by_id(bytes.fromhex(channel_id))):
menu.addAction(_("View Channel"), lambda: self.parent.show_channel_details(chan))
if is_unconfirmed and tx:
if tx_details.can_bump:
menu.addAction(_("Increase fee"), lambda: self.parent.bump_fee_dialog(tx))

View File

@@ -1117,6 +1117,8 @@ class Abstract_Wallet(ABC, Logger, EventListener):
tx_item['type'] = item['type']
ln_value = Decimal(item['amount_msat']) / 1000 # for channel open/close tx
tx_item['ln_value'] = Satoshis(ln_value)
if channel_id := item.get('channel_id'):
tx_item['channel_id'] = channel_id
else:
if item['type'] == 'swap':
# swap items do not have all the fields. We can skip skip them