qt: add menu item to view closing transaction of channel

This commit is contained in:
ThomasV 2020-02-22 12:28:07 +01:00
parent b12c913d47
commit 7771daf94e
2 changed files with 10 additions and 0 deletions

View file

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

View file

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