From 6491421930728d218f935e48e162026d48842e5e Mon Sep 17 00:00:00 2001 From: ThomasV Date: Thu, 25 Mar 2021 11:24:33 +0100 Subject: [PATCH] lnchannel: rename force_close_detected -> closing_detected, use it only if state is OPEN --- electrum/lnchannel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py index e2e619a92..7a0c0269f 100644 --- a/electrum/lnchannel.py +++ b/electrum/lnchannel.py @@ -304,7 +304,7 @@ class AbstractChannel(Logger, ABC): # we must not trust the server with unconfirmed transactions, # because the state transition is irreversible. if the remote # force closed, we remain OPEN until the closing tx is confirmed - self.force_close_detected = True + self.closing_detected = True if self.lnworker: util.trigger_callback('channel', self.lnworker.wallet, self) @@ -339,8 +339,8 @@ class AbstractChannel(Logger, ABC): def get_state_for_GUI(self) -> str: cs = self.get_state() - if cs < ChannelState.CLOSED and self.force_close_detected: - return 'FORCE_CLOSING' + if cs == ChannelState.OPEN and self.closing_detected: + return 'FORCE-CLOSING' return cs.name @abstractmethod @@ -419,7 +419,7 @@ class ChannelBackup(AbstractChannel): self.config = {} if self.is_imported: self.init_config(cb) - self.force_close_detected = False # not a state, only for GUI + self.closing_detected = False # not a state, only for GUI def init_config(self, cb): self.config[LOCAL] = LocalConfig.from_seed( @@ -553,7 +553,7 @@ class Channel(AbstractChannel): self._receive_fail_reasons = {} # type: Dict[int, (bytes, OnionRoutingFailure)] self._ignore_max_htlc_value = False # used in tests self.should_request_force_close = False - self.force_close_detected = False # not a state, only for GUI + self.closing_detected = False # not a state, only for GUI def has_onchain_backup(self): return self.storage.get('has_onchain_backup', False) @@ -735,7 +735,7 @@ class Channel(AbstractChannel): def get_state_for_GUI(self): cs_name = super().get_state_for_GUI() - if self.is_closed() or self.force_close_detected: + if self.is_closed() or self.closing_detected: return cs_name ps = self.peer_state if ps != PeerState.GOOD: