Browse Source

lnchannel: rename force_close_detected -> closing_detected, use it only if state is OPEN

patch-4
ThomasV 4 years ago
parent
commit
6491421930
  1. 12
      electrum/lnchannel.py

12
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:

Loading…
Cancel
Save