lnchannel.get_close_opts: allow REQUEST_REMOTE_FCLOSE if WE_ARE_TOXIC
related https://github.com/spesmilo/electrum/issues/8770
This commit is contained in:
@@ -1015,6 +1015,8 @@ class Channel(AbstractChannel):
|
||||
def should_try_to_reestablish_peer(self) -> bool:
|
||||
if self.peer_state != PeerState.DISCONNECTED:
|
||||
return False
|
||||
if self.should_request_force_close:
|
||||
return True
|
||||
return ChannelState.PREOPENING < self._state < ChannelState.CLOSING
|
||||
|
||||
def get_funding_address(self):
|
||||
@@ -1629,6 +1631,8 @@ class Channel(AbstractChannel):
|
||||
if not self.has_unsettled_htlcs():
|
||||
ret.append(ChanCloseOption.COOP_CLOSE)
|
||||
ret.append(ChanCloseOption.REQUEST_REMOTE_FCLOSE)
|
||||
if self.get_state() == ChannelState.WE_ARE_TOXIC:
|
||||
ret.append(ChanCloseOption.REQUEST_REMOTE_FCLOSE)
|
||||
if not self.is_closed() or self.get_state() == ChannelState.REQUESTED_FCLOSE:
|
||||
ret.append(ChanCloseOption.LOCAL_FCLOSE)
|
||||
assert not (self.get_state() == ChannelState.WE_ARE_TOXIC and ChanCloseOption.LOCAL_FCLOSE in ret), "local force-close unsafe if we are toxic"
|
||||
|
||||
Reference in New Issue
Block a user