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.

Comment thread tests/integration_tests_rust.rs Outdated
/// `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.

@Bartok9
Bartok9 force-pushed the fix/close-channel-no-match-error branch 2 times, most recently from 20f0b54 to d66df47 Compare September 16, 2026 12:44
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 d66df47 to 0e2b867 Compare September 16, 2026 16:37
@Bartok9

Bartok9 commented Sep 16, 2026

Copy link
Copy Markdown
Author

Thanks @tnull — applied both nits:

  • log_error when no matching channel is found (user_channel_id + counterparty)
  • dropped the dedicated integration test

Tip 0e2b867. The earlier macos 1.85 failure was channel_full_cycle_force_close (Unexpected balance state in tests/common/mod.rs:632) after a splice+force-close path this PR does not change; main is green on the same parent (f375e4d).

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