fix balance sanity check in get_lightning_history
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user