+/**
+ * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_CVec_u8ZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKCVec_u8Z *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_CVec_u8ZZ;
+
+/**
+ * The contents of CResult_CVec_CVec_u8ZZNoneZ
+ */
+typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCVec_CVec_u8ZZ *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_CVec_CVec_u8ZZNoneZPtr;
+
+/**
+ * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ {
+ /**
+ * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents;
+ /**
+ * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_CVec_CVec_u8ZZNoneZ;
+
+
+
+/**
+ * A simple implementation of Sign that just keeps the private keys in memory.
+ *
+ * This implementation performs no policy checks and is insufficient by itself as
+ * a secure external signer.
+ */
+typedef struct MUST_USE_STRUCT LDKInMemorySigner {
+ /**
+ * 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.
+ */
+ LDKnativeInMemorySigner *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;
+} LDKInMemorySigner;
+
+/**
+ * The contents of CResult_InMemorySignerDecodeErrorZ
+ */
+typedef union LDKCResult_InMemorySignerDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKInMemorySigner *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_InMemorySignerDecodeErrorZPtr;
+
+/**
+ * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::keysinterface::InMemorySigner 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_InMemorySignerDecodeErrorZ {
+ /**
+ * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_InMemorySignerDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_InMemorySignerDecodeErrorZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_TxOutZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKTxOut *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_TxOutZ;
+
+/**
+ * The contents of CResult_TransactionNoneZ
+ */
+typedef union LDKCResult_TransactionNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKTransaction *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_TransactionNoneZPtr;
+
+/**
+ * A CResult_TransactionNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::Transaction on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_TransactionNoneZ {
+ /**
+ * The contents of this CResult_TransactionNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_TransactionNoneZPtr contents;
+ /**
+ * Whether this CResult_TransactionNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_TransactionNoneZ;
+
+
+
+/**
+ * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates
+ * on-chain transactions to ensure no loss of funds occurs.
+ *
+ * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date
+ * information and are actively monitoring the chain.
+ *
+ * Pending Events or updated HTLCs which have not yet been read out by
+ * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and
+ * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events
+ * gotten are fully handled before re-serializing the new state.
+ *
+ * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which
+ * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
+ * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the
+ * returned block hash and the the current chain and then reconnecting blocks to get to the
+ * best chain) upon deserializing the object!
+ */
+typedef struct MUST_USE_STRUCT LDKChannelMonitor {
+ /**
+ * 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.
+ */
+ LDKnativeChannelMonitor *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;
+} LDKChannelMonitor;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_BlockHashChannelMonitorZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKThirtyTwoBytes a;
+ /**
+ * The element at position 1
+ */
+ struct LDKChannelMonitor b;
+} LDKC2Tuple_BlockHashChannelMonitorZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_BlockHashChannelMonitorZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ;
+
+/**
+ * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ
+ */
+typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKIOError *err;
+} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr;
+
+/**
+ * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ {
+ /**
+ * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents;
+ /**
+ * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ;
+
+/**
+ * An enum which can either contain a u16 or not
+ */
+typedef enum LDKCOption_u16Z_Tag {
+ /**
+ * When we're in this state, this COption_u16Z contains a u16
+ */
+ LDKCOption_u16Z_Some,
+ /**
+ * When we're in this state, this COption_u16Z contains nothing
+ */
+ LDKCOption_u16Z_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_u16Z_Sentinel,
+} LDKCOption_u16Z_Tag;
+
+typedef struct LDKCOption_u16Z {
+ LDKCOption_u16Z_Tag tag;
+ union {
+ struct {
+ uint16_t some;
+ };
+ };
+} LDKCOption_u16Z;
+
+/**
+ * Indicates an error on the client's part (usually some variant of attempting to use too-low or
+ * too-high values)
+ */
+typedef enum LDKAPIError_Tag {
+ /**
+ * Indicates the API was wholly misused (see err for more). Cases where these can be returned
+ * are documented, but generally indicates some precondition of a function was violated.
+ */
+ LDKAPIError_APIMisuseError,
+ /**
+ * Due to a high feerate, we were unable to complete the request.
+ * For example, this may be returned if the feerate implies we cannot open a channel at the
+ * requested value, but opening a larger channel would succeed.
+ */
+ LDKAPIError_FeeRateTooHigh,
+ /**
+ * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route,
+ * too-many-hops, etc).
+ */
+ LDKAPIError_RouteError,
+ /**
+ * We were unable to complete the request as the Channel required to do so is unable to
+ * complete the request (or was not found). This can take many forms, including disconnected
+ * peer, channel at capacity, channel shutting down, etc.
+ */
+ LDKAPIError_ChannelUnavailable,
+ /**
+ * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the
+ * attempted action to fail.
+ */
+ LDKAPIError_MonitorUpdateFailed,
+ /**
+ * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible
+ * with the channel counterparty as negotiated in [`InitFeatures`].
+ *
+ * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open
+ * a channel or cooperatively close one with this peer (and will have to force-close instead).
+ *
+ * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey
+ * [`InitFeatures`]: crate::ln::features::InitFeatures
+ */
+ LDKAPIError_IncompatibleShutdownScript,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKAPIError_Sentinel,
+} LDKAPIError_Tag;
+
+typedef struct LDKAPIError_LDKAPIMisuseError_Body {
+ /**
+ * A human-readable error message
+ */
+ struct LDKStr err;
+} LDKAPIError_LDKAPIMisuseError_Body;
+
+typedef struct LDKAPIError_LDKFeeRateTooHigh_Body {
+ /**
+ * A human-readable error message
+ */
+ struct LDKStr err;
+ /**
+ * The feerate which was too high.
+ */
+ uint32_t feerate;
+} LDKAPIError_LDKFeeRateTooHigh_Body;
+
+typedef struct LDKAPIError_LDKRouteError_Body {
+ /**
+ * A human-readable error message
+ */
+ struct LDKStr err;
+} LDKAPIError_LDKRouteError_Body;
+
+typedef struct LDKAPIError_LDKChannelUnavailable_Body {
+ /**
+ * A human-readable error message
+ */
+ struct LDKStr err;
+} LDKAPIError_LDKChannelUnavailable_Body;
+
+typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body {
+ /**
+ * The incompatible shutdown script.
+ */
+ struct LDKShutdownScript script;
+} LDKAPIError_LDKIncompatibleShutdownScript_Body;
+
+typedef struct MUST_USE_STRUCT LDKAPIError {
+ LDKAPIError_Tag tag;
+ union {
+ LDKAPIError_LDKAPIMisuseError_Body api_misuse_error;
+ LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high;
+ LDKAPIError_LDKRouteError_Body route_error;
+ LDKAPIError_LDKChannelUnavailable_Body channel_unavailable;
+ LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script;
+ };
+} LDKAPIError;
+
+/**
+ * The contents of CResult_NoneAPIErrorZ
+ */
+typedef union LDKCResult_NoneAPIErrorZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKAPIError *err;
+} LDKCResult_NoneAPIErrorZPtr;
+
+/**
+ * A CResult_NoneAPIErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneAPIErrorZ {
+ /**
+ * The contents of this CResult_NoneAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NoneAPIErrorZPtr contents;
+ /**
+ * Whether this CResult_NoneAPIErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NoneAPIErrorZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_CResult_NoneAPIErrorZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKCResult_NoneAPIErrorZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_CResult_NoneAPIErrorZZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_APIErrorZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKAPIError *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_APIErrorZ;
+
+/**
+ * The contents of CResult__u832APIErrorZ
+ */
+typedef union LDKCResult__u832APIErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKAPIError *err;
+} LDKCResult__u832APIErrorZPtr;
+
+/**
+ * A CResult__u832APIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult__u832APIErrorZ {
+ /**
+ * The contents of this CResult__u832APIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult__u832APIErrorZPtr contents;
+ /**
+ * Whether this CResult__u832APIErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult__u832APIErrorZ;
+
+/**
+ * If a payment fails to send, it can be in one of several states. This enum is returned as the
+ * Err() type describing which state the payment is in, see the description of individual enum
+ * states for more.
+ */
+typedef enum LDKPaymentSendFailure_Tag {
+ /**
+ * A parameter which was passed to send_payment was invalid, preventing us from attempting to
+ * send the payment at all. No channel state has been changed or messages sent to peers, and
+ * once you've changed the parameter at error, you can freely retry the payment in full.
+ */
+ LDKPaymentSendFailure_ParameterError,
+ /**
+ * A parameter in a single path which was passed to send_payment was invalid, preventing us
+ * from attempting to send the payment at all. No channel state has been changed or messages
+ * sent to peers, and once you've changed the parameter at error, you can freely retry the
+ * payment in full.
+ *
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment.
+ */
+ LDKPaymentSendFailure_PathParameterError,
+ /**
+ * All paths which were attempted failed to send, with no channel state change taking place.
+ * You can freely retry the payment in full (though you probably want to do so over different
+ * paths than the ones selected).
+ */
+ LDKPaymentSendFailure_AllFailedRetrySafe,
+ /**
+ * Some paths which were attempted failed to send, though possibly not all. At least some
+ * paths have irrevocably committed to the HTLC and retrying the payment in full would result
+ * in over-/re-payment.
+ *
+ * The results here are ordered the same as the paths in the route object which was passed to
+ * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely
+ * retried (though there is currently no API with which to do so).
+ *
+ * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried
+ * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the
+ * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel
+ * with the latest update_id.
+ */
+ LDKPaymentSendFailure_PartialFailure,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentSendFailure_Sentinel,
+} LDKPaymentSendFailure_Tag;
+
+typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body {
+ /**
+ * The errors themselves, in the same order as the route hops.
+ */
+ struct LDKCVec_CResult_NoneAPIErrorZZ results;
+ /**
+ * If some paths failed without irrevocably committing to the new HTLC(s), this will
+ * contain a [`RouteParameters`] object which can be used to calculate a new route that
+ * will pay all remaining unpaid balance.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKRouteParameters failed_paths_retry;
+ /**
+ * The payment id for the payment, which is now at least partially pending.
+ */
+ struct LDKThirtyTwoBytes payment_id;
+} LDKPaymentSendFailure_LDKPartialFailure_Body;
+
+typedef struct MUST_USE_STRUCT LDKPaymentSendFailure {
+ LDKPaymentSendFailure_Tag tag;
+ union {
+ struct {
+ struct LDKAPIError parameter_error;
+ };
+ struct {
+ struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error;
+ };
+ struct {
+ struct LDKCVec_APIErrorZ all_failed_retry_safe;
+ };
+ LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure;
+ };
+} LDKPaymentSendFailure;
+
+/**
+ * The contents of CResult_PaymentIdPaymentSendFailureZ
+ */
+typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_PaymentIdPaymentSendFailureZPtr;
+
+/**
+ * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentIdPaymentSendFailureZ {
+ /**
+ * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PaymentIdPaymentSendFailureZPtr contents;
+ /**
+ * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentIdPaymentSendFailureZ;
+
+/**
+ * The contents of CResult_NonePaymentSendFailureZ
+ */
+typedef union LDKCResult_NonePaymentSendFailureZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_NonePaymentSendFailureZPtr;
+
+/**
+ * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NonePaymentSendFailureZ {
+ /**
+ * The contents of this CResult_NonePaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NonePaymentSendFailureZPtr contents;
+ /**
+ * Whether this CResult_NonePaymentSendFailureZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NonePaymentSendFailureZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_PaymentHashPaymentIdZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKThirtyTwoBytes a;
+ /**
+ * The element at position 1
+ */
+ struct LDKThirtyTwoBytes b;
+} LDKC2Tuple_PaymentHashPaymentIdZ;
+
+/**
+ * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ
+ */
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_PaymentHashPaymentIdZ *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKPaymentSendFailure *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr;
+
+/**
+ * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ {
+ /**
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ;
+
+/**
+ * A 4-byte byte array.
+ */
+typedef struct LDKFourBytes {
+ /**
+ * The four bytes
+ */
+ uint8_t data[4];
+} LDKFourBytes;
+
+/**
+ * A 16-byte byte array.
+ */
+typedef struct LDKSixteenBytes {
+ /**
+ * The sixteen bytes
+ */
+ uint8_t data[16];
+} LDKSixteenBytes;
+
+/**
+ * A 12-byte byte array.
+ */
+typedef struct LDKTwelveBytes {
+ /**
+ * The twelve bytes
+ */
+ uint8_t data[12];
+} LDKTwelveBytes;
+
+/**
+ * An address which can be used to connect to a remote peer
+ */
+typedef enum LDKNetAddress_Tag {
+ /**
+ * An IPv4 address/port on which the peer is listening.
+ */
+ LDKNetAddress_IPv4,
+ /**
+ * An IPv6 address/port on which the peer is listening.
+ */
+ LDKNetAddress_IPv6,
+ /**
+ * An old-style Tor onion address/port on which the peer is listening.
+ *
+ * This field is deprecated and the Tor network generally no longer supports V2 Onion
+ * addresses. Thus, the details are not parsed here.
+ */
+ LDKNetAddress_OnionV2,
+ /**
+ * A new-style Tor onion address/port on which the peer is listening.
+ * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version,
+ * wrap as base32 and append \".onion\".
+ */
+ LDKNetAddress_OnionV3,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKNetAddress_Sentinel,
+} LDKNetAddress_Tag;
+
+typedef struct LDKNetAddress_LDKIPv4_Body {
+ /**
+ * The 4-byte IPv4 address
+ */
+ struct LDKFourBytes addr;
+ /**
+ * The port on which the node is listening
+ */
+ uint16_t port;
+} LDKNetAddress_LDKIPv4_Body;
+
+typedef struct LDKNetAddress_LDKIPv6_Body {
+ /**
+ * The 16-byte IPv6 address
+ */
+ struct LDKSixteenBytes addr;
+ /**
+ * The port on which the node is listening
+ */
+ uint16_t port;
+} LDKNetAddress_LDKIPv6_Body;
+
+typedef struct LDKNetAddress_LDKOnionV3_Body {
+ /**
+ * The ed25519 long-term public key of the peer
+ */
+ struct LDKThirtyTwoBytes ed25519_pubkey;
+ /**
+ * The checksum of the pubkey and version, as included in the onion address
+ */
+ uint16_t checksum;
+ /**
+ * The version byte, as defined by the Tor Onion v3 spec.
+ */
+ uint8_t version;
+ /**
+ * The port on which the node is listening
+ */
+ uint16_t port;
+} LDKNetAddress_LDKOnionV3_Body;
+
+typedef struct MUST_USE_STRUCT LDKNetAddress {
+ LDKNetAddress_Tag tag;
+ union {
+ LDKNetAddress_LDKIPv4_Body i_pv4;
+ LDKNetAddress_LDKIPv6_Body i_pv6;
+ struct {
+ struct LDKTwelveBytes onion_v2;
+ };
+ LDKNetAddress_LDKOnionV3_Body onion_v3;
+ };
+} LDKNetAddress;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_NetAddressZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKNetAddress *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_NetAddressZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKThirtyTwoBytes a;
+ /**
+ * The element at position 1
+ */
+ struct LDKThirtyTwoBytes b;
+} LDKC2Tuple_PaymentHashPaymentSecretZ;
+
+/**
+ * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ
+ */
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr;
+
+/**
+ * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ {
+ /**
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ;
+
+/**
+ * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ
+ */
+typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_PaymentHashPaymentSecretZ *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKAPIError *err;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr;
+
+/**
+ * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ {
+ /**
+ * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ;
+
+/**
+ * The contents of CResult_PaymentSecretNoneZ
+ */
+typedef union LDKCResult_PaymentSecretNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_PaymentSecretNoneZPtr;
+
+/**
+ * A CResult_PaymentSecretNoneZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentSecretNoneZ {
+ /**
+ * The contents of this CResult_PaymentSecretNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PaymentSecretNoneZPtr contents;
+ /**
+ * Whether this CResult_PaymentSecretNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentSecretNoneZ;
+
+/**
+ * The contents of CResult_PaymentSecretAPIErrorZ
+ */
+typedef union LDKCResult_PaymentSecretAPIErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKAPIError *err;
+} LDKCResult_PaymentSecretAPIErrorZPtr;
+
+/**
+ * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentSecretAPIErrorZ {
+ /**
+ * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PaymentSecretAPIErrorZPtr contents;
+ /**
+ * Whether this CResult_PaymentSecretAPIErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentSecretAPIErrorZ;
+
+/**
+ * The contents of CResult_PaymentPreimageAPIErrorZ
+ */
+typedef union LDKCResult_PaymentPreimageAPIErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKAPIError *err;
+} LDKCResult_PaymentPreimageAPIErrorZPtr;
+
+/**
+ * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentPreimageAPIErrorZ {
+ /**
+ * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PaymentPreimageAPIErrorZPtr contents;
+ /**
+ * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentPreimageAPIErrorZ;
+
+
+
+/**
+ * Information needed for constructing an invoice route hint for this channel.
+ */
+typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo {
+ /**
+ * 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.
+ */
+ LDKnativeCounterpartyForwardingInfo *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;
+} LDKCounterpartyForwardingInfo;
+
+/**
+ * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ
+ */
+typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCounterpartyForwardingInfo *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_CounterpartyForwardingInfoDecodeErrorZPtr;
+
+/**
+ * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo 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_CounterpartyForwardingInfoDecodeErrorZ {
+ /**
+ * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ;
+
+
+
+/**
+ * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`]
+ * to better separate parameters.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelCounterparty {
+ /**
+ * 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.
+ */
+ LDKnativeChannelCounterparty *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;
+} LDKChannelCounterparty;
+
+/**
+ * The contents of CResult_ChannelCounterpartyDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelCounterparty *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_ChannelCounterpartyDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::ChannelCounterparty 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_ChannelCounterpartyDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelCounterpartyDecodeErrorZ;
+
+/**
+ * The contents of CResult_ChannelDetailsDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelDetails *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_ChannelDetailsDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::ChannelDetails 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_ChannelDetailsDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelDetailsDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelDetailsDecodeErrorZ;
+
+
+
+/**
+ * Route hints used in constructing invoices for [phantom node payents].
+ *
+ * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+ */
+typedef struct MUST_USE_STRUCT LDKPhantomRouteHints {
+ /**
+ * 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.
+ */
+ LDKnativePhantomRouteHints *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;
+} LDKPhantomRouteHints;
+
+/**
+ * The contents of CResult_PhantomRouteHintsDecodeErrorZ
+ */
+typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPhantomRouteHints *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_PhantomRouteHintsDecodeErrorZPtr;
+
+/**
+ * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::channelmanager::PhantomRouteHints 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_PhantomRouteHintsDecodeErrorZ {
+ /**
+ * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PhantomRouteHintsDecodeErrorZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_ChannelMonitorZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKChannelMonitor *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_ChannelMonitorZ;
+
+
+
+/**
+ * An update generated by the underlying Channel itself which contains some new information the
+ * ChannelMonitor should be made aware of.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate {
+ /**
+ * 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.
+ */
+ LDKnativeChannelMonitorUpdate *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;
+} LDKChannelMonitorUpdate;
+
+/**
+ * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as
+ * blocks are connected and disconnected.
+ *
+ * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are
+ * responsible for maintaining a set of monitors such that they can be updated accordingly as
+ * channel state changes and HTLCs are resolved. See method documentation for specific
+ * requirements.
+ *
+ * Implementations **must** ensure that updates are successfully applied and persisted upon method
+ * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down
+ * without taking any further action such as persisting the current state.
+ *
+ * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing
+ * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it
+ * could result in a revoked transaction being broadcast, allowing the counterparty to claim all
+ * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle
+ * multiple instances.
+ *
+ * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure
+ */
+typedef struct LDKWatch {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Watches a channel identified by `funding_txo` using `monitor`.
+ *
+ * Implementations are responsible for watching the chain for the funding transaction along
+ * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means
+ * calling [`block_connected`] and [`block_disconnected`] on the monitor.
+ *
+ * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if
+ * the given `funding_txo` has previously been registered via `watch_channel`.
+ *
+ * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch
+ * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected
+ * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor);
+ /**
+ * Updates a channel identified by `funding_txo` by applying `update` to its monitor.
+ *
+ * Implementations must call [`update_monitor`] with the given update. See
+ * [`ChannelMonitorUpdateErr`] for invariants around returning an error.
+ *
+ * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update);
+ /**
+ * Returns any monitor events since the last call. Subsequent calls must only return new
+ * events.
+ *
+ * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no
+ * further events may be returned here until the [`ChannelMonitor`] has been fully persisted
+ * to disk.
+ *
+ * For details on asynchronous [`ChannelMonitor`] updating and returning
+ * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`].
+ */
+ struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKWatch;
+
+/**
+ * An interface to send a transaction to the Bitcoin network.
+ */
+typedef struct LDKBroadcasterInterface {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Sends a transaction out to (hopefully) be mined.
+ */
+ void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKBroadcasterInterface;
+
+/**
+ * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not
+ * own the memory pointed to by data.
+ */
+typedef struct LDKu8slice {
+ /**
+ * A pointer to the byte buffer
+ */
+ const uint8_t *data;
+ /**
+ * The number of bytes pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKu8slice;
+
+/**
+ * A trait to describe an object which can get user secrets and key material.
+ */
+typedef struct LDKKeysInterface {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`].
+ *
+ * This method must return the same value each time it is called with a given `Recipient`
+ * parameter.
+ */
+ struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient);
+ /**
+ * Get a script pubkey which we send funds to when claiming on-chain contestable outputs.
+ *
+ * This method should return a different value each time it is called, to avoid linking
+ * on-chain funds across channels as controlled to the same user.
+ */
+ struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg);
+ /**
+ * Get a script pubkey which we will send funds to when closing a channel.
+ *
+ * This method should return a different value each time it is called, to avoid linking
+ * on-chain funds across channels as controlled to the same user.
+ */
+ struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg);
+ /**
+ * Get a new set of Sign for per-channel secrets. These MUST be unique even if you
+ * restarted with some stale data!
+ *
+ * This method must return a different value each time it is called.
+ */
+ struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis);
+ /**
+ * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting
+ * onion packets and for temporary channel IDs. There is no requirement that these be
+ * persisted anywhere, though they must be unique across restarts.
+ *
+ * This method must return a different value each time it is called.
+ */
+ struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg);
+ /**
+ * Reads a `Signer` for this `KeysInterface` from the given input stream.
+ * This is only called during deserialization of other objects which contain
+ * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s).
+ * The bytes are exactly those which `<Self::Signer as Writeable>::write()` writes, and
+ * contain no versioning scheme. You may wish to include your own version prefix and ensure
+ * you've read all of the provided bytes to ensure no corruption occurred.
+ */
+ struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader);
+ /**
+ * Sign an invoice.
+ * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of
+ * this trait to parse the invoice and make sure they're signing what they expect, rather than
+ * blindly signing the hash.
+ * The hrp is ascii bytes, while the invoice data is base32.
+ *
+ * The secret key used to sign the invoice is dependent on the [`Recipient`].
+ */
+ struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient);
+ /**
+ * Get secret key material as bytes for use in encrypting and decrypting inbound payment data.
+ *
+ * If the implementor of this trait supports [phantom node payments], then every node that is
+ * intended to be included in the phantom invoice route hints must return the same value from
+ * this method.
+ *
+ * This method must return the same value each time it is called.
+ *
+ * [phantom node payments]: PhantomKeysManager
+ */
+ struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKKeysInterface;
+
+/**
+ * A trait which should be implemented to provide feerate information on a number of time
+ * horizons.
+ *
+ * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're
+ * called from inside the library in response to chain events, P2P events, or timer events).
+ */
+typedef struct LDKFeeEstimator {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Gets estimated satoshis of fee required per 1000 Weight-Units.
+ *
+ * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later
+ * round-downs don't put us below 1 satoshi-per-byte).
+ *
+ * This method can be implemented with the following unit conversions:
+ * * max(satoshis-per-byte * 250, 253)
+ * * max(satoshis-per-kbyte / 4, 253)
+ */
+ uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKFeeEstimator;
+
+
+
+/**
+ * A Record, unit of logging output with Metadata to enable filtering
+ * Module_path, file, line to inform on log's source
+ */
+typedef struct MUST_USE_STRUCT LDKRecord {
+ /**
+ * 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.
+ */
+ LDKnativeRecord *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;
+} LDKRecord;
+
+/**
+ * A trait encapsulating the operations required of a logger
+ */
+typedef struct LDKLogger {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Logs the `Record`
+ */
+ void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKLogger;
+
+
+
+/**
+ * Manager which keeps track of a number of channels and sends messages to the appropriate
+ * channel, also tracking HTLC preimages and forwarding onion packets appropriately.
+ *
+ * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through
+ * to individual Channels.
+ *
+ * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for
+ * all peers during write/read (though does not modify this instance, only the instance being
+ * serialized). This will result in any channels which have not yet exchanged funding_created (ie
+ * called funding_transaction_generated for outbound channels).
+ *
+ * Note that you can be a bit lazier about writing out ChannelManager than you can be with
+ * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before
+ * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates
+ * happens out-of-band (and will prevent any other ChannelManager operations from occurring during
+ * the serialization process). If the deserialized version is out-of-date compared to the
+ * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the
+ * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees).
+ *
+ * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which
+ * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along
+ * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call
+ * block_connected() to step towards your best block) upon deserialization before using the
+ * object!
+ *
+ * Note that ChannelManager is responsible for tracking liveness of its channels and generating
+ * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid
+ * spam due to quick disconnection/reconnection, updates are not sent until the channel has been
+ * offline for a full minute. In order to track this, you must call
+ * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect.
+ *
+ * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager
+ * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but
+ * essentially you should default to using a SimpleRefChannelManager, and use a
+ * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when
+ * you're using lightning-net-tokio.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelManager {
+ /**
+ * 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.
+ */
+ LDKnativeChannelManager *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;
+} LDKChannelManager;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_BlockHashChannelManagerZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKThirtyTwoBytes a;
+ /**
+ * The element at position 1
+ */
+ struct LDKChannelManager b;
+} LDKC2Tuple_BlockHashChannelManagerZ;
+
+/**
+ * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ
+ */
+typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_BlockHashChannelManagerZ *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_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr;
+
+/**
+ * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ 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_C2Tuple_BlockHashChannelManagerZDecodeErrorZ {
+ /**
+ * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ;
+
+
+
+/**
+ * Options which apply on a per-channel basis and may change at runtime or based on negotiation
+ * with our counterparty.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelConfig {
+ /**
+ * 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.
+ */
+ LDKnativeChannelConfig *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;
+} LDKChannelConfig;
+
+/**
+ * The contents of CResult_ChannelConfigDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelConfigDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelConfig *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_ChannelConfigDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::util::config::ChannelConfig 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_ChannelConfigDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelConfigDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelConfigDecodeErrorZ;
+
+/**
+ * The contents of CResult_OutPointDecodeErrorZ
+ */
+typedef union LDKCResult_OutPointDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKOutPoint *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_OutPointDecodeErrorZPtr;
+
+/**
+ * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::transaction::OutPoint 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_OutPointDecodeErrorZ {
+ /**
+ * The contents of this CResult_OutPointDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_OutPointDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_OutPointDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_OutPointDecodeErrorZ;
+
+/**
+ * Defines a type identifier for sending messages over the wire.
+ *
+ * Messages implementing this trait specify a type and must be [`Writeable`].
+ */
+typedef struct LDKType {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the type identifying the message payload.
+ */
+ uint16_t (*type_id)(const void *this_arg);
+ /**
+ * Return a human-readable "debug" string describing this object
+ */
+ struct LDKStr (*debug_str)(const void *this_arg);
+ /**
+ * Serialize the object into a byte array
+ */
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKType;
+
+/**
+ * An enum which can either contain a crate::lightning::ln::wire::Type or not
+ */
+typedef enum LDKCOption_TypeZ_Tag {
+ /**
+ * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type
+ */
+ LDKCOption_TypeZ_Some,
+ /**
+ * When we're in this state, this COption_TypeZ contains nothing
+ */
+ LDKCOption_TypeZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_TypeZ_Sentinel,
+} LDKCOption_TypeZ_Tag;
+
+typedef struct LDKCOption_TypeZ {
+ LDKCOption_TypeZ_Tag tag;
+ union {
+ struct {
+ struct LDKType some;
+ };
+ };
+} LDKCOption_TypeZ;
+
+/**
+ * The contents of CResult_COption_TypeZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_TypeZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCOption_TypeZ *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_TypeZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_TypeZ 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_TypeZDecodeErrorZ {
+ /**
+ * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_COption_TypeZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_COption_TypeZDecodeErrorZ;
+
+/**
+ * An error that may occur when making a payment.
+ */
+typedef enum LDKPaymentError_Tag {
+ /**
+ * An error resulting from the provided [`Invoice`] or payment hash.
+ */
+ LDKPaymentError_Invoice,
+ /**
+ * An error occurring when finding a route.
+ */
+ LDKPaymentError_Routing,
+ /**
+ * An error occurring when sending a payment.
+ */
+ LDKPaymentError_Sending,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentError_Sentinel,
+} LDKPaymentError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKPaymentError {
+ LDKPaymentError_Tag tag;
+ union {
+ struct {
+ struct LDKStr invoice;
+ };
+ struct {
+ struct LDKLightningError routing;
+ };
+ struct {
+ struct LDKPaymentSendFailure sending;
+ };
+ };
+} LDKPaymentError;
+
+/**
+ * The contents of CResult_PaymentIdPaymentErrorZ
+ */
+typedef union LDKCResult_PaymentIdPaymentErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKThirtyTwoBytes *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKPaymentError *err;
+} LDKCResult_PaymentIdPaymentErrorZPtr;
+
+/**
+ * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PaymentIdPaymentErrorZ {
+ /**
+ * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PaymentIdPaymentErrorZPtr contents;
+ /**
+ * Whether this CResult_PaymentIdPaymentErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PaymentIdPaymentErrorZ;
+
+/**
+ * Sub-errors which don't have specific information in them use this type.
+ */
+typedef struct LDKError {
+ /**
+ * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here
+ */
+ uint8_t _dummy;
+} LDKError;
+
+/**
+ * Errors that indicate what is wrong with the invoice. They have some granularity for debug
+ * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user.
+ */
+typedef enum LDKParseError_Tag {
+ LDKParseError_Bech32Error,
+ LDKParseError_ParseAmountError,
+ LDKParseError_MalformedSignature,
+ LDKParseError_BadPrefix,
+ LDKParseError_UnknownCurrency,
+ LDKParseError_UnknownSiPrefix,
+ LDKParseError_MalformedHRP,
+ LDKParseError_TooShortDataPart,
+ LDKParseError_UnexpectedEndOfTaggedFields,
+ LDKParseError_DescriptionDecodeError,
+ LDKParseError_PaddingError,
+ LDKParseError_IntegerOverflowError,
+ LDKParseError_InvalidSegWitProgramLength,
+ LDKParseError_InvalidPubKeyHashLength,
+ LDKParseError_InvalidScriptHashLength,
+ LDKParseError_InvalidRecoveryId,
+ LDKParseError_InvalidSliceLength,
+ /**
+ * Not an error, but used internally to signal that a part of the invoice should be ignored
+ * according to BOLT11
+ */
+ LDKParseError_Skip,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKParseError_Sentinel,
+} LDKParseError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParseError {
+ LDKParseError_Tag tag;
+ union {
+ struct {
+ struct LDKBech32Error bech32_error;
+ };
+ struct {
+ struct LDKError parse_amount_error;
+ };
+ struct {
+ enum LDKSecp256k1Error malformed_signature;
+ };
+ struct {
+ struct LDKError description_decode_error;
+ };
+ struct {
+ struct LDKStr invalid_slice_length;
+ };
+ };
+} LDKParseError;
+
+/**
+ * The contents of CResult_SiPrefixParseErrorZ
+ */
+typedef union LDKCResult_SiPrefixParseErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ enum LDKSiPrefix *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKParseError *err;
+} LDKCResult_SiPrefixParseErrorZPtr;
+
+/**
+ * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_SiPrefixParseErrorZ {
+ /**
+ * The contents of this CResult_SiPrefixParseErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_SiPrefixParseErrorZPtr contents;
+ /**
+ * Whether this CResult_SiPrefixParseErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_SiPrefixParseErrorZ;
+
+
+
+/**
+ * Represents a syntactically and semantically correct lightning BOLT11 invoice.
+ *
+ * There are three ways to construct an `Invoice`:
+ * 1. using `InvoiceBuilder`
+ * 2. using `Invoice::from_signed(SignedRawInvoice)`
+ * 3. using `str::parse::<Invoice>(&str)`
+ */
+typedef struct MUST_USE_STRUCT LDKInvoice {
+ /**
+ * 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.
+ */
+ LDKnativeInvoice *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;
+} LDKInvoice;
+
+/**
+ * Indicates that something went wrong while parsing or validating the invoice. Parsing errors
+ * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors
+ * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice.
+ */
+typedef enum LDKParseOrSemanticError_Tag {
+ /**
+ * The invoice couldn't be decoded
+ */
+ LDKParseOrSemanticError_ParseError,
+ /**
+ * The invoice could be decoded but violates the BOLT11 standard
+ */
+ LDKParseOrSemanticError_SemanticError,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKParseOrSemanticError_Sentinel,
+} LDKParseOrSemanticError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKParseOrSemanticError {
+ LDKParseOrSemanticError_Tag tag;
+ union {
+ struct {
+ struct LDKParseError parse_error;
+ };
+ struct {
+ enum LDKSemanticError semantic_error;
+ };
+ };
+} LDKParseOrSemanticError;
+
+/**
+ * The contents of CResult_InvoiceParseOrSemanticErrorZ
+ */
+typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKInvoice *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKParseOrSemanticError *err;
+} LDKCResult_InvoiceParseOrSemanticErrorZPtr;
+
+/**
+ * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ {
+ /**
+ * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents;
+ /**
+ * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_InvoiceParseOrSemanticErrorZ;
+
+
+
+/**
+ * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
+ * invalid.
+ *
+ * # Invariants
+ * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`.
+ */
+typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
+ /**
+ * 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.
+ */
+ LDKnativeSignedRawInvoice *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;
+} LDKSignedRawInvoice;
+
+/**
+ * The contents of CResult_SignedRawInvoiceParseErrorZ
+ */
+typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKSignedRawInvoice *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKParseError *err;
+} LDKCResult_SignedRawInvoiceParseErrorZPtr;
+
+/**
+ * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_SignedRawInvoiceParseErrorZ {
+ /**
+ * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_SignedRawInvoiceParseErrorZPtr contents;
+ /**
+ * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_SignedRawInvoiceParseErrorZ;
+
+
+
+/**
+ * Represents an syntactically correct Invoice for a payment on the lightning network,
+ * but without the signature information.
+ * De- and encoding should not lead to information loss but may lead to different hashes.
+ *
+ * For methods without docs see the corresponding methods in `Invoice`.
+ */
+typedef struct MUST_USE_STRUCT LDKRawInvoice {
+ /**
+ * 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.
+ */
+ LDKnativeRawInvoice *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;
+} LDKRawInvoice;
+
+
+
+/**
+ * Recoverable signature
+ */
+typedef struct MUST_USE_STRUCT LDKInvoiceSignature {
+ /**
+ * 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.
+ */
+ LDKnativeInvoiceSignature *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;
+} LDKInvoiceSignature;
+
+/**
+ * A tuple of 3 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKRawInvoice a;
+ /**
+ * The element at position 1
+ */
+ struct LDKThirtyTwoBytes b;
+ /**
+ * The element at position 2
+ */
+ struct LDKInvoiceSignature c;
+} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ;
+
+
+
+/**
+ * Payee public key
+ */
+typedef struct MUST_USE_STRUCT LDKPayeePubKey {
+ /**
+ * 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.
+ */
+ LDKnativePayeePubKey *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;
+} LDKPayeePubKey;
+
+/**
+ * The contents of CResult_PayeePubKeyErrorZ
+ */
+typedef union LDKCResult_PayeePubKeyErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPayeePubKey *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKSecp256k1Error *err;
+} LDKCResult_PayeePubKeyErrorZPtr;
+
+/**
+ * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PayeePubKeyErrorZ {
+ /**
+ * The contents of this CResult_PayeePubKeyErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PayeePubKeyErrorZPtr contents;
+ /**
+ * Whether this CResult_PayeePubKeyErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PayeePubKeyErrorZ;
+
+
+
+/**
+ * Private routing information
+ *
+ * # Invariants
+ * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops)
+ *
+ */
+typedef struct MUST_USE_STRUCT LDKPrivateRoute {
+ /**
+ * 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.
+ */
+ LDKnativePrivateRoute *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;
+} LDKPrivateRoute;
+
+/**
+ * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_PrivateRouteZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKPrivateRoute *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_PrivateRouteZ;
+
+
+
+/**
+ * A timestamp that refers to a date after 1 January 1970.
+ *
+ * # Invariants
+ *
+ * The Unix timestamp representing the stored time has to be positive and no greater than
+ * [`MAX_TIMESTAMP`].
+ */
+typedef struct MUST_USE_STRUCT LDKPositiveTimestamp {
+ /**
+ * 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.
+ */
+ LDKnativePositiveTimestamp *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;
+} LDKPositiveTimestamp;
+
+/**
+ * The contents of CResult_PositiveTimestampCreationErrorZ
+ */
+typedef union LDKCResult_PositiveTimestampCreationErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPositiveTimestamp *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKCreationError *err;
+} LDKCResult_PositiveTimestampCreationErrorZPtr;
+
+/**
+ * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PositiveTimestampCreationErrorZ {
+ /**
+ * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PositiveTimestampCreationErrorZPtr contents;
+ /**
+ * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PositiveTimestampCreationErrorZ;
+
+/**
+ * The contents of CResult_NoneSemanticErrorZ
+ */
+typedef union LDKCResult_NoneSemanticErrorZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKSemanticError *err;
+} LDKCResult_NoneSemanticErrorZPtr;
+
+/**
+ * A CResult_NoneSemanticErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning_invoice::SemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneSemanticErrorZ {
+ /**
+ * The contents of this CResult_NoneSemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NoneSemanticErrorZPtr contents;
+ /**
+ * Whether this CResult_NoneSemanticErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NoneSemanticErrorZ;
+
+/**
+ * The contents of CResult_InvoiceSemanticErrorZ
+ */
+typedef union LDKCResult_InvoiceSemanticErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKInvoice *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKSemanticError *err;
+} LDKCResult_InvoiceSemanticErrorZPtr;
+
+/**
+ * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_InvoiceSemanticErrorZ {
+ /**
+ * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_InvoiceSemanticErrorZPtr contents;
+ /**
+ * Whether this CResult_InvoiceSemanticErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_InvoiceSemanticErrorZ;
+
+
+
+/**
+ * Description string
+ *
+ * # Invariants
+ * The description can be at most 639 __bytes__ long
+ */
+typedef struct MUST_USE_STRUCT LDKDescription {
+ /**
+ * 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.
+ */
+ LDKnativeDescription *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;
+} LDKDescription;
+
+/**
+ * The contents of CResult_DescriptionCreationErrorZ
+ */
+typedef union LDKCResult_DescriptionCreationErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKDescription *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKCreationError *err;
+} LDKCResult_DescriptionCreationErrorZPtr;
+
+/**
+ * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_DescriptionCreationErrorZ {
+ /**
+ * The contents of this CResult_DescriptionCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_DescriptionCreationErrorZPtr contents;
+ /**
+ * Whether this CResult_DescriptionCreationErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_DescriptionCreationErrorZ;
+
+/**
+ * The contents of CResult_PrivateRouteCreationErrorZ
+ */
+typedef union LDKCResult_PrivateRouteCreationErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPrivateRoute *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKCreationError *err;
+} LDKCResult_PrivateRouteCreationErrorZPtr;
+
+/**
+ * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_PrivateRouteCreationErrorZ {
+ /**
+ * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PrivateRouteCreationErrorZPtr contents;
+ /**
+ * Whether this CResult_PrivateRouteCreationErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PrivateRouteCreationErrorZ;
+
+/**
+ * The contents of CResult_StringErrorZ
+ */
+typedef union LDKCResult_StringErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKStr *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ enum LDKSecp256k1Error *err;
+} LDKCResult_StringErrorZPtr;
+
+/**
+ * A CResult_StringErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_StringErrorZ {
+ /**
+ * The contents of this CResult_StringErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_StringErrorZPtr contents;
+ /**
+ * Whether this CResult_StringErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_StringErrorZ;
+
+/**
+ * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelMonitorUpdate *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_ChannelMonitorUpdateDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate 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_ChannelMonitorUpdateDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelMonitorUpdateDecodeErrorZ;
+
+/**
+ * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not
+ */
+typedef enum LDKCOption_MonitorEventZ_Tag {
+ /**
+ * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent
+ */
+ LDKCOption_MonitorEventZ_Some,
+ /**
+ * When we're in this state, this COption_MonitorEventZ contains nothing
+ */
+ LDKCOption_MonitorEventZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_MonitorEventZ_Sentinel,
+} LDKCOption_MonitorEventZ_Tag;
+
+typedef struct LDKCOption_MonitorEventZ {
+ LDKCOption_MonitorEventZ_Tag tag;
+ union {
+ struct {
+ struct LDKMonitorEvent some;
+ };
+ };
+} LDKCOption_MonitorEventZ;
+
+/**
+ * The contents of CResult_COption_MonitorEventZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCOption_MonitorEventZ *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_MonitorEventZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_MonitorEventZ 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_MonitorEventZDecodeErrorZ {
+ /**
+ * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_COption_MonitorEventZDecodeErrorZ;
+
+/**
+ * The contents of CResult_HTLCUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKHTLCUpdate *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_HTLCUpdateDecodeErrorZPtr;
+
+/**
+ * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::channelmonitor::HTLCUpdate 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_HTLCUpdateDecodeErrorZ {
+ /**
+ * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_HTLCUpdateDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_HTLCUpdateDecodeErrorZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_OutPointScriptZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKOutPoint a;
+ /**
+ * The element at position 1
+ */
+ struct LDKCVec_u8Z b;
+} LDKC2Tuple_OutPointScriptZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_u32ScriptZ {
+ /**
+ * The element at position 0
+ */
+ uint32_t a;
+ /**
+ * The element at position 1
+ */
+ struct LDKCVec_u8Z b;
+} LDKC2Tuple_u32ScriptZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_u32ScriptZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_u32ScriptZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_u32ScriptZZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKThirtyTwoBytes a;
+ /**
+ * The element at position 1
+ */
+ struct LDKCVec_C2Tuple_u32ScriptZZ b;
+} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_EventZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKEvent *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_EventZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_TransactionZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKTransaction *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_TransactionZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_u32TxOutZ {
+ /**
+ * The element at position 0
+ */
+ uint32_t a;
+ /**
+ * The element at position 1
+ */
+ struct LDKTxOut b;
+} LDKC2Tuple_u32TxOutZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_u32TxOutZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_u32TxOutZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_u32TxOutZZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKThirtyTwoBytes a;
+ /**
+ * The element at position 1
+ */
+ struct LDKCVec_C2Tuple_u32TxOutZZ b;
+} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_TransactionOutputsZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_TransactionOutputsZ;
+
+/**
+ * Details about the balance(s) available for spending once the channel appears on chain.
+ *
+ * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not
+ * be provided.
+ */
+typedef enum LDKBalance_Tag {
+ /**
+ * The channel is not yet closed (or the commitment or closing transaction has not yet
+ * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is
+ * force-closed now.
+ */
+ LDKBalance_ClaimableOnChannelClose,
+ /**
+ * The channel has been closed, and the given balance is ours but awaiting confirmations until
+ * we consider it spendable.
+ */
+ LDKBalance_ClaimableAwaitingConfirmations,
+ /**
+ * The channel has been closed, and the given balance should be ours but awaiting spending
+ * transaction confirmation. If the spending transaction does not confirm in time, it is
+ * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain.
+ *
+ * Once the spending transaction confirms, before it has reached enough confirmations to be
+ * considered safe from chain reorganizations, the balance will instead be provided via
+ * [`Balance::ClaimableAwaitingConfirmations`].
+ */
+ LDKBalance_ContentiousClaimable,
+ /**
+ * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain
+ * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat
+ * likely to be claimed by our counterparty before we do.
+ */
+ LDKBalance_MaybeClaimableHTLCAwaitingTimeout,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKBalance_Sentinel,
+} LDKBalance_Tag;
+
+typedef struct LDKBalance_LDKClaimableOnChannelClose_Body {
+ /**
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
+ */
+ uint64_t claimable_amount_satoshis;
+} LDKBalance_LDKClaimableOnChannelClose_Body;
+
+typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body {
+ /**
+ * The amount available to claim, in satoshis, possibly excluding the on-chain fees which
+ * were spent in broadcasting the transaction.
+ */
+ uint64_t claimable_amount_satoshis;
+ /**
+ * The height at which an [`Event::SpendableOutputs`] event will be generated for this
+ * amount.
+ */
+ uint32_t confirmation_height;
+} LDKBalance_LDKClaimableAwaitingConfirmations_Body;
+
+typedef struct LDKBalance_LDKContentiousClaimable_Body {
+ /**
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
+ */
+ uint64_t claimable_amount_satoshis;
+ /**
+ * The height at which the counterparty may be able to claim the balance if we have not
+ * done so.
+ */
+ uint32_t timeout_height;
+} LDKBalance_LDKContentiousClaimable_Body;
+
+typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body {
+ /**
+ * The amount available to claim, in satoshis, excluding the on-chain fees which will be
+ * required to do so.
+ */
+ uint64_t claimable_amount_satoshis;
+ /**
+ * The height at which we will be able to claim the balance if our counterparty has not
+ * done so.
+ */
+ uint32_t claimable_height;
+} LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body;
+
+typedef struct MUST_USE_STRUCT LDKBalance {
+ LDKBalance_Tag tag;
+ union {
+ LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close;
+ LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations;
+ LDKBalance_LDKContentiousClaimable_Body contentious_claimable;
+ LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout;
+ };
+} LDKBalance;
+
+/**
+ * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_BalanceZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKBalance *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_BalanceZ;
+
+/**
+ * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ
+ */
+typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKC2Tuple_BlockHashChannelMonitorZ *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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr;
+
+/**
+ * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ 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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ {
+ /**
+ * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ;
+
+/**
+ * The contents of CResult_NoneLightningErrorZ
+ */
+typedef union LDKCResult_NoneLightningErrorZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKLightningError *err;
+} LDKCResult_NoneLightningErrorZPtr;
+
+/**
+ * A CResult_NoneLightningErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneLightningErrorZ {
+ /**
+ * The contents of this CResult_NoneLightningErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NoneLightningErrorZPtr contents;
+ /**
+ * Whether this CResult_NoneLightningErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NoneLightningErrorZ;
+
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_PublicKeyTypeZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKPublicKey a;
+ /**
+ * The element at position 1
+ */
+ struct LDKType b;
+} LDKC2Tuple_PublicKeyTypeZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_PublicKeyTypeZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_PublicKeyTypeZZ;
+
+/**
+ * The contents of CResult_boolLightningErrorZ
+ */
+typedef union LDKCResult_boolLightningErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ bool *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKLightningError *err;
+} LDKCResult_boolLightningErrorZPtr;
+
+/**
+ * A CResult_boolLightningErrorZ represents the result of a fallible operation,
+ * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_boolLightningErrorZ {
+ /**
+ * The contents of this CResult_boolLightningErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_boolLightningErrorZPtr contents;
+ /**
+ * Whether this CResult_boolLightningErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_boolLightningErrorZ;
+
+/**
+ * A tuple of 3 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKChannelAnnouncement a;
+ /**
+ * The element at position 1
+ */
+ struct LDKChannelUpdate b;
+ /**
+ * The element at position 2
+ */
+ struct LDKChannelUpdate c;
+} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_NodeAnnouncementZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKNodeAnnouncement *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_NodeAnnouncementZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_PublicKeyZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKPublicKey *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_PublicKeyZ;
+
+/**
+ * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not
+ */
+typedef enum LDKCOption_NetAddressZ_Tag {
+ /**
+ * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress
+ */
+ LDKCOption_NetAddressZ_Some,
+ /**
+ * When we're in this state, this COption_NetAddressZ contains nothing
+ */
+ LDKCOption_NetAddressZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_NetAddressZ_Sentinel,
+} LDKCOption_NetAddressZ_Tag;
+
+typedef struct LDKCOption_NetAddressZ {
+ LDKCOption_NetAddressZ_Tag tag;
+ union {
+ struct {
+ struct LDKNetAddress some;
+ };
+ };
+} LDKCOption_NetAddressZ;
+
+
+
+/**
+ * Error for PeerManager errors. If you get one of these, you must disconnect the socket and
+ * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the
+ * descriptor.
+ */
+typedef struct MUST_USE_STRUCT LDKPeerHandleError {
+ /**
+ * 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.
+ */
+ LDKnativePeerHandleError *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;
+} LDKPeerHandleError;
+
+/**
+ * The contents of CResult_CVec_u8ZPeerHandleErrorZ
+ */
+typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCVec_u8Z *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKPeerHandleError *err;
+} LDKCResult_CVec_u8ZPeerHandleErrorZPtr;
+
+/**
+ * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ {
+ /**
+ * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents;
+ /**
+ * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_CVec_u8ZPeerHandleErrorZ;
+
+/**
+ * The contents of CResult_NonePeerHandleErrorZ
+ */
+typedef union LDKCResult_NonePeerHandleErrorZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKPeerHandleError *err;
+} LDKCResult_NonePeerHandleErrorZPtr;
+
+/**
+ * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation,
+ * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NonePeerHandleErrorZ {
+ /**
+ * The contents of this CResult_NonePeerHandleErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NonePeerHandleErrorZPtr contents;
+ /**
+ * Whether this CResult_NonePeerHandleErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NonePeerHandleErrorZ;
+
+/**
+ * The contents of CResult_boolPeerHandleErrorZ
+ */
+typedef union LDKCResult_boolPeerHandleErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ bool *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKPeerHandleError *err;
+} LDKCResult_boolPeerHandleErrorZPtr;
+
+/**
+ * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation,
+ * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_boolPeerHandleErrorZ {
+ /**
+ * The contents of this CResult_boolPeerHandleErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_boolPeerHandleErrorZPtr contents;
+ /**
+ * Whether this CResult_boolPeerHandleErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_boolPeerHandleErrorZ;
+
+
+
+/**
+ * Represents the compressed public key of a node
+ */
+typedef struct MUST_USE_STRUCT LDKNodeId {
+ /**
+ * 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.
+ */
+ LDKnativeNodeId *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;
+} LDKNodeId;
+
+/**
+ * The contents of CResult_NodeIdDecodeErrorZ
+ */
+typedef union LDKCResult_NodeIdDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNodeId *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_NodeIdDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::NodeId 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_NodeIdDecodeErrorZ {
+ /**
+ * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NodeIdDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NodeIdDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NodeIdDecodeErrorZ;
+
+/**
+ * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCOption_NetworkUpdateZ *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_NetworkUpdateZDecodeErrorZPtr;
+
+/**
+ * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_NetworkUpdateZ 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_NetworkUpdateZDecodeErrorZ {
+ /**
+ * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_COption_NetworkUpdateZDecodeErrorZ;
+
+/**
+ * The `Access` trait defines behavior for accessing chain data and state, such as blocks and
+ * UTXOs.
+ */
+typedef struct LDKAccess {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the transaction output of a funding transaction encoded by [`short_channel_id`].
+ * Returns an error if `genesis_hash` is for a different chain or if such a transaction output
+ * is unknown.
+ *
+ * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id
+ */
+ struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKAccess;
+
+/**
+ * An enum which can either contain a crate::lightning::chain::Access or not
+ */
+typedef enum LDKCOption_AccessZ_Tag {
+ /**
+ * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access
+ */
+ LDKCOption_AccessZ_Some,
+ /**
+ * When we're in this state, this COption_AccessZ contains nothing
+ */
+ LDKCOption_AccessZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_AccessZ_Sentinel,
+} LDKCOption_AccessZ_Tag;
+
+typedef struct LDKCOption_AccessZ {
+ LDKCOption_AccessZ_Tag tag;
+ union {
+ struct {
+ struct LDKAccess some;
+ };
+ };
+} LDKCOption_AccessZ;
+
+
+
+/**
+ * Details about one direction of a channel as received within a [`ChannelUpdate`].
+ */
+typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo {
+ /**
+ * 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.
+ */
+ LDKnativeChannelUpdateInfo *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;
+} LDKChannelUpdateInfo;
+
+/**
+ * The contents of CResult_ChannelUpdateInfoDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelUpdateInfo *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_ChannelUpdateInfoDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::ChannelUpdateInfo 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_ChannelUpdateInfoDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelUpdateInfoDecodeErrorZ;
+
+
+
+/**
+ * Details about a channel (both directions).
+ * Received within a channel announcement.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelInfo {
+ /**
+ * 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.
+ */
+ LDKnativeChannelInfo *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;
+} LDKChannelInfo;
+
+/**
+ * The contents of CResult_ChannelInfoDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelInfoDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelInfo *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_ChannelInfoDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::ChannelInfo 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_ChannelInfoDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelInfoDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelInfoDecodeErrorZ;
+
+
+
+/**
+ * Fees for routing via a given channel or a node
+ */
+typedef struct MUST_USE_STRUCT LDKRoutingFees {
+ /**
+ * 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.
+ */
+ LDKnativeRoutingFees *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;
+} LDKRoutingFees;
+
+/**
+ * The contents of CResult_RoutingFeesDecodeErrorZ
+ */
+typedef union LDKCResult_RoutingFeesDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKRoutingFees *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_RoutingFeesDecodeErrorZPtr;
+
+/**
+ * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::RoutingFees 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_RoutingFeesDecodeErrorZ {
+ /**
+ * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_RoutingFeesDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_RoutingFeesDecodeErrorZ;
+
+
+
+/**
+ * Information received in the latest node_announcement from this node.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo {
+ /**
+ * 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.
+ */
+ LDKnativeNodeAnnouncementInfo *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;
+} LDKNodeAnnouncementInfo;
+
+/**
+ * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ
+ */
+typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNodeAnnouncementInfo *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_NodeAnnouncementInfoDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo 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_NodeAnnouncementInfoDecodeErrorZ {
+ /**
+ * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NodeAnnouncementInfoDecodeErrorZ;
+
+/**
+ * A dynamically-allocated array of u64s of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_u64Z {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ uint64_t *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_u64Z;
+
+
+
+/**
+ * Details about a node in the network, known from the network announcement.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeInfo {
+ /**
+ * 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.
+ */
+ LDKnativeNodeInfo *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;
+} LDKNodeInfo;
+
+/**
+ * The contents of CResult_NodeInfoDecodeErrorZ
+ */
+typedef union LDKCResult_NodeInfoDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNodeInfo *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_NodeInfoDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::NodeInfo 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_NodeInfoDecodeErrorZ {
+ /**
+ * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NodeInfoDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NodeInfoDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NodeInfoDecodeErrorZ;
+
+/**
+ * The contents of CResult_NetworkGraphDecodeErrorZ
+ */
+typedef union LDKCResult_NetworkGraphDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNetworkGraph *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_NetworkGraphDecodeErrorZPtr;
+
+/**
+ * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::network_graph::NetworkGraph 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_NetworkGraphDecodeErrorZ {
+ /**
+ * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NetworkGraphDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NetworkGraphDecodeErrorZ;
+
+/**
+ * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not
+ */
+typedef enum LDKCOption_CVec_NetAddressZZ_Tag {
+ /**
+ * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ
+ */
+ LDKCOption_CVec_NetAddressZZ_Some,
+ /**
+ * When we're in this state, this COption_CVec_NetAddressZZ contains nothing
+ */
+ LDKCOption_CVec_NetAddressZZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_CVec_NetAddressZZ_Sentinel,
+} LDKCOption_CVec_NetAddressZZ_Tag;
+
+typedef struct LDKCOption_CVec_NetAddressZZ {
+ LDKCOption_CVec_NetAddressZZ_Tag tag;
+ union {
+ struct {
+ struct LDKCVec_NetAddressZ some;
+ };
+ };
+} LDKCOption_CVec_NetAddressZZ;
+
+/**
+ * The contents of CResult_NetAddressDecodeErrorZ
+ */
+typedef union LDKCResult_NetAddressDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNetAddress *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_NetAddressDecodeErrorZPtr;
+
+/**
+ * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::NetAddress 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_NetAddressDecodeErrorZ {
+ /**
+ * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NetAddressDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NetAddressDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NetAddressDecodeErrorZ;
+
+
+
+/**
+ * An update_add_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC {
+ /**
+ * 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.
+ */
+ LDKnativeUpdateAddHTLC *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;
+} LDKUpdateAddHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateAddHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateAddHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateAddHTLCZ;
+
+
+
+/**
+ * An update_fulfill_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFulfillHTLC {
+ /**
+ * 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.
+ */
+ LDKnativeUpdateFulfillHTLC *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;
+} LDKUpdateFulfillHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateFulfillHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateFulfillHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateFulfillHTLCZ;
+
+
+
+/**
+ * An update_fail_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFailHTLC {
+ /**
+ * 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.
+ */
+ LDKnativeUpdateFailHTLC *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;
+} LDKUpdateFailHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateFailHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateFailHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateFailHTLCZ;
+
+
+
+/**
+ * An update_fail_malformed_htlc message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFailMalformedHTLC {
+ /**
+ * 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.
+ */
+ LDKnativeUpdateFailMalformedHTLC *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;
+} LDKUpdateFailMalformedHTLC;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_UpdateFailMalformedHTLCZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKUpdateFailMalformedHTLC *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_UpdateFailMalformedHTLCZ;
+
+/**
+ * The contents of CResult_AcceptChannelDecodeErrorZ
+ */
+typedef union LDKCResult_AcceptChannelDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKAcceptChannel *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_AcceptChannelDecodeErrorZPtr;
+
+/**
+ * A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::AcceptChannel 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_AcceptChannelDecodeErrorZ {
+ /**
+ * The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_AcceptChannelDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_AcceptChannelDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_AcceptChannelDecodeErrorZ;
+
+/**
+ * The contents of CResult_AnnouncementSignaturesDecodeErrorZ
+ */
+typedef union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKAnnouncementSignatures *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_AnnouncementSignaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::AnnouncementSignatures 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_AnnouncementSignaturesDecodeErrorZ {
+ /**
+ * The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_AnnouncementSignaturesDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_AnnouncementSignaturesDecodeErrorZ;
+
+/**
+ * The contents of CResult_ChannelReestablishDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelReestablishDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelReestablish *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_ChannelReestablishDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ChannelReestablish 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_ChannelReestablishDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelReestablishDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelReestablishDecodeErrorZ;
+
+/**
+ * The contents of CResult_ClosingSignedDecodeErrorZ
+ */
+typedef union LDKCResult_ClosingSignedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKClosingSigned *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_ClosingSignedDecodeErrorZPtr;
+
+/**
+ * A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ClosingSigned 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_ClosingSignedDecodeErrorZ {
+ /**
+ * The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ClosingSignedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ClosingSignedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ClosingSignedDecodeErrorZ;
+
+
+
+/**
+ * The minimum and maximum fees which the sender is willing to place on the closing transaction.
+ * This is provided in [`ClosingSigned`] by both sides to indicate the fee range they are willing
+ * to use.
+ */
+typedef struct MUST_USE_STRUCT LDKClosingSignedFeeRange {
+ /**
+ * 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.
+ */
+ LDKnativeClosingSignedFeeRange *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;
+} LDKClosingSignedFeeRange;
+
+/**
+ * The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ
+ */
+typedef union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKClosingSignedFeeRange *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_ClosingSignedFeeRangeDecodeErrorZPtr;
+
+/**
+ * A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ClosingSignedFeeRange 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_ClosingSignedFeeRangeDecodeErrorZ {
+ /**
+ * The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ClosingSignedFeeRangeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ClosingSignedFeeRangeDecodeErrorZ;
+
+
+
+/**
+ * A commitment_signed message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKCommitmentSigned {
+ /**
+ * 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.
+ */
+ LDKnativeCommitmentSigned *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;
+} LDKCommitmentSigned;
+
+/**
+ * The contents of CResult_CommitmentSignedDecodeErrorZ
+ */
+typedef union LDKCResult_CommitmentSignedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKCommitmentSigned *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_CommitmentSignedDecodeErrorZPtr;
+
+/**
+ * A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::CommitmentSigned 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_CommitmentSignedDecodeErrorZ {
+ /**
+ * The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_CommitmentSignedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_CommitmentSignedDecodeErrorZ;
+
+/**
+ * The contents of CResult_FundingCreatedDecodeErrorZ
+ */
+typedef union LDKCResult_FundingCreatedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKFundingCreated *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_FundingCreatedDecodeErrorZPtr;
+
+/**
+ * A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::FundingCreated 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_FundingCreatedDecodeErrorZ {
+ /**
+ * The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_FundingCreatedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_FundingCreatedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_FundingCreatedDecodeErrorZ;
+
+/**
+ * The contents of CResult_FundingSignedDecodeErrorZ
+ */
+typedef union LDKCResult_FundingSignedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKFundingSigned *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_FundingSignedDecodeErrorZPtr;
+
+/**
+ * A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::FundingSigned 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_FundingSignedDecodeErrorZ {
+ /**
+ * The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_FundingSignedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_FundingSignedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_FundingSignedDecodeErrorZ;
+
+/**
+ * The contents of CResult_FundingLockedDecodeErrorZ
+ */
+typedef union LDKCResult_FundingLockedDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKFundingLocked *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_FundingLockedDecodeErrorZPtr;
+
+/**
+ * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::FundingLocked 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_FundingLockedDecodeErrorZ {
+ /**
+ * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_FundingLockedDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_FundingLockedDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_FundingLockedDecodeErrorZ;
+
+
+
+/**
+ * An init message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKInit {
+ /**
+ * 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.
+ */
+ LDKnativeInit *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;
+} LDKInit;
+
+/**
+ * The contents of CResult_InitDecodeErrorZ
+ */
+typedef union LDKCResult_InitDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKInit *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_InitDecodeErrorZPtr;
+
+/**
+ * A CResult_InitDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Init 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_InitDecodeErrorZ {
+ /**
+ * The contents of this CResult_InitDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_InitDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_InitDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_InitDecodeErrorZ;
+
+/**
+ * The contents of CResult_OpenChannelDecodeErrorZ
+ */
+typedef union LDKCResult_OpenChannelDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKOpenChannel *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_OpenChannelDecodeErrorZPtr;
+
+/**
+ * A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::OpenChannel 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_OpenChannelDecodeErrorZ {
+ /**
+ * The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_OpenChannelDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_OpenChannelDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_OpenChannelDecodeErrorZ;
+
+/**
+ * The contents of CResult_RevokeAndACKDecodeErrorZ
+ */
+typedef union LDKCResult_RevokeAndACKDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKRevokeAndACK *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_RevokeAndACKDecodeErrorZPtr;
+
+/**
+ * A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::RevokeAndACK 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_RevokeAndACKDecodeErrorZ {
+ /**
+ * The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_RevokeAndACKDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_RevokeAndACKDecodeErrorZ;
+
+/**
+ * The contents of CResult_ShutdownDecodeErrorZ
+ */
+typedef union LDKCResult_ShutdownDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKShutdown *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_ShutdownDecodeErrorZPtr;
+
+/**
+ * A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Shutdown 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_ShutdownDecodeErrorZ {
+ /**
+ * The contents of this CResult_ShutdownDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ShutdownDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ShutdownDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ShutdownDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateFailHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFailHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFailHTLC *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_UpdateFailHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFailHTLC 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_UpdateFailHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFailHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFailHTLCDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFailMalformedHTLC *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_UpdateFailMalformedHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC 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_UpdateFailMalformedHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFailMalformedHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ;
+
+
+
+/**
+ * An update_fee message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKUpdateFee {
+ /**
+ * 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.
+ */
+ LDKnativeUpdateFee *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;
+} LDKUpdateFee;
+
+/**
+ * The contents of CResult_UpdateFeeDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFeeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFee *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_UpdateFeeDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFee 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_UpdateFeeDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFeeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFeeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFeeDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateFulfillHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateFulfillHTLC *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_UpdateFulfillHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateFulfillHTLC 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_UpdateFulfillHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateFulfillHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateFulfillHTLCDecodeErrorZ;
+
+/**
+ * The contents of CResult_UpdateAddHTLCDecodeErrorZ
+ */
+typedef union LDKCResult_UpdateAddHTLCDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUpdateAddHTLC *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_UpdateAddHTLCDecodeErrorZPtr;
+
+/**
+ * A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UpdateAddHTLC 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_UpdateAddHTLCDecodeErrorZ {
+ /**
+ * The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UpdateAddHTLCDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UpdateAddHTLCDecodeErrorZ;
+
+
+
+/**
+ * A ping message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKPing {
+ /**
+ * 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.
+ */
+ LDKnativePing *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;
+} LDKPing;
+
+/**
+ * The contents of CResult_PingDecodeErrorZ
+ */
+typedef union LDKCResult_PingDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPing *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_PingDecodeErrorZPtr;
+
+/**
+ * A CResult_PingDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Ping 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_PingDecodeErrorZ {
+ /**
+ * The contents of this CResult_PingDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PingDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_PingDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PingDecodeErrorZ;
+
+
+
+/**
+ * A pong message to be sent or received from a peer
+ */
+typedef struct MUST_USE_STRUCT LDKPong {
+ /**
+ * 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.
+ */
+ LDKnativePong *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;
+} LDKPong;
+
+/**
+ * The contents of CResult_PongDecodeErrorZ
+ */
+typedef union LDKCResult_PongDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKPong *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_PongDecodeErrorZPtr;
+
+/**
+ * A CResult_PongDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::Pong 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_PongDecodeErrorZ {
+ /**
+ * The contents of this CResult_PongDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_PongDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_PongDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_PongDecodeErrorZ;
+
+/**
+ * The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUnsignedChannelAnnouncement *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_UnsignedChannelAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement 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_UnsignedChannelAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UnsignedChannelAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ;
+
+/**
+ * The contents of CResult_ChannelAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelAnnouncement *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_ChannelAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ChannelAnnouncement 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_ChannelAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelAnnouncementDecodeErrorZ;
+
+
+
+/**
+ * The unsigned part of a channel_update
+ */
+typedef struct MUST_USE_STRUCT LDKUnsignedChannelUpdate {
+ /**
+ * 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.
+ */
+ LDKnativeUnsignedChannelUpdate *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;
+} LDKUnsignedChannelUpdate;
+
+/**
+ * The contents of CResult_UnsignedChannelUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUnsignedChannelUpdate *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_UnsignedChannelUpdateDecodeErrorZPtr;
+
+/**
+ * A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UnsignedChannelUpdate 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_UnsignedChannelUpdateDecodeErrorZ {
+ /**
+ * The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UnsignedChannelUpdateDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UnsignedChannelUpdateDecodeErrorZ;
+
+/**
+ * The contents of CResult_ChannelUpdateDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelUpdateDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKChannelUpdate *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_ChannelUpdateDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ChannelUpdate 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_ChannelUpdateDecodeErrorZ {
+ /**
+ * The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ChannelUpdateDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ChannelUpdateDecodeErrorZ;
+
+/**
+ * The contents of CResult_ErrorMessageDecodeErrorZ
+ */
+typedef union LDKCResult_ErrorMessageDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKErrorMessage *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_ErrorMessageDecodeErrorZPtr;
+
+/**
+ * A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ErrorMessage 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_ErrorMessageDecodeErrorZ {
+ /**
+ * The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ErrorMessageDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ErrorMessageDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ErrorMessageDecodeErrorZ;
+
+/**
+ * The contents of CResult_WarningMessageDecodeErrorZ
+ */
+typedef union LDKCResult_WarningMessageDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKWarningMessage *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_WarningMessageDecodeErrorZPtr;
+
+/**
+ * A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::WarningMessage 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_WarningMessageDecodeErrorZ {
+ /**
+ * The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_WarningMessageDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_WarningMessageDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_WarningMessageDecodeErrorZ;
+
+
+
+/**
+ * The unsigned part of a node_announcement
+ */
+typedef struct MUST_USE_STRUCT LDKUnsignedNodeAnnouncement {
+ /**
+ * 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.
+ */
+ LDKnativeUnsignedNodeAnnouncement *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;
+} LDKUnsignedNodeAnnouncement;
+
+/**
+ * The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUnsignedNodeAnnouncement *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_UnsignedNodeAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement 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_UnsignedNodeAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UnsignedNodeAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ;
+
+/**
+ * The contents of CResult_NodeAnnouncementDecodeErrorZ
+ */
+typedef union LDKCResult_NodeAnnouncementDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKNodeAnnouncement *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_NodeAnnouncementDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::NodeAnnouncement 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_NodeAnnouncementDecodeErrorZ {
+ /**
+ * The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NodeAnnouncementDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NodeAnnouncementDecodeErrorZ;
+
+/**
+ * The contents of CResult_QueryShortChannelIdsDecodeErrorZ
+ */
+typedef union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKQueryShortChannelIds *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_QueryShortChannelIdsDecodeErrorZPtr;
+
+/**
+ * A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::QueryShortChannelIds 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_QueryShortChannelIdsDecodeErrorZ {
+ /**
+ * The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_QueryShortChannelIdsDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_QueryShortChannelIdsDecodeErrorZ;
+
+
+
+/**
+ * A reply_short_channel_ids_end message is sent as a reply to a
+ * query_short_channel_ids message. The query recipient makes a best
+ * effort to respond based on their local network view which may not be
+ * a perfect view of the network.
+ */
+typedef struct MUST_USE_STRUCT LDKReplyShortChannelIdsEnd {
+ /**
+ * 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.
+ */
+ LDKnativeReplyShortChannelIdsEnd *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;
+} LDKReplyShortChannelIdsEnd;
+
+/**
+ * The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ
+ */
+typedef union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKReplyShortChannelIdsEnd *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_ReplyShortChannelIdsEndDecodeErrorZPtr;
+
+/**
+ * A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd 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_ReplyShortChannelIdsEndDecodeErrorZ {
+ /**
+ * The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ReplyShortChannelIdsEndDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ;
+
+/**
+ * The contents of CResult_QueryChannelRangeDecodeErrorZ
+ */
+typedef union LDKCResult_QueryChannelRangeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKQueryChannelRange *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_QueryChannelRangeDecodeErrorZPtr;
+
+/**
+ * A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::QueryChannelRange 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_QueryChannelRangeDecodeErrorZ {
+ /**
+ * The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_QueryChannelRangeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_QueryChannelRangeDecodeErrorZ;
+
+/**
+ * The contents of CResult_ReplyChannelRangeDecodeErrorZ
+ */
+typedef union LDKCResult_ReplyChannelRangeDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKReplyChannelRange *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_ReplyChannelRangeDecodeErrorZPtr;
+
+/**
+ * A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::ReplyChannelRange 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_ReplyChannelRangeDecodeErrorZ {
+ /**
+ * The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ReplyChannelRangeDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ReplyChannelRangeDecodeErrorZ;
+
+/**
+ * The contents of CResult_GossipTimestampFilterDecodeErrorZ
+ */
+typedef union LDKCResult_GossipTimestampFilterDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKGossipTimestampFilter *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_GossipTimestampFilterDecodeErrorZPtr;
+
+/**
+ * A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::msgs::GossipTimestampFilter 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_GossipTimestampFilterDecodeErrorZ {
+ /**
+ * The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_GossipTimestampFilterDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_GossipTimestampFilterDecodeErrorZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::ln::channelmanager::PhantomRouteHintss of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_PhantomRouteHintsZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKPhantomRouteHints *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_PhantomRouteHintsZ;
+
+/**
+ * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
+ * may occur.
+ */
+typedef enum LDKSignOrCreationError_Tag {
+ /**
+ * An error occurred during signing
+ */
+ LDKSignOrCreationError_SignError,
+ /**
+ * An error occurred while building the transaction
+ */
+ LDKSignOrCreationError_CreationError,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKSignOrCreationError_Sentinel,
+} LDKSignOrCreationError_Tag;
+
+typedef struct MUST_USE_STRUCT LDKSignOrCreationError {
+ LDKSignOrCreationError_Tag tag;
+ union {
+ struct {
+ enum LDKCreationError creation_error;
+ };
+ };
+} LDKSignOrCreationError;
+
+/**
+ * The contents of CResult_InvoiceSignOrCreationErrorZ
+ */
+typedef union LDKCResult_InvoiceSignOrCreationErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKInvoice *result;
+ /**
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
+ */
+ struct LDKSignOrCreationError *err;
+} LDKCResult_InvoiceSignOrCreationErrorZPtr;
+
+/**
+ * A CResult_InvoiceSignOrCreationErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_InvoiceSignOrCreationErrorZ {
+ /**
+ * The contents of this CResult_InvoiceSignOrCreationErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_InvoiceSignOrCreationErrorZPtr contents;
+ /**
+ * Whether this CResult_InvoiceSignOrCreationErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_InvoiceSignOrCreationErrorZ;
+
+
+
+/**
+ * A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
+ *
+ * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction
+ * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via
+ * the return value of [`Filter::register_output`].
+ *
+ * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and
+ * may have been spent there. See [`Filter::register_output`] for details.
+ *
+ * [`ChannelMonitor`]: channelmonitor::ChannelMonitor
+ * [`ChannelMonitor::block_connected`]: channelmonitor::ChannelMonitor::block_connected
+ */
+typedef struct MUST_USE_STRUCT LDKWatchedOutput {
+ /**
+ * 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.
+ */
+ LDKnativeWatchedOutput *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;
+} LDKWatchedOutput;
+
+/**
+ * The `Filter` trait defines behavior for indicating chain activity of interest pertaining to
+ * channels.
+ *
+ * This is useful in order to have a [`Watch`] implementation convey to a chain source which
+ * transactions to be notified of. Notification may take the form of pre-filtering blocks or, in
+ * the case of [BIP 157]/[BIP 158], only fetching a block if the compact filter matches. If
+ * receiving full blocks from a chain source, any further filtering is unnecessary.
+ *
+ * After an output has been registered, subsequent block retrievals from the chain source must not
+ * exclude any transactions matching the new criteria nor any in-block descendants of such
+ * transactions.
+ *
+ * Note that use as part of a [`Watch`] implementation involves reentrancy. Therefore, the `Filter`
+ * should not block on I/O. Implementations should instead queue the newly monitored data to be
+ * processed later. Then, in order to block until the data has been processed, any [`Watch`]
+ * invocation that has called the `Filter` must return [`TemporaryFailure`].
+ *
+ * [`TemporaryFailure`]: ChannelMonitorUpdateErr::TemporaryFailure
+ * [BIP 157]: https://github.com/bitcoin/bips/blob/master/bip-0157.mediawiki
+ * [BIP 158]: https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki
+ */
+typedef struct LDKFilter {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Registers interest in a transaction with `txid` and having an output with `script_pubkey` as
+ * a spending condition.
+ */
+ void (*register_tx)(const void *this_arg, const uint8_t (*txid)[32], struct LDKu8slice script_pubkey);
+ /**
+ * Registers interest in spends of a transaction output.
+ *
+ * Optionally, when `output.block_hash` is set, should return any transaction spending the
+ * output that is found in the corresponding block along with its index.
+ *
+ * This return value is useful for Electrum clients in order to supply in-block descendant
+ * transactions which otherwise were not included. This is not necessary for other clients if
+ * such descendant transactions were already included (e.g., when a BIP 157 client provides the
+ * full block).
+ */
+ struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKFilter;
+
+/**
+ * An enum which can either contain a crate::lightning::chain::Filter or not
+ */
+typedef enum LDKCOption_FilterZ_Tag {
+ /**
+ * When we're in this state, this COption_FilterZ contains a crate::lightning::chain::Filter
+ */
+ LDKCOption_FilterZ_Some,
+ /**
+ * When we're in this state, this COption_FilterZ contains nothing
+ */
+ LDKCOption_FilterZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_FilterZ_Sentinel,
+} LDKCOption_FilterZ_Tag;
+
+typedef struct LDKCOption_FilterZ {
+ LDKCOption_FilterZ_Tag tag;
+ union {
+ struct {
+ struct LDKFilter some;
+ };
+ };
+} LDKCOption_FilterZ;
+
+
+
+/**
+ * A read-only reference to a current ChannelMonitor.
+ *
+ * Note that this holds a mutex in [`ChainMonitor`] and may block other events until it is
+ * released.
+ */
+typedef struct MUST_USE_STRUCT LDKLockedChannelMonitor {
+ /**
+ * 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.
+ */
+ LDKnativeLockedChannelMonitor *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;
+} LDKLockedChannelMonitor;
+
+/**
+ * The contents of CResult_LockedChannelMonitorNoneZ
+ */
+typedef union LDKCResult_LockedChannelMonitorNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKLockedChannelMonitor *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_LockedChannelMonitorNoneZPtr;
+
+/**
+ * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation,
+ * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_LockedChannelMonitorNoneZ {
+ /**
+ * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_LockedChannelMonitorNoneZPtr contents;
+ /**
+ * Whether this CResult_LockedChannelMonitorNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_LockedChannelMonitorNoneZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_OutPointZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKOutPoint *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_OutPointZ;
+
+/**
+ * A trait indicating an object may generate message send events
+ */
+typedef struct LDKMessageSendEventsProvider {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Gets the list of pending events which were generated by previous actions, clearing the list
+ * in the process.
+ */
+ struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKMessageSendEventsProvider;
+
+/**
+ * A trait implemented for objects handling events from [`EventsProvider`].
+ */
+typedef struct LDKEventHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Handles the given [`Event`].
+ *
+ * See [`EventsProvider`] for details that must be considered when implementing this method.
+ */
+ void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKEventHandler;
+
+/**
+ * A trait indicating an object may generate events.
+ *
+ * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
+ *
+ * # Requirements
+ *
+ * See [`process_pending_events`] for requirements around event processing.
+ *
+ * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
+ * event since the last invocation. The handler must either act upon the event immediately
+ * or preserve it for later handling.
+ *
+ * Note, handlers may call back into the provider and thus deadlocking must be avoided. Be sure to
+ * consult the provider's documentation on the implication of processing events and how a handler
+ * may safely use the provider (e.g., see [`ChannelManager::process_pending_events`] and
+ * [`ChainMonitor::process_pending_events`]).
+ *
+ * (C-not implementable) As there is likely no reason for a user to implement this trait on their
+ * own type(s).
+ *
+ * [`process_pending_events`]: Self::process_pending_events
+ * [`handle_event`]: EventHandler::handle_event
+ * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events
+ * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events
+ */
+typedef struct LDKEventsProvider {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Processes any events generated since the last call using the given event handler.
+ *
+ * Subsequent calls must only process new events. However, handlers must be capable of handling
+ * duplicate events across process restarts. This may occur if the provider was recovered from
+ * an old state (i.e., it hadn't been successfully persisted after processing pending events).
+ */
+ void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKEventsProvider;
+
+
+
+/**
+ * Configuration we set when applicable.
+ *
+ * Default::default() provides sane defaults.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelHandshakeConfig {
+ /**
+ * 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.
+ */
+ LDKnativeChannelHandshakeConfig *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;
+} LDKChannelHandshakeConfig;
+
+
+
+/**
+ * Optional channel limits which are applied during channel creation.
+ *
+ * These limits are only applied to our counterparty's limits, not our own.
+ *
+ * Use 0/<type>::max_value() as appropriate to skip checking.
+ *
+ * Provides sane defaults for most configurations.
+ *
+ * Most additional limits are disabled except those with which specify a default in individual
+ * field documentation. Note that this may result in barely-usable channels, but since they
+ * are applied mostly only to incoming channels that's not much of a problem.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelHandshakeLimits {
+ /**
+ * 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.
+ */
+ LDKnativeChannelHandshakeLimits *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;
+} LDKChannelHandshakeLimits;
+
+
+
+/**
+ * Top-level config which holds ChannelHandshakeLimits and ChannelConfig.
+ *
+ * Default::default() provides sane defaults for most configurations
+ * (but currently with 0 relay fees!)
+ */
+typedef struct MUST_USE_STRUCT LDKUserConfig {
+ /**
+ * 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.
+ */
+ LDKnativeUserConfig *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;
+} LDKUserConfig;
+
+
+
+/**
+ * The best known block as identified by its hash and height.
+ */
+typedef struct MUST_USE_STRUCT LDKBestBlock {
+ /**
+ * 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.
+ */
+ LDKnativeBestBlock *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;
+} LDKBestBlock;
+
+/**
+ * The `Listen` trait is used to notify when blocks have been connected or disconnected from the
+ * chain.
+ *
+ * Useful when needing to replay chain data upon startup or as new chain events occur. Clients
+ * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`].
+ * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers
+ * when needed.
+ */
+typedef struct LDKListen {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Notifies the listener that a block was added at the given height.
+ */
+ void (*block_connected)(const void *this_arg, struct LDKu8slice block, uint32_t height);
+ /**
+ * Notifies the listener that a block was removed at the given height.
+ */
+ void (*block_disconnected)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKListen;
+
+/**
+ * The `Confirm` trait is used to notify when transactions have been confirmed on chain or
+ * unconfirmed during a chain reorganization.
+ *
+ * Clients sourcing chain data using a transaction-oriented API should prefer this interface over
+ * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity
+ * related to registered transactions and outputs. Upon notification, it would pass along the
+ * matching transactions using this interface.
+ *
+ * # Use
+ *
+ * The intended use is as follows:
+ * - Call [`transactions_confirmed`] to process any on-chain activity of interest.
+ * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`]
+ * that has been reorganized out of the chain.
+ * - Call [`best_block_updated`] whenever a new chain tip becomes available.
+ *
+ * # Order
+ *
+ * Clients must call these methods in chain order. Specifically:
+ * - Transactions confirmed in a block must be given before transactions confirmed in a later
+ * block.
+ * - Dependent transactions within the same block must be given in topological order, possibly in
+ * separate calls.
+ * - Unconfirmed transactions must be given after the original confirmations and before any
+ * reconfirmation.
+ *
+ * See individual method documentation for further details.
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ * [`best_block_updated`]: Self::best_block_updated
+ * [`get_relevant_txids`]: Self::get_relevant_txids
+ */
+typedef struct LDKConfirm {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Processes transactions confirmed in a block with a given header and height.
+ *
+ * Should be called for any transactions registered by [`Filter::register_tx`] or any
+ * transactions spending an output registered by [`Filter::register_output`]. Such transactions
+ * appearing in the same block do not need to be included in the same call; instead, multiple
+ * calls with additional transactions may be made so long as they are made in [chain order].
+ *
+ * May be called before or after [`best_block_updated`] for the corresponding block. However,
+ * in the event of a chain reorganization, it must not be called with a `header` that is no
+ * longer in the chain as of the last call to [`best_block_updated`].
+ *
+ * [chain order]: Confirm#Order
+ * [`best_block_updated`]: Self::best_block_updated
+ */
+ void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height);
+ /**
+ * Processes a transaction that is no longer confirmed as result of a chain reorganization.
+ *
+ * Should be called for any transaction returned by [`get_relevant_txids`] if it has been
+ * reorganized out of the best chain. Once called, the given transaction should not be returned
+ * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`].
+ *
+ * [`get_relevant_txids`]: Self::get_relevant_txids
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ */
+ void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]);
+ /**
+ * Processes an update to the best header connected at the given height.
+ *
+ * Should be called when a new header is available but may be skipped for intermediary blocks
+ * if they become available at the same time.
+ */
+ void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height);
+ /**
+ * Returns transactions that should be monitored for reorganization out of the chain.
+ *
+ * Should include any transactions passed to [`transactions_confirmed`] that have insufficient
+ * confirmations to be safe from a chain reorganization. Should not include any transactions
+ * passed to [`transaction_unconfirmed`] unless later reconfirmed.
+ *
+ * May be called to determine the subset of transactions that must still be monitored for
+ * reorganization. Will be idempotent between calls but may change as a result of calls to the
+ * other interface methods. Thus, this is useful to determine which transactions may need to be
+ * given to [`transaction_unconfirmed`].
+ *
+ * [`transactions_confirmed`]: Self::transactions_confirmed
+ * [`transaction_unconfirmed`]: Self::transaction_unconfirmed
+ */
+ struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKConfirm;
+
+
+
+/**
+ * An opaque identifier describing a specific [`Persist`] method call.
+ */
+typedef struct MUST_USE_STRUCT LDKMonitorUpdateId {
+ /**
+ * 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.
+ */
+ LDKnativeMonitorUpdateId *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;
+} LDKMonitorUpdateId;
+
+/**
+ * `Persist` defines behavior for persisting channel monitors: this could mean
+ * writing once to disk, and/or uploading to one or more backup services.
+ *
+ * Each method can return three possible values:
+ * * If persistence (including any relevant `fsync()` calls) happens immediately, the
+ * implementation should return `Ok(())`, indicating normal channel operation should continue.
+ * * If persistence happens asynchronously, implementations should first ensure the
+ * [`ChannelMonitor`] or [`ChannelMonitorUpdate`] are written durably to disk, and then return
+ * `Err(ChannelMonitorUpdateErr::TemporaryFailure)` while the update continues in the
+ * background. Once the update completes, [`ChainMonitor::channel_monitor_updated`] should be
+ * called with the corresponding [`MonitorUpdateId`].
+ *
+ * Note that unlike the direct [`chain::Watch`] interface,
+ * [`ChainMonitor::channel_monitor_updated`] must be called once for *each* update which occurs.
+ *
+ * * If persistence fails for some reason, implementations should return
+ * `Err(ChannelMonitorUpdateErr::PermanentFailure)`, in which case the channel will likely be
+ * closed without broadcasting the latest state. See
+ * [`ChannelMonitorUpdateErr::PermanentFailure`] for more details.
+ */
+typedef struct LDKPersist {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Persist a new channel's data in response to a [`chain::Watch::watch_channel`] call. This is
+ * called by [`ChannelManager`] for new channels, or may be called directly, e.g. on startup.
+ *
+ * The data can be stored any way you want, but the identifier provided by LDK is the
+ * channel's outpoint (and it is up to you to maintain a correct mapping between the outpoint
+ * and the stored channel data). Note that you **must** persist every new monitor to disk.
+ *
+ * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
+ * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+ *
+ * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`
+ * and [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`Writeable::write`]: crate::util::ser::Writeable::write
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*persist_new_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
+ /**
+ * Update one channel's data. The provided [`ChannelMonitor`] has already applied the given
+ * update.
+ *
+ * Note that on every update, you **must** persist either the [`ChannelMonitorUpdate`] or the
+ * updated monitor itself to disk/backups. See the [`Persist`] trait documentation for more
+ * details.
+ *
+ * During blockchain synchronization operations, this may be called with no
+ * [`ChannelMonitorUpdate`], in which case the full [`ChannelMonitor`] needs to be persisted.
+ * Note that after the full [`ChannelMonitor`] is persisted any previous
+ * [`ChannelMonitorUpdate`]s which were persisted should be discarded - they can no longer be
+ * applied to the persisted [`ChannelMonitor`] as they were already applied.
+ *
+ * If an implementer chooses to persist the updates only, they need to make
+ * sure that all the updates are applied to the `ChannelMonitors` *before*
+ * the set of channel monitors is given to the `ChannelManager`
+ * deserialization routine. See [`ChannelMonitor::update_monitor`] for
+ * applying a monitor update to a monitor. If full `ChannelMonitors` are
+ * persisted, then there is no need to persist individual updates.
+ *
+ * Note that there could be a performance tradeoff between persisting complete
+ * channel monitors on every update vs. persisting only updates and applying
+ * them in batches. The size of each monitor grows `O(number of state updates)`
+ * whereas updates are small and `O(1)`.
+ *
+ * The `update_id` is used to identify this call to [`ChainMonitor::channel_monitor_updated`],
+ * if you return [`ChannelMonitorUpdateErr::TemporaryFailure`].
+ *
+ * See [`Writeable::write`] on [`ChannelMonitor`] for writing out a `ChannelMonitor`,
+ * [`Writeable::write`] on [`ChannelMonitorUpdate`] for writing out an update, and
+ * [`ChannelMonitorUpdateErr`] for requirements when returning errors.
+ *
+ * [`Writeable::write`]: crate::util::ser::Writeable::write
+ *
+ * Note that update (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKPersist;
+
+
+
+/**
+ * An implementation of [`chain::Watch`] for monitoring channels.
+ *
+ * Connected and disconnected blocks must be provided to `ChainMonitor` as documented by
+ * [`chain::Watch`]. May be used in conjunction with [`ChannelManager`] to monitor channels locally
+ * or used independently to monitor channels remotely. See the [module-level documentation] for
+ * details.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [module-level documentation]: crate::chain::chainmonitor
+ */
+typedef struct MUST_USE_STRUCT LDKChainMonitor {
+ /**
+ * 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.
+ */
+ LDKnativeChainMonitor *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;
+} LDKChainMonitor;
+
+
+
+/**
+ * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key
+ * and derives keys from that.
+ *
+ * Your node_id is seed/0'
+ * ChannelMonitor closes may use seed/1'
+ * Cooperative closes may use seed/2'
+ * The two close keys may be needed to claim on-chain funds!
+ *
+ * This struct cannot be used for nodes that wish to support receiving phantom payments;
+ * [`PhantomKeysManager`] must be used instead.
+ *
+ * Note that switching between this struct and [`PhantomKeysManager`] will invalidate any
+ * previously issued invoices and attempts to pay previous invoices will fail.
+ */
+typedef struct MUST_USE_STRUCT LDKKeysManager {
+ /**
+ * 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.
+ */
+ LDKnativeKeysManager *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;
+} LDKKeysManager;
+
+
+
+/**
+ * Similar to [`KeysManager`], but allows the node using this struct to receive phantom node
+ * payments.
+ *
+ * A phantom node payment is a payment made to a phantom invoice, which is an invoice that can be
+ * paid to one of multiple nodes. This works because we encode the invoice route hints such that
+ * LDK will recognize an incoming payment as destined for a phantom node, and collect the payment
+ * itself without ever needing to forward to this fake node.
+ *
+ * Phantom node payments are useful for load balancing between multiple LDK nodes. They also
+ * provide some fault tolerance, because payers will automatically retry paying other provided
+ * nodes in the case that one node goes down.
+ *
+ * Note that multi-path payments are not supported in phantom invoices for security reasons.
+ * Switching between this struct and [`KeysManager`] will invalidate any previously issued
+ * invoices and attempts to pay previous invoices will fail.
+ */
+typedef struct MUST_USE_STRUCT LDKPhantomKeysManager {
+ /**
+ * 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.
+ */
+ LDKnativePhantomKeysManager *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;
+} LDKPhantomKeysManager;
+
+
+
+/**
+ * Chain-related parameters used to construct a new `ChannelManager`.
+ *
+ * Typically, the block-specific parameters are derived from the best block hash for the network,
+ * as a newly constructed `ChannelManager` will not have created any channels yet. These parameters
+ * are not needed when deserializing a previously constructed `ChannelManager`.
+ */
+typedef struct MUST_USE_STRUCT LDKChainParameters {
+ /**
+ * 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.
+ */
+ LDKnativeChainParameters *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;
+} LDKChainParameters;
+
+/**
+ * A 3-byte byte array.
+ */
+typedef struct LDKThreeBytes {
+ /**
+ * The three bytes
+ */
+ uint8_t data[3];
+} LDKThreeBytes;
+
+/**
+ * A trait to describe an object which can receive channel messages.
+ *
+ * Messages MAY be called in parallel when they originate from different their_node_ids, however
+ * they MUST NOT be called in parallel when the two calls have the same their_node_id.
+ */
+typedef struct LDKChannelMessageHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Handle an incoming open_channel message from the given peer.
+ */
+ void (*handle_open_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKOpenChannel *NONNULL_PTR msg);
+ /**
+ * Handle an incoming accept_channel message from the given peer.
+ */
+ void (*handle_accept_channel)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKInitFeatures their_features, const struct LDKAcceptChannel *NONNULL_PTR msg);
+ /**
+ * Handle an incoming funding_created message from the given peer.
+ */
+ void (*handle_funding_created)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingCreated *NONNULL_PTR msg);
+ /**
+ * Handle an incoming funding_signed message from the given peer.
+ */
+ void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg);
+ /**
+ * Handle an incoming funding_locked message from the given peer.
+ */
+ void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg);
+ /**
+ * Handle an incoming shutdown message from the given peer.
+ */
+ void (*handle_shutdown)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInitFeatures *NONNULL_PTR their_features, const struct LDKShutdown *NONNULL_PTR msg);
+ /**
+ * Handle an incoming closing_signed message from the given peer.
+ */
+ void (*handle_closing_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKClosingSigned *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_add_htlc message from the given peer.
+ */
+ void (*handle_update_add_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateAddHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fulfill_htlc message from the given peer.
+ */
+ void (*handle_update_fulfill_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFulfillHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fail_htlc message from the given peer.
+ */
+ void (*handle_update_fail_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fail_malformed_htlc message from the given peer.
+ */
+ void (*handle_update_fail_malformed_htlc)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFailMalformedHTLC *NONNULL_PTR msg);
+ /**
+ * Handle an incoming commitment_signed message from the given peer.
+ */
+ void (*handle_commitment_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKCommitmentSigned *NONNULL_PTR msg);
+ /**
+ * Handle an incoming revoke_and_ack message from the given peer.
+ */
+ void (*handle_revoke_and_ack)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKRevokeAndACK *NONNULL_PTR msg);
+ /**
+ * Handle an incoming update_fee message from the given peer.
+ */
+ void (*handle_update_fee)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKUpdateFee *NONNULL_PTR msg);
+ /**
+ * Handle an incoming announcement_signatures message from the given peer.
+ */
+ void (*handle_announcement_signatures)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKAnnouncementSignatures *NONNULL_PTR msg);
+ /**
+ * Indicates a connection to the peer failed/an existing connection was lost. If no connection
+ * is believed to be possible in the future (eg they're sending us messages we don't
+ * understand or indicate they require unknown feature bits), no_connection_possible is set
+ * and any outstanding channels should be failed.
+ */
+ void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible);
+ /**
+ * Handle a peer reconnecting, possibly generating channel_reestablish message(s).
+ */
+ void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR msg);
+ /**
+ * Handle an incoming channel_reestablish message from the given peer.
+ */
+ void (*handle_channel_reestablish)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReestablish *NONNULL_PTR msg);
+ /**
+ * Handle an incoming channel update from the given peer.
+ */
+ void (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg);
+ /**
+ * Handle an incoming error message from the given peer.
+ */
+ void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg);
+ /**
+ * Implementation of MessageSendEventsProvider for this object.
+ */
+ struct LDKMessageSendEventsProvider MessageSendEventsProvider;
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKChannelMessageHandler;
+
+
+
+/**
+ * Arguments for the creation of a ChannelManager that are not deserialized.
+ *
+ * At a high-level, the process for deserializing a ChannelManager and resuming normal operation
+ * is:
+ * 1) Deserialize all stored [`ChannelMonitor`]s.
+ * 2) Deserialize the [`ChannelManager`] by filling in this struct and calling:
+ * `<(BlockHash, ChannelManager)>::read(reader, args)`
+ * This may result in closing some channels if the [`ChannelMonitor`] is newer than the stored
+ * [`ChannelManager`] state to ensure no loss of funds. Thus, transactions may be broadcasted.
+ * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the
+ * same way you would handle a [`chain::Filter`] call using
+ * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`].
+ * 4) Reconnect blocks on your [`ChannelMonitor`]s.
+ * 5) Disconnect/connect blocks on the [`ChannelManager`].
+ * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk.
+ * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you
+ * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in
+ * the next step.
+ * 7) Move the [`ChannelMonitor`]s into your local [`chain::Watch`]. If you're using a
+ * [`ChainMonitor`], this is done by calling [`chain::Watch::watch_channel`].
+ *
+ * Note that the ordering of #4-7 is not of importance, however all four must occur before you
+ * call any other methods on the newly-deserialized [`ChannelManager`].
+ *
+ * Note that because some channels may be closed during deserialization, it is critical that you
+ * always deserialize only the latest version of a ChannelManager and ChannelMonitors available to
+ * you. If you deserialize an old ChannelManager (during which force-closure transactions may be
+ * broadcast), and then later deserialize a newer version of the same ChannelManager (which will
+ * not force-close the same channels but consider them live), you may end up revoking a state for
+ * which you've already broadcasted the transaction.
+ *
+ * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
+ */
+typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs {
+ /**
+ * 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.
+ */
+ LDKnativeChannelManagerReadArgs *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;
+} LDKChannelManagerReadArgs;
+
+
+
+/**
+ * Proof that the sender knows the per-commitment secret of the previous commitment transaction.
+ * This is used to convince the recipient that the channel is at a certain commitment
+ * number even if they lost that data due to a local failure. Of course, the peer may lie
+ * and even later commitments may have been revoked.
+ */
+typedef struct MUST_USE_STRUCT LDKDataLossProtect {
+ /**
+ * 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.
+ */
+ LDKnativeDataLossProtect *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;
+} LDKDataLossProtect;
+
+/**
+ * A trait to describe an object which can receive routing messages.
+ *
+ * # Implementor DoS Warnings
+ *
+ * For `gossip_queries` messages there are potential DoS vectors when handling
+ * inbound queries. Implementors using an on-disk network graph should be aware of
+ * repeated disk I/O for queries accessing different parts of the network graph.
+ */
+typedef struct LDKRoutingMessageHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Handle an incoming node_announcement message, returning true if it should be forwarded on,
+ * false or returning an Err otherwise.
+ */
+ struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg);
+ /**
+ * Handle a channel_announcement message, returning true if it should be forwarded on, false
+ * or returning an Err otherwise.
+ */
+ struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg);
+ /**
+ * Handle an incoming channel_update message, returning true if it should be forwarded on,
+ * false or returning an Err otherwise.
+ */
+ struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg);
+ /**
+ * Gets a subset of the channel announcements and updates required to dump our routing table
+ * to a remote node, starting at the short_channel_id indicated by starting_point and
+ * including the batch_amount entries immediately higher in numerical value than starting_point.
+ */
+ struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount);
+ /**
+ * Gets a subset of the node announcements required to dump our routing table to a remote node,
+ * starting at the node *after* the provided publickey and including batch_amount entries
+ * immediately higher (as defined by <PublicKey as Ord>::cmp) than starting_point.
+ * If None is provided for starting_point, we start at the first node.
+ *
+ * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount);
+ /**
+ * Called when a connection is established with a peer. This can be used to
+ * perform routing table synchronization using a strategy defined by the
+ * implementor.
+ */
+ void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init);
+ /**
+ * Handles the reply of a query we initiated to learn about channels
+ * for a given range of blocks. We can expect to receive one or more
+ * replies to a single query.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_reply_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyChannelRange msg);
+ /**
+ * Handles the reply of a query we initiated asking for routing gossip
+ * messages for a list of channels. We should receive this message when
+ * a node has completed its best effort to send us the pertaining routing
+ * gossip messages.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_reply_short_channel_ids_end)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKReplyShortChannelIdsEnd msg);
+ /**
+ * Handles when a peer asks us to send a list of short_channel_ids
+ * for the requested range of blocks.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_query_channel_range)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryChannelRange msg);
+ /**
+ * Handles when a peer asks us to send routing gossip messages for a
+ * list of short_channel_ids.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg);
+ /**
+ * Implementation of MessageSendEventsProvider for this object.
+ */
+ struct LDKMessageSendEventsProvider MessageSendEventsProvider;
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKRoutingMessageHandler;
+
+/**
+ * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers)
+ * decoders.
+ */
+typedef struct LDKCustomMessageReader {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Decodes a custom message to `CustomMessageType`. If the given message type is known to the
+ * implementation and the message could be decoded, must return `Ok(Some(message))`. If the
+ * message type is unknown to the implementation, must return `Ok(None)`. If a decoding error
+ * occur, must return `Err(DecodeError::X)` where `X` details the encountered error.
+ */
+ struct LDKCResult_COption_TypeZDecodeErrorZ (*read)(const void *this_arg, uint16_t message_type, struct LDKu8slice buffer);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKCustomMessageReader;
+
+/**
+ * Handler for BOLT1-compliant messages.
+ */
+typedef struct LDKCustomMessageHandler {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Called with the message type that was received and the buffer to be read.
+ * Can return a `MessageHandlingError` if the message could not be handled.
+ */
+ struct LDKCResult_NoneLightningErrorZ (*handle_custom_message)(const void *this_arg, struct LDKType msg, struct LDKPublicKey sender_node_id);
+ /**
+ * Gets the list of pending messages which were generated by the custom message
+ * handler, clearing the list in the process. The first tuple element must
+ * correspond to the intended recipients node ids. If no connection to one of the
+ * specified node does not exist, the message is simply not sent to it.
+ */
+ struct LDKCVec_C2Tuple_PublicKeyTypeZZ (*get_and_clear_pending_msg)(const void *this_arg);
+ /**
+ * Implementation of CustomMessageReader for this object.
+ */
+ struct LDKCustomMessageReader CustomMessageReader;
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKCustomMessageHandler;
+
+
+
+/**
+ * A dummy struct which implements `RoutingMessageHandler` without storing any routing information
+ * or doing any processing. You can provide one of these as the route_handler in a MessageHandler.
+ */
+typedef struct MUST_USE_STRUCT LDKIgnoringMessageHandler {
+ /**
+ * 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.
+ */
+ LDKnativeIgnoringMessageHandler *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;
+} LDKIgnoringMessageHandler;
+
+
+
+/**
+ * A dummy struct which implements `ChannelMessageHandler` without having any channels.
+ * You can provide one of these as the route_handler in a MessageHandler.
+ */
+typedef struct MUST_USE_STRUCT LDKErroringMessageHandler {
+ /**
+ * 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.
+ */
+ LDKnativeErroringMessageHandler *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;
+} LDKErroringMessageHandler;
+
+
+
+/**
+ * Provides references to trait impls which handle different types of messages.
+ */
+typedef struct MUST_USE_STRUCT LDKMessageHandler {
+ /**
+ * 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.
+ */
+ LDKnativeMessageHandler *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;
+} LDKMessageHandler;
+
+/**
+ * Provides an object which can be used to send data to and which uniquely identifies a connection
+ * to a remote host. You will need to be able to generate multiple of these which meet Eq and
+ * implement Hash to meet the PeerManager API.
+ *
+ * For efficiency, Clone should be relatively cheap for this type.
+ *
+ * Two descriptors may compare equal (by [`cmp::Eq`] and [`hash::Hash`]) as long as the original
+ * has been disconnected, the [`PeerManager`] has been informed of the disconnection (either by it
+ * having triggered the disconnection or a call to [`PeerManager::socket_disconnected`]), and no
+ * further calls to the [`PeerManager`] related to the original socket occur. This allows you to
+ * use a file descriptor for your SocketDescriptor directly, however for simplicity you may wish
+ * to simply use another value which is guaranteed to be globally unique instead.
+ */
+typedef struct LDKSocketDescriptor {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Attempts to send some data from the given slice to the peer.
+ *
+ * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected.
+ * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be
+ * called and further write attempts may occur until that time.
+ *
+ * If the returned size is smaller than `data.len()`, a
+ * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be
+ * written. Additionally, until a `send_data` event completes fully, no further
+ * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to
+ * prevent denial-of-service issues, you should not read or buffer any data from the socket
+ * until then.
+ *
+ * If a [`PeerManager::read_event`] call on this descriptor had previously returned true
+ * (indicating that read events should be paused to prevent DoS in the send buffer),
+ * `resume_read` may be set indicating that read events on this descriptor should resume. A
+ * `resume_read` of false carries no meaning, and should not cause any action.
+ */
+ uintptr_t (*send_data)(void *this_arg, struct LDKu8slice data, bool resume_read);
+ /**
+ * Disconnect the socket pointed to by this SocketDescriptor.
+ *
+ * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this
+ * call (doing so is a noop).
+ */
+ void (*disconnect_socket)(void *this_arg);
+ /**
+ * Checks if two objects are equal given this object's this_arg pointer and another object.
+ */
+ bool (*eq)(const void *this_arg, const struct LDKSocketDescriptor *NONNULL_PTR other_arg);
+ /**
+ * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer.
+ * This is used, for example, for inclusion of this object in a hash map.
+ */
+ uint64_t (*hash)(const void *this_arg);
+ /**
+ * Called, if set, after this SocketDescriptor has been cloned into a duplicate object.
+ * The new SocketDescriptor is provided, and should be mutated as needed to perform a
+ * deep copy of the object pointed to by this_arg or avoid any double-freeing.
+ */
+ void (*cloned)(struct LDKSocketDescriptor *NONNULL_PTR new_SocketDescriptor);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKSocketDescriptor;
+
+
+
+/**
+ * A PeerManager manages a set of peers, described by their [`SocketDescriptor`] and marshalls
+ * socket events into messages which it passes on to its [`MessageHandler`].
+ *
+ * Locks are taken internally, so you must never assume that reentrancy from a
+ * [`SocketDescriptor`] call back into [`PeerManager`] methods will not deadlock.
+ *
+ * Calls to [`read_event`] will decode relevant messages and pass them to the
+ * [`ChannelMessageHandler`], likely doing message processing in-line. Thus, the primary form of
+ * parallelism in Rust-Lightning is in calls to [`read_event`]. Note, however, that calls to any
+ * [`PeerManager`] functions related to the same connection must occur only in serial, making new
+ * calls only after previous ones have returned.
+ *
+ * Rather than using a plain PeerManager, it is preferable to use either a SimpleArcPeerManager
+ * a SimpleRefPeerManager, for conciseness. See their documentation for more details, but
+ * essentially you should default to using a SimpleRefPeerManager, and use a
+ * SimpleArcPeerManager when you require a PeerManager with a static lifetime, such as when
+ * you're using lightning-net-tokio.
+ *
+ * [`read_event`]: PeerManager::read_event
+ */
+typedef struct MUST_USE_STRUCT LDKPeerManager {
+ /**
+ * 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.
+ */
+ LDKnativePeerManager *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;
+} LDKPeerManager;
+
+
+
+/**
+ * Static channel fields used to build transactions given per-commitment fields, organized by
+ * broadcaster/countersignatory.
+ *
+ * This is derived from the holder/counterparty-organized ChannelTransactionParameters via the
+ * as_holder_broadcastable and as_counterparty_broadcastable functions.
+ */
+typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters {
+ /**
+ * 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.
+ */
+ LDKnativeDirectedChannelTransactionParameters *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;
+} LDKDirectedChannelTransactionParameters;
+
+
+
+/**
+ * A read-only view of [`NetworkGraph`].
+ */
+typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph {
+ /**
+ * 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.
+ */
+ LDKnativeReadOnlyNetworkGraph *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;
+} LDKReadOnlyNetworkGraph;
+
+
+
+/**
+ * Receives and validates network updates from peers,
+ * stores authentic and relevant data as a network graph.
+ * This network graph is then used for routing payments.
+ * Provides interface to help with initial routing sync by
+ * serving historical announcements.
+ *
+ * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the
+ * [`NetworkGraph`].
+ */
+typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler {
+ /**
+ * 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.
+ */
+ LDKnativeNetGraphMsgHandler *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;
+} LDKNetGraphMsgHandler;
+
+
+
+/**
+ * A wrapper around [`ChannelInfo`] representing information about the channel as directed from a
+ * source node to a target node.
+ */
+typedef struct MUST_USE_STRUCT LDKDirectedChannelInfo {
+ /**
+ * 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.
+ */
+ LDKnativeDirectedChannelInfo *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;
+} LDKDirectedChannelInfo;
+
+/**
+ * The effective capacity of a channel for routing purposes.
+ *
+ * While this may be smaller than the actual channel capacity, amounts greater than
+ * [`Self::as_msat`] should not be routed through the channel.
+ */
+typedef enum LDKEffectiveCapacity_Tag {
+ /**
+ * The available liquidity in the channel known from being a channel counterparty, and thus a
+ * direct hop.
+ */
+ LDKEffectiveCapacity_ExactLiquidity,
+ /**
+ * The maximum HTLC amount in one direction as advertised on the gossip network.
+ */
+ LDKEffectiveCapacity_MaximumHTLC,
+ /**
+ * The total capacity of the channel as determined by the funding transaction.
+ */
+ LDKEffectiveCapacity_Total,
+ /**
+ * A capacity sufficient to route any payment, typically used for private channels provided by
+ * an invoice.
+ */
+ LDKEffectiveCapacity_Infinite,
+ /**
+ * A capacity that is unknown possibly because either the chain state is unavailable to know
+ * the total capacity or the `htlc_maximum_msat` was not advertised on the gossip network.
+ */
+ LDKEffectiveCapacity_Unknown,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKEffectiveCapacity_Sentinel,
+} LDKEffectiveCapacity_Tag;
+
+typedef struct LDKEffectiveCapacity_LDKExactLiquidity_Body {
+ /**
+ * Either the inbound or outbound liquidity depending on the direction, denominated in
+ * millisatoshi.
+ */
+ uint64_t liquidity_msat;
+} LDKEffectiveCapacity_LDKExactLiquidity_Body;
+
+typedef struct LDKEffectiveCapacity_LDKMaximumHTLC_Body {
+ /**
+ * The maximum HTLC amount denominated in millisatoshi.
+ */
+ uint64_t amount_msat;
+} LDKEffectiveCapacity_LDKMaximumHTLC_Body;
+
+typedef struct LDKEffectiveCapacity_LDKTotal_Body {
+ /**
+ * The funding amount denominated in millisatoshi.
+ */
+ uint64_t capacity_msat;
+} LDKEffectiveCapacity_LDKTotal_Body;
+
+typedef struct MUST_USE_STRUCT LDKEffectiveCapacity {
+ LDKEffectiveCapacity_Tag tag;
+ union {
+ LDKEffectiveCapacity_LDKExactLiquidity_Body exact_liquidity;
+ LDKEffectiveCapacity_LDKMaximumHTLC_Body maximum_htlc;
+ LDKEffectiveCapacity_LDKTotal_Body total;
+ };
+} LDKEffectiveCapacity;
+
+/**
+ * An interface used to score payment channels for path finding.
+ *
+ *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel.
+ */
+typedef struct LDKScore {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the
+ * given channel in the direction from `source` to `target`.
+ *
+ * The channel's capacity (less any other MPP parts that are also being considered for use in
+ * the same payment) is given by `capacity_msat`. It may be determined from various sources
+ * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near
+ * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount.
+ * Thus, implementations should be overflow-safe.
+ */
+ uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target);
+ /**
+ * Handles updating channel penalties after failing to route through a channel.
+ */
+ void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
+ /**
+ * Handles updating channel penalties after successfully routing along a path.
+ */
+ void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
+ /**
+ * Serialize the object into a byte array
+ */
+ struct LDKCVec_u8Z (*write)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKScore;
+
+/**
+ * A scorer that is accessed under a lock.
+ *
+ * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while
+ * having shared ownership of a scorer but without requiring internal locking in [`Score`]
+ * implementations. Internal locking would be detrimental to route finding performance and could
+ * result in [`Score::channel_penalty_msat`] returning a different value for the same channel.
+ *
+ * [`find_route`]: crate::routing::router::find_route
+ */
+typedef struct LDKLockableScore {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the locked scorer.
+ */
+ struct LDKScore (*lock)(const void *this_arg);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKLockableScore;
+
+
+
+/**
+ * A concrete implementation of [`LockableScore`] which supports multi-threading.
+ */
+typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore {
+ /**
+ * 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.
+ */
+ LDKnativeMultiThreadedLockableScore *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;
+} LDKMultiThreadedLockableScore;
+
+
+
+/**
+ * Parameters for configuring [`ProbabilisticScorer`].
+ *
+ * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel
+ * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel).
+ */
+typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters {
+ /**
+ * 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.
+ */
+ LDKnativeProbabilisticScoringParameters *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;
+} LDKProbabilisticScoringParameters;
+
+
+
+/**
+ * FilesystemPersister persists channel data on disk, where each channel's
+ * data is stored in a file named after its funding outpoint.
+ *
+ * Warning: this module does the best it can with calls to persist data, but it
+ * can only guarantee that the data is passed to the drive. It is up to the
+ * drive manufacturers to do the actual persistence properly, which they often
+ * don't (especially on consumer-grade hardware). Therefore, it is up to the
+ * user to validate their entire storage stack, to ensure the writes are
+ * persistent.
+ * Corollary: especially when dealing with larger amounts of money, it is best
+ * practice to have multiple channel data backups and not rely only on one
+ * FilesystemPersister.
+ */
+typedef struct MUST_USE_STRUCT LDKFilesystemPersister {
+ /**
+ * 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.
+ */
+ LDKnativeFilesystemPersister *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;
+} LDKFilesystemPersister;
+
+
+
+/**
+ * `BackgroundProcessor` takes care of tasks that (1) need to happen periodically to keep
+ * Rust-Lightning running properly, and (2) either can or should be run in the background. Its
+ * responsibilities are:
+ * * Processing [`Event`]s with a user-provided [`EventHandler`].
+ * * Monitoring whether the [`ChannelManager`] needs to be re-persisted to disk, and if so,
+ * writing it to disk/backups by invoking the callback given to it at startup.
+ * [`ChannelManager`] persistence should be done in the background.
+ * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`]
+ * at the appropriate intervals.
+ * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to
+ * [`BackgroundProcessor::start`]).
+ *
+ * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied
+ * upon as doing so may result in high latency.
+ *
+ * # Note
+ *
+ * If [`ChannelManager`] persistence fails and the persisted manager becomes out-of-date, then
+ * there is a risk of channels force-closing on startup when the manager realizes it's outdated.
+ * However, as long as [`ChannelMonitor`] backups are sound, no funds besides those used for
+ * unilateral chain closure fees are at risk.
+ *
+ * [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
+ * [`Event`]: lightning::util::events::Event
+ *BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
+ */
+typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
+ /**
+ * 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.
+ */
+ LDKnativeBackgroundProcessor *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;
+} LDKBackgroundProcessor;
+
+/**
+ * Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk.
+ */
+typedef struct LDKPersister {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed
+ * (which will cause the [`BackgroundProcessor`] which called this method to exit).
+ */
+ struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager);
+ /**
+ * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed.
+ */
+ struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKPersister;
+
+
+
+/**
+ * Data of the `RawInvoice` that is encoded in the data part
+ */
+typedef struct MUST_USE_STRUCT LDKRawDataPart {
+ /**
+ * 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.
+ */
+ LDKnativeRawDataPart *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;
+} LDKRawDataPart;
+
+
+
+/**
+ * SHA-256 hash
+ */
+typedef struct MUST_USE_STRUCT LDKSha256 {
+ /**
+ * 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.
+ */
+ LDKnativeSha256 *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;
+} LDKSha256;
+
+
+
+/**
+ * Positive duration that defines when (relatively to the timestamp) in the future the invoice
+ * expires
+ */
+typedef struct MUST_USE_STRUCT LDKExpiryTime {
+ /**
+ * 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.
+ */
+ LDKnativeExpiryTime *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;
+} LDKExpiryTime;
+
+
+
+/**
+ * `min_final_cltv_expiry` to use for the last HTLC in the route
+ */
+typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry {
+ /**
+ * 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.
+ */
+ LDKnativeMinFinalCltvExpiry *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;
+} LDKMinFinalCltvExpiry;
+
+/**
+ * A 20-byte byte array.
+ */
+typedef struct LDKTwentyBytes {
+ /**
+ * The twenty bytes
+ */
+ uint8_t data[20];
+} LDKTwentyBytes;
+
+/**
+ * Fallback address in case no LN payment is possible
+ */
+typedef enum LDKFallback_Tag {
+ LDKFallback_SegWitProgram,
+ LDKFallback_PubKeyHash,
+ LDKFallback_ScriptHash,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKFallback_Sentinel,
+} LDKFallback_Tag;
+
+typedef struct LDKFallback_LDKSegWitProgram_Body {
+ struct LDKu5 version;
+ struct LDKCVec_u8Z program;
+} LDKFallback_LDKSegWitProgram_Body;
+
+typedef struct MUST_USE_STRUCT LDKFallback {
+ LDKFallback_Tag tag;
+ union {
+ LDKFallback_LDKSegWitProgram_Body seg_wit_program;
+ struct {
+ struct LDKTwentyBytes pub_key_hash;
+ };
+ struct {
+ struct LDKTwentyBytes script_hash;
+ };
+ };
+} LDKFallback;
+
+/**
+ * A trait defining behavior of an [`Invoice`] payer.
+ */
+typedef struct LDKPayer {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Returns the payer's node id.
+ */
+ struct LDKPublicKey (*node_id)(const void *this_arg);
+ /**
+ * Returns the payer's channels.
+ */
+ struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg);
+ /**
+ * Sends a payment over the Lightning Network using the given [`Route`].
+ *
+ * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret);
+ /**
+ * Sends a spontaneous payment over the Lightning Network using the given [`Route`].
+ */
+ struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage);
+ /**
+ * Retries a failed payment path for the [`PaymentId`] using the given [`Route`].
+ */
+ struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id);
+ /**
+ * Signals that no further retries for the given payment will occur.
+ */
+ void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKPayer;
+
+/**
+ * A trait defining behavior for routing an [`Invoice`] payment.
+ */
+typedef struct LDKRouter {
+ /**
+ * An opaque pointer which is passed to your function implementations as an argument.
+ * This has no meaning in the LDK, and can be NULL or any other value.
+ */
+ void *this_arg;
+ /**
+ * Finds a [`Route`] between `payer` and `payee` for a payment with the given values.
+ *
+ * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer);
+ /**
+ * Frees any resources associated with this object given its this_arg pointer.
+ * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed.
+ */
+ void (*free)(void *this_arg);
+} LDKRouter;
+
+
+
+/**
+ * A utility for paying [`Invoice`]s and sending spontaneous payments.
+ *
+ * See [module-level documentation] for details.
+ *
+ * [module-level documentation]: crate::payment
+ */
+typedef struct MUST_USE_STRUCT LDKInvoicePayer {
+ /**
+ * 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.
+ */
+ LDKnativeInvoicePayer *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;
+} LDKInvoicePayer;
+
+
+
+/**
+ * Number of attempts to retry payment path failures for an [`Invoice`].
+ *
+ * Note that this is the number of *path* failures, not full payment retries. For multi-path
+ * payments, if this is less than the total number of paths, we will never even retry all of the
+ * payment's paths.
+ */
+typedef struct MUST_USE_STRUCT LDKRetryAttempts {
+ /**
+ * 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.
+ */
+ LDKnativeRetryAttempts *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;
+} LDKRetryAttempts;
+
+
+
+/**
+ * A [`Router`] implemented using [`find_route`].
+ */
+typedef struct MUST_USE_STRUCT LDKDefaultRouter {
+ /**
+ * 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.
+ */
+ LDKnativeDefaultRouter *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;
+} LDKDefaultRouter;
+
+extern const uintptr_t MAX_BUF_SIZE;
+
+extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT;
+
+extern const uint64_t CLOSED_CHANNEL_UPDATE_ID;
+
+extern const uint32_t ANTI_REORG_DELAY;
+
+extern const uint16_t BREAKDOWN_TIMEOUT;
+
+extern const uint16_t MIN_CLTV_EXPIRY_DELTA;
+
+extern const uint32_t MIN_FINAL_CLTV_EXPIRY;
+
+extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH;
+
+extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT;
+
+extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA;
+
+extern const uint64_t MAX_TIMESTAMP;
+
+extern const uint64_t DEFAULT_EXPIRY_TIME;
+
+extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY;
+
+extern const uint8_t TAG_PAYMENT_HASH;
+
+extern const uint8_t TAG_DESCRIPTION;
+
+extern const uint8_t TAG_PAYEE_PUB_KEY;
+
+extern const uint8_t TAG_DESCRIPTION_HASH;
+
+extern const uint8_t TAG_EXPIRY_TIME;
+
+extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY;
+
+extern const uint8_t TAG_FALLBACK;
+
+extern const uint8_t TAG_PRIVATE_ROUTE;
+
+extern const uint8_t TAG_PAYMENT_SECRET;
+
+extern const uint8_t TAG_FEATURES;
+
+struct LDKStr _ldk_get_compiled_version(void);
+
+struct LDKStr _ldk_c_bindings_get_compiled_version(void);
+
+/**
+ * Creates a new Bech32Error which has the same data as `orig`
+ */
+struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig);
+
+/**
+ * Releases any memory held by the given `Bech32Error` (which is currently none)
+ */
+void Bech32Error_free(struct LDKBech32Error o);
+
+/**
+ * Frees the data buffer, if data_is_owned is set and datalen > 0.
+ */
+void Transaction_free(struct LDKTransaction _res);
+
+/**
+ * Convenience function for constructing a new TxOut
+ */
+struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value);
+
+/**
+ * Frees the data pointed to by script_pubkey.
+ */
+void TxOut_free(struct LDKTxOut _res);
+
+/**
+ * Creates a new TxOut which has the same data as `orig` but with a new script buffer.
+ */
+struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig);
+
+/**
+ * Frees the data buffer, if chars_is_owned is set and len > 0.
+ */
+void Str_free(struct LDKStr _res);
+
+#if defined(LDK_DEBUG_BUILD)
+/**
+ * This function exists for memory safety testing purposes. It should never be used in production
+ * code
+ */
+const void *__unmangle_inner_ptr(const void *ptr);
+#endif
+
+/**
+ * Creates a new CResult_NoneNoneZ in the success state.
+ */
+struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneNoneZ in the error state.
+ */
+struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneNoneZ.
+ */
+void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res);
+
+/**
+ * Creates a new CResult_NoneNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state.
+ */
+struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o);
+
+/**
+ * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state.
+ */
+struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ.
+ */
+void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_SecretKeyErrorZ in the success state.
+ */
+struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o);
+
+/**
+ * Creates a new CResult_SecretKeyErrorZ in the error state.
+ */
+struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_SecretKeyErrorZ.
+ */
+void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res);
+
+/**
+ * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PublicKeyErrorZ in the success state.
+ */
+struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o);
+
+/**
+ * Creates a new CResult_PublicKeyErrorZ in the error state.
+ */
+struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PublicKeyErrorZ.
+ */
+void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res);
+
+/**
+ * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state.
+ */
+struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o);
+
+/**
+ * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state.
+ */
+struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ.
+ */
+void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o);
+
+/**
+ * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ.
+ */
+void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_TxCreationKeysErrorZ in the success state.
+ */
+struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o);
+
+/**
+ * Creates a new CResult_TxCreationKeysErrorZ in the error state.
+ */
+struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TxCreationKeysErrorZ.
+ */
+void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res);
+
+/**
+ * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_u32Z containing a u32
+ */
+struct LDKCOption_u32Z COption_u32Z_some(uint32_t o);
+
+/**
+ * Constructs a new COption_u32Z containing nothing
+ */
+struct LDKCOption_u32Z COption_u32Z_none(void);
+
+/**
+ * Frees any resources associated with the u32, if we are in the Some state
+ */
+void COption_u32Z_free(struct LDKCOption_u32Z _res);
+
+/**
+ * Creates a new COption_u32Z which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state.
+ */
+struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o);
+
+/**
+ * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state.
+ */
+struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ.
+ */
+void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_NoneZ containing a
+ */
+enum LDKCOption_NoneZ COption_NoneZ_some(void);
+
+/**
+ * Constructs a new COption_NoneZ containing nothing
+ */
+enum LDKCOption_NoneZ COption_NoneZ_none(void);
+
+/**
+ * Frees any resources associated with the , if we are in the Some state
+ */
+void COption_NoneZ_free(enum LDKCOption_NoneZ _res);
+
+/**
+ * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o);
+
+/**
+ * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ.
+ */
+void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o);
+
+/**
+ * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ.
+ */
+void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res);
+
+/**
+ * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state.
+ */
+struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o);
+
+/**
+ * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state.
+ */
+struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ.
+ */
+void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state.
+ */
+struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o);
+
+/**
+ * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state.
+ */
+struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ.
+ */
+void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state.
+ */
+struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o);
+
+/**
+ * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state.
+ */
+struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ.
+ */
+void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res);
+
+/**
+ * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state.
+ */
+struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o);
+
+/**
+ * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state.
+ */
+struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ.
+ */
+void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state.
+ */
+struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o);
+
+/**
+ * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state.
+ */
+struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ.
+ */
+void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res);
+
+/**
+ * Creates a new CResult_CVec_SignatureZNoneZ in the success state.
+ */
+struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o);
+
+/**
+ * Creates a new CResult_CVec_SignatureZNoneZ in the error state.
+ */
+struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CVec_SignatureZNoneZ.
+ */
+void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res);
+
+/**
+ * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o);
+
+/**
+ * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ.
+ */
+void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state.
+ */
+struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o);
+
+/**
+ * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state.
+ */
+struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ.
+ */
+void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res);
+
+/**
+ * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NoneErrorZ in the success state.
+ */
+struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneErrorZ in the error state.
+ */
+struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneErrorZ.
+ */
+void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res);
+
+/**
+ * Creates a new CResult_NoneErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RouteHopDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o);
+
+/**
+ * Creates a new CResult_RouteHopDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteHopDecodeErrorZ.
+ */
+void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
+
+/**
+ * Creates a new CResult_RouteDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o);
+
+/**
+ * Creates a new CResult_RouteDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteDecodeErrorZ.
+ */
+void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RouteParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o);
+
+/**
+ * Creates a new CResult_RouteParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteParametersDecodeErrorZ.
+ */
+void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+
+/**
+ * Constructs a new COption_u64Z containing a u64
+ */
+struct LDKCOption_u64Z COption_u64Z_some(uint64_t o);
+
+/**
+ * Constructs a new COption_u64Z containing nothing
+ */
+struct LDKCOption_u64Z COption_u64Z_none(void);
+
+/**
+ * Frees any resources associated with the u64, if we are in the Some state
+ */
+void COption_u64Z_free(struct LDKCOption_u64Z _res);
+
+/**
+ * Creates a new COption_u64Z which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o);
+
+/**
+ * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ.
+ */
+void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteHintDecodeErrorZ.
+ */
+void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ.
+ */
+void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res);
+
+/**
+ * Creates a new CResult_RouteLightningErrorZ in the success state.
+ */
+struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o);
+
+/**
+ * Creates a new CResult_RouteLightningErrorZ in the error state.
+ */
+struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RouteLightningErrorZ.
+ */
+void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res);
+
+/**
+ * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_TxOutAccessErrorZ in the success state.
+ */
+struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o);
+
+/**
+ * Creates a new CResult_TxOutAccessErrorZ in the error state.
+ */
+struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TxOutAccessErrorZ.
+ */
+void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res);
+
+/**
+ * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_usizeTransactionZ from the contained elements.
+ */
+struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b);
+
+/**
+ * Frees any resources used by the C2Tuple_usizeTransactionZ.
+ */
+void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_TxidZ_free(struct LDKCVec_TxidZ _res);
+
+/**
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state.
+ */
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state.
+ */
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ.
+ */
+void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res);
+
+/**
+ * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res);
+
+/**
+ * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o);
+
+/**
+ * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state
+ */
+void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res);
+
+/**
+ * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason
+ */
+struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o);
+
+/**
+ * Constructs a new COption_ClosureReasonZ containing nothing
+ */
+struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state
+ */
+void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res);
+
+/**
+ * Creates a new COption_ClosureReasonZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o);
+
+/**
+ * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ.
+ */
+void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate
+ */
+struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o);
+
+/**
+ * Constructs a new COption_NetworkUpdateZ containing nothing
+ */
+struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state
+ */
+void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res);
+
+/**
+ * Creates a new COption_NetworkUpdateZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res);
+
+/**
+ * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event
+ */
+struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o);
+
+/**
+ * Constructs a new COption_EventZ containing nothing
+ */
+struct LDKCOption_EventZ COption_EventZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state
+ */
+void COption_EventZ_free(struct LDKCOption_EventZ _res);
+
+/**
+ * Creates a new COption_EventZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_COption_EventZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o);
+
+/**
+ * Creates a new CResult_COption_EventZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_EventZDecodeErrorZ.
+ */
+void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res);
+
+/**
+ * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state.
+ */
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o);
+
+/**
+ * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state.
+ */
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ.
+ */
+void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o);
+
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ.
+ */
+void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ScorerDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o);
+
+/**
+ * Creates a new CResult_ScorerDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ScorerDecodeErrorZ.
+ */
+void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o);
+
+/**
+ * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ.
+ */
+void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o);
+
+/**
+ * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ.
+ */
+void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o);
+
+/**
+ * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ.
+ */
+void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o);
+
+/**
+ * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ.
+ */
+void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o);
+
+/**
+ * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ.
+ */
+void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o);
+
+/**
+ * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ.
+ */
+void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state.
+ */
+struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKDelayedPaymentOutputDescriptor o);
+
+/**
+ * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state.
+ */
+struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ.
+ */
+void CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state.
+ */
+struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(struct LDKStaticPaymentOutputDescriptor o);
+
+/**
+ * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state.
+ */
+struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ.
+ */
+void CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state.
+ */
+struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_ok(struct LDKSpendableOutputDescriptor o);
+
+/**
+ * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state.
+ */
+struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ.
+ */
+void CResult_SpendableOutputDescriptorDecodeErrorZ_free(struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ CResult_SpendableOutputDescriptorDecodeErrorZ_clone(const struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_PaymentPreimageZ_free(struct LDKCVec_PaymentPreimageZ _res);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_clone(const struct LDKC2Tuple_SignatureCVec_SignatureZZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_SignatureCVec_SignatureZZ from the contained elements.
+ */
+struct LDKC2Tuple_SignatureCVec_SignatureZZ C2Tuple_SignatureCVec_SignatureZZ_new(struct LDKSignature a, struct LDKCVec_SignatureZ b);
+
+/**
+ * Frees any resources used by the C2Tuple_SignatureCVec_SignatureZZ.
+ */
+void C2Tuple_SignatureCVec_SignatureZZ_free(struct LDKC2Tuple_SignatureCVec_SignatureZZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the success state.
+ */
+struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(struct LDKC2Tuple_SignatureCVec_SignatureZZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ in the error state.
+ */
+struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ.
+ */
+void CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_SignatureNoneZ in the success state.
+ */
+struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_ok(struct LDKSignature o);
+
+/**
+ * Creates a new CResult_SignatureNoneZ in the error state.
+ */
+struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SignatureNoneZ_is_ok(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_SignatureNoneZ.
+ */
+void CResult_SignatureNoneZ_free(struct LDKCResult_SignatureNoneZ _res);
+
+/**
+ * Creates a new CResult_SignatureNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SignatureNoneZ CResult_SignatureNoneZ_clone(const struct LDKCResult_SignatureNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_clone(const struct LDKC2Tuple_SignatureSignatureZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_SignatureSignatureZ from the contained elements.
+ */
+struct LDKC2Tuple_SignatureSignatureZ C2Tuple_SignatureSignatureZ_new(struct LDKSignature a, struct LDKSignature b);
+
+/**
+ * Frees any resources used by the C2Tuple_SignatureSignatureZ.
+ */
+void C2Tuple_SignatureSignatureZ_free(struct LDKC2Tuple_SignatureSignatureZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the success state.
+ */
+struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_ok(struct LDKC2Tuple_SignatureSignatureZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ in the error state.
+ */
+struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ.
+ */
+void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_SecretKeyNoneZ in the success state.
+ */
+struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o);
+
+/**
+ * Creates a new CResult_SecretKeyNoneZ in the error state.
+ */
+struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_SecretKeyNoneZ.
+ */
+void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res);
+
+/**
+ * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_SignDecodeErrorZ in the success state.
+ */
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o);
+
+/**
+ * Creates a new CResult_SignDecodeErrorZ in the error state.
+ */
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_SignDecodeErrorZ.
+ */
+void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_u5Z_free(struct LDKCVec_u5Z _res);
+
+/**
+ * Creates a new CResult_RecoverableSignatureNoneZ in the success state.
+ */
+struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o);
+
+/**
+ * Creates a new CResult_RecoverableSignatureNoneZ in the error state.
+ */
+struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RecoverableSignatureNoneZ.
+ */
+void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res);
+
+/**
+ * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_u8Z_free(struct LDKCVec_u8Z _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res);
+
+/**
+ * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state.
+ */
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o);
+
+/**
+ * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state.
+ */
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ.
+ */
+void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res);
+
+/**
+ * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state.
+ */
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o);
+
+/**
+ * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state.
+ */
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ.
+ */
+void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res);
+
+/**
+ * Creates a new CResult_TransactionNoneZ in the success state.
+ */
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o);
+
+/**
+ * Creates a new CResult_TransactionNoneZ in the error state.
+ */
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TransactionNoneZ.
+ */
+void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res);
+
+/**
+ * Creates a new CResult_TransactionNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements.
+ */
+struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b);
+
+/**
+ * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ.
+ */
+void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res);
+
+/**
+ * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state.
+ */
+struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o);
+
+/**
+ * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state.
+ */
+struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ.
+ */
+void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res);
+
+/**
+ * Constructs a new COption_u16Z containing a u16
+ */
+struct LDKCOption_u16Z COption_u16Z_some(uint16_t o);
+
+/**
+ * Constructs a new COption_u16Z containing nothing
+ */
+struct LDKCOption_u16Z COption_u16Z_none(void);
+
+/**
+ * Frees any resources associated with the u16, if we are in the Some state
+ */
+void COption_u16Z_free(struct LDKCOption_u16Z _res);
+
+/**
+ * Creates a new COption_u16Z which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NoneAPIErrorZ in the success state.
+ */
+struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneAPIErrorZ in the error state.
+ */
+struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneAPIErrorZ.
+ */
+void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res);
+
+/**
+ * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
+
+/**
+ * Creates a new CResult__u832APIErrorZ in the success state.
+ */
+struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult__u832APIErrorZ in the error state.
+ */
+struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult__u832APIErrorZ.
+ */
+void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res);
+
+/**
+ * Creates a new CResult__u832APIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state.
+ */
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state.
+ */
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ.
+ */
+void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NonePaymentSendFailureZ in the success state.
+ */
+struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void);
+
+/**
+ * Creates a new CResult_NonePaymentSendFailureZ in the error state.
+ */
+struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NonePaymentSendFailureZ.
+ */
+void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res);
+
+/**
+ * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements.
+ */
+struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
+
+/**
+ * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ.
+ */
+void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ.
+ */
+void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements.
+ */
+struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b);
+
+/**
+ * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ.
+ */
+void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ.
+ */
+void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ.
+ */
+void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PaymentSecretNoneZ in the success state.
+ */
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentSecretNoneZ in the error state.
+ */
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentSecretNoneZ.
+ */
+void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res);
+
+/**
+ * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PaymentSecretAPIErrorZ in the success state.
+ */
+struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentSecretAPIErrorZ in the error state.
+ */
+struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentSecretAPIErrorZ.
+ */
+void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state.
+ */
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state.
+ */
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ.
+ */
+void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state.
+ */
+struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o);
+
+/**
+ * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state.
+ */
+struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ.
+ */
+void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o);
+
+/**
+ * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ.
+ */
+void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o);
+
+/**
+ * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ.
+ */
+void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o);
+
+/**
+ * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ.
+ */
+void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res);
+
+/**
+ * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements.
+ */
+struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b);
+
+/**
+ * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ.
+ */
+void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.
+ */
+void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o);
+
+/**
+ * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ.
+ */
+void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_OutPointDecodeErrorZ in the success state.
+ */
+struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o);
+
+/**
+ * Creates a new CResult_OutPointDecodeErrorZ in the error state.
+ */
+struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_OutPointDecodeErrorZ.
+ */
+void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type
+ */
+struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o);
+
+/**
+ * Constructs a new COption_TypeZ containing nothing
+ */
+struct LDKCOption_TypeZ COption_TypeZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state
+ */
+void COption_TypeZ_free(struct LDKCOption_TypeZ _res);
+
+/**
+ * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o);
+
+/**
+ * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ.
+ */
+void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the success state.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ in the error state.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentIdPaymentErrorZ.
+ */
+void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_SiPrefixParseErrorZ in the success state.
+ */
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o);
+
+/**
+ * Creates a new CResult_SiPrefixParseErrorZ in the error state.
+ */
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_SiPrefixParseErrorZ.
+ */
+void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res);
+
+/**
+ * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state.
+ */
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o);
+
+/**
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state.
+ */
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ.
+ */
+void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res);
+
+/**
+ * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state.
+ */
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o);
+
+/**
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state.
+ */
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ.
+ */
+void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res);
+
+/**
+ * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements.
+ */
+struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c);
+
+/**
+ * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ.
+ */
+void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res);
+
+/**
+ * Creates a new CResult_PayeePubKeyErrorZ in the success state.
+ */
+struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o);
+
+/**
+ * Creates a new CResult_PayeePubKeyErrorZ in the error state.
+ */
+struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PayeePubKeyErrorZ.
+ */
+void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res);
+
+/**
+ * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res);
+
+/**
+ * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state.
+ */
+struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o);
+
+/**
+ * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state.
+ */
+struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ.
+ */
+void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res);
+
+/**
+ * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NoneSemanticErrorZ in the success state.
+ */
+struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneSemanticErrorZ in the error state.
+ */
+struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneSemanticErrorZ.
+ */
+void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res);
+
+/**
+ * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_InvoiceSemanticErrorZ in the success state.
+ */
+struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o);
+
+/**
+ * Creates a new CResult_InvoiceSemanticErrorZ in the error state.
+ */
+struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_InvoiceSemanticErrorZ.
+ */
+void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res);
+
+/**
+ * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_DescriptionCreationErrorZ in the success state.
+ */
+struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o);
+
+/**
+ * Creates a new CResult_DescriptionCreationErrorZ in the error state.
+ */
+struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_DescriptionCreationErrorZ.
+ */
+void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res);
+
+/**
+ * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PrivateRouteCreationErrorZ in the success state.
+ */
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o);
+
+/**
+ * Creates a new CResult_PrivateRouteCreationErrorZ in the error state.
+ */
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PrivateRouteCreationErrorZ.
+ */
+void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res);
+
+/**
+ * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_StringErrorZ in the success state.
+ */
+struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o);
+
+/**
+ * Creates a new CResult_StringErrorZ in the error state.
+ */
+struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_StringErrorZ.
+ */
+void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o);
+
+/**
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ.
+ */
+void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent
+ */
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o);
+
+/**
+ * Constructs a new COption_MonitorEventZ containing nothing
+ */
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state
+ */
+void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res);
+
+/**
+ * Creates a new COption_MonitorEventZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o);
+
+/**
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ.
+ */
+void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state.
+ */
+struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o);
+
+/**
+ * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state.
+ */
+struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ.
+ */
+void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_OutPointScriptZ from the contained elements.
+ */
+struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b);
+
+/**
+ * Frees any resources used by the C2Tuple_OutPointScriptZ.
+ */
+void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_u32ScriptZ from the contained elements.
+ */
+struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b);
+
+/**
+ * Frees any resources used by the C2Tuple_u32ScriptZ.
+ */
+void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements.
+ */
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b);
+
+/**
+ * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ.
+ */
+void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_EventZ_free(struct LDKCVec_EventZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_u32TxOutZ from the contained elements.
+ */
+struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b);
+
+/**
+ * Frees any resources used by the C2Tuple_u32TxOutZ.
+ */
+void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements.
+ */
+struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b);
+
+/**
+ * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ.
+ */
+void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res);
+
+/**
+ * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o);
+
+/**
+ * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.
+ */
+void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NoneLightningErrorZ in the success state.
+ */
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneLightningErrorZ in the error state.
+ */
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NoneLightningErrorZ.
+ */
+void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res);
+
+/**
+ * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements.
+ */
+struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b);
+
+/**
+ * Frees any resources used by the C2Tuple_PublicKeyTypeZ.
+ */
+void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res);
+
+/**
+ * Creates a new CResult_boolLightningErrorZ in the success state.
+ */
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o);
+
+/**
+ * Creates a new CResult_boolLightningErrorZ in the error state.
+ */
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_boolLightningErrorZ.
+ */
+void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res);
+
+/**
+ * Creates a new CResult_boolLightningErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements.
+ */
+struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c);
+
+/**
+ * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ.
+ */
+void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
+
+/**
+ * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress
+ */
+struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o);
+
+/**
+ * Constructs a new COption_NetAddressZ containing nothing
+ */
+struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state
+ */
+void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res);
+
+/**
+ * Creates a new COption_NetAddressZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state.
+ */
+struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o);
+
+/**
+ * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state.
+ */
+struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ.
+ */
+void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res);
+
+/**
+ * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NonePeerHandleErrorZ in the success state.
+ */
+struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NonePeerHandleErrorZ in the error state.
+ */
+struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NonePeerHandleErrorZ.
+ */
+void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
+
+/**
+ * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_boolPeerHandleErrorZ in the success state.
+ */
+struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
+
+/**
+ * Creates a new CResult_boolPeerHandleErrorZ in the error state.
+ */
+struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_boolPeerHandleErrorZ.
+ */
+void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
+
+/**
+ * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NodeIdDecodeErrorZ in the success state.
+ */
+struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o);
+
+/**
+ * Creates a new CResult_NodeIdDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NodeIdDecodeErrorZ.
+ */
+void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o);
+
+/**
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ.
+ */
+void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access
+ */
+struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o);
+
+/**
+ * Constructs a new COption_AccessZ containing nothing
+ */
+struct LDKCOption_AccessZ COption_AccessZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state
+ */
+void COption_AccessZ_free(struct LDKCOption_AccessZ _res);
+
+/**
+ * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o);
+
+/**
+ * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ.
+ */
+void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o);
+
+/**
+ * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ.
+ */
+void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o);
+
+/**
+ * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ.
+ */
+void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state.
+ */
+struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o);
+
+/**
+ * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ.
+ */
+void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_u64Z_free(struct LDKCVec_u64Z _res);
+
+/**
+ * Creates a new CResult_NodeInfoDecodeErrorZ in the success state.
+ */
+struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o);
+
+/**
+ * Creates a new CResult_NodeInfoDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NodeInfoDecodeErrorZ.
+ */
+void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state.
+ */
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o);
+
+/**
+ * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ.
+ */
+void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NetworkGraphDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ
+ */
+struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o);
+
+/**
+ * Constructs a new COption_CVec_NetAddressZZ containing nothing
+ */
+struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state
+ */
+void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res);
+
+/**
+ * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NetAddressDecodeErrorZ in the success state.
+ */
+struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_ok(struct LDKNetAddress o);
+
+/**
+ * Creates a new CResult_NetAddressDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NetAddressDecodeErrorZ_is_ok(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NetAddressDecodeErrorZ.
+ */
+void CResult_NetAddressDecodeErrorZ_free(struct LDKCResult_NetAddressDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NetAddressDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NetAddressDecodeErrorZ CResult_NetAddressDecodeErrorZ_clone(const struct LDKCResult_NetAddressDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_UpdateAddHTLCZ_free(struct LDKCVec_UpdateAddHTLCZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_UpdateFulfillHTLCZ_free(struct LDKCVec_UpdateFulfillHTLCZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_UpdateFailHTLCZ_free(struct LDKCVec_UpdateFailHTLCZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_UpdateFailMalformedHTLCZ_free(struct LDKCVec_UpdateFailMalformedHTLCZ _res);
+
+/**
+ * Creates a new CResult_AcceptChannelDecodeErrorZ in the success state.
+ */
+struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_ok(struct LDKAcceptChannel o);
+
+/**
+ * Creates a new CResult_AcceptChannelDecodeErrorZ in the error state.
+ */
+struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_AcceptChannelDecodeErrorZ_is_ok(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_AcceptChannelDecodeErrorZ.
+ */
+void CResult_AcceptChannelDecodeErrorZ_free(struct LDKCResult_AcceptChannelDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_AcceptChannelDecodeErrorZ CResult_AcceptChannelDecodeErrorZ_clone(const struct LDKCResult_AcceptChannelDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state.
+ */
+struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_ok(struct LDKAnnouncementSignatures o);
+
+/**
+ * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state.
+ */
+struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ.
+ */
+void CResult_AnnouncementSignaturesDecodeErrorZ_free(struct LDKCResult_AnnouncementSignaturesDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_AnnouncementSignaturesDecodeErrorZ CResult_AnnouncementSignaturesDecodeErrorZ_clone(const struct LDKCResult_AnnouncementSignaturesDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_ok(struct LDKChannelReestablish o);
+
+/**
+ * Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelReestablishDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ.
+ */
+void CResult_ChannelReestablishDecodeErrorZ_free(struct LDKCResult_ChannelReestablishDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelReestablishDecodeErrorZ CResult_ChannelReestablishDecodeErrorZ_clone(const struct LDKCResult_ChannelReestablishDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ClosingSignedDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_ok(struct LDKClosingSigned o);
+
+/**
+ * Creates a new CResult_ClosingSignedDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ClosingSignedDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ClosingSignedDecodeErrorZ.
+ */
+void CResult_ClosingSignedDecodeErrorZ_free(struct LDKCResult_ClosingSignedDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ClosingSignedDecodeErrorZ CResult_ClosingSignedDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(struct LDKClosingSignedFeeRange o);
+
+/**
+ * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ.
+ */
+void CResult_ClosingSignedFeeRangeDecodeErrorZ_free(struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(const struct LDKCResult_ClosingSignedFeeRangeDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state.
+ */
+struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_ok(struct LDKCommitmentSigned o);
+
+/**
+ * Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state.
+ */
+struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_CommitmentSignedDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ.
+ */
+void CResult_CommitmentSignedDecodeErrorZ_free(struct LDKCResult_CommitmentSignedDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_CommitmentSignedDecodeErrorZ CResult_CommitmentSignedDecodeErrorZ_clone(const struct LDKCResult_CommitmentSignedDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_FundingCreatedDecodeErrorZ in the success state.
+ */
+struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_ok(struct LDKFundingCreated o);
+
+/**
+ * Creates a new CResult_FundingCreatedDecodeErrorZ in the error state.
+ */
+struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_FundingCreatedDecodeErrorZ_is_ok(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_FundingCreatedDecodeErrorZ.
+ */
+void CResult_FundingCreatedDecodeErrorZ_free(struct LDKCResult_FundingCreatedDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_FundingCreatedDecodeErrorZ CResult_FundingCreatedDecodeErrorZ_clone(const struct LDKCResult_FundingCreatedDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_FundingSignedDecodeErrorZ in the success state.
+ */
+struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_ok(struct LDKFundingSigned o);
+
+/**
+ * Creates a new CResult_FundingSignedDecodeErrorZ in the error state.
+ */
+struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_FundingSignedDecodeErrorZ_is_ok(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_FundingSignedDecodeErrorZ.
+ */
+void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_FundingLockedDecodeErrorZ in the success state.
+ */
+struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o);
+
+/**
+ * Creates a new CResult_FundingLockedDecodeErrorZ in the error state.
+ */
+struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_FundingLockedDecodeErrorZ.
+ */
+void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_InitDecodeErrorZ in the success state.
+ */
+struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_ok(struct LDKInit o);
+
+/**
+ * Creates a new CResult_InitDecodeErrorZ in the error state.
+ */
+struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InitDecodeErrorZ_is_ok(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_InitDecodeErrorZ.
+ */
+void CResult_InitDecodeErrorZ_free(struct LDKCResult_InitDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_InitDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_InitDecodeErrorZ CResult_InitDecodeErrorZ_clone(const struct LDKCResult_InitDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_OpenChannelDecodeErrorZ in the success state.
+ */
+struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_ok(struct LDKOpenChannel o);
+
+/**
+ * Creates a new CResult_OpenChannelDecodeErrorZ in the error state.
+ */
+struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_OpenChannelDecodeErrorZ_is_ok(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_OpenChannelDecodeErrorZ.
+ */
+void CResult_OpenChannelDecodeErrorZ_free(struct LDKCResult_OpenChannelDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_OpenChannelDecodeErrorZ CResult_OpenChannelDecodeErrorZ_clone(const struct LDKCResult_OpenChannelDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_ok(struct LDKRevokeAndACK o);
+
+/**
+ * Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RevokeAndACKDecodeErrorZ_is_ok(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ.
+ */
+void CResult_RevokeAndACKDecodeErrorZ_free(struct LDKCResult_RevokeAndACKDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RevokeAndACKDecodeErrorZ CResult_RevokeAndACKDecodeErrorZ_clone(const struct LDKCResult_RevokeAndACKDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ShutdownDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_ok(struct LDKShutdown o);
+
+/**
+ * Creates a new CResult_ShutdownDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ShutdownDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ShutdownDecodeErrorZ.
+ */
+void CResult_ShutdownDecodeErrorZ_free(struct LDKCResult_ShutdownDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ShutdownDecodeErrorZ CResult_ShutdownDecodeErrorZ_clone(const struct LDKCResult_ShutdownDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_ok(struct LDKUpdateFailHTLC o);
+
+/**
+ * Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFailHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ.
+ */
+void CResult_UpdateFailHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailHTLCDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UpdateFailHTLCDecodeErrorZ CResult_UpdateFailHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailHTLCDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(struct LDKUpdateFailMalformedHTLC o);
+
+/**
+ * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ.
+ */
+void CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UpdateFeeDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_ok(struct LDKUpdateFee o);
+
+/**
+ * Creates a new CResult_UpdateFeeDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFeeDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UpdateFeeDecodeErrorZ.
+ */
+void CResult_UpdateFeeDecodeErrorZ_free(struct LDKCResult_UpdateFeeDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UpdateFeeDecodeErrorZ CResult_UpdateFeeDecodeErrorZ_clone(const struct LDKCResult_UpdateFeeDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_ok(struct LDKUpdateFulfillHTLC o);
+
+/**
+ * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ.
+ */
+void CResult_UpdateFulfillHTLCDecodeErrorZ_free(struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ CResult_UpdateFulfillHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateFulfillHTLCDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_ok(struct LDKUpdateAddHTLC o);
+
+/**
+ * Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UpdateAddHTLCDecodeErrorZ_is_ok(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ.
+ */
+void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PingDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_ok(struct LDKPing o);
+
+/**
+ * Creates a new CResult_PingDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PingDecodeErrorZ_is_ok(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PingDecodeErrorZ.
+ */
+void CResult_PingDecodeErrorZ_free(struct LDKCResult_PingDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PingDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PingDecodeErrorZ CResult_PingDecodeErrorZ_clone(const struct LDKCResult_PingDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PongDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_ok(struct LDKPong o);
+
+/**
+ * Creates a new CResult_PongDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PongDecodeErrorZ_is_ok(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PongDecodeErrorZ.
+ */
+void CResult_PongDecodeErrorZ_free(struct LDKCResult_PongDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PongDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PongDecodeErrorZ CResult_PongDecodeErrorZ_clone(const struct LDKCResult_PongDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(struct LDKUnsignedChannelAnnouncement o);
+
+/**
+ * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
+ */
+void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
+
+/**
+ * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
+ */
+void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
+
+/**
+ * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
+ */
+void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
+
+/**
+ * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
+ */
+void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
+
+/**
+ * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
+ */
+void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
+ */
+struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
+
+/**
+ * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
+ */
+struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
+ */
+void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
+
+/**
+ * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
+ */
+void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
+ */
+struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
+
+/**
+ * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
+ */
+struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
+ */
+void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
+ */
+struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
+
+/**
+ * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
+ */
+struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
+ */
+void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
+
+/**
+ * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
+ */
+void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
+ */
+struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
+
+/**
+ * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
+ */
+struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
+ */
+void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
+ */
+struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
+
+/**
+ * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
+ */
+struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
+ */
+void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
+ */
+struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
+
+/**
+ * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
+ */
+struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
+ */
+void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
+
+/**
+ * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
+ */
+struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
+
+/**
+ * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
+ */
+struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
+ */
+void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
+
+/**
+ * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
+ */
+struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
+
+/**
+ * Constructs a new COption_FilterZ containing nothing
+ */
+struct LDKCOption_FilterZ COption_FilterZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
+ */
+void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
+
+/**
+ * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
+ */
+struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
+
+/**
+ * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
+ */
+struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
+ */
+void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
+
+/**
+ * Frees any resources used by the PaymentPurpose
+ */
+void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
+
+/**
+ * Creates a copy of the PaymentPurpose
+ */
+struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
+ */
+struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
+
+/**
+ * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
+ */
+struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
+
+/**
+ * Frees any resources used by the ClosureReason
+ */
+void ClosureReason_free(struct LDKClosureReason this_ptr);
+
+/**
+ * Creates a copy of the ClosureReason
+ */
+struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
+
+/**
+ * Utility method to constructs a new HolderForceClosed-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_holder_force_closed(void);
+
+/**
+ * Utility method to constructs a new CooperativeClosure-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_cooperative_closure(void);
+
+/**
+ * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
+
+/**
+ * Utility method to constructs a new FundingTimedOut-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_funding_timed_out(void);
+
+/**
+ * Utility method to constructs a new ProcessingError-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
+
+/**
+ * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_disconnected_peer(void);
+
+/**
+ * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
+ */
+struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
+
+/**
+ * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
+ */
+struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
+
+/**
+ * Read a ClosureReason from a byte array, created by ClosureReason_write
+ */
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the Event
+ */
+void Event_free(struct LDKEvent this_ptr);
+
+/**
+ * Creates a copy of the Event
+ */
+struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new FundingGenerationReady-variant Event
+ */
+struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id);
+
+/**
+ * Utility method to constructs a new PaymentReceived-variant Event
+ */
+struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose);
+
+/**
+ * Utility method to constructs a new PaymentSent-variant Event
+ */
+struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
+
+/**
+ * Utility method to constructs a new PaymentPathFailed-variant Event
+ */
+struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
+
+/**
+ * Utility method to constructs a new PaymentFailed-variant Event
+ */
+struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
+
+/**
+ * Utility method to constructs a new PendingHTLCsForwardable-variant Event
+ */
+struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
+
+/**
+ * Utility method to constructs a new SpendableOutputs-variant Event
+ */
+struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
+
+/**
+ * Utility method to constructs a new PaymentForwarded-variant Event
+ */
+struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
+
+/**
+ * Utility method to constructs a new ChannelClosed-variant Event
+ */
+struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason);
+
+/**
+ * Utility method to constructs a new DiscardFunding-variant Event
+ */
+struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
+
+/**
+ * Utility method to constructs a new PaymentPathSuccessful-variant Event
+ */
+struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
+
+/**
+ * Utility method to constructs a new OpenChannelRequest-variant Event
+ */
+struct LDKEvent Event_open_channel_request(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type);
+
+/**
+ * Serialize the Event object into a byte array which can be read by Event_read
+ */
+struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
+
+/**
+ * Read a Event from a byte array, created by Event_write
+ */
+struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the MessageSendEvent
+ */
+void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
+
+/**
+ * Creates a copy of the MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
+
+/**
+ * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
+
+/**
+ * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
+
+/**
+ * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
+
+/**
+ * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg);
+
+/**
+ * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
+
+/**
+ * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
+
+/**
+ * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
+
+/**
+ * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
+
+/**
+ * Utility method to constructs a new SendShutdown-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
+
+/**
+ * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
+
+/**
+ * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
+
+/**
+ * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
+
+/**
+ * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
+
+/**
+ * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
+
+/**
+ * Utility method to constructs a new HandleError-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
+
+/**
+ * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
+
+/**
+ * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
+
+/**
+ * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
+
+/**
+ * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
+
+/**
+ * Calls the free function if one is set
+ */
+void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void EventsProvider_free(struct LDKEventsProvider this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void EventHandler_free(struct LDKEventHandler this_ptr);
+
+/**
+ * Frees any resources used by the APIError
+ */
+void APIError_free(struct LDKAPIError this_ptr);
+
+/**
+ * Creates a copy of the APIError
+ */
+struct LDKAPIError APIError_clone(const struct LDKAPIError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new APIMisuseError-variant APIError
+ */
+struct LDKAPIError APIError_apimisuse_error(struct LDKStr err);
+
+/**
+ * Utility method to constructs a new FeeRateTooHigh-variant APIError
+ */
+struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate);
+
+/**
+ * Utility method to constructs a new RouteError-variant APIError
+ */
+struct LDKAPIError APIError_route_error(struct LDKStr err);
+
+/**
+ * Utility method to constructs a new ChannelUnavailable-variant APIError
+ */
+struct LDKAPIError APIError_channel_unavailable(struct LDKStr err);
+
+/**
+ * Utility method to constructs a new MonitorUpdateFailed-variant APIError
+ */
+struct LDKAPIError APIError_monitor_update_failed(void);
+
+/**
+ * Utility method to constructs a new IncompatibleShutdownScript-variant APIError
+ */
+struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script);
+
+/**
+ * Creates a digital signature of a message given a SecretKey, like the node's secret.
+ * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller.
+ * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
+ */
+struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]);
+
+/**
+ * Recovers the PublicKey of the signer of the message given the message and the signature.
+ */
+struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig);
+
+/**
+ * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature,
+ * and the PublicKey.
+ */
+bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk);
+
+/**
+ * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
+ */
+struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature);
+
+/**
+ * Creates a copy of the Level
+ */
+enum LDKLevel Level_clone(const enum LDKLevel *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Gossip-variant Level
+ */
+enum LDKLevel Level_gossip(void);
+
+/**
+ * Utility method to constructs a new Trace-variant Level
+ */
+enum LDKLevel Level_trace(void);
+
+/**
+ * Utility method to constructs a new Debug-variant Level
+ */
+enum LDKLevel Level_debug(void);
+
+/**
+ * Utility method to constructs a new Info-variant Level
+ */
+enum LDKLevel Level_info(void);
+
+/**
+ * Utility method to constructs a new Warn-variant Level
+ */
+enum LDKLevel Level_warn(void);
+
+/**
+ * Utility method to constructs a new Error-variant Level
+ */
+enum LDKLevel Level_error(void);
+
+/**
+ * Checks if two Levels contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
+
+/**
+ * Checks if two Levels contain equal inner contents.
+ */
+uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
+
+/**
+ * Returns the most verbose logging level.
+ */
+MUST_USE_RES enum LDKLevel Level_max(void);
+
+/**
+ * Frees any resources used by the Record, if is_owned is set and inner is non-NULL.
+ */
+void Record_free(struct LDKRecord this_obj);
+
+/**
+ * The verbosity level of the message.
+ */
+enum LDKLevel Record_get_level(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The verbosity level of the message.
+ */
+void Record_set_level(struct LDKRecord *NONNULL_PTR this_ptr, enum LDKLevel val);
+
+/**
+ * The message body.
+ */
+struct LDKStr Record_get_args(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The message body.
+ */
+void Record_set_args(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * The module path of the message.
+ */
+struct LDKStr Record_get_module_path(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The module path of the message.
+ */
+void Record_set_module_path(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * The source file containing the message.
+ */
+struct LDKStr Record_get_file(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The source file containing the message.
+ */
+void Record_set_file(struct LDKRecord *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * The line containing the message.
+ */
+uint32_t Record_get_line(const struct LDKRecord *NONNULL_PTR this_ptr);
+
+/**
+ * The line containing the message.
+ */
+void Record_set_line(struct LDKRecord *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Creates a copy of the Record
+ */
+struct LDKRecord Record_clone(const struct LDKRecord *NONNULL_PTR orig);
+
+/**
+ * Calls the free function if one is set
+ */
+void Logger_free(struct LDKLogger this_ptr);
+
+/**
+ * Frees any resources used by the ChannelHandshakeConfig, if is_owned is set and inner is non-NULL.
+ */
+void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj);
+
+/**
+ * Confirmations we will wait for before considering the channel locked in.
+ * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
+ * equivalent limit applied to outbound channels).
+ *
+ * Default value: 6.
+ */
+uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Confirmations we will wait for before considering the channel locked in.
+ * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the
+ * equivalent limit applied to outbound channels).
+ *
+ * Default value: 6.
+ */
+void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Set to the number of blocks we require our counterparty to wait to claim their money (ie
+ * the number of blocks we have to punish our counterparty if they broadcast a revoked
+ * transaction).
+ *
+ * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
+ * be online to check for revoked transactions on-chain at least once every our_to_self_delay
+ * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
+ * possibly with time in between to RBF the spending transaction).
+ *
+ * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
+ * case of an honest unilateral channel close, which implicitly decrease the economic value of
+ * our channel.
+ *
+ * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
+ * can tweak config to ask for more security, not less.
+ */
+uint16_t ChannelHandshakeConfig_get_our_to_self_delay(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Set to the number of blocks we require our counterparty to wait to claim their money (ie
+ * the number of blocks we have to punish our counterparty if they broadcast a revoked
+ * transaction).
+ *
+ * This is one of the main parameters of our security model. We (or one of our watchtowers) MUST
+ * be online to check for revoked transactions on-chain at least once every our_to_self_delay
+ * blocks (minus some margin to allow us enough time to broadcast and confirm a transaction,
+ * possibly with time in between to RBF the spending transaction).
+ *
+ * Meanwhile, asking for a too high delay, we bother peer to freeze funds for nothing in
+ * case of an honest unilateral channel close, which implicitly decrease the economic value of
+ * our channel.
+ *
+ * Default value: [`BREAKDOWN_TIMEOUT`], we enforce it as a minimum at channel opening so you
+ * can tweak config to ask for more security, not less.
+ */
+void ChannelHandshakeConfig_set_our_to_self_delay(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t val);
+
+/**
+ * Set to the smallest value HTLC we will accept to process.
+ *
+ * This value is sent to our counterparty on channel-open and we close the channel any time
+ * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
+ *
+ * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
+ * by the protocol.
+ */
+uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Set to the smallest value HTLC we will accept to process.
+ *
+ * This value is sent to our counterparty on channel-open and we close the channel any time
+ * our counterparty misbehaves by sending us an HTLC with a value smaller than this.
+ *
+ * Default value: 1. If the value is less than 1, it is ignored and set to 1, as is required
+ * by the protocol.
+ */
+void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
+ * BOLTs) option for outbound private channels. This provides better privacy by not including
+ * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
+ * relay HTLCs to us using the channel's SCID alias.
+ *
+ * If this option is set, channels may be created that will not be readable by LDK versions
+ * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
+ * [`DecodeError:InvalidValue`].
+ *
+ * Note that setting this to true does *not* prevent us from opening channels with
+ * counterparties that do not support the `scid_alias` option; we will simply fall back to a
+ * private channel without that option.
+ *
+ * Ignored if the channel is negotiated to be announced, see
+ * [`ChannelConfig::announced_channel`] and
+ * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
+ *
+ * Default value: false. This value is likely to change to true in the future.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
+ */
+bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
+
+/**
+ * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the
+ * BOLTs) option for outbound private channels. This provides better privacy by not including
+ * our real on-chain channel UTXO in each invoice and requiring that our counterparty only
+ * relay HTLCs to us using the channel's SCID alias.
+ *
+ * If this option is set, channels may be created that will not be readable by LDK versions
+ * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a
+ * [`DecodeError:InvalidValue`].
+ *
+ * Note that setting this to true does *not* prevent us from opening channels with
+ * counterparties that do not support the `scid_alias` option; we will simply fall back to a
+ * private channel without that option.
+ *
+ * Ignored if the channel is negotiated to be announced, see
+ * [`ChannelConfig::announced_channel`] and
+ * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more.
+ *
+ * Default value: false. This value is likely to change to true in the future.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue
+ */
+void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val);
+
+/**
+ * Constructs a new ChannelHandshakeConfig given each field
+ */
+MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_new(uint32_t minimum_depth_arg, uint16_t our_to_self_delay_arg, uint64_t our_htlc_minimum_msat_arg, bool negotiate_scid_privacy_arg);
+
+/**
+ * Creates a copy of the ChannelHandshakeConfig
+ */
+struct LDKChannelHandshakeConfig ChannelHandshakeConfig_clone(const struct LDKChannelHandshakeConfig *NONNULL_PTR orig);
+
+/**
+ * Creates a "default" ChannelHandshakeConfig. See struct and individual field documentaiton for details on which values are used.
+ */
+MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(void);
+
+/**
+ * Frees any resources used by the ChannelHandshakeLimits, if is_owned is set and inner is non-NULL.
+ */
+void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj);
+
+/**
+ * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
+ * only applies to inbound channels.
+ *
+ * Default value: 0.
+ */
+uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so
+ * only applies to inbound channels.
+ *
+ * Default value: 0.
+ */
+void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
+ * you to limit the maximum minimum-size they can require.
+ *
+ * Default value: u64::max_value.
+ */
+uint64_t ChannelHandshakeLimits_get_max_htlc_minimum_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows
+ * you to limit the maximum minimum-size they can require.
+ *
+ * Default value: u64::max_value.
+ */
+void ChannelHandshakeLimits_set_max_htlc_minimum_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
+ * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
+ *
+ * Default value: 0.
+ */
+uint64_t ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * The remote node sets a limit on the maximum value of pending HTLCs to them at any given
+ * time to limit their funds exposure to HTLCs. This allows you to set a minimum such value.
+ *
+ * Default value: 0.
+ */
+void ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The remote node will require we keep a certain amount in direct payment to ourselves at all
+ * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
+ * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
+ *
+ * Default value: u64::max_value.
+ */
+uint64_t ChannelHandshakeLimits_get_max_channel_reserve_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * The remote node will require we keep a certain amount in direct payment to ourselves at all
+ * time, ensuring that we are able to be punished if we broadcast an old state. This allows to
+ * you limit the amount which we will have to keep to ourselves (and cannot use for HTLCs).
+ *
+ * Default value: u64::max_value.
+ */
+void ChannelHandshakeLimits_set_max_channel_reserve_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
+ * time. This allows you to set a minimum such value.
+ *
+ * Default value: 0.
+ */
+uint16_t ChannelHandshakeLimits_get_min_max_accepted_htlcs(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * The remote node sets a limit on the maximum number of pending HTLCs to them at any given
+ * time. This allows you to set a minimum such value.
+ *
+ * Default value: 0.
+ */
+void ChannelHandshakeLimits_set_min_max_accepted_htlcs(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
+
+/**
+ * Before a channel is usable the funding transaction will need to be confirmed by at least a
+ * certain number of blocks, specified by the node which is not the funder (as the funder can
+ * assume they aren't going to double-spend themselves).
+ * This config allows you to set a limit on the maximum amount of time to wait.
+ *
+ * Default value: 144, or roughly one day and only applies to outbound channels.
+ */
+uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * Before a channel is usable the funding transaction will need to be confirmed by at least a
+ * certain number of blocks, specified by the node which is not the funder (as the funder can
+ * assume they aren't going to double-spend themselves).
+ * This config allows you to set a limit on the maximum amount of time to wait.
+ *
+ * Default value: 144, or roughly one day and only applies to outbound channels.
+ */
+void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Set to force an incoming channel to match our announced channel preference in
+ * [`ChannelConfig::announced_channel`].
+ *
+ * For a node which is not online reliably, this should be set to true and
+ * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
+ * channels will ever be opened.
+ *
+ * Default value: true.
+ */
+bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * Set to force an incoming channel to match our announced channel preference in
+ * [`ChannelConfig::announced_channel`].
+ *
+ * For a node which is not online reliably, this should be set to true and
+ * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public)
+ * channels will ever be opened.
+ *
+ * Default value: true.
+ */
+void ChannelHandshakeLimits_set_force_announced_channel_preference(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val);
+
+/**
+ * Set to the amount of time we're willing to wait to claim money back to us.
+ *
+ * Not checking this value would be a security issue, as our peer would be able to set it to
+ * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
+ *
+ * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
+ * reduce the loss of having useless locked funds (if your peer accepts)
+ */
+uint16_t ChannelHandshakeLimits_get_their_to_self_delay(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr);
+
+/**
+ * Set to the amount of time we're willing to wait to claim money back to us.
+ *
+ * Not checking this value would be a security issue, as our peer would be able to set it to
+ * max relative lock-time (a year) and we would \"lose\" money as it would be locked for a long time.
+ *
+ * Default value: 2016, which we also enforce as a maximum value so you can tweak config to
+ * reduce the loss of having useless locked funds (if your peer accepts)
+ */
+void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint16_t val);
+
+/**
+ * Constructs a new ChannelHandshakeLimits given each field
+ */
+MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg);
+
+/**
+ * Creates a copy of the ChannelHandshakeLimits
+ */
+struct LDKChannelHandshakeLimits ChannelHandshakeLimits_clone(const struct LDKChannelHandshakeLimits *NONNULL_PTR orig);
+
+/**
+ * Creates a "default" ChannelHandshakeLimits. See struct and individual field documentaiton for details on which values are used.
+ */
+MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_default(void);
+
+/**
+ * Frees any resources used by the ChannelConfig, if is_owned is set and inner is non-NULL.
+ */
+void ChannelConfig_free(struct LDKChannelConfig this_obj);
+
+/**
+ * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
+ * over the channel.
+ * This may be allowed to change at runtime in a later update, however doing so must result in
+ * update messages sent to notify all nodes of our updated relay fee.
+ *
+ * Default value: 0.
+ */
+uint32_t ChannelConfig_get_forwarding_fee_proportional_millionths(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Amount (in millionths of a satoshi) charged per satoshi for payments forwarded outbound
+ * over the channel.
+ * This may be allowed to change at runtime in a later update, however doing so must result in
+ * update messages sent to notify all nodes of our updated relay fee.
+ *
+ * Default value: 0.
+ */
+void ChannelConfig_set_forwarding_fee_proportional_millionths(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
+ * excess of [`forwarding_fee_proportional_millionths`].
+ * This may be allowed to change at runtime in a later update, however doing so must result in
+ * update messages sent to notify all nodes of our updated relay fee.
+ *
+ * The default value of a single satoshi roughly matches the market rate on many routing nodes
+ * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
+ * this node.
+ *
+ * Default value: 1000.
+ *
+ * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
+ */
+uint32_t ChannelConfig_get_forwarding_fee_base_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Amount (in milli-satoshi) charged for payments forwarded outbound over the channel, in
+ * excess of [`forwarding_fee_proportional_millionths`].
+ * This may be allowed to change at runtime in a later update, however doing so must result in
+ * update messages sent to notify all nodes of our updated relay fee.
+ *
+ * The default value of a single satoshi roughly matches the market rate on many routing nodes
+ * as of July 2021. Adjusting it upwards or downwards may change whether nodes route through
+ * this node.
+ *
+ * Default value: 1000.
+ *
+ * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths
+ */
+void ChannelConfig_set_forwarding_fee_base_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
+ * the channel this config applies to.
+ *
+ * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
+ * HTLC balance when a channel appears on-chain whereas
+ * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
+ * (non-HTLC-encumbered) balance.
+ *
+ * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
+ * we (or one of our watchtowers) MUST be online to check for broadcast of the current
+ * commitment transaction at least once per this many blocks (minus some margin to allow us
+ * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
+ * the spending transaction).
+ *
+ * Default value: 72 (12 hours at an average of 6 blocks/hour).
+ * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
+ * [`MIN_CLTV_EXPIRY_DELTA`] instead.
+ *
+ * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
+ */
+uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+
+/**
+ * The difference in the CLTV value between incoming HTLCs and an outbound HTLC forwarded over
+ * the channel this config applies to.
+ *
+ * This is analogous to [`ChannelHandshakeConfig::our_to_self_delay`] but applies to in-flight
+ * HTLC balance when a channel appears on-chain whereas
+ * [`ChannelHandshakeConfig::our_to_self_delay`] applies to the remaining
+ * (non-HTLC-encumbered) balance.
+ *
+ * Thus, for HTLC-encumbered balances to be enforced on-chain when a channel is force-closed,
+ * we (or one of our watchtowers) MUST be online to check for broadcast of the current
+ * commitment transaction at least once per this many blocks (minus some margin to allow us
+ * enough time to broadcast and confirm a transaction, possibly with time in between to RBF
+ * the spending transaction).
+ *
+ * Default value: 72 (12 hours at an average of 6 blocks/hour).
+ * Minimum value: [`MIN_CLTV_EXPIRY_DELTA`], any values less than this will be treated as
+ * [`MIN_CLTV_EXPIRY_DELTA`] instead.
+ *
+ * [`MIN_CLTV_EXPIRY_DELTA`]: crate::ln::channelmanager::MIN_CLTV_EXPIRY_DELTA
+ */
+void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val);
+
+/**
+ * Set to announce the channel publicly and notify all nodes that they can route via this
+ * channel.
+ *
+ * This should only be set to true for nodes which expect to be online reliably.
+ *
+ * As the node which funds a channel picks this value this will only apply for new outbound
+ * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
+ *
+ * This cannot be changed after the initial channel handshake.
+ *
+ * Default value: false.
+ */
+bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Set to announce the channel publicly and notify all nodes that they can route via this
+ * channel.
+ *
+ * This should only be set to true for nodes which expect to be online reliably.
+ *
+ * As the node which funds a channel picks this value this will only apply for new outbound
+ * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set.
+ *
+ * This cannot be changed after the initial channel handshake.
+ *
+ * Default value: false.
+ */
+void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
+
+/**
+ * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
+ * supports it, they will then enforce the mutual-close output to us matches what we provided
+ * at intialization, preventing us from closing to an alternate pubkey.
+ *
+ * This is set to true by default to provide a slight increase in security, though ultimately
+ * any attacker who is able to take control of a channel can just as easily send the funds via
+ * lightning payments, so we never require that our counterparties support this option.
+ *
+ * This cannot be changed after a channel has been initialized.
+ *
+ * Default value: true.
+ */
+bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+
+/**
+ * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty
+ * supports it, they will then enforce the mutual-close output to us matches what we provided
+ * at intialization, preventing us from closing to an alternate pubkey.
+ *
+ * This is set to true by default to provide a slight increase in security, though ultimately
+ * any attacker who is able to take control of a channel can just as easily send the funds via
+ * lightning payments, so we never require that our counterparties support this option.
+ *
+ * This cannot be changed after a channel has been initialized.
+ *
+ * Default value: true.
+ */
+void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val);
+
+/**
+ * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
+ * small to claim on-chain.
+ *
+ * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
+ * not be claimable on-chain, instead being turned into additional miner fees if either
+ * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
+ * to such payments may be sustantial if there are many dust HTLCs present when the
+ * channel is force-closed.
+ *
+ * This limit is applied for sent, forwarded, and received HTLCs and limits the total
+ * exposure across all three types per-channel. Setting this too low may prevent the
+ * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
+ * important to prevent stealing of dust HTLCs by miners.
+ *
+ * Default value: 5_000_000 msat.
+ */
+uint64_t ChannelConfig_get_max_dust_htlc_exposure_msat(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too
+ * small to claim on-chain.
+ *
+ * When an HTLC present in one of our channels is below a \"dust\" threshold, the HTLC will
+ * not be claimable on-chain, instead being turned into additional miner fees if either
+ * party force-closes the channel. Because the threshold is per-HTLC, our total exposure
+ * to such payments may be sustantial if there are many dust HTLCs present when the
+ * channel is force-closed.
+ *
+ * This limit is applied for sent, forwarded, and received HTLCs and limits the total
+ * exposure across all three types per-channel. Setting this too low may prevent the
+ * sending or receipt of low-value HTLCs on high-traffic nodes, and this limit is very
+ * important to prevent stealing of dust HTLCs by miners.
+ *
+ * Default value: 5_000_000 msat.
+ */
+void ChannelConfig_set_max_dust_htlc_exposure_msat(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The additional fee we're willing to pay to avoid waiting for the counterparty's
+ * `to_self_delay` to reclaim funds.
+ *
+ * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
+ * closing transaction which both sides find acceptable, ultimately paid by the channel
+ * funder/initiator.
+ *
+ * When we are the funder, because we have to pay the channel closing fee, we bound the
+ * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+ * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
+ * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+ * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
+ * funds.
+ *
+ * When we are not the funder, we require the closing transaction fee pay at least our
+ * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+ * Thus, this value is ignored when we are not the funder.
+ *
+ * Default value: 1000 satoshis.
+ *
+ * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+ * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+ */
+uint64_t ChannelConfig_get_force_close_avoidance_max_fee_satoshis(const struct LDKChannelConfig *NONNULL_PTR this_ptr);
+
+/**
+ * The additional fee we're willing to pay to avoid waiting for the counterparty's
+ * `to_self_delay` to reclaim funds.
+ *
+ * When we close a channel cooperatively with our counterparty, we negotiate a fee for the
+ * closing transaction which both sides find acceptable, ultimately paid by the channel
+ * funder/initiator.
+ *
+ * When we are the funder, because we have to pay the channel closing fee, we bound the
+ * acceptable fee by our [`Background`] and [`Normal`] fees, with the upper bound increased by
+ * this value. Because the on-chain fee we'd pay to force-close the channel is kept near our
+ * [`Normal`] feerate during normal operation, this value represents the additional fee we're
+ * willing to pay in order to avoid waiting for our counterparty's to_self_delay to reclaim our
+ * funds.
+ *
+ * When we are not the funder, we require the closing transaction fee pay at least our
+ * [`Background`] fee estimate, but allow our counterparty to pay as much fee as they like.
+ * Thus, this value is ignored when we are not the funder.
+ *
+ * Default value: 1000 satoshis.
+ *
+ * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+ * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
+ */
+void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Constructs a new ChannelConfig given each field
+ */
+MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg);
+
+/**
+ * Creates a copy of the ChannelConfig
+ */
+struct LDKChannelConfig ChannelConfig_clone(const struct LDKChannelConfig *NONNULL_PTR orig);
+
+/**
+ * Creates a "default" ChannelConfig. See struct and individual field documentaiton for details on which values are used.
+ */
+MUST_USE_RES struct LDKChannelConfig ChannelConfig_default(void);
+
+/**
+ * Serialize the ChannelConfig object into a byte array which can be read by ChannelConfig_read
+ */
+struct LDKCVec_u8Z ChannelConfig_write(const struct LDKChannelConfig *NONNULL_PTR obj);
+
+/**
+ * Read a ChannelConfig from a byte array, created by ChannelConfig_write
+ */
+struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the UserConfig, if is_owned is set and inner is non-NULL.
+ */
+void UserConfig_free(struct LDKUserConfig this_obj);
+
+/**
+ * Channel config that we propose to our counterparty.
+ */
+struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Channel config that we propose to our counterparty.
+ */
+void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val);
+
+/**
+ * Limits applied to our counterparty's proposed channel config settings.
+ */
+struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Limits applied to our counterparty's proposed channel config settings.
+ */
+void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val);
+
+/**
+ * Channel config which affects behavior during channel lifetime.
+ */
+struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr);
+
+/**
+ * Channel config which affects behavior during channel lifetime.
+ */
+void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val);
+
+/**
+ * If this is set to false, we will reject any HTLCs which were to be forwarded over private
+ * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
+ * node which is not online reliably.
+ *
+ * For nodes which are not online reliably, you should set all channels to *not* be announced
+ * (using [`ChannelConfig::announced_channel`] and
+ * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
+ * ensure you are not exposed to any forwarding risk.
+ *
+ * Note that because you cannot change a channel's announced state after creation, there is no
+ * way to disable forwarding on public channels retroactively. Thus, in order to change a node
+ * from a publicly-announced forwarding node to a private non-forwarding node you must close
+ * all your channels and open new ones. For privacy, you should also change your node_id
+ * (swapping all private and public key material for new ones) at that time.
+ *
+ * Default value: false.
+ */
+bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
+
+/**
+ * If this is set to false, we will reject any HTLCs which were to be forwarded over private
+ * channels. This prevents us from taking on HTLC-forwarding risk when we intend to run as a
+ * node which is not online reliably.
+ *
+ * For nodes which are not online reliably, you should set all channels to *not* be announced
+ * (using [`ChannelConfig::announced_channel`] and
+ * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to
+ * ensure you are not exposed to any forwarding risk.
+ *
+ * Note that because you cannot change a channel's announced state after creation, there is no
+ * way to disable forwarding on public channels retroactively. Thus, in order to change a node
+ * from a publicly-announced forwarding node to a private non-forwarding node you must close
+ * all your channels and open new ones. For privacy, you should also change your node_id
+ * (swapping all private and public key material for new ones) at that time.
+ *
+ * Default value: false.
+ */
+void UserConfig_set_accept_forwards_to_priv_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
+
+/**
+ * If this is set to false, we do not accept inbound requests to open a new channel.
+ * Default value: true.
+ */
+bool UserConfig_get_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
+
+/**
+ * If this is set to false, we do not accept inbound requests to open a new channel.
+ * Default value: true.
+ */
+void UserConfig_set_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
+
+/**
+ * If this is set to true, the user needs to manually accept inbound requests to open a new
+ * channel.
+ *
+ * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
+ * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
+ * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
+ * user explicitly chooses to accept the request.
+ *
+ * Default value: false.
+ *
+ * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
+ * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
+ * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
+ */
+bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig *NONNULL_PTR this_ptr);
+
+/**
+ * If this is set to true, the user needs to manually accept inbound requests to open a new
+ * channel.
+ *
+ * When set to true, [`Event::OpenChannelRequest`] will be triggered once a request to open a
+ * new inbound channel is received through a [`msgs::OpenChannel`] message. In that case, a
+ * [`msgs::AcceptChannel`] message will not be sent back to the counterparty node unless the
+ * user explicitly chooses to accept the request.
+ *
+ * Default value: false.
+ *
+ * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
+ * [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
+ * [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
+ */
+void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
+
+/**
+ * Constructs a new UserConfig given each field
+ */
+MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg);
+
+/**
+ * Creates a copy of the UserConfig
+ */
+struct LDKUserConfig UserConfig_clone(const struct LDKUserConfig *NONNULL_PTR orig);
+
+/**
+ * Creates a "default" UserConfig. See struct and individual field documentaiton for details on which values are used.
+ */
+MUST_USE_RES struct LDKUserConfig UserConfig_default(void);
+
+/**
+ * Frees any resources used by the BestBlock, if is_owned is set and inner is non-NULL.
+ */
+void BestBlock_free(struct LDKBestBlock this_obj);
+
+/**
+ * Creates a copy of the BestBlock
+ */
+struct LDKBestBlock BestBlock_clone(const struct LDKBestBlock *NONNULL_PTR orig);
+
+/**
+ * Constructs a `BestBlock` that represents the genesis block at height 0 of the given
+ * network.
+ */
+MUST_USE_RES struct LDKBestBlock BestBlock_from_genesis(enum LDKNetwork network);
+
+/**
+ * Returns a `BestBlock` as identified by the given block hash and height.
+ */
+MUST_USE_RES struct LDKBestBlock BestBlock_new(struct LDKThirtyTwoBytes block_hash, uint32_t height);
+
+/**
+ * Returns the best block hash.
+ */
+MUST_USE_RES struct LDKThirtyTwoBytes BestBlock_block_hash(const struct LDKBestBlock *NONNULL_PTR this_arg);
+
+/**
+ * Returns the best block height.
+ */
+MUST_USE_RES uint32_t BestBlock_height(const struct LDKBestBlock *NONNULL_PTR this_arg);
+
+/**
+ * Creates a copy of the AccessError
+ */
+enum LDKAccessError AccessError_clone(const enum LDKAccessError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new UnknownChain-variant AccessError
+ */
+enum LDKAccessError AccessError_unknown_chain(void);
+
+/**
+ * Utility method to constructs a new UnknownTx-variant AccessError
+ */
+enum LDKAccessError AccessError_unknown_tx(void);
+
+/**
+ * Calls the free function if one is set
+ */
+void Access_free(struct LDKAccess this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void Listen_free(struct LDKListen this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void Confirm_free(struct LDKConfirm this_ptr);
+
+/**
+ * Creates a copy of the ChannelMonitorUpdateErr
+ */
+enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_clone(const enum LDKChannelMonitorUpdateErr *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new TemporaryFailure-variant ChannelMonitorUpdateErr
+ */
+enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_temporary_failure(void);
+
+/**
+ * Utility method to constructs a new PermanentFailure-variant ChannelMonitorUpdateErr
+ */
+enum LDKChannelMonitorUpdateErr ChannelMonitorUpdateErr_permanent_failure(void);
+
+/**
+ * Calls the free function if one is set
+ */
+void Watch_free(struct LDKWatch this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void Filter_free(struct LDKFilter this_ptr);
+
+/**
+ * Frees any resources used by the WatchedOutput, if is_owned is set and inner is non-NULL.
+ */
+void WatchedOutput_free(struct LDKWatchedOutput this_obj);
+
+/**
+ * First block where the transaction output may have been spent.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKThirtyTwoBytes WatchedOutput_get_block_hash(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
+
+/**
+ * First block where the transaction output may have been spent.
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void WatchedOutput_set_block_hash(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+
+/**
+ * Outpoint identifying the transaction output.
+ */
+struct LDKOutPoint WatchedOutput_get_outpoint(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
+
+/**
+ * Outpoint identifying the transaction output.
+ */
+void WatchedOutput_set_outpoint(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKOutPoint val);
+
+/**
+ * Spending condition of the transaction output.
+ */
+struct LDKu8slice WatchedOutput_get_script_pubkey(const struct LDKWatchedOutput *NONNULL_PTR this_ptr);
+
+/**
+ * Spending condition of the transaction output.
+ */
+void WatchedOutput_set_script_pubkey(struct LDKWatchedOutput *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val);
+
+/**
+ * Constructs a new WatchedOutput given each field
+ */
+MUST_USE_RES struct LDKWatchedOutput WatchedOutput_new(struct LDKThirtyTwoBytes block_hash_arg, struct LDKOutPoint outpoint_arg, struct LDKCVec_u8Z script_pubkey_arg);
+
+/**
+ * Creates a copy of the WatchedOutput
+ */
+struct LDKWatchedOutput WatchedOutput_clone(const struct LDKWatchedOutput *NONNULL_PTR orig);
+
+/**
+ * Checks if two WatchedOutputs contain equal inner contents.
+ */
+uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
+
+/**
+ * Calls the free function if one is set
+ */
+void BroadcasterInterface_free(struct LDKBroadcasterInterface this_ptr);
+
+/**
+ * Creates a copy of the ConfirmationTarget
+ */
+enum LDKConfirmationTarget ConfirmationTarget_clone(const enum LDKConfirmationTarget *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Background-variant ConfirmationTarget
+ */
+enum LDKConfirmationTarget ConfirmationTarget_background(void);
+
+/**
+ * Utility method to constructs a new Normal-variant ConfirmationTarget
+ */
+enum LDKConfirmationTarget ConfirmationTarget_normal(void);
+
+/**
+ * Utility method to constructs a new HighPriority-variant ConfirmationTarget
+ */
+enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
+
+/**
+ * Checks if two ConfirmationTargets contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool ConfirmationTarget_eq(const enum LDKConfirmationTarget *NONNULL_PTR a, const enum LDKConfirmationTarget *NONNULL_PTR b);
+
+/**
+ * Calls the free function if one is set
+ */
+void FeeEstimator_free(struct LDKFeeEstimator this_ptr);
+
+/**
+ * Frees any resources used by the MonitorUpdateId, if is_owned is set and inner is non-NULL.
+ */
+void MonitorUpdateId_free(struct LDKMonitorUpdateId this_obj);
+
+/**
+ * Creates a copy of the MonitorUpdateId
+ */
+struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
+
+/**
+ * Checks if two MonitorUpdateIds contain equal inner contents.
+ */
+uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
+
+/**
+ * Checks if two MonitorUpdateIds contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Two objects with NULL inner values will be considered "equal" here.
+ */
+bool MonitorUpdateId_eq(const struct LDKMonitorUpdateId *NONNULL_PTR a, const struct LDKMonitorUpdateId *NONNULL_PTR b);
+
+/**
+ * Calls the free function if one is set
+ */
+void Persist_free(struct LDKPersist this_ptr);
+
+/**
+ * Frees any resources used by the LockedChannelMonitor, if is_owned is set and inner is non-NULL.
+ */
+void LockedChannelMonitor_free(struct LDKLockedChannelMonitor this_obj);
+
+/**
+ * Frees any resources used by the ChainMonitor, if is_owned is set and inner is non-NULL.
+ */
+void ChainMonitor_free(struct LDKChainMonitor this_obj);
+
+/**
+ * Creates a new `ChainMonitor` used to watch on-chain activity pertaining to channels.
+ *
+ * When an optional chain source implementing [`chain::Filter`] is provided, the chain monitor
+ * will call back to it indicating transactions and outputs of interest. This allows clients to
+ * pre-filter blocks or only fetch blocks matching a compact filter. Otherwise, clients may
+ * always need to fetch full blocks absent another means for determining which blocks contain
+ * transactions relevant to the watched channels.
+ */
+MUST_USE_RES struct LDKChainMonitor ChainMonitor_new(struct LDKCOption_FilterZ chain_source, struct LDKBroadcasterInterface broadcaster, struct LDKLogger logger, struct LDKFeeEstimator feeest, struct LDKPersist persister);
+
+/**
+ * Gets the balances in the contained [`ChannelMonitor`]s which are claimable on-chain or
+ * claims which are awaiting confirmation.
+ *
+ * Includes the balances from each [`ChannelMonitor`] *except* those included in
+ * `ignored_channels`, allowing you to filter out balances from channels which are still open
+ * (and whose balance should likely be pulled from the [`ChannelDetails`]).
+ *
+ * See [`ChannelMonitor::get_claimable_balances`] for more details on the exact criteria for
+ * inclusion in the return value.
+ */
+MUST_USE_RES struct LDKCVec_BalanceZ ChainMonitor_get_claimable_balances(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKCVec_ChannelDetailsZ ignored_channels);
+
+/**
+ * Gets the [`LockedChannelMonitor`] for a given funding outpoint, returning an `Err` if no
+ * such [`ChannelMonitor`] is currently being monitored for.
+ *
+ * Note that the result holds a mutex over our monitor set, and should not be held
+ * indefinitely.
+ */
+MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monitor(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo);
+
+/**
+ * Lists the funding outpoint of each [`ChannelMonitor`] being monitored.
+ *
+ * Note that [`ChannelMonitor`]s are not removed when a channel is closed as they are always
+ * monitoring for on-chain state resolutions.
+ */
+MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Indicates the persistence of a [`ChannelMonitor`] has completed after
+ * [`ChannelMonitorUpdateErr::TemporaryFailure`] was returned from an update operation.
+ *
+ * Thus, the anticipated use is, at a high level:
+ * 1) This [`ChainMonitor`] calls [`Persist::update_persisted_channel`] which stores the
+ * update to disk and begins updating any remote (e.g. watchtower/backup) copies,
+ * returning [`ChannelMonitorUpdateErr::TemporaryFailure`],
+ * 2) once all remote copies are updated, you call this function with the
+ * `completed_update_id` that completed, and once all pending updates have completed the
+ * channel will be re-enabled.
+ *
+ * Returns an [`APIError::APIMisuseError`] if `funding_txo` does not match any currently
+ * registered [`ChannelMonitor`]s.
+ */
+MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChainMonitor_channel_monitor_updated(const struct LDKChainMonitor *NONNULL_PTR this_arg, struct LDKOutPoint funding_txo, struct LDKMonitorUpdateId completed_update_id);
+
+/**
+ * Constructs a new Listen which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Listen must be freed before this_arg is
+ */
+struct LDKListen ChainMonitor_as_Listen(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Constructs a new Confirm which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Confirm must be freed before this_arg is
+ */
+struct LDKConfirm ChainMonitor_as_Confirm(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Constructs a new Watch which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned Watch must be freed before this_arg is
+ */
+struct LDKWatch ChainMonitor_as_Watch(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Constructs a new EventsProvider which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EventsProvider must be freed before this_arg is
+ */
+struct LDKEventsProvider ChainMonitor_as_EventsProvider(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Frees any resources used by the ChannelMonitorUpdate, if is_owned is set and inner is non-NULL.
+ */
+void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj);
+
+/**
+ * The sequence number of this update. Updates *must* be replayed in-order according to this
+ * sequence number (and updates may panic if they are not). The update_id values are strictly
+ * increasing and increase by one for each new update, with one exception specified below.
+ *
+ * This sequence number is also used to track up to which points updates which returned
+ * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+ * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
+ *
+ * The only instance where update_id values are not strictly increasing is the case where we
+ * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
+ * its docs for more details.
+ */
+uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr);
+
+/**
+ * The sequence number of this update. Updates *must* be replayed in-order according to this
+ * sequence number (and updates may panic if they are not). The update_id values are strictly
+ * increasing and increase by one for each new update, with one exception specified below.
+ *
+ * This sequence number is also used to track up to which points updates which returned
+ * ChannelMonitorUpdateErr::TemporaryFailure have been applied to all copies of a given
+ * ChannelMonitor when ChannelManager::channel_monitor_updated is called.
+ *
+ * The only instance where update_id values are not strictly increasing is the case where we
+ * allow post-force-close updates with a special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. See
+ * its docs for more details.
+ */
+void ChannelMonitorUpdate_set_update_id(struct LDKChannelMonitorUpdate *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Creates a copy of the ChannelMonitorUpdate
+ */
+struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
+
+/**
+ * Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
+ */
+struct LDKCVec_u8Z ChannelMonitorUpdate_write(const struct LDKChannelMonitorUpdate *NONNULL_PTR obj);
+
+/**
+ * Read a ChannelMonitorUpdate from a byte array, created by ChannelMonitorUpdate_write
+ */
+struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ ChannelMonitorUpdate_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the MonitorEvent
+ */
+void MonitorEvent_free(struct LDKMonitorEvent this_ptr);
+
+/**
+ * Creates a copy of the MonitorEvent
+ */
+struct LDKMonitorEvent MonitorEvent_clone(const struct LDKMonitorEvent *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new HTLCEvent-variant MonitorEvent
+ */
+struct LDKMonitorEvent MonitorEvent_htlcevent(struct LDKHTLCUpdate a);
+
+/**
+ * Utility method to constructs a new CommitmentTxConfirmed-variant MonitorEvent
+ */
+struct LDKMonitorEvent MonitorEvent_commitment_tx_confirmed(struct LDKOutPoint a);
+
+/**
+ * Utility method to constructs a new UpdateCompleted-variant MonitorEvent
+ */
+struct LDKMonitorEvent MonitorEvent_update_completed(struct LDKOutPoint funding_txo, uint64_t monitor_update_id);
+
+/**
+ * Utility method to constructs a new UpdateFailed-variant MonitorEvent
+ */
+struct LDKMonitorEvent MonitorEvent_update_failed(struct LDKOutPoint a);
+
+/**
+ * Serialize the MonitorEvent object into a byte array which can be read by MonitorEvent_read
+ */
+struct LDKCVec_u8Z MonitorEvent_write(const struct LDKMonitorEvent *NONNULL_PTR obj);
+
+/**
+ * Read a MonitorEvent from a byte array, created by MonitorEvent_write
+ */
+struct LDKCResult_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the HTLCUpdate, if is_owned is set and inner is non-NULL.
+ */
+void HTLCUpdate_free(struct LDKHTLCUpdate this_obj);
+
+/**
+ * Creates a copy of the HTLCUpdate
+ */
+struct LDKHTLCUpdate HTLCUpdate_clone(const struct LDKHTLCUpdate *NONNULL_PTR orig);
+
+/**
+ * Serialize the HTLCUpdate object into a byte array which can be read by HTLCUpdate_read
+ */
+struct LDKCVec_u8Z HTLCUpdate_write(const struct LDKHTLCUpdate *NONNULL_PTR obj);
+
+/**
+ * Read a HTLCUpdate from a byte array, created by HTLCUpdate_write
+ */
+struct LDKCResult_HTLCUpdateDecodeErrorZ HTLCUpdate_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the Balance
+ */
+void Balance_free(struct LDKBalance this_ptr);
+
+/**
+ * Creates a copy of the Balance
+ */
+struct LDKBalance Balance_clone(const struct LDKBalance *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new ClaimableOnChannelClose-variant Balance
+ */
+struct LDKBalance Balance_claimable_on_channel_close(uint64_t claimable_amount_satoshis);
+
+/**
+ * Utility method to constructs a new ClaimableAwaitingConfirmations-variant Balance
+ */
+struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_amount_satoshis, uint32_t confirmation_height);
+
+/**
+ * Utility method to constructs a new ContentiousClaimable-variant Balance
+ */
+struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height);
+
+/**
+ * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance
+ */
+struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height);
+
+/**
+ * Checks if two Balances contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool Balance_eq(const struct LDKBalance *NONNULL_PTR a, const struct LDKBalance *NONNULL_PTR b);
+
+/**
+ * Frees any resources used by the ChannelMonitor, if is_owned is set and inner is non-NULL.
+ */
+void ChannelMonitor_free(struct LDKChannelMonitor this_obj);
+
+/**
+ * Serialize the ChannelMonitor object into a byte array which can be read by ChannelMonitor_read
+ */
+struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_PTR obj);
+
+/**
+ * Updates a ChannelMonitor on the basis of some new information provided by the Channel
+ * itself.
+ *
+ * panics if the given update is not the next update by update_id.
+ */
+MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger);
+
+/**
+ * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this
+ * ChannelMonitor.
+ */
+MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Gets the funding transaction outpoint of the channel this ChannelMonitor is monitoring for.
+ */
+MUST_USE_RES struct LDKC2Tuple_OutPointScriptZ ChannelMonitor_get_funding_txo(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Gets a list of txids, with their output scripts (in the order they appear in the
+ * transaction), which we must learn about spends of via block_connected().
+ */
+MUST_USE_RES struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ ChannelMonitor_get_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Loads the funding txo and outputs to watch into the given `chain::Filter` by repeatedly
+ * calling `chain::Filter::register_output` and `chain::Filter::register_tx` until all outputs
+ * have been registered.
+ */
+void ChannelMonitor_load_outputs_to_watch(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKFilter *NONNULL_PTR filter);
+
+/**
+ * Get the list of HTLCs who's status has been updated on chain. This should be called by
+ * ChannelManager via [`chain::Watch::release_pending_monitor_events`].
+ */
+MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_monitor_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Gets the list of pending events which were generated by previous actions, clearing the list
+ * in the process.
+ *
+ * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to
+ * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do
+ * no internal locking in ChannelMonitors.
+ */
+MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of
+ * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of
+ * fallen-behind, i.e when receiving a channel_reestablish with a proof that our counterparty side knows
+ * a higher revocation secret than the holder commitment number we are aware of. Broadcasting these
+ * transactions are UNSAFE, as they allow counterparty side to punish you. Nevertheless you may want to
+ * broadcast them if counterparty don't close channel with his higher commitment transaction after a
+ * substantial amount of time (a month or even a year) to get back funds. Best may be to contact
+ * out-of-band the other node operator to coordinate with him if option is available to you.
+ * In any-case, choice is up to the user.
+ */
+MUST_USE_RES struct LDKCVec_TransactionZ ChannelMonitor_get_latest_holder_commitment_txn(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger);
+
+/**
+ * Processes transactions in a newly connected block, which may result in any of the following:
+ * - update the monitor's state against resolved HTLCs
+ * - punish the counterparty in the case of seeing a revoked commitment transaction
+ * - force close the channel and claim/timeout incoming/outgoing HTLCs if near expiration
+ * - detect settled outputs for later spending
+ * - schedule and bump any in-flight claims
+ *
+ * Returns any new outputs to watch from `txdata`; after called, these are also included in
+ * [`get_outputs_to_watch`].
+ *
+ * [`get_outputs_to_watch`]: #method.get_outputs_to_watch
+ */
+MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_block_connected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+
+/**
+ * Determines if the disconnected block contained any transactions of interest and updates
+ * appropriately.
+ */
+void ChannelMonitor_block_disconnected(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+
+/**
+ * Processes transactions confirmed in a block with the given header and height, returning new
+ * outputs to watch. See [`block_connected`] for details.
+ *
+ * Used instead of [`block_connected`] by clients that are notified of transactions rather than
+ * blocks. See [`chain::Confirm`] for calling expectations.
+ *
+ * [`block_connected`]: Self::block_connected
+ */
+MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_transactions_confirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+
+/**
+ * Processes a transaction that was reorganized out of the chain.
+ *
+ * Used instead of [`block_disconnected`] by clients that are notified of transactions rather
+ * than blocks. See [`chain::Confirm`] for calling expectations.
+ *
+ * [`block_disconnected`]: Self::block_disconnected
+ */
+void ChannelMonitor_transaction_unconfirmed(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*txid)[32], struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+
+/**
+ * Updates the monitor with the current best chain tip, returning new outputs to watch. See
+ * [`block_connected`] for details.
+ *
+ * Used instead of [`block_connected`] by clients that are notified of transactions rather than
+ * blocks. See [`chain::Confirm`] for calling expectations.
+ *
+ * [`block_connected`]: Self::block_connected
+ */
+MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_updated(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const uint8_t (*header)[80], uint32_t height, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);