commit 7771daf94e47ffa7f06bfb39cd37c012a475b39d
parent b12c913d47054639486eb58e295ea6ea7f5116e4
Author: ThomasV <thomasv@electrum.org>
Date: Sat, 22 Feb 2020 12:28:07 +0100
qt: add menu item to view closing transaction of channel
Diffstat:
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/electrum/gui/qt/channels_list.py b/electrum/gui/qt/channels_list.py
@@ -119,6 +119,11 @@ class ChannelsList(MyTreeView):
if chan.peer_state == peer_states.GOOD:
menu.addAction(_("Close channel"), lambda: self.close_channel(channel_id))
menu.addAction(_("Force-close channel"), lambda: self.force_close(channel_id))
+ else:
+ txid = chan.get_closing_txid()
+ closing_tx = self.lnworker.lnwatcher.db.get_transaction(txid)
+ 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.exec_(self.viewport().mapToGlobal(position))
diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py
@@ -311,6 +311,11 @@ class Channel(Logger):
# the closing txid has been saved
return self.get_state() >= channel_states.CLOSED
+ def get_closing_txid(self):
+ item = self.lnworker.channel_timestamps.get(self.channel_id.hex())
+ funding_txid, funding_height, funding_timestamp, closing_txid, closing_height, closing_timestamp = item
+ return closing_txid
+
def is_redeemed(self):
return self.get_state() == channel_states.REDEEMED