Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework channel reestablish #2036

Merged
merged 3 commits into from
Oct 27, 2021
Merged

Rework channel reestablish #2036

merged 3 commits into from
Oct 27, 2021

Conversation

pm47
Copy link
Member

@pm47 pm47 commented Oct 27, 2021

In an "outdated commitment" scenario where we are on the up-to-date side, we always react by force-closing the channel immediately, not giving our peer a chance to fix their data and restart. On top of that, we consider this a commitment sync error, instead of clearly logging that our counterparty is using outdated data.

Addressing this turned out to be rabbit-holey: our sync code is quite complicated and is a bit redundant because we separate between:

  • checking whether we are late
  • deciding what messages we need to retransmit

Also, discovered a missing corner case when syncing in SHUTDOWN state.

This has been extracted from #1838.

In an "outdated commitment" scenario where we are on the up-to-date side, we always react by force-closing the channel immediately, not giving our peer a chance to fix their data and restart. On top of that, we consider this a commitment sync error, instead of clearly logging that our counterparty is using outdated data.

Addressing this turned out to be rabbit-holey: our sync code is quite complicated and is a bit redundant because we separate between:
- checking whether we are late
- deciding what messages we need to retransmit

Also, discovered a missing corner case when syncing in SHUTDOWN state.
@pm47 pm47 requested a review from t-bast October 27, 2021 08:39
@codecov-commenter
Copy link

Codecov Report

Merging #2036 (4bb16c1) into master (2e9f8d9) will decrease coverage by 0.06%.
The diff coverage is 86.74%.

@@            Coverage Diff             @@
##           master    #2036      +/-   ##
==========================================
- Coverage   87.64%   87.58%   -0.07%     
==========================================
  Files         161      161              
  Lines       12590    12589       -1     
  Branches      566      515      -51     
==========================================
- Hits        11035    11026       -9     
- Misses       1555     1563       +8     
Impacted Files Coverage Δ
...c/main/scala/fr/acinq/eclair/channel/Helpers.scala 94.78% <83.33%> (-0.79%) ⬇️
...c/main/scala/fr/acinq/eclair/channel/Channel.scala 88.24% <87.50%> (-0.47%) ⬇️
...in/scala/fr/acinq/eclair/channel/Commitments.scala 94.65% <100.00%> (+0.14%) ⬆️
...main/scala/fr/acinq/eclair/router/Validation.scala 92.30% <0.00%> (-0.39%) ⬇️

@pm47 pm47 requested a review from t-bast October 27, 2021 09:24
@pm47 pm47 merged commit 2c0c24e into master Oct 27, 2021
@pm47 pm47 deleted the rework-reestablish branch October 27, 2021 09:45
pm47 added a commit to ACINQ/lightning-kmp that referenced this pull request Apr 16, 2024
This is inspired from eclair, but changes are kept minimal. We don't
support the `RemoteLate` case.

Eclair had a full rework in ACINQ/eclair#2036,
that separated concerns better and got completely rid of exceptions.
pm47 added a commit to ACINQ/lightning-kmp that referenced this pull request Apr 16, 2024
This is the equivalent of ACINQ/eclair#2036.

Notably we remove the `RevocationSyncError` exception, and in case the
peer has an outdated commitment we stay in stand by, waiting for their
`error` before force-closing.
pm47 added a commit to ACINQ/lightning-kmp that referenced this pull request Apr 17, 2024
- properly handle `channel_reestablish` in state `Syncing(Shutdown)`
- implement the equivalent of ACINQ/eclair#2036, a major rework/cleanup of the reestablish logic, with separation of concerns, strong typing, etc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants