Repository navigation
Conversation
`open-channel` returned as soon as the open was initiated, so scripts had to poll list-channels to learn whether the counterparty accepted or rejected the channel. With `--wait`, the CLI subscribes to the event stream before calling open_channel, since the stream is live-only, and waits for a ChannelStateChanged event for the returned user_channel_id. Pending (or Ready, if Pending was missed) counts as success and prints the channel_id and funding_txo. OpenFailed or Closed counts as failure and prints the reason from the server. It does not wait for the funding transaction to confirm. `--wait-timeout <SECS>` bounds the wait. On timeout the CLI prints the current entry for the channel from list_channels, if there is one. Exit codes are 0 for pending, 1 for a request or event stream error, 2 for a failed open and 3 for a timeout, matching `pay --wait`. AI tools were used to help write this change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
I've assigned @benthecarman as a reviewer! |
benthecarman
requested changes
Oct 22, 2026
benthecarman
left a comment
Collaborator
There was a problem hiding this comment.
The wait logic here is mostly the same as pay_wait.rs just copied. Could we pull the common parts into a shared module before this lands? pay --wait and open-channel --wait are the first two, and close-channel or splice will likely want --wait too. I'd rather the next one doesn't become a third copy.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
open-channelreturned as soon as the open was initiated, so scripts had to poll list-channels to learn whether the counterparty accepted or rejected the channel.With
--wait, the CLI subscribes to the event stream before calling open_channel, since the stream is live-only, and waits for a ChannelStateChanged event for the returned user_channel_id. Pending (or Ready, if Pending was missed) counts as success and prints the channel_id and funding_txo. OpenFailed or Closed counts as failure and prints the reason from the server. It does not wait for the funding transaction to confirm.--wait-timeout <SECS>bounds the wait. On timeout the CLI prints the current entry for the channel from list_channels, if there is one. Exit codes are 0 for pending, 1 for a request or event stream error, 2 for a failed open and 3 for a timeout, matchingpay --wait.For example when opening a channel for 100.000 sats when 200.000 is the minimum required by the counterpart node the command
open-channelwill finish and just replied:{ "user_channel_id": "<user-channel-id>" }But if the user looks for the channel using
list-channelsthe user cannot see anything about that channel. In order to know what happened the user has to actually look at the logs of the server. Or there might be other way I did not find.With the new
--waitwhen the same situation as before happens, it gives the user information about the failed channel open and the reason.And when the opening is successful it gives: