electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 0147623d114d20db9052aa1569ed3305f0b010c2
parent 67d24bf12981a730b7b95c369360ccbec5ed29c9
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:
Melectrum/lnpeer.py | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py @@ -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):