From f808ec911af63d01cdbff1813eaa39a1f5bd6107 Mon Sep 17 00:00:00 2001 From: SomberNight Date: Mon, 15 Jan 2024 21:21:29 +0000 Subject: [PATCH] lnpeer.reest_chan: allow state transition WE_ARE_TOXIC->WE_ARE_TOXIC if the remote does not know we are behind, they will try to send us chan_reest ``` 38.52 | W | P/lnpeer.Peer.[LNWallet, 034cd7a09f-ed50cf95] | channel_reestablish (533x1x1): remote is ahead of us! They should force-close. Remote PCP: 03857eabd943eec820d56b94d2f162763294565627cc42c4a0db0e7c6b77da46be 38.52 | E | P/lnpeer.Peer.[LNWallet, 034cd7a09f-ed50cf95] | Exception in main_loop: Exception('Transition not allowed: WE_ARE_TOXIC -> WE_ARE_TOXIC') Traceback (most recent call last): File "/home/user/wspace/electrum/electrum/util.py", line 1148, in wrapper return await func(*args, **kwargs) File "/home/user/wspace/electrum/electrum/lnpeer.py", line 426, in wrapper_func return await func(self, *args, **kwargs) File "/home/user/wspace/electrum/electrum/lnpeer.py", line 440, in main_loop async with self.taskgroup as group: File "/home/user/.local/lib/python3.10/site-packages/aiorpcx/curio.py", line 297, in __aexit__ await self.join() File "/home/user/wspace/electrum/electrum/util.py", line 1319, in join task.result() File "/home/user/wspace/electrum/electrum/lnpeer.py", line 1231, in on_channel_reestablish chan.set_state(ChannelState.WE_ARE_TOXIC) File "/home/user/wspace/electrum/electrum/lnchannel.py", line 215, in set_state raise Exception(f"Transition not allowed: {old_state.name} -> {state.name}") Exception: Transition not allowed: WE_ARE_TOXIC -> WE_ARE_TOXIC ``` --- electrum/lnchannel.py | 1 + 1 file changed, 1 insertion(+) diff --git a/electrum/lnchannel.py b/electrum/lnchannel.py index ed8074d8b..973e1c0f3 100644 --- a/electrum/lnchannel.py +++ b/electrum/lnchannel.py @@ -140,6 +140,7 @@ state_transitions = [ (cs.OPEN, cs.WE_ARE_TOXIC), (cs.SHUTDOWN, cs.WE_ARE_TOXIC), (cs.REQUESTED_FCLOSE, cs.WE_ARE_TOXIC), + (cs.WE_ARE_TOXIC, cs.WE_ARE_TOXIC), # (cs.FORCE_CLOSING, cs.FORCE_CLOSING), # allow multiple attempts (cs.FORCE_CLOSING, cs.CLOSED),