From 2511d8118c9f47188822a617362b86baf77e6f04 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Wed, 29 Jun 2022 16:12:47 +0200 Subject: [PATCH] lnworker.get_lightning_history(&get_payment_value): rm failing assert follow-up https://github.com/spesmilo/electrum/commit/e1d34300e59c6b35c7a97a776603ed7085b9e413 follow-up https://github.com/spesmilo/electrum/commit/dc15d59fcf04418c7ed36838beac30efd8d4774f ``` Traceback (most recent call last): File ".../electrum/gui/qt/main_window.py", line 910, in timer_actions self.update_wallet() File ".../electrum/gui/qt/main_window.py", line 1068, in update_wallet self.update_tabs() File ".../electrum/gui/qt/main_window.py", line 1075, in update_tabs self.history_model.refresh('update_tabs') File ".../electrum/util.py", line 439, in return lambda *args, **kw_args: do_profile(args, kw_args) File ".../electrum/util.py", line 435, in do_profile o = func(*args, **kw_args) File ".../electrum/gui/qt/history_list.py", line 275, in refresh transactions = wallet.get_full_history( File ".../electrum/util.py", line 439, in return lambda *args, **kw_args: do_profile(args, kw_args) File ".../electrum/util.py", line 435, in do_profile o = func(*args, **kw_args) File ".../electrum/wallet.py", line 1109, in get_full_history lightning_history = self.lnworker.get_lightning_history() if self.lnworker and include_lightning else {} File ".../electrum/lnworker.py", line 839, in get_lightning_history assert direction == PaymentDirection.FORWARDING AssertionError ``` --- electrum/lnworker.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/electrum/lnworker.py b/electrum/lnworker.py index 298f46ba0..b530e3b9d 100644 --- a/electrum/lnworker.py +++ b/electrum/lnworker.py @@ -806,7 +806,7 @@ class LNWallet(LNWorker): def get_payment_value( self, info: Optional['PaymentInfo'], - plist: List[HTLCWithStatus]) -> Tuple[int, int, int, int]: + plist: List[HTLCWithStatus]) -> Tuple[PaymentDirection, int, Optional[int], int]: """ fee_msat is included in amount_msat""" assert plist amount_msat = sum(int(x.direction) * x.htlc.amount_msat for x in plist) @@ -833,10 +833,8 @@ class LNWallet(LNWorker): key = payment_hash.hex() info = self.get_payment_info(payment_hash) direction, amount_msat, fee_msat, timestamp = self.get_payment_value(info, plist) - if info is not None: - label = self.wallet.get_label_for_rhash(key) - else: - assert direction == PaymentDirection.FORWARDING + label = self.wallet.get_label_for_rhash(key) + if not label and direction == PaymentDirection.FORWARDING: label = _('Forwarding') preimage = self.get_preimage(payment_hash).hex() item = {