Skip to content

Expose ChannelDetails::channel_shutdown_state#827

Open
f3r10 wants to merge 1 commit intolightningdevkit:mainfrom
f3r10:feat/expose_channel_shutdown_state
Open

Expose ChannelDetails::channel_shutdown_state#827
f3r10 wants to merge 1 commit intolightningdevkit:mainfrom
f3r10:feat/expose_channel_shutdown_state

Conversation

@f3r10
Copy link

@f3r10 f3r10 commented Mar 14, 2026

Summary

Closes #803.

We currently don't expose ChannelDetails::channel_shutdown_state, so there is no good way for callers to tell whether a channel is actively going through a cooperative shutdown or merely has its peer temporarily disconnected — both situations cause is_usable to become false.

This PR adds:

  • A new ChannelShutdownState enum (mirroring LDK's own type) with variants NotShuttingDown, ShutdownInitiated, ResolvingHTLCs, NegotiatingClosingFee, and ShutdownComplete.
  • An Option<ChannelShutdownState> field on ChannelDetails, populated from LdkChannelDetails::channel_shutdown_state via the existing From conversion.
  • A typedef enum ChannelShutdownState entry in the UniFFI UDL so the field is available to Swift, Kotlin, and Python bindings.
  • Public re-export of ChannelShutdownState from the crate root.

Add a `ChannelShutdownState` enum mirroring LDK's own type, and expose
it as an `Option<ChannelShutdownState>` field on `ChannelDetails`.
@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Mar 14, 2026

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.

@ldk-reviews-bot ldk-reviews-bot requested a review from tnull March 14, 2026 19:17
pub config: ChannelConfig,
/// The current shutdown state of the channel, if any.
///
/// Returns `None` for channels that have not yet started the shutdown process.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we replace this to accurately reflect what the source from the library says Returns None for ChannelDetails serialized on LDK versions prior to 0.0.116.

@Camillarhi
Copy link
Contributor

Thanks for looking into this. Could we add assertions for channel_shutdown_state in the existing integration tests? For example, after both nodes receive the channel_ready event in do_channel_full_cycle

@ldk-reviews-bot
Copy link

🔔 1st Reminder

Hey @tnull! This PR has been waiting for your review.
Please take a look when you have a chance. If you're unable to review, please let us know so we can find another reviewer.

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.

Expose ChannelDetails::channel_shutdown_state

3 participants