This PR makes the latest channel reestablishment message being stored as part of the channel close summary, such that it can be sent even when a channel ahs been closed.
This makes it possible for nodes to recover from the case where they have been offline, lost state, and comes back online, attempting to reseync the channel.
Note: This PR contains a DB migration. To ensure deserialization code is not changed in the future, and breaking old migrations, a versioned copy of the current deserialization logic is added to the file
The text was updated successfully, but these errors were encountered:
This commit adds a new file legacy_serialization.go, where a copy of the current deserializeCloseChannelSummary is made, called deserializeCloseChannelSummaryV6. The rationale is to keep old deserialization code around to be used during migration, as it is hard maintaining compatibility with the old format while changing the code in use.
This commit adds an optional field LastChanSyncMsg to the CloseChannelSummary, which will be used to save the ChannelReestablish message for the channel at the point of channel close.
This lets us get the channel reestablish message without creating the LightningChannel struct first.
We pool the database for the channel commit point with an exponential backoff. This is meant to handle the case where we are in process of handling a channel sync, and the case where we detect a channel close and must wait for the peer to come online to start channel sync before we can proceed.
This adds the scenario where a channel is closed while the node is offline, the node loses state and comes back online. In this case the node should attempt to resync the channel, and the peer should resend a channel sync message for the closed channel, such that the node can retrieve its funds.