URI: 
       tlnpeer: Peer.is_initialized() should not raise - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 0147623d114d20db9052aa1569ed3305f0b010c2
   DIR parent 67d24bf12981a730b7b95c369360ccbec5ed29c9
  HTML Author: SomberNight <somber.night@protonmail.com>
       Date:   Sat, 29 Feb 2020 20:10:02 +0100
       
       lnpeer: Peer.is_initialized() should not raise
       
       Traceback (most recent call last):
         File "...\electrum\electrum\gui\qt\main_window.py", line 434, in on_network_qt
           self.update_lightning_icon()
         File "...\electrum\electrum\gui\qt\main_window.py", line 2092, in update_lightning_icon
           cur, total = self.network.lngossip.get_sync_progress_estimate()
         File "...\electrum\electrum\lnworker.py", line 373, in get_sync_progress_estimate
           if self.num_peers() == 0:
         File "...\electrum\electrum\lnworker.py", line 202, in num_peers
           return sum([p.is_initialized() for p in self.peers.values()])
         File "...\electrum\electrum\lnworker.py", line 202, in
           return sum([p.is_initialized() for p in self.peers.values()])
         File "...\electrum\electrum\lnpeer.py", line 128, in is_initialized
           return self.initialized.done() and self.initialized.result() is True
       concurrent.futures._base.CancelledError
       
       Diffstat:
         M electrum/lnpeer.py                  |       7 +++++--
       
       1 file changed, 5 insertions(+), 2 deletions(-)
       ---
   DIR diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py
       t@@ -124,8 +124,11 @@ class Peer(Logger):
                if self._sent_init and self._received_init:
                    self.initialized.set_result(True)
        
       -    def is_initialized(self):
       -        return self.initialized.done() and self.initialized.result() is True
       +    def is_initialized(self) -> bool:
       +        return (self.initialized.done()
       +                and not self.initialized.cancelled()
       +                and self.initialized.exception() is None
       +                and self.initialized.result() is True)
        
            async def initialize(self):
                if isinstance(self.transport, LNTransport):