URI: 
       tQt gui: show messages about payment outcome - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit d6b4268fdeabd9c8c004e1a226a1ed2118375a00
   DIR parent 02c39a950f5f547ed9b294f81e3f064d4cd7f319
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Thu, 18 Oct 2018 13:46:01 +0200
       
       Qt gui: show messages about payment outcome
       
       Diffstat:
         M electrum/gui/qt/main_window.py      |       8 ++++++--
         M electrum/lnbase.py                  |       3 +++
       
       2 files changed, 9 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/electrum/gui/qt/main_window.py b/electrum/gui/qt/main_window.py
       t@@ -223,7 +223,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
                    interests = ['wallet_updated', 'network_updated', 'blockchain_updated',
                                 'new_transaction', 'status',
                                 'banner', 'verified', 'fee', 'fee_histogram', 'on_quotes',
       -                         'on_history', 'channel', 'channels', 'ln_status']
       +                         'on_history', 'channel', 'channels', 'ln_status', 'ln_message']
                    # To avoid leaking references to "self" that prevent the
                    # window from being GC-ed when closed, callbacks should be
                    # methods of this class only, and specifically not be
       t@@ -360,7 +360,7 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
                    wallet, tx = args
                    if wallet == self.wallet:
                        self.tx_notification_queue.put(tx)
       -        elif event in ['status', 'banner', 'verified', 'fee', 'fee_histogram']:
       +        elif event in ['status', 'banner', 'verified', 'fee', 'fee_histogram', 'ln_message']:
                    # Handle in GUI thread
                    self.network_signal.emit(event, args)
                elif event == 'on_quotes':
       t@@ -395,6 +395,10 @@ class ElectrumWindow(QMainWindow, MessageBoxMixin, Logger):
                        self.fee_slider.update()
                        self.require_fee_update = True
                    self.history_model.on_fee_histogram()
       +        elif event == 'ln_message':
       +            lnworker, message = args
       +            if lnworker == self.wallet.lnworker:
       +                self.show_message(message)
                else:
                    self.logger.info(f"unexpected network_qt signal: {event} {args}")
        
   DIR diff --git a/electrum/lnbase.py b/electrum/lnbase.py
       t@@ -870,6 +870,7 @@ class Peer(PrintError):
                self.send_commitment(chan)  # htlc will be removed
                await self.receive_revoke(chan)
                self.lnworker.save_channel(chan)
       +        self.network.trigger_callback('ln_message', self.lnworker, 'Payment failed')
        
            async def _handle_error_code_from_failed_htlc(self, error_reason, route: List[RouteEdge], channel_id, htlc_id):
                chan = self.channels[channel_id]
       t@@ -985,6 +986,7 @@ class Peer(PrintError):
                self.send_commitment(chan) # htlc will be removed
                await self.receive_revoke(chan)
                self.lnworker.save_channel(chan)
       +        self.network.trigger_callback('ln_message', self.lnworker, 'Payment sent')
        
                # used in lightning-integration
                self.payment_preimages[sha256(preimage)].put_nowait(preimage)
       t@@ -1018,6 +1020,7 @@ class Peer(PrintError):
                chan.settle_htlc(preimage, htlc_id)
                await self.update_channel(chan, "update_fulfill_htlc", channel_id=channel_id, id=htlc_id, payment_preimage=preimage)
                self.lnworker.save_channel(chan)
       +        self.network.trigger_callback('ln_message', self.lnworker, 'Payment received')
        
            def on_revoke_and_ack(self, payload):
                print("got revoke_and_ack")