Browse Source

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

related: https://github.com/spesmilo/electrum/issues/7930
patch-4
SomberNight 3 years ago
parent
commit
767b058946
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 2
      electrum/gui/qt/channels_list.py
  2. 4
      electrum/gui/qt/history_list.py
  3. 2
      electrum/wallet.py

2
electrum/gui/qt/channels_list.py

@ -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)

4
electrum/gui/qt/history_list.py

@ -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))

2
electrum/wallet.py

@ -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

Loading…
Cancel
Save