+#[repr(C)]
+pub enum ChannelShutdownState {
+ /// Channel has not sent or received a shutdown message.
+ NotShuttingDown,
+ /// Local node has sent a shutdown message for this channel.
+ ShutdownInitiated,
+ /// Shutdown message exchanges have concluded and the channels are in the midst of
+ /// resolving all existing open HTLCs before closing can continue.
+ ResolvingHTLCs,
+ /// All HTLCs have been resolved, nodes are currently negotiating channel close onchain fee rates.
+ NegotiatingClosingFee,
+ /// We've successfully negotiated a closing_signed dance. At this point `ChannelManager` is about
+ /// to drop the channel.
+ ShutdownComplete,
+}
+use lightning::ln::channelmanager::ChannelShutdownState as ChannelShutdownStateImport;
+pub(crate) type nativeChannelShutdownState = ChannelShutdownStateImport;
+
+impl ChannelShutdownState {
+ #[allow(unused)]
+ pub(crate) fn to_native(&self) -> nativeChannelShutdownState {
+ match self {
+ ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown,
+ ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated,
+ ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs,
+ ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee,
+ ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete,
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn into_native(self) -> nativeChannelShutdownState {
+ match self {
+ ChannelShutdownState::NotShuttingDown => nativeChannelShutdownState::NotShuttingDown,
+ ChannelShutdownState::ShutdownInitiated => nativeChannelShutdownState::ShutdownInitiated,
+ ChannelShutdownState::ResolvingHTLCs => nativeChannelShutdownState::ResolvingHTLCs,
+ ChannelShutdownState::NegotiatingClosingFee => nativeChannelShutdownState::NegotiatingClosingFee,
+ ChannelShutdownState::ShutdownComplete => nativeChannelShutdownState::ShutdownComplete,
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn from_native(native: &nativeChannelShutdownState) -> Self {
+ match native {
+ nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown,
+ nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated,
+ nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs,
+ nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee,
+ nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete,
+ }
+ }
+ #[allow(unused)]
+ pub(crate) fn native_into(native: nativeChannelShutdownState) -> Self {
+ match native {
+ nativeChannelShutdownState::NotShuttingDown => ChannelShutdownState::NotShuttingDown,
+ nativeChannelShutdownState::ShutdownInitiated => ChannelShutdownState::ShutdownInitiated,
+ nativeChannelShutdownState::ResolvingHTLCs => ChannelShutdownState::ResolvingHTLCs,
+ nativeChannelShutdownState::NegotiatingClosingFee => ChannelShutdownState::NegotiatingClosingFee,
+ nativeChannelShutdownState::ShutdownComplete => ChannelShutdownState::ShutdownComplete,
+ }
+ }
+}
+/// Creates a copy of the ChannelShutdownState
+#[no_mangle]
+pub extern "C" fn ChannelShutdownState_clone(orig: &ChannelShutdownState) -> ChannelShutdownState {
+ orig.clone()
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelShutdownState_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const ChannelShutdownState)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn ChannelShutdownState_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut ChannelShutdownState) };
+}
+#[no_mangle]
+/// Utility method to constructs a new NotShuttingDown-variant ChannelShutdownState
+pub extern "C" fn ChannelShutdownState_not_shutting_down() -> ChannelShutdownState {
+ ChannelShutdownState::NotShuttingDown}
+#[no_mangle]
+/// Utility method to constructs a new ShutdownInitiated-variant ChannelShutdownState
+pub extern "C" fn ChannelShutdownState_shutdown_initiated() -> ChannelShutdownState {
+ ChannelShutdownState::ShutdownInitiated}
+#[no_mangle]
+/// Utility method to constructs a new ResolvingHTLCs-variant ChannelShutdownState
+pub extern "C" fn ChannelShutdownState_resolving_htlcs() -> ChannelShutdownState {
+ ChannelShutdownState::ResolvingHTLCs}
+#[no_mangle]
+/// Utility method to constructs a new NegotiatingClosingFee-variant ChannelShutdownState
+pub extern "C" fn ChannelShutdownState_negotiating_closing_fee() -> ChannelShutdownState {
+ ChannelShutdownState::NegotiatingClosingFee}
+#[no_mangle]
+/// Utility method to constructs a new ShutdownComplete-variant ChannelShutdownState
+pub extern "C" fn ChannelShutdownState_shutdown_complete() -> ChannelShutdownState {
+ ChannelShutdownState::ShutdownComplete}
+/// Checks if two ChannelShutdownStates contain equal inner contents.
+/// This ignores pointers and is_owned flags and looks at the values in fields.
+#[no_mangle]
+pub extern "C" fn ChannelShutdownState_eq(a: &ChannelShutdownState, b: &ChannelShutdownState) -> bool {
+ if &a.to_native() == &b.to_native() { true } else { false }
+}
+/// Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
+/// These include payments that have yet to find a successful path, or have unresolved HTLCs.