Browse Source

lnworker.get_lightning_history(&get_payment_value): rm failing assert

follow-up e1d34300e5
follow-up dc15d59fcf

```
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 <lambda>
    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 <lambda>
    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
```
patch-4
SomberNight 3 years ago
parent
commit
2511d8118c
No known key found for this signature in database GPG Key ID: B33B5F232C6271E9
  1. 8
      electrum/lnworker.py

8
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 = {

Loading…
Cancel
Save