Skip to content

improve CloseChannel docs #9958

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ZZiigguurraatt
Copy link

@ZZiigguurraatt ZZiigguurraatt commented Jun 17, 2025

This is a docs change only to improve the clarity of how to use CloseChannel .

Fixes #9771
Fixes #9837

Copy link
Contributor

coderabbitai bot commented Jun 17, 2025

Important

Review skipped

Auto reviews are limited to specific labels.

🏷️ Labels to auto review (1)
  • llm-review

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@ZZiigguurraatt
Copy link
Author

Do I also need to update lightning.swagger.json to properly complete this PR? It is unclear to me why we seem to have duplicate text in there. What is lightning.swagger.json for?

@guggero
Copy link
Collaborator

guggero commented Jun 17, 2025

Do I also need to update lightning.swagger.json to properly complete this PR? It is unclear to me why we seem to have duplicate text in there. What is lightning.swagger.json for?

Yes, you need to generate the stubs with make rpc.

@ZZiigguurraatt ZZiigguurraatt force-pushed the closechannel_docs branch 2 times, most recently from 6380421 to 89cd7f2 Compare June 19, 2025 15:20
@ZZiigguurraatt
Copy link
Author

@ziggie1984 please review.

Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

Nice addition!

// If `no_wait=true` (`wait=false`) when a coop close is attempted, then the
// rpc call will not initially block while it awaits a closing txid to be
// broadcasted to the mempool. Instead, a coop close will be initiated even
// if there are HTLCs active in flight on the channel and a `close_instant`
Copy link
Collaborator

Choose a reason for hiding this comment

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

and a close_instant msg will sent over the stream ...

Copy link
Author

Choose a reason for hiding this comment

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

please check my update

Comment on lines 2188 to 2190
// resolved before that can happen. If a coop close is attempted with no in
// flight HTLCs on the channel OR a force close is attempted, the `no_wait`
// option is ignored. In summary, the `no_wait` option controls if the user
Copy link
Collaborator

Choose a reason for hiding this comment

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

If a coop close is attempted with no inflight HTLCs on the channel the no_wait=true parameter has still the effect that the stream sends the close_instant msg immediately however that should not make much of a difference because LND should broadcast the closing tx without much time delay and therefore should send the close_pending update right after.

Copy link
Author

Choose a reason for hiding this comment

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

please check my update on this. I'm not sure if I got it right about force closing.

// wait for the in flight HTLCs to be resolved and then start the coop
// closing process. Note: `lncli closechannel` always sets `no_wait=true`
// and its `--block` option controls if `lncli` should wait for a
// `close_pending` update and a `chan_close` update before returning or if
Copy link
Collaborator

Choose a reason for hiding this comment

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

should wait for the chan_close update (we still on the lncli side wait for the close_pending, which signals when the tx is broadcasted to the mempool)

Copy link
Author

Choose a reason for hiding this comment

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

please check my update

Comment on lines 2186 to 2189
// will fail and abort the closing process because it can't wait for a
// closing TXID to be broadcast to the mempool because it needs to
// immediately tell the user that there are in flight HTLCs that need to be
// resolved before that can happen. If a coop close is attempted with no in
Copy link
Collaborator

Choose a reason for hiding this comment

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

then the rpc call will fail and abort the closing process because the caller wants to wait for the closing tx being broadcasted to the mempool but because of the inflight HTLCs this can be very long therefore LND will not allow initiating the coop-close with this setting.

Copy link
Collaborator

Choose a reason for hiding this comment

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

it is not that we can't we just decided to not do so because of the above reasons, does it make sense ?

Copy link
Author

Choose a reason for hiding this comment

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

no, that is very convoluted.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ok I am trying to say, that we decided to not close the channel in that case because we do not want the user to wait until the HTLCs resolves because he signaled via "wait=true" he wants to wait for the closing information. But we definitely could, like technically this is not a problem, it is just we decided not to, to make sure the user does not have to wait forever

Copy link
Author

Choose a reason for hiding this comment

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

so how exactly would you re-write the sentence?

@ZZiigguurraatt ZZiigguurraatt marked this pull request as ready for review June 24, 2025 15:16
@ZZiigguurraatt
Copy link
Author

taking out of draft as I'd like to see some feedback from others. @saubyk , do you have any feedback?

Copy link
Collaborator

@ziggie1984 ziggie1984 left a comment

Choose a reason for hiding this comment

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

LGTM

@ziggie1984 ziggie1984 requested a review from saubyk June 24, 2025 17:10
// initiated even if HTLCs are active on the channel. The channel will wait
// until all HTLCs are resolved and then start the coop closing process. The
// channel will be disabled in the meantime and will disallow any new HTLCs.
// When force closing, `no_wait` has no effect.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is an extremely verbose description and it doesn't seem to me that this is right place to get into the detailed scenarios here. How and where would this content would be made available to the user?

My first reaction is that it's not easy to follow and digest. And we may need to supplement the documentation somewhere else, rather than here.

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.

[bug]: CloseChannel: no_wait=True still waiting [bug]: CloseChannel documentation makes no mention of the new RBF cooperative close protocol
4 participants