Skip to content

Commit 4917f7e

Browse files
committed
fix balance sanity check in get_lightning_history
1 parent 5ce8033 commit 4917f7e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

electrum/lnchannel.py

+4
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,10 @@ def is_closed(self) -> bool:
235235
# the closing txid has been saved
236236
return self.get_state() >= ChannelState.CLOSING
237237

238+
def is_closed_or_closing(self):
239+
# related: self.get_state_for_GUI
240+
return self.is_closed() or self.unconfirmed_closing_txid is not None
241+
238242
def is_redeemed(self) -> bool:
239243
return self.get_state() == ChannelState.REDEEMED
240244

electrum/lnworker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ def get_lightning_history(self) -> Dict[str, LightningHistoryItem]:
10561056

10571057
# sanity check
10581058
balance_msat = sum([x.amount_msat for x in out.values()])
1059-
lb = sum(chan.balance(LOCAL) if not chan.is_closed() else 0
1059+
lb = sum(chan.balance(LOCAL) if not chan.is_closed_or_closing() else 0
10601060
for chan in self.channels.values())
10611061
assert balance_msat == lb
10621062
return out

0 commit comments

Comments
 (0)