Skip to content

fix(close_channel): error when no matching channel found - #1094

Open
Bartok9 wants to merge 1 commit into
lightningdevkit:mainfrom
Bartok9:fix/close-channel-no-match-error
Open

Bartok9 wants to merge 1 commit into
lightningdevkit:mainfrom
Bartok9:fix/close-channel-no-match-error

Conversation

@Bartok9

@Bartok9 Bartok9 commented Sep 11, 2026

Copy link
Copy Markdown

close_channel and force_close_channel returned Ok(()) when no matching UserChannelId was found for the counterparty, silently succeeding without initiating a close. Now returns Err(ChannelClosingFailed), matching update_channel_config.

Closes #1084

AI-assisted: generated by Sera (Hermes Agent), verified manually. Integration test compiles; runtime requires bitcoind/electrs binaries not available in this cron environment.

Agent-Owner:sera

@ldk-reviews-bot

ldk-reviews-bot commented Sep 11, 2026

Copy link
Copy Markdown

I've assigned @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

Comment thread src/lib.rs
Ok(())
Ok(())
} else {
Err(Error::ChannelClosingFailed)

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.

We should always at least log what/why it failed when we return an error.

/// `UserChannelId` did not match any channel for the counterparty, silently
/// succeeding without initiating a close.
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
async fn close_unknown_user_channel_id_errors() {

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.

I don't think the change is worth a dedicated test case, please drop it.

Closes lightningdevkit#1084

Previously close_channel and force_close_channel returned Ok(()) when
no matching UserChannelId was found for the counterparty, silently
succeeding without initiating a close. Now returns Err(ChannelClosingFailed),
matching update_channel_config.

AI-assisted: generated by Sera (Hermes Agent), verified manually.
Tests compile; integration test requires bitcoind/electrs binaries
(architecturally incompatible electrs binary in this cron environment,
same failure affects all integration tests)

Signed-off-by: Bartok9 <259807879+Bartok9@users.noreply.github.com>
@Bartok9
Bartok9 force-pushed the fix/close-channel-no-match-error branch from c7b80b8 to 20f0b54 Compare September 15, 2026 12:42
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.

close_channel returns Ok when no channel matches the user_channel_id

3 participants