1
0

fix balance sanity check in get_lightning_history

This commit is contained in:
ThomasV
2025-02-28 09:42:24 +01:00
parent 5ce80332ec
commit 4917f7e3ce
2 changed files with 5 additions and 1 deletions

View File

@@ -235,6 +235,10 @@ class AbstractChannel(Logger, ABC):
# the closing txid has been saved
return self.get_state() >= ChannelState.CLOSING
def is_closed_or_closing(self):
# related: self.get_state_for_GUI
return self.is_closed() or self.unconfirmed_closing_txid is not None
def is_redeemed(self) -> bool:
return self.get_state() == ChannelState.REDEEMED

View File

@@ -1056,7 +1056,7 @@ class LNWallet(LNWorker):
# sanity check
balance_msat = sum([x.amount_msat for x in out.values()])
lb = sum(chan.balance(LOCAL) if not chan.is_closed() else 0
lb = sum(chan.balance(LOCAL) if not chan.is_closed_or_closing() else 0
for chan in self.channels.values())
assert balance_msat == lb
return out