+
+
+/**
+ * A [`channel_update`] message to be sent to or received from a peer.
+ *
+ * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
+ */
+typedef struct MUST_USE_STRUCT LDKChannelUpdate {
+ /**
+ * A pointer to the opaque Rust object.
+ * Nearly everywhere, inner must be non-null, however in places where
+ * the Rust equivalent takes an Option, it may be set to null to indicate None.
+ */
+ LDKnativeChannelUpdate *inner;
+ /**
+ * Indicates that this is the only struct which contains the same pointer.
+ * Rust functions which take ownership of an object provided via an argument require
+ * this to be true and invalidate the object pointed to by inner.
+ */
+ bool is_owned;
+} LDKChannelUpdate;
+
+/**
+ * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
+ * return packet by a node along the route. See [BOLT #4] for details.
+ *
+ * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
+ */
+typedef enum LDKNetworkUpdate_Tag {
+ /**
+ * An error indicating a `channel_update` messages should be applied via
+ * [`NetworkGraph::update_channel`].
+ */
+ LDKNetworkUpdate_ChannelUpdateMessage,
+ /**
+ * An error indicating that a channel failed to route a payment, which should be applied via
+ * [`NetworkGraph::channel_failed`].
+ */
+ LDKNetworkUpdate_ChannelFailure,
+ /**
+ * An error indicating that a node failed to route a payment, which should be applied via
+ * [`NetworkGraph::node_failed_permanent`] if permanent.
+ */
+ LDKNetworkUpdate_NodeFailure,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKNetworkUpdate_Sentinel,
+} LDKNetworkUpdate_Tag;
+
+typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
+ /**
+ * The update to apply via [`NetworkGraph::update_channel`].
+ */
+ struct LDKChannelUpdate msg;
+} LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
+
+typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
+ /**
+ * The short channel id of the closed channel.
+ */
+ uint64_t short_channel_id;
+ /**
+ * Whether the channel should be permanently removed or temporarily disabled until a new
+ * `channel_update` message is received.
+ */
+ bool is_permanent;
+} LDKNetworkUpdate_LDKChannelFailure_Body;
+
+typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
+ /**
+ * The node id of the failed node.
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * Whether the node should be permanently removed from consideration or can be restored
+ * when a new `channel_update` message is received.
+ */
+ bool is_permanent;
+} LDKNetworkUpdate_LDKNodeFailure_Body;
+
+typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
+ LDKNetworkUpdate_Tag tag;
+ union {
+ LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
+ LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
+ LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
+ };
+} LDKNetworkUpdate;
+
+/**
+ * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
+ */
+typedef enum LDKCOption_NetworkUpdateZ_Tag {
+ /**
+ * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
+ */
+ LDKCOption_NetworkUpdateZ_Some,
+ /**
+ * When we're in this state, this COption_NetworkUpdateZ contains nothing
+ */
+ LDKCOption_NetworkUpdateZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_NetworkUpdateZ_Sentinel,
+} LDKCOption_NetworkUpdateZ_Tag;
+
+typedef struct LDKCOption_NetworkUpdateZ {
+ LDKCOption_NetworkUpdateZ_Tag tag;
+ union {
+ struct {
+ struct LDKNetworkUpdate some;
+ };
+ };
+} LDKCOption_NetworkUpdateZ;
+
+/**
+ * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may
+ * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`].
+ *
+ * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
+ * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
+ */
+typedef enum LDKPathFailure_Tag {
+ /**
+ * We failed to initially send the payment and no HTLC was committed to. Contains the relevant
+ * error.
+ */
+ LDKPathFailure_InitialSend,
+ /**
+ * A hop on the path failed to forward our payment.
+ */
+ LDKPathFailure_OnPath,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPathFailure_Sentinel,
+} LDKPathFailure_Tag;
+
+typedef struct LDKPathFailure_LDKInitialSend_Body {
+ /**
+ * The error surfaced from initial send.
+ */
+ struct LDKAPIError err;
+} LDKPathFailure_LDKInitialSend_Body;
+
+typedef struct LDKPathFailure_LDKOnPath_Body {
+ /**
+ * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing
+ * decisions can take into account the update.
+ *
+ * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
+ * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
+ */
+ struct LDKCOption_NetworkUpdateZ network_update;
+} LDKPathFailure_LDKOnPath_Body;
+
+typedef struct MUST_USE_STRUCT LDKPathFailure {
+ LDKPathFailure_Tag tag;
+ union {
+ LDKPathFailure_LDKInitialSend_Body initial_send;
+ LDKPathFailure_LDKOnPath_Body on_path;
+ };
+} LDKPathFailure;
+
+/**
+ * An enum which can either contain a crate::lightning::util::events::PathFailure or not
+ */
+typedef enum LDKCOption_PathFailureZ_Tag {
+ /**
+ * When we're in this state, this COption_PathFailureZ contains a crate::lightning::util::events::PathFailure
+ */
+ LDKCOption_PathFailureZ_Some,
+ /**
+ * When we're in this state, this COption_PathFailureZ contains nothing
+ */
+ LDKCOption_PathFailureZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_PathFailureZ_Sentinel,
+} LDKCOption_PathFailureZ_Tag;
+
+typedef struct LDKCOption_PathFailureZ {
+ LDKCOption_PathFailureZ_Tag tag;
+ union {
+ struct {
+ struct LDKPathFailure some;
+ };
+ };
+} LDKCOption_PathFailureZ;
+
+/**
+ * The contents of CResult_COption_PathFailureZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCOption_PathFailureZ *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKDecodeError *err;
+} LDKCResult_COption_PathFailureZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ {
+ /**
+ * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_COption_PathFailureZDecodeErrorZ;
+