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

Do not force-close channels when we cannot communicate with peers #1429

Merged

Conversation

TheBlueMatt
Copy link
Collaborator

In general, we should never be automatically force-closing our
users' channels unless there is some immediate risk of funds loss
(ie because of some HTLC(s) which are timing out soon). In any
other case, we should trust the user to be able to figure out what
is going on and close their channels manually instead of trying to
be overly clever and automate closures if we think the channel is
useless.

In this case, even if a peer has some required feature that does
not allow us to communicate with them, there is a strong
possibility that some LDK upgrade may allow us to in the future. In
the mean time, there is no reason to go on-chain unless the user
needs funds immediately. In such a case, the user should already
have logic to force-close channels with peers which are not
available for any reason.

@TheBlueMatt TheBlueMatt force-pushed the 2022-04-drop-no-conn-possible branch 3 times, most recently from dba08e5 to 6741021 Compare April 18, 2022 03:02
@codecov-commenter
Copy link

codecov-commenter commented Apr 18, 2022

Codecov Report

Merging #1429 (62edee5) into main (62edee5) will not change coverage.
The diff coverage is n/a.

❗ Current head 62edee5 differs from pull request most recent head e39d63c. Consider uploading reports for the commit e39d63c to get more accurate results

@@           Coverage Diff           @@
##             main    #1429   +/-   ##
=======================================
  Coverage   90.88%   90.88%           
=======================================
  Files          75       75           
  Lines       41517    41517           
  Branches    41517    41517           
=======================================
  Hits        37734    37734           
  Misses       3783     3783           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 62edee5...e39d63c. Read the comment docs.

@@ -2170,15 +2170,15 @@ fn channel_monitor_network_test() {
assert_eq!(nodes[0].node.list_channels().len(), 0);
assert_eq!(nodes[1].node.list_channels().len(), 1);
check_closed_event!(nodes[0], 1, ClosureReason::CommitmentTxConfirmed);
check_closed_event!(nodes[1], 1, ClosureReason::DisconnectedPeer);
check_closed_event!(nodes[1], 1, ClosureReason::HolderForceClosed);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, I think after this we we'll be missing test coverage of ClosureReason::DisconnectedPeer

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, well this doesn't change coverage of it for the "peer disconnected before confirmation" reason, only the no_connection_possible reason, so it doesn't really change coverage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@vincenzopalazzo vincenzopalazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good feature to have!

@TheBlueMatt TheBlueMatt force-pushed the 2022-04-drop-no-conn-possible branch from 72c29ff to 6902ccb Compare April 19, 2022 18:07
@TheBlueMatt
Copy link
Collaborator Author

Squashed

@TheBlueMatt
Copy link
Collaborator Author

Squashed.

arik-so
arik-so previously approved these changes Apr 27, 2022
@TheBlueMatt
Copy link
Collaborator Author

Oops missed that this now depends on #1435.

In general, we should never be automatically force-closing our
users' channels unless there is some immediate risk of funds loss
(ie because of some HTLC(s) which are timing out soon). In any
other case, we should trust the user to be able to figure out what
is going on and close their channels manually instead of trying to
be overly clever and automate closures if we think the channel is
useless.

In this case, even if a peer has some required feature that does
not allow us to communicate with them, there is a strong
possibility that some LDK upgrade may allow us to in the future. In
the mean time, there is no reason to go on-chain unless the user
needs funds immediately. In such a case, the user should already
have logic to force-close channels with peers which are not
available for any reason.
@TheBlueMatt TheBlueMatt force-pushed the 2022-04-drop-no-conn-possible branch from 99f0855 to e39d63c Compare April 28, 2022 02:50
@TheBlueMatt
Copy link
Collaborator Author

Not really sure why this ended up based on #1435, but that landed now so rebased this.

@TheBlueMatt TheBlueMatt merged commit e5c988e into lightningdevkit:main May 14, 2022
tnull pushed a commit to tnull/rust-lightning that referenced this pull request May 17, 2022
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.

5 participants