Skip to content

funding: add timeout to channel batch funding#8367

Closed
hieblmi wants to merge 4 commits into
lightningnetwork:masterfrom
hieblmi:batch-funding-timeout
Closed

funding: add timeout to channel batch funding#8367
hieblmi wants to merge 4 commits into
lightningnetwork:masterfrom
hieblmi:batch-funding-timeout

Conversation

@hieblmi
Copy link
Copy Markdown
Collaborator

@hieblmi hieblmi commented Jan 10, 2024

Fixes #8362.

In this PR we add a context deadline for the batch channel funding process. This gracefully ends the funding process if one or more of the batche's peers are unresponsive. Within the deadline window, the user can abort a pending batch opening via Ctrl+C. The blocking peers will be logged. An aborted batch will cancel all channel openings. The user has to restart with an adjusted batch.

@hieblmi hieblmi added funding Related to the opening of new channels with funding transactions on the blockchain batch funding labels Jan 10, 2024
@hieblmi hieblmi requested review from Roasbeef and guggero January 10, 2024 13:14
@hieblmi hieblmi self-assigned this Jan 10, 2024
@hieblmi hieblmi marked this pull request as draft January 10, 2024 13:14
@hieblmi hieblmi force-pushed the batch-funding-timeout branch from 63e5d82 to 242f7f9 Compare January 10, 2024 13:20
@hieblmi hieblmi force-pushed the batch-funding-timeout branch 3 times, most recently from e95d2b0 to d33c417 Compare January 11, 2024 11:17
Comment thread funding/batch.go Outdated
@hieblmi hieblmi force-pushed the batch-funding-timeout branch from d33c417 to b133a21 Compare January 11, 2024 11:26
@hieblmi hieblmi requested review from Roasbeef and guggero January 11, 2024 13:08
@hieblmi hieblmi marked this pull request as ready for review January 11, 2024 13:09
@hieblmi
Copy link
Copy Markdown
Collaborator Author

hieblmi commented Jan 11, 2024

Ready for review - unit tests still need to be fixed and an itest will be added.

Copy link
Copy Markdown
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

Nice work! Tested this locally and it works as advertised.
Though I'd slightly refactor it to be more in line with other patterns we use in the code base (see inline comment).

Comment thread funding/batch.go Outdated
Comment thread funding/batch.go Outdated
@hieblmi hieblmi force-pushed the batch-funding-timeout branch 2 times, most recently from fba1869 to 6d3f359 Compare January 12, 2024 12:38
@hieblmi hieblmi requested a review from guggero January 12, 2024 12:38
Copy link
Copy Markdown
Collaborator

@guggero guggero left a comment

Choose a reason for hiding this comment

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

tACK, LGTM 🎉

Not sure if adding an itest is easy... But a unit test should be possible.

@ziggie1984
Copy link
Copy Markdown
Collaborator

I wonder if we already have a timeout for the single-channel funding flow ?

@Roasbeef
Copy link
Copy Markdown
Member

I wonder if we already have a timeout for the single-channel funding flow ?

Yep we do, IIUC users wanted the batch funding attempts to time out sooner?

@hieblmi hieblmi force-pushed the batch-funding-timeout branch from 6d3f359 to 89f24db Compare January 26, 2024 09:46
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 26, 2024

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.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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 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.

@hieblmi hieblmi force-pushed the batch-funding-timeout branch 2 times, most recently from ebfb086 to 2be5d35 Compare January 26, 2024 14:08
@saubyk saubyk removed this from the v0.18.0 milestone Mar 5, 2024
@hieblmi
Copy link
Copy Markdown
Collaborator Author

hieblmi commented Mar 12, 2024

Haven't forgotten about this an want to pick it up soon.

@saubyk saubyk added this to the v0.18.1 milestone Mar 20, 2024
@hieblmi hieblmi force-pushed the batch-funding-timeout branch from f2bd339 to a969c19 Compare May 6, 2024 14:54
@saubyk saubyk added the P1 MUST be fixed or reviewed label Jun 25, 2024
@dstadulis
Copy link
Copy Markdown

@saubyk Since #8406 was merged and fixed #8362, it seems this PR should be closed

@guggero
Copy link
Copy Markdown
Collaborator

guggero commented Jul 8, 2024

I think we should keep the PR. Having a timeout is useful here, independent of the other fixes. Not having one just helped us discover the underlying issue.

@saubyk saubyk requested a review from ziggie1984 July 18, 2024 18:31
@saubyk saubyk modified the milestones: v0.18.3, v0.19.0 Jul 23, 2024
@lightninglabs-deploy
Copy link
Copy Markdown
Collaborator

@Roasbeef: review reminder
@ziggie1984: review reminder
@hieblmi, remember to re-request review from reviewers when ready

@ziggie1984
Copy link
Copy Markdown
Collaborator

!lightninglabs-deploy mute

@hieblmi hieblmi closed this Sep 26, 2024
@hieblmi hieblmi force-pushed the batch-funding-timeout branch from a969c19 to 6485a81 Compare September 26, 2024 10:39
@hieblmi hieblmi reopened this Sep 26, 2024
@ziggie1984 ziggie1984 force-pushed the batch-funding-timeout branch from cf66ed9 to e36390e Compare September 26, 2024 12:48
@hieblmi hieblmi force-pushed the batch-funding-timeout branch from e36390e to 0956abc Compare September 26, 2024 12:56
@ziggie1984 ziggie1984 force-pushed the batch-funding-timeout branch from 0956abc to 215516d Compare November 10, 2024 14:51
When the user aborts the psbt channel funding flow, the user
normally has to wait up to 10 min for the other node to cancel
the lingering funding attempt. This cmd provides the possiblity
to cancel a failed funding flow faster hence signaling to the peer
that he can also remove the attempt from his mappings.
@ziggie1984
Copy link
Copy Markdown
Collaborator

ziggie1984 commented Nov 11, 2024

I fixed the itests/unitests, let's see if the CI passes and then I think this is gtg (also added a new lncli commend)

}

var cancelPsbtCommand = cli.Command{
Name: "cancelPsbtFlow",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: we normally don't use camel case for command names.

@ziggie1984
Copy link
Copy Markdown
Collaborator

Ok so thought this would be very easy to solve, however we need to redesign the channel funding flow for this to work properly.

The problem currently is, that we might run into the case where we already fail the first channel with the first peer, before the other channels have properly registered the ChannelRegistration, this causes all kind of side effects. So we need to maybe add a new msg to:

isOpenStatusUpdate_Update

which currently has 3 types:

	//	*OpenStatusUpdate_ChanPending
	//	*OpenStatusUpdate_ChanOpen
	//	*OpenStatusUpdate_PsbtFund

something like OpenStatusUpdate_ChannelReservation and only close the funding process if all channels went successfully through this, otherwise we risk closing the batch funding and in the background the channel opening would continue (and the main problem we would not abort this opening with the peer)

@Roasbeef Roasbeef removed their request for review November 11, 2024 23:57
@saubyk saubyk removed this from lnd v0.19 Mar 3, 2025
@saubyk
Copy link
Copy Markdown
Collaborator

saubyk commented Mar 3, 2025

this got addressed with #8406

@saubyk saubyk closed this Mar 3, 2025
@saubyk saubyk removed this from the v0.19.0 milestone Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

batch funding funding Related to the opening of new channels with funding transactions on the blockchain P1 MUST be fixed or reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug?]: batchopenchannel hangs indefinitely

7 participants