URI: 
       tkivy: show closing transaction in channel dialog - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit c3c6b818573da915cdf01b2e9ce8e27253494abe
   DIR parent 7c77d7c1761d8a399ab16c33647d78132b9d5ffb
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Fri,  6 Mar 2020 06:49:46 +0100
       
       kivy: show closing transaction in channel dialog
       
       Diffstat:
         M electrum/gui/kivy/main_window.py    |       4 ++++
         M electrum/gui/kivy/uix/dialogs/ligh… |      18 ++++++++++++++++--
       
       2 files changed, 20 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/electrum/gui/kivy/main_window.py b/electrum/gui/kivy/main_window.py
       t@@ -1040,8 +1040,12 @@ class ElectrumWindow(App):
        
            def show_transaction(self, txid):
                tx = self.wallet.db.get_transaction(txid)
       +        if not tx and self.wallet.lnworker:
       +            tx = self.wallet.lnworker.lnwatcher.db.get_transaction(txid)
                if tx:
                    self.tx_dialog(tx)
       +        else:
       +            self.show_error(f'Transaction not found {txid}')
        
            def lightning_tx_dialog(self, tx):
                from .uix.dialogs.lightning_tx_dialog import LightningTxDialog
   DIR diff --git a/electrum/gui/kivy/uix/dialogs/lightning_channels.py b/electrum/gui/kivy/uix/dialogs/lightning_channels.py
       t@@ -96,6 +96,7 @@ Builder.load_string(r'''
            initiator:''
            capacity:''
            funding_txid:''
       +    closing_txid:''
            state:''
            local_ctn:0
            remote_ctn:0
       t@@ -104,6 +105,7 @@ Builder.load_string(r'''
            feerate:0
            can_send:''
            can_receive:''
       +    is_open:False
            BoxLayout:
                padding: '12dp', '12dp', '12dp', '12dp'
                spacing: '12dp'
       t@@ -130,10 +132,10 @@ Builder.load_string(r'''
                            value: root.capacity
                        BoxLabel:
                            text: _('Can send')
       -                    value: root.can_send
       +                    value: root.can_send if root.is_open else 'n/a'
                        BoxLabel:
                            text: _('Can receive')
       -                    value: root.can_receive
       +                    value: root.can_receive if root.is_open else 'n/a'
                        BoxLabel:
                            text: _('CSV delay')
                            value: 'Local: %d\nRemote: %d' % (root.local_csv, root.remote_csv)
       t@@ -156,6 +158,14 @@ Builder.load_string(r'''
                            data: root.funding_txid
                            name: _('Funding Transaction')
                            touch_callback: lambda: app.show_transaction(root.funding_txid)
       +                TopLabel:
       +                    text: _('Closing Transaction')
       +                    opacity: int(bool(root.closing_txid))
       +                TxHashLabel:
       +                    opacity: int(bool(root.closing_txid))
       +                    data: root.closing_txid
       +                    name: _('Closing Transaction')
       +                    touch_callback: lambda: app.show_transaction(root.closing_txid)
                        Widget:
                            size_hint: 1, 0.1
                Widget:
       t@@ -207,6 +217,10 @@ class ChannelDetailsPopup(Popup):
                self.feerate = chan.get_latest_feerate(LOCAL)
                self.can_send = self.app.format_amount_and_units(chan.available_to_spend(LOCAL) // 1000)
                self.can_receive = self.app.format_amount_and_units(chan.available_to_spend(REMOTE) // 1000)
       +        self.is_open = chan.is_open()
       +        closed = chan.get_closing_height()
       +        if closed:
       +            self.closing_txid, closing_height, closing_timestamp = closed
        
            def close(self):
                Question(_('Close channel?'), self._close).open()