electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 28452e2d4661715841aba7bea43c855dc6e9f9e1
parent 0d160cceead9ba70080fe3f19b47c90490fc26d3
Author: ThomasV <thomasv@electrum.org>
Date:   Fri,  6 Mar 2020 11:25:34 +0100

do not try to reestablish channel if state is FORCE_CLOSING

Diffstat:
Melectrum/lnchannel.py | 6+++---
Melectrum/lnpeer.py | 2+-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py @@ -70,8 +70,8 @@ class channel_states(IntEnum): # - Non-funding node: has sent the funding_signed message. FUNDED = 2 # Funding tx was mined (requires min_depth and tx verification) OPEN = 3 # both parties have sent funding_locked - FORCE_CLOSING = 4 # force-close tx has been broadcast - CLOSING = 5 # shutdown has been sent. + CLOSING = 4 # shutdown has been sent. + FORCE_CLOSING = 5 # force-close tx has been broadcast CLOSED = 6 # funding txo has been spent REDEEMED = 7 # we can stop watching @@ -400,7 +400,7 @@ class Channel(Logger): return True 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): script = funding_output_script(self.config[LOCAL], self.config[REMOTE]) diff --git a/electrum/lnpeer.py b/electrum/lnpeer.py @@ -724,7 +724,7 @@ class Peer(Logger): async def reestablish_channel(self, chan: Channel): await self.initialized 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: self.logger.info(f'reestablish_channel was called but channel {chan.get_id_for_log()} ' f'already in peer_state {chan.peer_state}')