Browse Source

do not try to reestablish channel if state is FORCE_CLOSING

hard-fail-on-bad-server-string
ThomasV 5 years ago
parent
commit
28452e2d46
  1. 6
      electrum/lnchannel.py
  2. 2
      electrum/lnpeer.py

6
electrum/lnchannel.py

@ -70,8 +70,8 @@ class channel_states(IntEnum):
# - Non-funding node: has sent the funding_signed message. # - Non-funding node: has sent the funding_signed message.
FUNDED = 2 # Funding tx was mined (requires min_depth and tx verification) FUNDED = 2 # Funding tx was mined (requires min_depth and tx verification)
OPEN = 3 # both parties have sent funding_locked OPEN = 3 # both parties have sent funding_locked
FORCE_CLOSING = 4 # force-close tx has been broadcast CLOSING = 4 # shutdown has been sent.
CLOSING = 5 # shutdown has been sent. FORCE_CLOSING = 5 # force-close tx has been broadcast
CLOSED = 6 # funding txo has been spent CLOSED = 6 # funding txo has been spent
REDEEMED = 7 # we can stop watching REDEEMED = 7 # we can stop watching
@ -400,7 +400,7 @@ class Channel(Logger):
return True return True
def should_try_to_reestablish_peer(self) -> bool: def should_try_to_reestablish_peer(self) -> bool:
return channel_states.PREOPENING < self._state < channel_states.CLOSED and self.peer_state == peer_states.DISCONNECTED return channel_states.PREOPENING < self._state < channel_states.FORCE_CLOSING and self.peer_state == peer_states.DISCONNECTED
def get_funding_address(self): def get_funding_address(self):
script = funding_output_script(self.config[LOCAL], self.config[REMOTE]) script = funding_output_script(self.config[LOCAL], self.config[REMOTE])

2
electrum/lnpeer.py

@ -724,7 +724,7 @@ class Peer(Logger):
async def reestablish_channel(self, chan: Channel): async def reestablish_channel(self, chan: Channel):
await self.initialized await self.initialized
chan_id = chan.channel_id chan_id = chan.channel_id
assert channel_states.PREOPENING < chan.get_state() < channel_states.CLOSED assert channel_states.PREOPENING < chan.get_state() < channel_states.FORCE_CLOSING
if chan.peer_state != peer_states.DISCONNECTED: if chan.peer_state != peer_states.DISCONNECTED:
self.logger.info(f'reestablish_channel was called but channel {chan.get_id_for_log()} ' self.logger.info(f'reestablish_channel was called but channel {chan.get_id_for_log()} '
f'already in peer_state {chan.peer_state}') f'already in peer_state {chan.peer_state}')

Loading…
Cancel
Save