You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Recover channels that remain in AwaitingChannelReady when the peer's ChannelReady message was lost before a disconnect.
This PR:
treats a duplicate ChannelReady received by an already-ready channel as an
idempotent no-op;
replays the local ChannelReady only when the peer's commitment numbers
identify the initial ready-handshake gap;
requires a persisted local funding confirmation and no pending commitment or
TLC work before taking the replay path;
verifies that normal ready-channel reconnections do not replay ChannelReady.
Background
A channel may reach the following state if one ChannelReady message is lost:
Node
State
Commitment numbers
A
ChannelReady
2/2
B
AwaitingChannelReady(OUR_CHANNEL_READY)
1/1
Both nodes have observed the funding transaction confirmation and sent their
own ChannelReady. B's message reached A, allowing A to enter ChannelReady, but A's message did not reach B.
When the peers reconnect, B resends its ChannelReady. Previously, A rejected
that duplicate because it was already in ChannelReady, while A did not replay
its own ChannelReady. B therefore remained stuck.
The regression test originally proposed in #1544 first created a fully
established channel and then changed only B's state enum back to AwaitingChannelReady(OUR_CHANNEL_READY).
Creating a fully established channel has already executed on_new_channel_ready() on both nodes. That transition changes the state to ChannelReady and advances both commitment numbers from 1/1 to 2/2.
Changing only the enum therefore produced this inconsistent state:
Node
State
Commitment numbers
A
ChannelReady
2/2
B
AwaitingChannelReady(OUR_CHANNEL_READY)
2/2
B cannot naturally remain in AwaitingChannelReady after its counters have
been advanced by on_new_channel_ready().
This distinction matters because ReestablishChannel carries commitment
numbers, not the peer's local channel state or ready flags. A peer reporting 2/2 is indistinguishable from an ordinary fully-ready peer. Making the
original fixture pass would therefore require replaying ChannelReady during
normal ready-channel reconnections.
The updated regression fixture models the reachable state by keeping the
already-ready side at 2/2 and restoring the waiting side to 1/1.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1544.
Summary
Recover channels that remain in
AwaitingChannelReadywhen the peer'sChannelReadymessage was lost before a disconnect.This PR:
ChannelReadyreceived by an already-ready channel as anidempotent no-op;
ChannelReadyonly when the peer's commitment numbersidentify the initial ready-handshake gap;
TLC work before taking the replay path;
ChannelReady.Background
A channel may reach the following state if one
ChannelReadymessage is lost:ChannelReady2/2AwaitingChannelReady(OUR_CHANNEL_READY)1/1Both nodes have observed the funding transaction confirmation and sent their
own
ChannelReady. B's message reached A, allowing A to enterChannelReady, but A's message did not reach B.When the peers reconnect, B resends its
ChannelReady. Previously, A rejectedthat duplicate because it was already in
ChannelReady, while A did not replayits own
ChannelReady. B therefore remained stuck.