diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py index 166a45e05..33fac6de9 100644 --- a/electrum/gui/qt/channels_list.py +++ b/electrum/gui/qt/channels_list.py @@ -16,7 +16,6 @@ from electrum.lnutil import LOCAL, REMOTE, format_short_channel_id, LN_MAX_FUNDI from .util import (MyTreeView, WindowModalDialog, Buttons, OkButton, CancelButton, EnterButton, WaitingDialog, MONOSPACE_FONT) from .amountedit import BTCAmountEdit, FreezableLineEdit -from .channel_details import ChannelDetailsDialog ROLE_CHANNEL_ID = Qt.UserRole @@ -118,8 +117,11 @@ class ChannelsList(MyTreeView): return channel_id = idx.sibling(idx.row(), self.Columns.NODE_ID).data(ROLE_CHANNEL_ID) chan = self.lnworker.channels[channel_id] - menu.addAction(_("Details..."), lambda: self.details(channel_id)) + menu.addAction(_("Details..."), lambda: self.parent.show_channel(channel_id)) self.add_copy_menu(menu, idx) + funding_tx = self.parent.wallet.db.get_transaction(chan.funding_outpoint.txid) + if funding_tx: + menu.addAction(_("View funding transaction"), lambda: self.parent.show_transaction(funding_tx)) if not chan.is_closed(): if chan.peer_state == peer_states.GOOD: menu.addAction(_("Close channel"), lambda: self.close_channel(channel_id)) @@ -132,13 +134,9 @@ class ChannelsList(MyTreeView): if closing_tx: menu.addAction(_("View closing transaction"), lambda: self.parent.show_transaction(closing_tx)) if chan.is_redeemed(): - menu.addAction(_("Remove"), lambda: self.remove_channel(channel_id)) + menu.addAction(_("Delete"), lambda: self.remove_channel(channel_id)) menu.exec_(self.viewport().mapToGlobal(position)) - def details(self, channel_id): - assert self.parent.wallet - ChannelDetailsDialog(self.parent, channel_id).show() - @QtCore.pyqtSlot(Channel) def do_update_single_row(self, chan): lnworker = self.parent.wallet.lnworker diff --git a/electrum/gui/qt/history_list.py b/electrum/gui/qt/history_list.py index 7b52f51f4..d0ca0eb1e 100644 --- a/electrum/gui/qt/history_list.py +++ b/electrum/gui/qt/history_list.py @@ -274,9 +274,10 @@ class HistoryModel(QAbstractItemModel, Logger): if fx: fx.history_used_spot = False wallet = self.parent.wallet self.set_visibility_of_columns() - transactions = wallet.get_full_history(self.parent.fx, - onchain_domain=self.get_domain(), - include_lightning=self.should_include_lightning_payments()) + transactions = wallet.get_full_history( + self.parent.fx, + onchain_domain=self.get_domain(), + include_lightning=self.should_include_lightning_payments()) if transactions == list(self.transactions.values()): return old_length = len(self.transactions) @@ -621,7 +622,8 @@ class HistoryList(MyTreeView, AcceptFileDragDrop): tx_item = self.hm.transactions.value_from_pos(idx.row()) if tx_item.get('lightning') and tx_item['type'] == 'payment': menu = QMenu() - menu.addAction(_("Details"), lambda: self.parent.show_lightning_transaction(tx_item)) + menu.addAction(_("View payment"), lambda: self.parent.show_lightning_transaction(tx_item)) + self.add_copy_menu(menu, idx) menu.exec_(self.viewport().mapToGlobal(position)) return tx_hash = tx_item['txid'] @@ -646,7 +648,10 @@ class HistoryList(MyTreeView, AcceptFileDragDrop): # TODO use siblingAtColumn when min Qt version is >=5.11 persistent = QPersistentModelIndex(org_idx.sibling(org_idx.row(), c)) menu.addAction(_("Edit {}").format(label), lambda p=persistent: self.edit(QModelIndex(p))) - menu.addAction(_("Details"), lambda: self.show_transaction(tx_item, tx)) + 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 is_unconfirmed and tx: # note: the current implementation of RBF *needs* the old tx fee if tx_details.can_bump and tx_details.fee is not None: diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py index 5e38e30af..39c62c294 100644 --- a/electrum/gui/qt/main_window.py +++ b/electrum/gui/qt/main_window.py @@ -969,6 +969,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger): d = address_dialog.AddressDialog(self, addr) d.exec_() + def show_channel(self, channel_id): + from . import channel_details + channel_details.ChannelDetailsDialog(self, channel_id).show() + def show_transaction(self, tx, *, tx_desc=None): '''tx_desc is set only for txs created in the Send tab''' show_transaction(tx, parent=self, desc=tx_desc) diff --git a/electrum/wallet.py b/electrum/wallet.py index 02c4dd1c7..72b7f3cea 100644 --- a/electrum/wallet.py +++ b/electrum/wallet.py @@ -763,6 +763,8 @@ class Abstract_Wallet(AddressSynchronizer, ABC): if txid and txid in transactions_tmp: item = transactions_tmp[txid] item['label'] = tx_item['label'] + item['type'] = tx_item['type'] + item['channel_id'] = tx_item['channel_id'] item['ln_value'] = Satoshis(ln_value) else: tx_item['lightning'] = True