} LDKConfirmationTarget;
/**
- * Errors that may occur when constructing a new `RawInvoice` or `Invoice`
+ * Errors that may occur when constructing a new [`RawInvoice`] or [`Invoice`]
*/
typedef enum LDKCreationError {
/**
- * The supplied description string was longer than 639 __bytes__ (see [`Description::new(…)`](./struct.Description.html#method.new))
+ * The supplied description string was longer than 639 __bytes__ (see [`Description::new`])
*/
LDKCreationError_DescriptionTooLong,
/**
LDKNetwork_Sentinel,
} LDKNetwork;
+/**
+ * The reason the payment failed. Used in [`Event::PaymentFailed`].
+ */
+typedef enum LDKPaymentFailureReason {
+ /**
+ * The intended recipient rejected our payment.
+ */
+ LDKPaymentFailureReason_RecipientRejected,
+ /**
+ * The user chose to abandon this payment by calling [`ChannelManager::abandon_payment`].
+ *
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ */
+ LDKPaymentFailureReason_UserAbandoned,
+ /**
+ * We exhausted all of our retry attempts while trying to send the payment, or we
+ * exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry
+ * attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will
+ * have come before this.
+ *
+ * [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout
+ */
+ LDKPaymentFailureReason_RetriesExhausted,
+ /**
+ * The payment expired while retrying, based on the provided
+ * [`PaymentParameters::expiry_time`].
+ *
+ * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time
+ */
+ LDKPaymentFailureReason_PaymentExpired,
+ /**
+ * We failed to find a route while retrying the payment.
+ */
+ LDKPaymentFailureReason_RouteNotFound,
+ /**
+ * This error should generally never happen. This likely means that there is a problem with
+ * your router.
+ */
+ LDKPaymentFailureReason_UnexpectedError,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKPaymentFailureReason_Sentinel,
+} LDKPaymentFailureReason;
+
/**
* Specifies the recipient of an invoice.
*
} LDKRecipient;
/**
- * Indicates an immediate error on [`ChannelManager::send_payment_with_retry`]. Further errors
- * may be surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
+ * Indicates an immediate error on [`ChannelManager::send_payment`]. Further errors may be
+ * surfaced later via [`Event::PaymentPathFailed`] and [`Event::PaymentFailed`].
*
- * [`ChannelManager::send_payment_with_retry`]: crate::ln::channelmanager::ChannelManager::send_payment_with_retry
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
- * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
+ * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
*/
typedef enum LDKRetryableSendFailure {
/**
* yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
*
* [`PaymentId`]: crate::ln::channelmanager::PaymentId
- * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent
- * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
+ * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
+ * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
*/
LDKRetryableSendFailure_DuplicatePayment,
/**
} LDKSecp256k1Error;
/**
- * Errors that may occur when converting a `RawInvoice` to an `Invoice`. They relate to the
+ * Errors that may occur when converting a [`RawInvoice`] to an [`Invoice`]. They relate to the
* requirements sections in BOLT #11
*/
typedef enum LDKSemanticError {
uint64_t value;
} LDKTxOut;
+/**
+ * An enum which can either contain a u64 or not
+ */
+typedef enum LDKCOption_DurationZ_Tag {
+ /**
+ * When we're in this state, this COption_DurationZ contains a u64
+ */
+ LDKCOption_DurationZ_Some,
+ /**
+ * When we're in this state, this COption_DurationZ contains nothing
+ */
+ LDKCOption_DurationZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_DurationZ_Sentinel,
+} LDKCOption_DurationZ_Tag;
+
+typedef struct LDKCOption_DurationZ {
+ LDKCOption_DurationZ_Tag tag;
+ union {
+ struct {
+ uint64_t some;
+ };
+ };
+} LDKCOption_DurationZ;
+
+
+
+/**
+ * Onion messages and payments can be sent and received to blinded paths, which serve to hide the
+ * identity of the recipient.
+ */
+typedef struct MUST_USE_STRUCT LDKBlindedPath {
+ /**
+ * 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.
+ */
+ LDKnativeBlindedPath *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;
+} LDKBlindedPath;
+
+/**
+ * A dynamically-allocated array of crate::lightning::blinded_path::BlindedPaths of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_BlindedPathZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKBlindedPath *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_BlindedPathZ;
+
+/**
+ * An enum which can either contain a u64 or not
+ */
+typedef enum LDKCOption_u64Z_Tag {
+ /**
+ * When we're in this state, this COption_u64Z contains a u64
+ */
+ LDKCOption_u64Z_Some,
+ /**
+ * When we're in this state, this COption_u64Z contains nothing
+ */
+ LDKCOption_u64Z_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_u64Z_Sentinel,
+} LDKCOption_u64Z_Tag;
+
+typedef struct LDKCOption_u64Z {
+ LDKCOption_u64Z_Tag tag;
+ union {
+ struct {
+ uint64_t some;
+ };
+ };
+} LDKCOption_u64Z;
+
/**
} LDKCVec_APIErrorZ;
/**
- * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
+ * An enum which can either contain a crate::c_types::derived::CVec_u8Z or not
*/
-typedef enum LDKCOption_HTLCClaimZ_Tag {
+typedef enum LDKCOption_CVec_u8ZZ_Tag {
/**
- * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
+ * When we're in this state, this COption_CVec_u8ZZ contains a crate::c_types::derived::CVec_u8Z
*/
- LDKCOption_HTLCClaimZ_Some,
+ LDKCOption_CVec_u8ZZ_Some,
/**
- * When we're in this state, this COption_HTLCClaimZ contains nothing
+ * When we're in this state, this COption_CVec_u8ZZ contains nothing
*/
- LDKCOption_HTLCClaimZ_None,
+ LDKCOption_CVec_u8ZZ_None,
/**
* Must be last for serialization purposes
*/
- LDKCOption_HTLCClaimZ_Sentinel,
-} LDKCOption_HTLCClaimZ_Tag;
+ LDKCOption_CVec_u8ZZ_Sentinel,
+} LDKCOption_CVec_u8ZZ_Tag;
-typedef struct LDKCOption_HTLCClaimZ {
- LDKCOption_HTLCClaimZ_Tag tag;
+typedef struct LDKCOption_CVec_u8ZZ {
+ LDKCOption_CVec_u8ZZ_Tag tag;
union {
struct {
- enum LDKHTLCClaim some;
+ struct LDKCVec_u8Z some;
};
};
-} LDKCOption_HTLCClaimZ;
-
-/**
- * The contents of CResult_NoneNoneZ
- */
-typedef union LDKCResult_NoneNoneZPtr {
- /**
- * Note that this value is always NULL, as there are no contents in the OK variant
- */
- void *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_NoneNoneZPtr;
-
-/**
- * A CResult_NoneNoneZ represents the result of a fallible operation,
- * containing a () on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_NoneNoneZ {
- /**
- * The contents of this CResult_NoneNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_NoneNoneZPtr contents;
- /**
- * Whether this CResult_NoneNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_NoneNoneZ;
+} LDKCOption_CVec_u8ZZ;
/**
- * Implements the per-commitment secret storage scheme from
- * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
+ * Information which is provided, encrypted, to the payment recipient when sending HTLCs.
*
- * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
- * or so.
+ * This should generally be constructed with data communicated to us from the recipient (via a
+ * BOLT11 or BOLT12 invoice).
*/
-typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
+typedef struct MUST_USE_STRUCT LDKRecipientOnionFields {
/**
* 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.
*/
- LDKnativeCounterpartyCommitmentSecrets *inner;
+ LDKnativeRecipientOnionFields *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;
-} LDKCounterpartyCommitmentSecrets;
+} LDKRecipientOnionFields;
/**
* An error in decoding a message or struct.
};
} LDKDecodeError;
+/**
+ * The contents of CResult_RecipientOnionFieldsDecodeErrorZ
+ */
+typedef union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKRecipientOnionFields *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_RecipientOnionFieldsDecodeErrorZPtr;
+
+/**
+ * A CResult_RecipientOnionFieldsDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::outbound_payment::RecipientOnionFields 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_RecipientOnionFieldsDecodeErrorZ {
+ /**
+ * The contents of this CResult_RecipientOnionFieldsDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_RecipientOnionFieldsDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_RecipientOnionFieldsDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_RecipientOnionFieldsDecodeErrorZ;
+
+/**
+ * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not
+ */
+typedef enum LDKCOption_HTLCClaimZ_Tag {
+ /**
+ * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim
+ */
+ LDKCOption_HTLCClaimZ_Some,
+ /**
+ * When we're in this state, this COption_HTLCClaimZ contains nothing
+ */
+ LDKCOption_HTLCClaimZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_HTLCClaimZ_Sentinel,
+} LDKCOption_HTLCClaimZ_Tag;
+
+typedef struct LDKCOption_HTLCClaimZ {
+ LDKCOption_HTLCClaimZ_Tag tag;
+ union {
+ struct {
+ enum LDKHTLCClaim some;
+ };
+ };
+} LDKCOption_HTLCClaimZ;
+
+/**
+ * The contents of CResult_NoneNoneZ
+ */
+typedef union LDKCResult_NoneNoneZPtr {
+ /**
+ * Note that this value is always NULL, as there are no contents in the OK variant
+ */
+ void *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_NoneNoneZPtr;
+
+/**
+ * A CResult_NoneNoneZ represents the result of a fallible operation,
+ * containing a () on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_NoneNoneZ {
+ /**
+ * The contents of this CResult_NoneNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_NoneNoneZPtr contents;
+ /**
+ * Whether this CResult_NoneNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_NoneNoneZ;
+
+
+
+/**
+ * Implements the per-commitment secret storage scheme from
+ * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage).
+ *
+ * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes
+ * or so.
+ */
+typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets {
+ /**
+ * 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.
+ */
+ LDKnativeCounterpartyCommitmentSecrets *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;
+} LDKCounterpartyCommitmentSecrets;
+
/**
* The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ
*/
bool result_ok;
} LDKCResult_ShutdownScriptInvalidShutdownScriptZ;
-/**
- * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
- */
-typedef struct LDKPublicKey {
- /**
- * The bytes of the public key
- */
- uint8_t compressed_form[33];
-} LDKPublicKey;
-
-/**
- * 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;
-
-
-
-/**
- * Onion messages can be sent and received to blinded paths, which serve to hide the identity of
- * the recipient.
- */
-typedef struct MUST_USE_STRUCT LDKBlindedPath {
- /**
- * 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.
- */
- LDKnativeBlindedPath *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;
-} LDKBlindedPath;
-
-/**
- * The contents of CResult_BlindedPathNoneZ
- */
-typedef union LDKCResult_BlindedPathNoneZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKBlindedPath *result;
- /**
- * Note that this value is always NULL, as there are no contents in the Err variant
- */
- void *err;
-} LDKCResult_BlindedPathNoneZPtr;
-
-/**
- * A CResult_BlindedPathNoneZ represents the result of a fallible operation,
- * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_BlindedPathNoneZ {
- /**
- * The contents of this CResult_BlindedPathNoneZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_BlindedPathNoneZPtr contents;
- /**
- * Whether this CResult_BlindedPathNoneZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_BlindedPathNoneZ;
-
-/**
- * The contents of CResult_BlindedPathDecodeErrorZ
- */
-typedef union LDKCResult_BlindedPathDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKBlindedPath *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_BlindedPathDecodeErrorZPtr;
-
-/**
- * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::onion_message::blinded_path::BlindedPath 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_BlindedPathDecodeErrorZ {
- /**
- * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_BlindedPathDecodeErrorZPtr contents;
- /**
- * Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_BlindedPathDecodeErrorZ;
-
/**
- * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
- * by outside observers and thus can be used to hide the identity of the recipient.
+ * Information needed to route a payment across a [`BlindedPath`].
*/
-typedef struct MUST_USE_STRUCT LDKBlindedHop {
+typedef struct MUST_USE_STRUCT LDKBlindedPayInfo {
/**
* 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.
*/
- LDKnativeBlindedHop *inner;
+ LDKnativeBlindedPayInfo *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;
-} LDKBlindedHop;
+} LDKBlindedPayInfo;
/**
- * The contents of CResult_BlindedHopDecodeErrorZ
+ * The contents of CResult_BlindedPayInfoDecodeErrorZ
*/
-typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
+typedef union LDKCResult_BlindedPayInfoDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKBlindedHop *result;
+ struct LDKBlindedPayInfo *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_BlindedHopDecodeErrorZPtr;
+} LDKCResult_BlindedPayInfoDecodeErrorZPtr;
/**
- * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_BlindedPayInfoDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::offers::invoice::BlindedPayInfo 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_BlindedHopDecodeErrorZ {
+typedef struct LDKCResult_BlindedPayInfoDecodeErrorZ {
/**
- * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
+ * The contents of this CResult_BlindedPayInfoDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_BlindedHopDecodeErrorZPtr contents;
+ union LDKCResult_BlindedPayInfoDecodeErrorZPtr contents;
/**
- * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
+ * Whether this CResult_BlindedPayInfoDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_BlindedHopDecodeErrorZ;
+} LDKCResult_BlindedPayInfoDecodeErrorZ;
/**
- * A hop in a route
+ * A path in a [`Route`] to the payment recipient. Must always be at least length one.
+ * If no [`Path::blinded_tail`] is present, then [`Path::hops`] length may be up to 19.
*/
-typedef struct MUST_USE_STRUCT LDKRouteHop {
+typedef struct MUST_USE_STRUCT LDKPath {
/**
* 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.
*/
- LDKnativeRouteHop *inner;
+ LDKnativePath *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;
-} LDKRouteHop;
-
-/**
- * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_RouteHopZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKRouteHop *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_RouteHopZ;
+} LDKPath;
/**
* An interface used to score payment channels for path finding.
/**
* 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);
+ void (*payment_path_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR 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);
+ void (*payment_path_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path);
/**
* Handles updating channel penalties after a probe over the given path failed.
*/
- void (*probe_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id);
+ void (*probe_failed)(void *this_arg, const struct LDKPath *NONNULL_PTR path, uint64_t short_channel_id);
/**
* Handles updating channel penalties after a probe over the given path succeeded.
*/
- void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path);
+ void (*probe_successful)(void *this_arg, const struct LDKPath *NONNULL_PTR path);
/**
* Serialize the object into a byte array
*/
/**
- * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels
+ * Details of a channel, as returned by [`ChannelManager::list_channels`] and [`ChannelManager::list_usable_channels`]
*/
typedef struct MUST_USE_STRUCT LDKChannelDetails {
/**
bool result_ok;
} LDKCResult_RouteLightningErrorZ;
-/**
- * An enum which can either contain a u64 or not
- */
-typedef enum LDKCOption_u64Z_Tag {
- /**
- * When we're in this state, this COption_u64Z contains a u64
- */
- LDKCOption_u64Z_Some,
- /**
- * When we're in this state, this COption_u64Z contains nothing
- */
- LDKCOption_u64Z_None,
- /**
- * Must be last for serialization purposes
- */
- LDKCOption_u64Z_Sentinel,
-} LDKCOption_u64Z_Tag;
-
-typedef struct LDKCOption_u64Z {
- LDKCOption_u64Z_Tag tag;
- union {
- struct {
- uint64_t some;
- };
- };
-} LDKCOption_u64Z;
-
/**
bool result_ok;
} LDKCResult_InFlightHtlcsDecodeErrorZ;
+
+
+/**
+ * A hop in a route, and additional metadata about it. \"Hop\" is defined as a node and the channel
+ * that leads to it.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHop {
+ /**
+ * 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.
+ */
+ LDKnativeRouteHop *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;
+} LDKRouteHop;
+
/**
* The contents of CResult_RouteHopDecodeErrorZ
*/
bool result_ok;
} LDKCResult_RouteHopDecodeErrorZ;
+
+
+/**
+ * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified
+ * by outside observers and thus can be used to hide the identity of the recipient.
+ */
+typedef struct MUST_USE_STRUCT LDKBlindedHop {
+ /**
+ * 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.
+ */
+ LDKnativeBlindedHop *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;
+} LDKBlindedHop;
+
+/**
+ * A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_BlindedHopZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKBlindedHop *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_BlindedHopZ;
+
+
+
+/**
+ * The blinded portion of a [`Path`], if we're routing to a recipient who provided blinded paths in
+ * their BOLT12 [`Invoice`].
+ *
+ * [`Invoice`]: crate::offers::invoice::Invoice
+ */
+typedef struct MUST_USE_STRUCT LDKBlindedTail {
+ /**
+ * 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.
+ */
+ LDKnativeBlindedTail *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;
+} LDKBlindedTail;
+
+/**
+ * The contents of CResult_BlindedTailDecodeErrorZ
+ */
+typedef union LDKCResult_BlindedTailDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKBlindedTail *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_BlindedTailDecodeErrorZPtr;
+
+/**
+ * A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::router::BlindedTail 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_BlindedTailDecodeErrorZ {
+ /**
+ * The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_BlindedTailDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_BlindedTailDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_BlindedTailDecodeErrorZ;
+
+/**
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_RouteHopZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKRouteHop *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_RouteHopZ;
+
/**
- * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size.
+ * A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size.
* This corresponds to std::vector in C++
*/
-typedef struct LDKCVec_CVec_RouteHopZZ {
+typedef struct LDKCVec_PathZ {
/**
* The elements in the array.
* If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKCVec_RouteHopZ *data;
+ struct LDKPath *data;
/**
* The number of elements pointed to by `data`.
*/
uintptr_t datalen;
-} LDKCVec_CVec_RouteHopZZ;
+} LDKCVec_PathZ;
/**
* The contents of CResult_RouteDecodeErrorZ
* Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
* [`Event::PaymentPathFailed`].
*
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
*/
typedef struct MUST_USE_STRUCT LDKRouteParameters {
/**
bool result_ok;
} LDKCResult_RouteParametersDecodeErrorZ;
-
-
-/**
- * A list of hops along a payment path terminating with a channel to the recipient.
- */
-typedef struct MUST_USE_STRUCT LDKRouteHint {
- /**
- * 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.
- */
- LDKnativeRouteHint *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;
-} LDKRouteHint;
-
-/**
- * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_RouteHintZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKRouteHint *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_RouteHintZ;
-
/**
* A dynamically-allocated array of u64s of arbitrary size.
* This corresponds to std::vector in C++
bool result_ok;
} LDKCResult_PaymentParametersDecodeErrorZ;
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_BlindedPayInfoBlindedPathZ {
+ /**
+ * The element at position 0
+ */
+ struct LDKBlindedPayInfo a;
+ /**
+ * The element at position 1
+ */
+ struct LDKBlindedPath b;
+} LDKC2Tuple_BlindedPayInfoBlindedPathZ;
+
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlindedPayInfoBlindedPathZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ;
+
+
+
+/**
+ * A list of hops along a payment path terminating with a channel to the recipient.
+ */
+typedef struct MUST_USE_STRUCT LDKRouteHint {
+ /**
+ * 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.
+ */
+ LDKnativeRouteHint *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;
+} LDKRouteHint;
+
+/**
+ * A dynamically-allocated array of crate::lightning::routing::router::RouteHints of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_RouteHintZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKRouteHint *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_RouteHintZ;
+
/**
} LDKCResult_RouteHintHopDecodeErrorZ;
/**
- * Some information provided on receipt of payment depends on whether the payment received is a
- * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
+ * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array.
*/
-typedef enum LDKPaymentPurpose_Tag {
+typedef struct LDKPublicKey {
/**
- * Information for receiving a payment that we generated an invoice for.
+ * The bytes of the public key
*/
- LDKPaymentPurpose_InvoicePayment,
+ uint8_t compressed_form[33];
+} LDKPublicKey;
+
+/**
+ * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_PublicKeyZ {
/**
- * Because this is a spontaneous payment, the payer generated their own preimage rather than us
- * (the payee) providing a preimage.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKPaymentPurpose_SpontaneousPayment,
+ struct LDKPublicKey *data;
/**
- * Must be last for serialization purposes
+ * The number of elements pointed to by `data`.
*/
- LDKPaymentPurpose_Sentinel,
-} LDKPaymentPurpose_Tag;
+ uintptr_t datalen;
+} LDKCVec_PublicKeyZ;
-typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
+/**
+ * A tuple of 2 elements. See the individual fields for the types contained.
+ */
+typedef struct LDKC2Tuple_usizeTransactionZ {
/**
- * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
- * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
- * [`ChannelManager::claim_funds`].
- *
- * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
- * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * The element at position 0
*/
- struct LDKThirtyTwoBytes payment_preimage;
+ uintptr_t a;
/**
- * The \"payment secret\". This authenticates the sender to the recipient, preventing a
- * number of deanonymization attacks during the routing process.
- * It is provided here for your reference, however its accuracy is enforced directly by
- * [`ChannelManager`] using the values you previously provided to
- * [`ChannelManager::create_inbound_payment`] or
- * [`ChannelManager::create_inbound_payment_for_hash`].
- *
- * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
- * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
- * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
+ * The element at position 1
*/
- struct LDKThirtyTwoBytes payment_secret;
-} LDKPaymentPurpose_LDKInvoicePayment_Body;
+ struct LDKTransaction b;
+} LDKC2Tuple_usizeTransactionZ;
-typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
- LDKPaymentPurpose_Tag tag;
- union {
- LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
- struct {
- struct LDKThirtyTwoBytes spontaneous_payment;
- };
- };
-} LDKPaymentPurpose;
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKC2Tuple_usizeTransactionZ *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_usizeTransactionZZ;
/**
- * The contents of CResult_PaymentPurposeDecodeErrorZ
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
+typedef struct LDKC2Tuple_TxidBlockHashZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The element at position 0
*/
- struct LDKPaymentPurpose *result;
+ struct LDKThirtyTwoBytes a;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The element at position 1
*/
- struct LDKDecodeError *err;
-} LDKCResult_PaymentPurposeDecodeErrorZPtr;
+ struct LDKThirtyTwoBytes b;
+} LDKC2Tuple_TxidBlockHashZ;
/**
- * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::util::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_PaymentPurposeDecodeErrorZ {
+typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ {
/**
- * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
+ struct LDKC2Tuple_TxidBlockHashZ *data;
/**
- * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_PaymentPurposeDecodeErrorZ;
+ uintptr_t datalen;
+} LDKCVec_C2Tuple_TxidBlockHashZZ;
/**
- * A [`channel_update`] message to be sent to or received from a peer.
- *
- * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
+ * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
+ * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
+ * preimage claim backward will lead to loss of funds.
*/
-typedef struct MUST_USE_STRUCT LDKChannelUpdate {
+typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
/**
* A pointer to the opaque Rust object.
* Nearly everywhere, inner must be non-null, however in places where
* the Rust equivalent takes an Option, it may be set to null to indicate None.
*/
- LDKnativeChannelUpdate *inner;
+ LDKnativeHTLCUpdate *inner;
/**
* Indicates that this is the only struct which contains the same pointer.
* Rust functions which take ownership of an object provided via an argument require
* this to be true and invalidate the object pointed to by inner.
*/
bool is_owned;
-} LDKChannelUpdate;
+} LDKHTLCUpdate;
+
+
/**
- * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
- * return packet by a node along the route. See [BOLT #4] for details.
+ * A reference to a transaction output.
*
- * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
+ * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
+ * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
*/
-typedef enum LDKNetworkUpdate_Tag {
+typedef struct MUST_USE_STRUCT LDKOutPoint {
/**
- * An error indicating a `channel_update` messages should be applied via
- * [`NetworkGraph::update_channel`].
+ * 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.
*/
- LDKNetworkUpdate_ChannelUpdateMessage,
+ LDKnativeOutPoint *inner;
/**
- * An error indicating that a channel failed to route a payment, which should be applied via
- * [`NetworkGraph::channel_failed`].
+ * 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.
*/
- LDKNetworkUpdate_ChannelFailure,
+ bool is_owned;
+} LDKOutPoint;
+
+/**
+ * An event to be processed by the ChannelManager.
+ */
+typedef enum LDKMonitorEvent_Tag {
/**
- * An error indicating that a node failed to route a payment, which should be applied via
- * [`NetworkGraph::node_failed_permanent`] if permanent.
+ * A monitor event containing an HTLCUpdate.
*/
- LDKNetworkUpdate_NodeFailure,
+ LDKMonitorEvent_HTLCEvent,
/**
- * Must be last for serialization purposes
+ * A monitor event that the Channel's commitment transaction was confirmed.
*/
- LDKNetworkUpdate_Sentinel,
-} LDKNetworkUpdate_Tag;
-
-typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
+ LDKMonitorEvent_CommitmentTxConfirmed,
/**
- * The update to apply via [`NetworkGraph::update_channel`].
+ * Indicates a [`ChannelMonitor`] update has completed. See
+ * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
+ *
+ * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
*/
- struct LDKChannelUpdate msg;
-} LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
-
-typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
+ LDKMonitorEvent_Completed,
/**
- * The short channel id of the closed channel.
+ * Indicates a [`ChannelMonitor`] update has failed. See
+ * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
+ *
+ * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
*/
- uint64_t short_channel_id;
+ LDKMonitorEvent_UpdateFailed,
/**
- * Whether the channel should be permanently removed or temporarily disabled until a new
- * `channel_update` message is received.
+ * Must be last for serialization purposes
*/
- bool is_permanent;
-} LDKNetworkUpdate_LDKChannelFailure_Body;
+ LDKMonitorEvent_Sentinel,
+} LDKMonitorEvent_Tag;
-typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
+typedef struct LDKMonitorEvent_LDKCompleted_Body {
/**
- * The node id of the failed node.
+ * The funding outpoint of the [`ChannelMonitor`] that was updated
*/
- struct LDKPublicKey node_id;
+ struct LDKOutPoint funding_txo;
/**
- * Whether the node should be permanently removed from consideration or can be restored
- * when a new `channel_update` message is received.
+ * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
+ * [`ChannelMonitor::get_latest_update_id`].
+ *
+ * Note that this should only be set to a given update's ID if all previous updates for the
+ * same [`ChannelMonitor`] have been applied and persisted.
*/
- bool is_permanent;
-} LDKNetworkUpdate_LDKNodeFailure_Body;
+ uint64_t monitor_update_id;
+} LDKMonitorEvent_LDKCompleted_Body;
-typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
- LDKNetworkUpdate_Tag tag;
+typedef struct MUST_USE_STRUCT LDKMonitorEvent {
+ LDKMonitorEvent_Tag tag;
union {
- LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
- LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
- LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
+ struct {
+ struct LDKHTLCUpdate htlc_event;
+ };
+ struct {
+ struct LDKOutPoint commitment_tx_confirmed;
+ };
+ LDKMonitorEvent_LDKCompleted_Body completed;
+ struct {
+ struct LDKOutPoint update_failed;
+ };
};
-} LDKNetworkUpdate;
+} LDKMonitorEvent;
/**
- * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
+ * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef enum LDKCOption_NetworkUpdateZ_Tag {
- /**
- * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
- */
- LDKCOption_NetworkUpdateZ_Some,
+typedef struct LDKCVec_MonitorEventZ {
/**
- * When we're in this state, this COption_NetworkUpdateZ contains nothing
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKCOption_NetworkUpdateZ_None,
+ struct LDKMonitorEvent *data;
/**
- * Must be last for serialization purposes
+ * The number of elements pointed to by `data`.
*/
- LDKCOption_NetworkUpdateZ_Sentinel,
-} LDKCOption_NetworkUpdateZ_Tag;
-
-typedef struct LDKCOption_NetworkUpdateZ {
- LDKCOption_NetworkUpdateZ_Tag tag;
- union {
- struct {
- struct LDKNetworkUpdate some;
- };
- };
-} LDKCOption_NetworkUpdateZ;
+ uintptr_t datalen;
+} LDKCVec_MonitorEventZ;
/**
- * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may
- * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`].
- *
- * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
- * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
+ * A tuple of 3 elements. See the individual fields for the types contained.
*/
-typedef enum LDKPathFailure_Tag {
+typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
/**
- * We failed to initially send the payment and no HTLC was committed to. Contains the relevant
- * error.
+ * The element at position 0
*/
- LDKPathFailure_InitialSend,
+ struct LDKOutPoint a;
/**
- * A hop on the path failed to forward our payment.
+ * The element at position 1
*/
- LDKPathFailure_OnPath,
+ struct LDKCVec_MonitorEventZ b;
/**
- * Must be last for serialization purposes
+ * The element at position 2
*/
- LDKPathFailure_Sentinel,
-} LDKPathFailure_Tag;
+ struct LDKPublicKey c;
+} LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
-typedef struct LDKPathFailure_LDKInitialSend_Body {
+/**
+ * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
/**
- * The error surfaced from initial send.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKAPIError err;
-} LDKPathFailure_LDKInitialSend_Body;
-
-typedef struct LDKPathFailure_LDKOnPath_Body {
+ struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
/**
- * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing
- * decisions can take into account the update.
- *
- * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
- * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
+ * The number of elements pointed to by `data`.
*/
- struct LDKCOption_NetworkUpdateZ network_update;
-} LDKPathFailure_LDKOnPath_Body;
+ uintptr_t datalen;
+} LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
+
-typedef struct MUST_USE_STRUCT LDKPathFailure {
- LDKPathFailure_Tag tag;
- union {
- LDKPathFailure_LDKInitialSend_Body initial_send;
- LDKPathFailure_LDKOnPath_Body on_path;
- };
-} LDKPathFailure;
/**
- * An enum which can either contain a crate::lightning::util::events::PathFailure or not
+ * [`Score`] implementation that uses a fixed penalty.
*/
-typedef enum LDKCOption_PathFailureZ_Tag {
- /**
- * When we're in this state, this COption_PathFailureZ contains a crate::lightning::util::events::PathFailure
- */
- LDKCOption_PathFailureZ_Some,
+typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
/**
- * When we're in this state, this COption_PathFailureZ contains nothing
+ * 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.
*/
- LDKCOption_PathFailureZ_None,
+ LDKnativeFixedPenaltyScorer *inner;
/**
- * Must be last for serialization purposes
+ * 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.
*/
- LDKCOption_PathFailureZ_Sentinel,
-} LDKCOption_PathFailureZ_Tag;
-
-typedef struct LDKCOption_PathFailureZ {
- LDKCOption_PathFailureZ_Tag tag;
- union {
- struct {
- struct LDKPathFailure some;
- };
- };
-} LDKCOption_PathFailureZ;
+ bool is_owned;
+} LDKFixedPenaltyScorer;
/**
- * The contents of CResult_COption_PathFailureZDecodeErrorZ
+ * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
*/
-typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr {
+typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCOption_PathFailureZ *result;
+ struct LDKFixedPenaltyScorer *result;
/**
* A pointer to the contents in the error state.
* Reading from this pointer when `result_ok` is set is undefined.
*/
struct LDKDecodeError *err;
-} LDKCResult_COption_PathFailureZDecodeErrorZPtr;
+} LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
/**
- * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
* `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ {
+typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
/**
- * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
+ * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents;
+ union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
/**
- * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
+ * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_COption_PathFailureZDecodeErrorZ;
+} LDKCResult_FixedPenaltyScorerDecodeErrorZ;
/**
- * The reason the channel was closed. See individual variants more details.
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef enum LDKClosureReason_Tag {
- /**
- * Closure generated from receiving a peer error message.
- *
- * Our counterparty may have broadcasted their latest commitment state, and we have
- * as well.
- */
- LDKClosureReason_CounterpartyForceClosed,
- /**
- * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
- *
- * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
- */
- LDKClosureReason_HolderForceClosed,
- /**
- * The channel was closed after negotiating a cooperative close and we've now broadcasted
- * the cooperative close transaction. Note the shutdown may have been initiated by us.
- */
- LDKClosureReason_CooperativeClosure,
- /**
- * A commitment transaction was confirmed on chain, closing the channel. Most likely this
- * commitment transaction came from our counterparty, but it may also have come from
- * a copy of our own `ChannelMonitor`.
- */
- LDKClosureReason_CommitmentTxConfirmed,
- /**
- * The funding transaction failed to confirm in a timely manner on an inbound channel.
- */
- LDKClosureReason_FundingTimedOut,
- /**
- * Closure generated from processing an event, likely a HTLC forward/relay/reception.
- */
- LDKClosureReason_ProcessingError,
- /**
- * The peer disconnected prior to funding completing. In this case the spec mandates that we
- * forget the channel entirely - we can attempt again if the peer reconnects.
- *
- * This includes cases where we restarted prior to funding completion, including prior to the
- * initial [`ChannelMonitor`] persistence completing.
- *
- * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
- * peer because of mutual incompatibility between us and our channel counterparty.
- *
- * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
- */
- LDKClosureReason_DisconnectedPeer,
- /**
- * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
- * the [`ChannelManager`] deserialized.
- *
- * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
- * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
- */
- LDKClosureReason_OutdatedChannelManager,
- /**
- * Must be last for serialization purposes
- */
- LDKClosureReason_Sentinel,
-} LDKClosureReason_Tag;
-
-typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
+typedef struct LDKC2Tuple_u64u64Z {
/**
- * The error which the peer sent us.
- *
- * The string should be sanitized before it is used (e.g emitted to logs
- * or printed to stdout). Otherwise, a well crafted error message may exploit
- * a security vulnerability in the terminal emulator or the logging subsystem.
+ * The element at position 0
*/
- struct LDKStr peer_msg;
-} LDKClosureReason_LDKCounterpartyForceClosed_Body;
-
-typedef struct LDKClosureReason_LDKProcessingError_Body {
+ uint64_t a;
/**
- * A developer-readable error message which we generated.
+ * The element at position 1
*/
- struct LDKStr err;
-} LDKClosureReason_LDKProcessingError_Body;
-
-typedef struct MUST_USE_STRUCT LDKClosureReason {
- LDKClosureReason_Tag tag;
- union {
- LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
- LDKClosureReason_LDKProcessingError_Body processing_error;
- };
-} LDKClosureReason;
+ uint64_t b;
+} LDKC2Tuple_u64u64Z;
/**
- * An enum which can either contain a crate::lightning::util::events::ClosureReason or not
+ * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
*/
-typedef enum LDKCOption_ClosureReasonZ_Tag {
+typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
/**
- * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::util::events::ClosureReason
+ * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
*/
- LDKCOption_ClosureReasonZ_Some,
+ LDKCOption_C2Tuple_u64u64ZZ_Some,
/**
- * When we're in this state, this COption_ClosureReasonZ contains nothing
+ * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
*/
- LDKCOption_ClosureReasonZ_None,
+ LDKCOption_C2Tuple_u64u64ZZ_None,
/**
* Must be last for serialization purposes
*/
- LDKCOption_ClosureReasonZ_Sentinel,
-} LDKCOption_ClosureReasonZ_Tag;
+ LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
+} LDKCOption_C2Tuple_u64u64ZZ_Tag;
-typedef struct LDKCOption_ClosureReasonZ {
- LDKCOption_ClosureReasonZ_Tag tag;
+typedef struct LDKCOption_C2Tuple_u64u64ZZ {
+ LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
union {
struct {
- struct LDKClosureReason some;
+ struct LDKC2Tuple_u64u64Z some;
};
};
-} LDKCOption_ClosureReasonZ;
+} LDKCOption_C2Tuple_u64u64ZZ;
/**
- * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
+ * 8 u16s
*/
-typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKCOption_ClosureReasonZ *result;
+typedef struct LDKEightU16s {
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The eight 16-bit integers
*/
- struct LDKDecodeError *err;
-} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
+ uint16_t data[8];
+} LDKEightU16s;
/**
- * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
+typedef struct LDKC2Tuple_Z {
/**
- * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The element at position 0
*/
- union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
+ struct LDKEightU16s a;
/**
- * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
+ * The element at position 1
*/
- bool result_ok;
-} LDKCResult_COption_ClosureReasonZDecodeErrorZ;
+ struct LDKEightU16s b;
+} LDKC2Tuple_Z;
/**
- * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
+ * A tuple of 2 elements. See the individual fields for the types contained.
*/
-typedef enum LDKHTLCDestination_Tag {
- /**
- * We tried forwarding to a channel but failed to do so. An example of such an instance is when
- * there is insufficient capacity in our outbound channel.
- */
- LDKHTLCDestination_NextHopChannel,
- /**
- * Scenario where we are unsure of the next node to forward the HTLC to.
- */
- LDKHTLCDestination_UnknownNextHop,
- /**
- * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate
- * intercept HTLC.
- */
- LDKHTLCDestination_InvalidForward,
- /**
- * Failure scenario where an HTLC may have been forwarded to be intended for us,
- * but is invalid for some reason, so we reject it.
- *
- * Some of the reasons may include:
- * * HTLC Timeouts
- * * Expected MPP amount to claim does not equal HTLC total
- * * Claimable amount does not match expected amount
- */
- LDKHTLCDestination_FailedPayment,
- /**
- * Must be last for serialization purposes
- */
- LDKHTLCDestination_Sentinel,
-} LDKHTLCDestination_Tag;
-
-typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
- /**
- * The `node_id` of the next node. For backwards compatibility, this field is
- * marked as optional, versions prior to 0.0.110 may not always be able to provide
- * counterparty node information.
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKPublicKey node_id;
- /**
- * The outgoing `channel_id` between us and the next node.
- */
- struct LDKThirtyTwoBytes channel_id;
-} LDKHTLCDestination_LDKNextHopChannel_Body;
-
-typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
- /**
- * Short channel id we are requesting to forward an HTLC to.
- */
- uint64_t requested_forward_scid;
-} LDKHTLCDestination_LDKUnknownNextHop_Body;
-
-typedef struct LDKHTLCDestination_LDKInvalidForward_Body {
+typedef struct LDKC2Tuple__u168_u168Z {
/**
- * Short channel id we are requesting to forward an HTLC to.
+ * The element at position 0
*/
- uint64_t requested_forward_scid;
-} LDKHTLCDestination_LDKInvalidForward_Body;
-
-typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
+ struct LDKEightU16s a;
/**
- * The payment hash of the payment we attempted to process.
+ * The element at position 1
*/
- struct LDKThirtyTwoBytes payment_hash;
-} LDKHTLCDestination_LDKFailedPayment_Body;
-
-typedef struct MUST_USE_STRUCT LDKHTLCDestination {
- LDKHTLCDestination_Tag tag;
- union {
- LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
- LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
- LDKHTLCDestination_LDKInvalidForward_Body invalid_forward;
- LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
- };
-} LDKHTLCDestination;
+ struct LDKEightU16s b;
+} LDKC2Tuple__u168_u168Z;
/**
- * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not
+ * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
*/
-typedef enum LDKCOption_HTLCDestinationZ_Tag {
+typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag {
/**
- * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination
+ * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
*/
- LDKCOption_HTLCDestinationZ_Some,
+ LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some,
/**
- * When we're in this state, this COption_HTLCDestinationZ contains nothing
+ * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
*/
- LDKCOption_HTLCDestinationZ_None,
+ LDKCOption_C2Tuple_EightU16sEightU16sZZ_None,
/**
* Must be last for serialization purposes
*/
- LDKCOption_HTLCDestinationZ_Sentinel,
-} LDKCOption_HTLCDestinationZ_Tag;
+ LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel,
+} LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag;
-typedef struct LDKCOption_HTLCDestinationZ {
- LDKCOption_HTLCDestinationZ_Tag tag;
+typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ {
+ LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag;
union {
struct {
- struct LDKHTLCDestination some;
+ struct LDKC2Tuple__u168_u168Z some;
};
};
-} LDKCOption_HTLCDestinationZ;
+} LDKCOption_C2Tuple_EightU16sEightU16sZZ;
/**
- * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
+ * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
+typedef struct LDKCVec_NodeIdZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKCOption_HTLCDestinationZ *result;
+ struct LDKNodeId *data;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The number of elements pointed to by `data`.
*/
- struct LDKDecodeError *err;
-} LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
+ uintptr_t datalen;
+} LDKCVec_NodeIdZ;
+
+
/**
- * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A Record, unit of logging output with Metadata to enable filtering
+ * Module_path, file, line to inform on log's source
*/
-typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
+typedef struct MUST_USE_STRUCT LDKRecord {
/**
- * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * 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.
*/
- union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
+ LDKnativeRecord *inner;
/**
- * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
+ * 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 result_ok;
-} LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
+ bool is_owned;
+} LDKRecord;
/**
- * An enum which can either contain a crate::c_types::U128 or not
+ * A trait encapsulating the operations required of a logger
*/
-typedef enum LDKCOption_u128Z_Tag {
+typedef struct LDKLogger {
/**
- * When we're in this state, this COption_u128Z contains a crate::c_types::U128
+ * 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.
*/
- LDKCOption_u128Z_Some,
+ void *this_arg;
/**
- * When we're in this state, this COption_u128Z contains nothing
+ * Logs the `Record`
*/
- LDKCOption_u128Z_None,
+ void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
/**
- * Must be last for serialization purposes
+ * 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.
*/
- LDKCOption_u128Z_Sentinel,
-} LDKCOption_u128Z_Tag;
-
-typedef struct LDKCOption_u128Z {
- LDKCOption_u128Z_Tag tag;
- union {
- struct {
- struct LDKU128 some;
- };
- };
-} LDKCOption_u128Z;
+ void (*free)(void *this_arg);
+} LDKLogger;
/**
- * A reference to a transaction output.
- *
- * Differs from bitcoin::blockdata::transaction::OutPoint as the index is a u16 instead of u32
- * due to LN's restrictions on index values. Should reduce (possibly) unsafe conversions this way.
+ * Represents the network as nodes and channels between them
*/
-typedef struct MUST_USE_STRUCT LDKOutPoint {
+typedef struct MUST_USE_STRUCT LDKNetworkGraph {
/**
* 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.
*/
- LDKnativeOutPoint *inner;
+ LDKnativeNetworkGraph *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;
-} LDKOutPoint;
+} LDKNetworkGraph;
/**
- * Information about a spendable output to a P2WSH script.
+ * [`Score`] implementation using channel success probability distributions.
*
- * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
+ * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
+ * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
+ * When a payment is forwarded through a channel (but fails later in the route), we learn the
+ * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
+ *
+ * These bounds are then used to determine a success probability using the formula from
+ * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
+ * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
+ *
+ * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
+ * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
+ * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
+ * terms of the entire path's success probability. This allows the router to directly compare
+ * penalties for different paths. See the documentation of those parameters for the exact formulas.
+ *
+ * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
+ *
+ * Further, we track the history of our upper and lower liquidity bounds for each channel,
+ * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
+ * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
+ * formula, but using the history of a channel rather than our latest estimates for the liquidity
+ * bounds.
+ *
+ * # Note
+ *
+ * Mixing the `no-std` feature between serialization and deserialization results in undefined
+ * behavior.
+ *
+ * [1]: https://arxiv.org/abs/2107.05322
+ * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
+ * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
+ * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
+ * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
+ * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
*/
-typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
+typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
/**
* 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.
*/
- LDKnativeDelayedPaymentOutputDescriptor *inner;
+ LDKnativeProbabilisticScorer *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;
-} LDKDelayedPaymentOutputDescriptor;
+} LDKProbabilisticScorer;
+
+/**
+ * The contents of CResult_ProbabilisticScorerDecodeErrorZ
+ */
+typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKProbabilisticScorer *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_ProbabilisticScorerDecodeErrorZPtr;
+
+/**
+ * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::routing::scoring::ProbabilisticScorer 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_ProbabilisticScorerDecodeErrorZ {
+ /**
+ * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_ProbabilisticScorerDecodeErrorZ;
/**
- * Information about a spendable output to our \"payment key\".
- *
- * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
+ * Features used within an `init` message.
*/
-typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
+typedef struct MUST_USE_STRUCT LDKInitFeatures {
/**
* 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.
*/
- LDKnativeStaticPaymentOutputDescriptor *inner;
+ LDKnativeInitFeatures *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;
-} LDKStaticPaymentOutputDescriptor;
+} LDKInitFeatures;
/**
- * Describes the necessary information to spend a spendable output.
- *
- * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any
- * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able
- * to spend on-chain. The information needed to do this is provided in this enum, including the
- * outpoint describing which `txid` and output `index` is available, the full output which exists
- * at that `txid`/`index`, and any keys or other information required to sign.
- *
- * [`SpendableOutputs`]: crate::util::events::Event::SpendableOutputs
+ * The contents of CResult_InitFeaturesDecodeErrorZ
*/
-typedef enum LDKSpendableOutputDescriptor_Tag {
- /**
- * An output to a script which was provided via [`SignerProvider`] directly, either from
- * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already
- * know how to spend it. No secret keys are provided as LDK was never given any key.
- * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
- * on-chain using the payment preimage or after it has timed out.
- *
- * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey
- * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey
- */
- LDKSpendableOutputDescriptor_StaticOutput,
- /**
- * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
- * delay.
- *
- * The witness in the spending input should be:
- * ```bitcoin
- * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
- * ```
- *
- * Note that the `nSequence` field in the spending input must be set to
- * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not
- * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after
- * the outpoint confirms, see [BIP
- * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK
- * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height
- * is reached.
- *
- * These are generally the result of a \"revocable\" output to us, spendable only by us unless
- * it is an output from an old state which we broadcast (which should never happen).
- *
- * To derive the delayed payment key which is used to sign this input, you must pass the
- * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
- * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided
- * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be
- * generated without the secret key using [`chan_utils::derive_public_key`] and only the
- * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`].
- *
- * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
- * used in the witness script generation), you must pass the counterparty
- * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
- * [`ChannelSigner::provide_channel_parameters`]) and the provided
- * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
- * [`chan_utils::derive_public_revocation_key`].
- *
- * The witness script which is hashed and included in the output `script_pubkey` may be
- * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived
- * as explained above), our delayed payment pubkey (derived as explained above), and the
- * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to
- * [`chan_utils::get_revokeable_redeemscript`].
- */
- LDKSpendableOutputDescriptor_DelayedPaymentOutput,
- /**
- * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key
- * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness
- * in the spending input is, thus, simply:
- * ```bitcoin
- * <BIP 143 signature> <payment key>
- * ```
- *
- * These are generally the result of our counterparty having broadcast the current state,
- * allowing us to claim the non-HTLC-encumbered outputs immediately.
- */
- LDKSpendableOutputDescriptor_StaticPaymentOutput,
- /**
- * Must be last for serialization purposes
- */
- LDKSpendableOutputDescriptor_Sentinel,
-} LDKSpendableOutputDescriptor_Tag;
-
-typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
+typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
/**
- * The outpoint which is spendable.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKOutPoint outpoint;
+ struct LDKInitFeatures *result;
/**
- * The output which is referenced by the given outpoint.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKTxOut output;
-} LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
-
-typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
- LDKSpendableOutputDescriptor_Tag tag;
- union {
- LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
- struct {
- struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
- };
- struct {
- struct LDKStaticPaymentOutputDescriptor static_payment_output;
- };
- };
-} LDKSpendableOutputDescriptor;
+ struct LDKDecodeError *err;
+} LDKCResult_InitFeaturesDecodeErrorZPtr;
/**
- * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
- * This corresponds to std::vector in C++
+ * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::InitFeatures 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 LDKCVec_SpendableOutputDescriptorZ {
+typedef struct LDKCResult_InitFeaturesDecodeErrorZ {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKSpendableOutputDescriptor *data;
+ union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
/**
- * The number of elements pointed to by `data`.
+ * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
*/
- uintptr_t datalen;
-} LDKCVec_SpendableOutputDescriptorZ;
+ bool result_ok;
+} LDKCResult_InitFeaturesDecodeErrorZ;
/**
- * Features used within the channel_type field in an OpenChannel message.
- *
- * A channel is always of some known \"type\", describing the transaction formats used and the exact
- * semantics of our interaction with our peer.
- *
- * Note that because a channel is a specific type which is proposed by the opener and accepted by
- * the counterparty, only required features are allowed here.
- *
- * This is serialized differently from other feature types - it is not prefixed by a length, and
- * thus must only appear inside a TLV where its length is known in advance.
+ * Features used within a `channel_announcement` message.
*/
-typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
+typedef struct MUST_USE_STRUCT LDKChannelFeatures {
/**
* 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.
*/
- LDKnativeChannelTypeFeatures *inner;
+ LDKnativeChannelFeatures *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;
-} LDKChannelTypeFeatures;
+} LDKChannelFeatures;
/**
- * An Event which you should probably take some action in response to.
- *
- * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
- * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
- * written as it makes no sense to respond to it after reconnecting to peers).
+ * The contents of CResult_ChannelFeaturesDecodeErrorZ
*/
-typedef enum LDKEvent_Tag {
- /**
- * Used to indicate that the client should generate a funding transaction with the given
- * parameters and then call [`ChannelManager::funding_transaction_generated`].
- * Generated in [`ChannelManager`] message handling.
- * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
- * counterparty can steal your funds!
- *
- * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
- * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
- */
- LDKEvent_FundingGenerationReady,
+typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
/**
- * Indicates that we've been offered a payment and it needs to be claimed via calling
- * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
- *
- * Note that if the preimage is not known, you should call
- * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
- * to free up resources for this HTLC and avoid network congestion.
- * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
- * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
- * automatically failed.
- *
- * # Note
- * LDK will not stop an inbound payment from being paid multiple times, so multiple
- * `PaymentClaimable` events may be generated for the same payment.
- *
- * # Note
- * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
- *
- * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
- * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
- * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKEvent_PaymentClaimable,
+ struct LDKChannelFeatures *result;
/**
- * Indicates a payment has been claimed and we've received money!
- *
- * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
- * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
- * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
- * [`Event::PaymentClaimable`] event.
- *
- * # Note
- * LDK will not stop an inbound payment from being paid multiple times, so multiple
- * `PaymentClaimable` events may be generated for the same payment. If you then call
- * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
- * multiple `PaymentClaimed` events.
- *
- * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKEvent_PaymentClaimed,
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::ChannelFeatures 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_ChannelFeaturesDecodeErrorZ {
/**
- * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
- * and we got back the payment preimage for it).
- *
- * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
- * event. In this situation, you SHOULD treat this payment as having succeeded.
+ * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKEvent_PaymentSent,
+ union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
/**
- * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
- * provide failure information for each path attempt in the payment, including retries.
- *
- * This event is provided once there are no further pending HTLCs for the payment and the
- * payment is no longer retryable, due either to the [`Retry`] provided or
- * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
- *
- * [`Retry`]: crate::ln::channelmanager::Retry
- * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
*/
- LDKEvent_PaymentFailed,
+ bool result_ok;
+} LDKCResult_ChannelFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within a `node_announcement` message.
+ */
+typedef struct MUST_USE_STRUCT LDKNodeFeatures {
/**
- * Indicates that a path for an outbound payment was successful.
- *
- * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
- * [`Event::PaymentSent`] for obtaining the payment preimage.
+ * 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.
*/
- LDKEvent_PaymentPathSuccessful,
+ LDKnativeNodeFeatures *inner;
/**
- * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
- * handle the HTLC.
- *
- * Note that this does *not* indicate that all paths for an MPP payment have failed, see
- * [`Event::PaymentFailed`].
- *
- * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
- * been exhausted.
- *
- * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ * 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.
*/
- LDKEvent_PaymentPathFailed,
+ bool is_owned;
+} LDKNodeFeatures;
+
+/**
+ * The contents of CResult_NodeFeaturesDecodeErrorZ
+ */
+typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
/**
- * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKEvent_ProbeSuccessful,
+ struct LDKNodeFeatures *result;
/**
- * Indicates that a probe payment we sent failed at an intermediary node on the path.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKEvent_ProbeFailed,
+ struct LDKDecodeError *err;
+} LDKCResult_NodeFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::NodeFeatures 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_NodeFeaturesDecodeErrorZ {
/**
- * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
- * a time in the future.
- *
- * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
+ * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKEvent_PendingHTLCsForwardable,
+ union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
/**
- * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
- * you've encoded an intercept scid in the receiver's invoice route hints using
- * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
- *
- * [`ChannelManager::forward_intercepted_htlc`] or
- * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
- * their docs for more information.
- *
- * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
- * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
- * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
- * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
+ * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
*/
- LDKEvent_HTLCIntercepted,
+ bool result_ok;
+} LDKCResult_NodeFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within an invoice.
+ */
+typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
/**
- * Used to indicate that an output which you should know how to spend was confirmed on chain
- * and is now spendable.
- * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
- * counterparty spending them due to some kind of timeout. Thus, you need to store them
- * somewhere and spend them when you create on-chain transactions.
+ * 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.
*/
- LDKEvent_SpendableOutputs,
+ LDKnativeInvoiceFeatures *inner;
/**
- * This event is generated when a payment has been successfully forwarded through us and a
- * forwarding fee earned.
+ * 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.
*/
- LDKEvent_PaymentForwarded,
+ bool is_owned;
+} LDKInvoiceFeatures;
+
+/**
+ * The contents of CResult_InvoiceFeaturesDecodeErrorZ
+ */
+typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
/**
- * Used to indicate that a channel with the given `channel_id` is ready to
- * be used. This event is emitted either when the funding transaction has been confirmed
- * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
- * establishment.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKEvent_ChannelReady,
+ struct LDKInvoiceFeatures *result;
/**
- * Used to indicate that a previously opened channel with the given `channel_id` is in the
- * process of closure.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- LDKEvent_ChannelClosed,
+ struct LDKDecodeError *err;
+} LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::InvoiceFeatures 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_InvoiceFeaturesDecodeErrorZ {
/**
- * Used to indicate to the user that they can abandon the funding transaction and recycle the
- * inputs for another purpose.
+ * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKEvent_DiscardFunding,
+ union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
/**
- * Indicates a request to open a new channel by a peer.
- *
- * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
- * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
- *
- * The event is only triggered when a new open channel request is received and the
- * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
- *
- * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
- * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
- * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
*/
- LDKEvent_OpenChannelRequest,
+ bool result_ok;
+} LDKCResult_InvoiceFeaturesDecodeErrorZ;
+
+
+
+/**
+ * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo
+ */
+typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures {
/**
- * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
- * forward it.
- *
- * Some scenarios where this event may be sent include:
- * * Insufficient capacity in the outbound channel
- * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
- * * When an unknown SCID is requested for forwarding a payment.
- * * Claiming an amount for an MPP payment that exceeds the HTLC total
- * * The HTLC has timed out
- *
- * This event, however, does not get generated if an HTLC fails to meet the forwarding
- * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
+ * 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.
*/
- LDKEvent_HTLCHandlingFailed,
+ LDKnativeBlindedHopFeatures *inner;
/**
- * Must be last for serialization purposes
+ * 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.
*/
- LDKEvent_Sentinel,
-} LDKEvent_Tag;
+ bool is_owned;
+} LDKBlindedHopFeatures;
-typedef struct LDKEvent_LDKFundingGenerationReady_Body {
- /**
- * The random channel_id we picked which you'll need to pass into
- * [`ChannelManager::funding_transaction_generated`].
- *
- * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
- */
- struct LDKThirtyTwoBytes temporary_channel_id;
+/**
+ * The contents of CResult_BlindedHopFeaturesDecodeErrorZ
+ */
+typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr {
/**
- * The counterparty's node_id, which you'll need to pass back into
- * [`ChannelManager::funding_transaction_generated`].
- *
- * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKPublicKey counterparty_node_id;
+ struct LDKBlindedHopFeatures *result;
/**
- * The value, in satoshis, that the output should have.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uint64_t channel_value_satoshis;
+ struct LDKDecodeError *err;
+} LDKCResult_BlindedHopFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::BlindedHopFeatures 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_BlindedHopFeaturesDecodeErrorZ {
/**
- * The script which should be used in the transaction output.
+ * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKCVec_u8Z output_script;
+ union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents;
/**
- * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
- * random value for an inbound channel. This may be zero for objects serialized with LDK
- * versions prior to 0.0.113.
- *
- * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
*/
- struct LDKU128 user_channel_id;
-} LDKEvent_LDKFundingGenerationReady_Body;
+ bool result_ok;
+} LDKCResult_BlindedHopFeaturesDecodeErrorZ;
-typedef struct LDKEvent_LDKPaymentClaimable_Body {
+
+
+/**
+ * Features used within the channel_type field in an OpenChannel message.
+ *
+ * A channel is always of some known \"type\", describing the transaction formats used and the exact
+ * semantics of our interaction with our peer.
+ *
+ * Note that because a channel is a specific type which is proposed by the opener and accepted by
+ * the counterparty, only required features are allowed here.
+ *
+ * This is serialized differently from other feature types - it is not prefixed by a length, and
+ * thus must only appear inside a TLV where its length is known in advance.
+ */
+typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures {
/**
- * The node that will receive the payment after it has been claimed.
- * This is useful to identify payments received via [phantom nodes].
- * This field will always be filled in when the event was generated by LDK versions
- * 0.0.113 and above.
- *
- * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * 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.
*/
- struct LDKPublicKey receiver_node_id;
+ LDKnativeChannelTypeFeatures *inner;
/**
- * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
- * not stop you from registering duplicate payment hashes for inbound payments.
+ * 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.
*/
- struct LDKThirtyTwoBytes payment_hash;
+ bool is_owned;
+} LDKChannelTypeFeatures;
+
+/**
+ * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
+ */
+typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
/**
- * The value, in thousandths of a satoshi, that this payment is for.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- uint64_t amount_msat;
+ struct LDKChannelTypeFeatures *result;
/**
- * Information for claiming this received payment, based on whether the purpose of the
- * payment is to pay an invoice or to send a spontaneous payment.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKPaymentPurpose purpose;
+ struct LDKDecodeError *err;
+} LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr;
+
+/**
+ * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::ln::features::ChannelTypeFeatures 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_ChannelTypeFeaturesDecodeErrorZ {
/**
- * The `channel_id` indicating over which channel we received the payment.
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKThirtyTwoBytes via_channel_id;
+ union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
/**
- * The `user_channel_id` indicating over which channel we received the payment.
+ * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
*/
- struct LDKCOption_u128Z via_user_channel_id;
-} LDKEvent_LDKPaymentClaimable_Body;
+ bool result_ok;
+} LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
-typedef struct LDKEvent_LDKPaymentClaimed_Body {
- /**
- * The node that received the payment.
- * This is useful to identify payments which were received via [phantom nodes].
- * This field will always be filled in when the event was generated by LDK versions
- * 0.0.113 and above.
- *
- * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKPublicKey receiver_node_id;
+/**
+ * Some information provided on receipt of payment depends on whether the payment received is a
+ * spontaneous payment or a \"conventional\" lightning payment that's paying an invoice.
+ */
+typedef enum LDKPaymentPurpose_Tag {
/**
- * The payment hash of the claimed payment. Note that LDK will not stop you from
- * registering duplicate payment hashes for inbound payments.
+ * Information for receiving a payment that we generated an invoice for.
*/
- struct LDKThirtyTwoBytes payment_hash;
+ LDKPaymentPurpose_InvoicePayment,
/**
- * The value, in thousandths of a satoshi, that this payment is for.
+ * Because this is a spontaneous payment, the payer generated their own preimage rather than us
+ * (the payee) providing a preimage.
*/
- uint64_t amount_msat;
+ LDKPaymentPurpose_SpontaneousPayment,
/**
- * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
- * spontaneous payment.
+ * Must be last for serialization purposes
*/
- struct LDKPaymentPurpose purpose;
-} LDKEvent_LDKPaymentClaimed_Body;
+ LDKPaymentPurpose_Sentinel,
+} LDKPaymentPurpose_Tag;
-typedef struct LDKEvent_LDKPaymentSent_Body {
+typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body {
/**
- * The id returned by [`ChannelManager::send_payment`].
+ * The preimage to the payment_hash, if the payment hash (and secret) were fetched via
+ * [`ChannelManager::create_inbound_payment`]. If provided, this can be handed directly to
+ * [`ChannelManager::claim_funds`].
*
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
*
* Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKThirtyTwoBytes payment_id;
- /**
- * The preimage to the hash given to ChannelManager::send_payment.
- * Note that this serves as a payment receipt, if you wish to have such a thing, you must
- * store it somehow!
- */
struct LDKThirtyTwoBytes payment_preimage;
/**
- * The hash that was given to [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- */
- struct LDKThirtyTwoBytes payment_hash;
- /**
- * The total fee which was spent at intermediate hops in this payment, across all paths.
- *
- * Note that, like [`Route::get_total_fees`] this does *not* include any potential
- * overpayment to the recipient node.
- *
- * If the recipient or an intermediate node misbehaves and gives us free money, this may
- * overstate the amount paid, though this is unlikely.
+ * The \"payment secret\". This authenticates the sender to the recipient, preventing a
+ * number of deanonymization attacks during the routing process.
+ * It is provided here for your reference, however its accuracy is enforced directly by
+ * [`ChannelManager`] using the values you previously provided to
+ * [`ChannelManager::create_inbound_payment`] or
+ * [`ChannelManager::create_inbound_payment_for_hash`].
*
- * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`ChannelManager::create_inbound_payment`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment
+ * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
*/
- struct LDKCOption_u64Z fee_paid_msat;
-} LDKEvent_LDKPaymentSent_Body;
+ struct LDKThirtyTwoBytes payment_secret;
+} LDKPaymentPurpose_LDKInvoicePayment_Body;
-typedef struct LDKEvent_LDKPaymentFailed_Body {
+typedef struct MUST_USE_STRUCT LDKPaymentPurpose {
+ LDKPaymentPurpose_Tag tag;
+ union {
+ LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment;
+ struct {
+ struct LDKThirtyTwoBytes spontaneous_payment;
+ };
+ };
+} LDKPaymentPurpose;
+
+/**
+ * The contents of CResult_PaymentPurposeDecodeErrorZ
+ */
+typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr {
/**
- * The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::abandon_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKThirtyTwoBytes payment_id;
+ struct LDKPaymentPurpose *result;
/**
- * The hash that was given to [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- struct LDKThirtyTwoBytes payment_hash;
-} LDKEvent_LDKPaymentFailed_Body;
+ struct LDKDecodeError *err;
+} LDKCResult_PaymentPurposeDecodeErrorZPtr;
-typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
- /**
- * The id returned by [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- */
- struct LDKThirtyTwoBytes payment_id;
+/**
+ * A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::events::PaymentPurpose 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_PaymentPurposeDecodeErrorZ {
/**
- * The hash that was given to [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKThirtyTwoBytes payment_hash;
+ union LDKCResult_PaymentPurposeDecodeErrorZPtr contents;
/**
- * The payment path that was successful.
- *
- * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
+ * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state.
*/
- struct LDKCVec_RouteHopZ path;
-} LDKEvent_LDKPaymentPathSuccessful_Body;
+ bool result_ok;
+} LDKCResult_PaymentPurposeDecodeErrorZ;
-typedef struct LDKEvent_LDKPaymentPathFailed_Body {
+
+
+/**
+ * A [`channel_update`] message to be sent to or received from a peer.
+ *
+ * [`channel_update`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
+ */
+typedef struct MUST_USE_STRUCT LDKChannelUpdate {
/**
- * The id returned by [`ChannelManager::send_payment`] and used with
- * [`ChannelManager::abandon_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
- * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * 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.
*/
- struct LDKThirtyTwoBytes payment_id;
+ LDKnativeChannelUpdate *inner;
/**
- * The hash that was given to [`ChannelManager::send_payment`].
- *
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * 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.
*/
- struct LDKThirtyTwoBytes payment_hash;
+ bool is_owned;
+} LDKChannelUpdate;
+
+/**
+ * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion
+ * return packet by a node along the route. See [BOLT #4] for details.
+ *
+ * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md
+ */
+typedef enum LDKNetworkUpdate_Tag {
/**
- * Indicates the payment was rejected for some reason by the recipient. This implies that
- * the payment has failed, not just the route in question. If this is not set, the payment may
- * be retried via a different route.
+ * An error indicating a `channel_update` messages should be applied via
+ * [`NetworkGraph::update_channel`].
*/
- bool payment_failed_permanently;
+ LDKNetworkUpdate_ChannelUpdateMessage,
/**
- * Extra error details based on the failure type. May contain an update that needs to be
- * applied to the [`NetworkGraph`].
- *
- * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
+ * An error indicating that a channel failed to route a payment, which should be applied via
+ * [`NetworkGraph::channel_failed_permanent`] if permanent.
*/
- struct LDKPathFailure failure;
+ LDKNetworkUpdate_ChannelFailure,
/**
- * The payment path that failed.
+ * An error indicating that a node failed to route a payment, which should be applied via
+ * [`NetworkGraph::node_failed_permanent`] if permanent.
*/
- struct LDKCVec_RouteHopZ path;
+ LDKNetworkUpdate_NodeFailure,
/**
- * The channel responsible for the failed payment path.
- *
- * Note that for route hints or for the first hop in a path this may be an SCID alias and
- * may not refer to a channel in the public network graph. These aliases may also collide
- * with channels in the public network graph.
- *
- * If this is `Some`, then the corresponding channel should be avoided when the payment is
- * retried. May be `None` for older [`Event`] serializations.
+ * Must be last for serialization purposes
*/
- struct LDKCOption_u64Z short_channel_id;
+ LDKNetworkUpdate_Sentinel,
+} LDKNetworkUpdate_Tag;
+
+typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body {
/**
- * Parameters used by LDK to compute a new [`Route`] when retrying the failed payment path.
- *
- * [`Route`]: crate::routing::router::Route
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * The update to apply via [`NetworkGraph::update_channel`].
*/
- struct LDKRouteParameters retry;
-} LDKEvent_LDKPaymentPathFailed_Body;
+ struct LDKChannelUpdate msg;
+} LDKNetworkUpdate_LDKChannelUpdateMessage_Body;
-typedef struct LDKEvent_LDKProbeSuccessful_Body {
+typedef struct LDKNetworkUpdate_LDKChannelFailure_Body {
/**
- * The id returned by [`ChannelManager::send_probe`].
- *
- * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+ * The short channel id of the closed channel.
*/
- struct LDKThirtyTwoBytes payment_id;
+ uint64_t short_channel_id;
/**
- * The hash generated by [`ChannelManager::send_probe`].
- *
- * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+ * Whether the channel should be permanently removed or temporarily disabled until a new
+ * `channel_update` message is received.
*/
- struct LDKThirtyTwoBytes payment_hash;
+ bool is_permanent;
+} LDKNetworkUpdate_LDKChannelFailure_Body;
+
+typedef struct LDKNetworkUpdate_LDKNodeFailure_Body {
/**
- * The payment path that was successful.
+ * The node id of the failed node.
*/
- struct LDKCVec_RouteHopZ path;
-} LDKEvent_LDKProbeSuccessful_Body;
-
-typedef struct LDKEvent_LDKProbeFailed_Body {
+ struct LDKPublicKey node_id;
/**
- * The id returned by [`ChannelManager::send_probe`].
- *
- * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+ * Whether the node should be permanently removed from consideration or can be restored
+ * when a new `channel_update` message is received.
*/
- struct LDKThirtyTwoBytes payment_id;
+ bool is_permanent;
+} LDKNetworkUpdate_LDKNodeFailure_Body;
+
+typedef struct MUST_USE_STRUCT LDKNetworkUpdate {
+ LDKNetworkUpdate_Tag tag;
+ union {
+ LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message;
+ LDKNetworkUpdate_LDKChannelFailure_Body channel_failure;
+ LDKNetworkUpdate_LDKNodeFailure_Body node_failure;
+ };
+} LDKNetworkUpdate;
+
+/**
+ * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not
+ */
+typedef enum LDKCOption_NetworkUpdateZ_Tag {
/**
- * The hash generated by [`ChannelManager::send_probe`].
- *
- * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
+ * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate
*/
- struct LDKThirtyTwoBytes payment_hash;
+ LDKCOption_NetworkUpdateZ_Some,
/**
- * The payment path that failed.
+ * When we're in this state, this COption_NetworkUpdateZ contains nothing
*/
- struct LDKCVec_RouteHopZ path;
+ LDKCOption_NetworkUpdateZ_None,
/**
- * The channel responsible for the failed probe.
- *
- * Note that for route hints or for the first hop in a path this may be an SCID alias and
- * may not refer to a channel in the public network graph. These aliases may also collide
- * with channels in the public network graph.
+ * Must be last for serialization purposes
*/
- struct LDKCOption_u64Z short_channel_id;
-} LDKEvent_LDKProbeFailed_Body;
+ LDKCOption_NetworkUpdateZ_Sentinel,
+} LDKCOption_NetworkUpdateZ_Tag;
-typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
- /**
- * The minimum amount of time that should be waited prior to calling
- * process_pending_htlc_forwards. To increase the effort required to correlate payments,
- * you should wait a random amount of time in roughly the range (now + time_forwardable,
- * now + 5*time_forwardable).
- */
- uint64_t time_forwardable;
-} LDKEvent_LDKPendingHTLCsForwardable_Body;
+typedef struct LDKCOption_NetworkUpdateZ {
+ LDKCOption_NetworkUpdateZ_Tag tag;
+ union {
+ struct {
+ struct LDKNetworkUpdate some;
+ };
+ };
+} LDKCOption_NetworkUpdateZ;
-typedef struct LDKEvent_LDKHTLCIntercepted_Body {
+/**
+ * When the payment path failure took place and extra details about it. [`PathFailure::OnPath`] may
+ * contain a [`NetworkUpdate`] that needs to be applied to the [`NetworkGraph`].
+ *
+ * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
+ * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
+ */
+typedef enum LDKPathFailure_Tag {
/**
- * An id to help LDK identify which HTLC is being forwarded or failed.
+ * We failed to initially send the payment and no HTLC was committed to. Contains the relevant
+ * error.
*/
- struct LDKThirtyTwoBytes intercept_id;
+ LDKPathFailure_InitialSend,
/**
- * The fake scid that was programmed as the next hop's scid, generated using
- * [`ChannelManager::get_intercept_scid`].
- *
- * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
+ * A hop on the path failed to forward our payment.
*/
- uint64_t requested_next_hop_scid;
+ LDKPathFailure_OnPath,
/**
- * The payment hash used for this HTLC.
+ * Must be last for serialization purposes
*/
- struct LDKThirtyTwoBytes payment_hash;
+ LDKPathFailure_Sentinel,
+} LDKPathFailure_Tag;
+
+typedef struct LDKPathFailure_LDKInitialSend_Body {
/**
- * How many msats were received on the inbound edge of this HTLC.
+ * The error surfaced from initial send.
*/
- uint64_t inbound_amount_msat;
+ struct LDKAPIError err;
+} LDKPathFailure_LDKInitialSend_Body;
+
+typedef struct LDKPathFailure_LDKOnPath_Body {
/**
- * How many msats the payer intended to route to the next node. Depending on the reason you are
- * intercepting this payment, you might take a fee by forwarding less than this amount.
+ * If present, this [`NetworkUpdate`] should be applied to the [`NetworkGraph`] so that routing
+ * decisions can take into account the update.
*
- * Note that LDK will NOT check that expected fees were factored into this value. You MUST
- * check that whatever fee you want has been included here or subtract it as required. Further,
- * LDK will not stop you from forwarding more than you received.
+ * [`NetworkUpdate`]: crate::routing::gossip::NetworkUpdate
+ * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
*/
- uint64_t expected_outbound_amount_msat;
-} LDKEvent_LDKHTLCIntercepted_Body;
+ struct LDKCOption_NetworkUpdateZ network_update;
+} LDKPathFailure_LDKOnPath_Body;
-typedef struct LDKEvent_LDKSpendableOutputs_Body {
+typedef struct MUST_USE_STRUCT LDKPathFailure {
+ LDKPathFailure_Tag tag;
+ union {
+ LDKPathFailure_LDKInitialSend_Body initial_send;
+ LDKPathFailure_LDKOnPath_Body on_path;
+ };
+} LDKPathFailure;
+
+/**
+ * An enum which can either contain a crate::lightning::events::PathFailure or not
+ */
+typedef enum LDKCOption_PathFailureZ_Tag {
/**
- * The outputs which you should store as spendable by you.
+ * When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure
*/
- struct LDKCVec_SpendableOutputDescriptorZ outputs;
-} LDKEvent_LDKSpendableOutputs_Body;
-
-typedef struct LDKEvent_LDKPaymentForwarded_Body {
+ LDKCOption_PathFailureZ_Some,
/**
- * The incoming channel between the previous node and us. This is only `None` for events
- * generated or serialized by versions prior to 0.0.107.
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * When we're in this state, this COption_PathFailureZ contains nothing
*/
- struct LDKThirtyTwoBytes prev_channel_id;
+ LDKCOption_PathFailureZ_None,
/**
- * The outgoing channel between the next node and us. This is only `None` for events
- * generated or serialized by versions prior to 0.0.107.
- *
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Must be last for serialization purposes
*/
- struct LDKThirtyTwoBytes next_channel_id;
+ LDKCOption_PathFailureZ_Sentinel,
+} LDKCOption_PathFailureZ_Tag;
+
+typedef struct LDKCOption_PathFailureZ {
+ LDKCOption_PathFailureZ_Tag tag;
+ union {
+ struct {
+ struct LDKPathFailure some;
+ };
+ };
+} LDKCOption_PathFailureZ;
+
+/**
+ * The contents of CResult_COption_PathFailureZDecodeErrorZ
+ */
+typedef union LDKCResult_COption_PathFailureZDecodeErrorZPtr {
/**
- * The fee, in milli-satoshis, which was earned as a result of the payment.
- *
- * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
- * was pending, the amount the next hop claimed will have been rounded down to the nearest
- * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
- * claimed the full value in millisatoshis from the source. In this case,
- * `claim_from_onchain_tx` will be set.
- *
- * If the channel which sent us the payment has been force-closed, we will claim the funds
- * via an on-chain transaction. In that case we do not yet know the on-chain transaction
- * fees which we will spend and will instead set this to `None`. It is possible duplicate
- * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
- * `None`.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCOption_u64Z fee_earned_msat;
+ struct LDKCOption_PathFailureZ *result;
/**
- * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
- * transaction.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- bool claim_from_onchain_tx;
-} LDKEvent_LDKPaymentForwarded_Body;
+ struct LDKDecodeError *err;
+} LDKCResult_COption_PathFailureZDecodeErrorZPtr;
-typedef struct LDKEvent_LDKChannelReady_Body {
+/**
+ * A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_COption_PathFailureZDecodeErrorZ {
/**
- * The channel_id of the channel that is ready.
+ * The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- struct LDKThirtyTwoBytes channel_id;
+ union LDKCResult_COption_PathFailureZDecodeErrorZPtr contents;
/**
- * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
- * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
- * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
- * `user_channel_id` will be randomized for an inbound channel.
- *
- * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
- * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
- * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ * Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state.
*/
- struct LDKU128 user_channel_id;
+ bool result_ok;
+} LDKCResult_COption_PathFailureZDecodeErrorZ;
+
+
+
+/**
+ * Struct to `Display` fields in a safe way using `PrintableString`
+ */
+typedef struct MUST_USE_STRUCT LDKUntrustedString {
/**
- * The node_id of the channel counterparty.
+ * 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.
*/
- struct LDKPublicKey counterparty_node_id;
+ LDKnativeUntrustedString *inner;
/**
- * The features that this channel will operate with.
+ * 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.
*/
- struct LDKChannelTypeFeatures channel_type;
-} LDKEvent_LDKChannelReady_Body;
+ bool is_owned;
+} LDKUntrustedString;
-typedef struct LDKEvent_LDKChannelClosed_Body {
+/**
+ * The reason the channel was closed. See individual variants more details.
+ */
+typedef enum LDKClosureReason_Tag {
/**
- * The channel_id of the channel which has been closed. Note that on-chain transactions
- * resolving the channel are likely still awaiting confirmation.
+ * Closure generated from receiving a peer error message.
+ *
+ * Our counterparty may have broadcasted their latest commitment state, and we have
+ * as well.
*/
- struct LDKThirtyTwoBytes channel_id;
+ LDKClosureReason_CounterpartyForceClosed,
/**
- * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
- * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
- * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
- * `user_channel_id` will be randomized for inbound channels.
- * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
- * zero for objects serialized with LDK versions prior to 0.0.102.
+ * Closure generated from [`ChannelManager::force_close_channel`], called by the user.
*
- * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
- * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
- * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ * [`ChannelManager::force_close_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel.
*/
- struct LDKU128 user_channel_id;
+ LDKClosureReason_HolderForceClosed,
/**
- * The reason the channel was closed.
+ * The channel was closed after negotiating a cooperative close and we've now broadcasted
+ * the cooperative close transaction. Note the shutdown may have been initiated by us.
*/
- struct LDKClosureReason reason;
-} LDKEvent_LDKChannelClosed_Body;
-
-typedef struct LDKEvent_LDKDiscardFunding_Body {
+ LDKClosureReason_CooperativeClosure,
/**
- * The channel_id of the channel which has been closed.
+ * A commitment transaction was confirmed on chain, closing the channel. Most likely this
+ * commitment transaction came from our counterparty, but it may also have come from
+ * a copy of our own `ChannelMonitor`.
*/
- struct LDKThirtyTwoBytes channel_id;
+ LDKClosureReason_CommitmentTxConfirmed,
/**
- * The full transaction received from the user
+ * The funding transaction failed to confirm in a timely manner on an inbound channel.
*/
- struct LDKTransaction transaction;
-} LDKEvent_LDKDiscardFunding_Body;
-
-typedef struct LDKEvent_LDKOpenChannelRequest_Body {
+ LDKClosureReason_FundingTimedOut,
/**
- * The temporary channel ID of the channel requested to be opened.
- *
- * When responding to the request, the `temporary_channel_id` should be passed
- * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
- * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
- *
- * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
- * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
+ * Closure generated from processing an event, likely a HTLC forward/relay/reception.
*/
- struct LDKThirtyTwoBytes temporary_channel_id;
+ LDKClosureReason_ProcessingError,
/**
- * The node_id of the counterparty requesting to open the channel.
+ * The peer disconnected prior to funding completing. In this case the spec mandates that we
+ * forget the channel entirely - we can attempt again if the peer reconnects.
*
- * When responding to the request, the `counterparty_node_id` should be passed
- * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
- * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
- * request.
+ * This includes cases where we restarted prior to funding completion, including prior to the
+ * initial [`ChannelMonitor`] persistence completing.
*
- * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
- * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
+ * In LDK versions prior to 0.0.107 this could also occur if we were unable to connect to the
+ * peer because of mutual incompatibility between us and our channel counterparty.
+ *
+ * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
*/
- struct LDKPublicKey counterparty_node_id;
+ LDKClosureReason_DisconnectedPeer,
/**
- * The channel value of the requested channel.
+ * Closure generated from `ChannelManager::read` if the [`ChannelMonitor`] is newer than
+ * the [`ChannelManager`] deserialized.
+ *
+ * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
*/
- uint64_t funding_satoshis;
+ LDKClosureReason_OutdatedChannelManager,
/**
- * Our starting balance in the channel if the request is accepted, in milli-satoshi.
+ * Must be last for serialization purposes
*/
- uint64_t push_msat;
+ LDKClosureReason_Sentinel,
+} LDKClosureReason_Tag;
+
+typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body {
/**
- * The features that this channel will operate with. If you reject the channel, a
- * well-behaved counterparty may automatically re-attempt the channel with a new set of
- * feature flags.
- *
- * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
- * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
- * 0.0.106.
+ * The error which the peer sent us.
*
- * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
- * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
- * 0.0.107. Channels setting this type also need to get manually accepted via
- * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
- * or will be rejected otherwise.
+ * Be careful about printing the peer_msg, a well-crafted message could exploit
+ * a security vulnerability in the terminal emulator or the logging subsystem.
+ * To be safe, use `Display` on `UntrustedString`
*
- * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`UntrustedString`]: crate::util::string::UntrustedString
*/
- struct LDKChannelTypeFeatures channel_type;
-} LDKEvent_LDKOpenChannelRequest_Body;
+ struct LDKUntrustedString peer_msg;
+} LDKClosureReason_LDKCounterpartyForceClosed_Body;
-typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
- /**
- * The channel over which the HTLC was received.
- */
- struct LDKThirtyTwoBytes prev_channel_id;
+typedef struct LDKClosureReason_LDKProcessingError_Body {
/**
- * Destination of the HTLC that failed to be processed.
+ * A developer-readable error message which we generated.
*/
- struct LDKHTLCDestination failed_next_destination;
-} LDKEvent_LDKHTLCHandlingFailed_Body;
+ struct LDKStr err;
+} LDKClosureReason_LDKProcessingError_Body;
-typedef struct MUST_USE_STRUCT LDKEvent {
- LDKEvent_Tag tag;
+typedef struct MUST_USE_STRUCT LDKClosureReason {
+ LDKClosureReason_Tag tag;
union {
- LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
- LDKEvent_LDKPaymentClaimable_Body payment_claimable;
- LDKEvent_LDKPaymentClaimed_Body payment_claimed;
- LDKEvent_LDKPaymentSent_Body payment_sent;
- LDKEvent_LDKPaymentFailed_Body payment_failed;
- LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
- LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
- LDKEvent_LDKProbeSuccessful_Body probe_successful;
- LDKEvent_LDKProbeFailed_Body probe_failed;
- LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
- LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted;
- LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
- LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
- LDKEvent_LDKChannelReady_Body channel_ready;
- LDKEvent_LDKChannelClosed_Body channel_closed;
- LDKEvent_LDKDiscardFunding_Body discard_funding;
- LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
- LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
+ LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed;
+ LDKClosureReason_LDKProcessingError_Body processing_error;
};
-} LDKEvent;
+} LDKClosureReason;
/**
- * An enum which can either contain a crate::lightning::util::events::Event or not
+ * An enum which can either contain a crate::lightning::events::ClosureReason or not
*/
-typedef enum LDKCOption_EventZ_Tag {
+typedef enum LDKCOption_ClosureReasonZ_Tag {
/**
- * When we're in this state, this COption_EventZ contains a crate::lightning::util::events::Event
+ * When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason
*/
- LDKCOption_EventZ_Some,
+ LDKCOption_ClosureReasonZ_Some,
/**
- * When we're in this state, this COption_EventZ contains nothing
+ * When we're in this state, this COption_ClosureReasonZ contains nothing
*/
- LDKCOption_EventZ_None,
+ LDKCOption_ClosureReasonZ_None,
/**
* Must be last for serialization purposes
*/
- LDKCOption_EventZ_Sentinel,
-} LDKCOption_EventZ_Tag;
+ LDKCOption_ClosureReasonZ_Sentinel,
+} LDKCOption_ClosureReasonZ_Tag;
-typedef struct LDKCOption_EventZ {
- LDKCOption_EventZ_Tag tag;
+typedef struct LDKCOption_ClosureReasonZ {
+ LDKCOption_ClosureReasonZ_Tag tag;
union {
struct {
- struct LDKEvent some;
+ struct LDKClosureReason some;
};
};
-} LDKCOption_EventZ;
+} LDKCOption_ClosureReasonZ;
/**
- * The contents of CResult_COption_EventZDecodeErrorZ
+ * The contents of CResult_COption_ClosureReasonZDecodeErrorZ
*/
-typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
+typedef union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKCOption_EventZ *result;
+ struct LDKCOption_ClosureReasonZ *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_EventZDecodeErrorZPtr;
+} LDKCResult_COption_ClosureReasonZDecodeErrorZPtr;
/**
- * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_ClosureReasonZ 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_EventZDecodeErrorZ {
+typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ {
/**
- * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
+ * The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_COption_EventZDecodeErrorZPtr contents;
+ union LDKCResult_COption_ClosureReasonZDecodeErrorZPtr contents;
/**
- * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
+ * Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_COption_EventZDecodeErrorZ;
-
-
+} LDKCResult_COption_ClosureReasonZDecodeErrorZ;
/**
- * An [`accept_channel`] message to be sent to or received from a peer.
- *
- * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
+ * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`].
*/
-typedef struct MUST_USE_STRUCT LDKAcceptChannel {
+typedef enum LDKHTLCDestination_Tag {
/**
- * 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.
+ * We tried forwarding to a channel but failed to do so. An example of such an instance is when
+ * there is insufficient capacity in our outbound channel.
*/
- LDKnativeAcceptChannel *inner;
+ LDKHTLCDestination_NextHopChannel,
/**
- * 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.
+ * Scenario where we are unsure of the next node to forward the HTLC to.
*/
- bool is_owned;
-} LDKAcceptChannel;
-
-
-
-/**
- * An [`open_channel`] message to be sent to or received from a peer.
- *
- * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
- */
-typedef struct MUST_USE_STRUCT LDKOpenChannel {
+ LDKHTLCDestination_UnknownNextHop,
/**
- * 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.
+ * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate
+ * intercept HTLC.
*/
- LDKnativeOpenChannel *inner;
+ LDKHTLCDestination_InvalidForward,
/**
- * 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.
+ * Failure scenario where an HTLC may have been forwarded to be intended for us,
+ * but is invalid for some reason, so we reject it.
+ *
+ * Some of the reasons may include:
+ * * HTLC Timeouts
+ * * Excess HTLCs for a payment that we have already fully received, over-paying for the
+ * payment,
+ * * The counterparty node modified the HTLC in transit,
+ * * A probing attack where an intermediary node is trying to detect if we are the ultimate
+ * recipient for a payment.
*/
- bool is_owned;
-} LDKOpenChannel;
-
+ LDKHTLCDestination_FailedPayment,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKHTLCDestination_Sentinel,
+} LDKHTLCDestination_Tag;
+typedef struct LDKHTLCDestination_LDKNextHopChannel_Body {
+ /**
+ * The `node_id` of the next node. For backwards compatibility, this field is
+ * marked as optional, versions prior to 0.0.110 may not always be able to provide
+ * counterparty node information.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The outgoing `channel_id` between us and the next node.
+ */
+ struct LDKThirtyTwoBytes channel_id;
+} LDKHTLCDestination_LDKNextHopChannel_Body;
-/**
- * A [`funding_created`] message to be sent to or received from a peer.
- *
- * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
- */
-typedef struct MUST_USE_STRUCT LDKFundingCreated {
+typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body {
/**
- * 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.
+ * Short channel id we are requesting to forward an HTLC to.
*/
- LDKnativeFundingCreated *inner;
+ uint64_t requested_forward_scid;
+} LDKHTLCDestination_LDKUnknownNextHop_Body;
+
+typedef struct LDKHTLCDestination_LDKInvalidForward_Body {
/**
- * 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.
+ * Short channel id we are requesting to forward an HTLC to.
*/
- bool is_owned;
-} LDKFundingCreated;
+ uint64_t requested_forward_scid;
+} LDKHTLCDestination_LDKInvalidForward_Body;
+typedef struct LDKHTLCDestination_LDKFailedPayment_Body {
+ /**
+ * The payment hash of the payment we attempted to process.
+ */
+ struct LDKThirtyTwoBytes payment_hash;
+} LDKHTLCDestination_LDKFailedPayment_Body;
+typedef struct MUST_USE_STRUCT LDKHTLCDestination {
+ LDKHTLCDestination_Tag tag;
+ union {
+ LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel;
+ LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop;
+ LDKHTLCDestination_LDKInvalidForward_Body invalid_forward;
+ LDKHTLCDestination_LDKFailedPayment_Body failed_payment;
+ };
+} LDKHTLCDestination;
/**
- * A [`funding_signed`] message to be sent to or received from a peer.
- *
- * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
+ * An enum which can either contain a crate::lightning::events::HTLCDestination or not
*/
-typedef struct MUST_USE_STRUCT LDKFundingSigned {
+typedef enum LDKCOption_HTLCDestinationZ_Tag {
/**
- * 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.
+ * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination
*/
- LDKnativeFundingSigned *inner;
+ LDKCOption_HTLCDestinationZ_Some,
/**
- * 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.
+ * When we're in this state, this COption_HTLCDestinationZ contains nothing
*/
- bool is_owned;
-} LDKFundingSigned;
-
+ LDKCOption_HTLCDestinationZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_HTLCDestinationZ_Sentinel,
+} LDKCOption_HTLCDestinationZ_Tag;
+typedef struct LDKCOption_HTLCDestinationZ {
+ LDKCOption_HTLCDestinationZ_Tag tag;
+ union {
+ struct {
+ struct LDKHTLCDestination some;
+ };
+ };
+} LDKCOption_HTLCDestinationZ;
/**
- * A [`channel_ready`] message to be sent to or received from a peer.
- *
- * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
+ * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ
*/
-typedef struct MUST_USE_STRUCT LDKChannelReady {
+typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr {
/**
- * 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.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKnativeChannelReady *inner;
+ struct LDKCOption_HTLCDestinationZ *result;
/**
- * 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.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- bool is_owned;
-} LDKChannelReady;
-
-
+ struct LDKDecodeError *err;
+} LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr;
/**
- * An [`announcement_signatures`] message to be sent to or received from a peer.
- *
- * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
+ * A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_HTLCDestinationZ 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 MUST_USE_STRUCT LDKAnnouncementSignatures {
+typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ {
/**
- * 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.
+ * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKnativeAnnouncementSignatures *inner;
+ union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents;
/**
- * 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.
+ * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state.
*/
- bool is_owned;
-} LDKAnnouncementSignatures;
-
-
+ bool result_ok;
+} LDKCResult_COption_HTLCDestinationZDecodeErrorZ;
/**
- * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment
- * transaction updates if they were pending.
+ * The contents of CResult_PaymentFailureReasonDecodeErrorZ
*/
-typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
+typedef union LDKCResult_PaymentFailureReasonDecodeErrorZPtr {
/**
- * 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.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- LDKnativeCommitmentUpdate *inner;
+ enum LDKPaymentFailureReason *result;
/**
- * 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.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- bool is_owned;
-} LDKCommitmentUpdate;
-
-
+ struct LDKDecodeError *err;
+} LDKCResult_PaymentFailureReasonDecodeErrorZPtr;
/**
- * A [`revoke_and_ack`] message to be sent to or received from a peer.
- *
- * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack
+ * A CResult_PaymentFailureReasonDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::events::PaymentFailureReason 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 MUST_USE_STRUCT LDKRevokeAndACK {
+typedef struct LDKCResult_PaymentFailureReasonDecodeErrorZ {
/**
- * 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.
+ * The contents of this CResult_PaymentFailureReasonDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- LDKnativeRevokeAndACK *inner;
+ union LDKCResult_PaymentFailureReasonDecodeErrorZPtr contents;
/**
- * 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.
+ * Whether this CResult_PaymentFailureReasonDecodeErrorZ represents a success state.
*/
- bool is_owned;
-} LDKRevokeAndACK;
-
-
+ bool result_ok;
+} LDKCResult_PaymentFailureReasonDecodeErrorZ;
/**
- * A [`closing_signed`] message to be sent to or received from a peer.
- *
- * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed
+ * An enum which can either contain a crate::c_types::U128 or not
*/
-typedef struct MUST_USE_STRUCT LDKClosingSigned {
+typedef enum LDKCOption_u128Z_Tag {
/**
- * 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.
+ * When we're in this state, this COption_u128Z contains a crate::c_types::U128
*/
- LDKnativeClosingSigned *inner;
+ LDKCOption_u128Z_Some,
/**
- * 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.
+ * When we're in this state, this COption_u128Z contains nothing
*/
- bool is_owned;
-} LDKClosingSigned;
-
+ LDKCOption_u128Z_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_u128Z_Sentinel,
+} LDKCOption_u128Z_Tag;
+typedef struct LDKCOption_u128Z {
+ LDKCOption_u128Z_Tag tag;
+ union {
+ struct {
+ struct LDKU128 some;
+ };
+ };
+} LDKCOption_u128Z;
/**
- * A [`shutdown`] message to be sent to or received from a peer.
- *
- * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown
+ * An enum which can either contain a crate::lightning::events::PaymentFailureReason or not
*/
-typedef struct MUST_USE_STRUCT LDKShutdown {
+typedef enum LDKCOption_PaymentFailureReasonZ_Tag {
/**
- * 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.
+ * When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason
*/
- LDKnativeShutdown *inner;
+ LDKCOption_PaymentFailureReasonZ_Some,
/**
- * 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.
+ * When we're in this state, this COption_PaymentFailureReasonZ contains nothing
*/
- bool is_owned;
-} LDKShutdown;
+ LDKCOption_PaymentFailureReasonZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_PaymentFailureReasonZ_Sentinel,
+} LDKCOption_PaymentFailureReasonZ_Tag;
+
+typedef struct LDKCOption_PaymentFailureReasonZ {
+ LDKCOption_PaymentFailureReasonZ_Tag tag;
+ union {
+ struct {
+ enum LDKPaymentFailureReason some;
+ };
+ };
+} LDKCOption_PaymentFailureReasonZ;
/**
- * A [`channel_reestablish`] message to be sent to or received from a peer.
+ * Information about a spendable output to a P2WSH script.
*
- * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
+ * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
*/
-typedef struct MUST_USE_STRUCT LDKChannelReestablish {
+typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor {
/**
* 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.
*/
- LDKnativeChannelReestablish *inner;
+ LDKnativeDelayedPaymentOutputDescriptor *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;
-} LDKChannelReestablish;
+} LDKDelayedPaymentOutputDescriptor;
/**
- * A [`channel_announcement`] message to be sent to or received from a peer.
+ * Information about a spendable output to our \"payment key\".
*
- * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
+ * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
*/
-typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
+typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor {
/**
* 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.
*/
- LDKnativeChannelAnnouncement *inner;
+ LDKnativeStaticPaymentOutputDescriptor *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;
-} LDKChannelAnnouncement;
-
-
+} LDKStaticPaymentOutputDescriptor;
/**
- * A [`node_announcement`] message to be sent to or received from a peer.
+ * Describes the necessary information to spend a spendable output.
*
- * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
+ * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any
+ * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able
+ * to spend on-chain. The information needed to do this is provided in this enum, including the
+ * outpoint describing which `txid` and output `index` is available, the full output which exists
+ * at that `txid`/`index`, and any keys or other information required to sign.
+ *
+ * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs
*/
-typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
+typedef enum LDKSpendableOutputDescriptor_Tag {
/**
- * 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.
+ * An output to a script which was provided via [`SignerProvider`] directly, either from
+ * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already
+ * know how to spend it. No secret keys are provided as LDK was never given any key.
+ * These may include outputs from a transaction punishing our counterparty or claiming an HTLC
+ * on-chain using the payment preimage or after it has timed out.
+ *
+ * [`get_shutdown_scriptpubkey`]: SignerProvider::get_shutdown_scriptpubkey
+ * [`get_destination_script`]: SignerProvider::get_shutdown_scriptpubkey
*/
- LDKnativeNodeAnnouncement *inner;
+ LDKSpendableOutputDescriptor_StaticOutput,
/**
- * 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.
+ * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV`
+ * delay.
+ *
+ * The witness in the spending input should be:
+ * ```bitcoin
+ * <BIP 143 signature> <empty vector> (MINIMALIF standard rule) <provided witnessScript>
+ * ```
+ *
+ * Note that the `nSequence` field in the spending input must be set to
+ * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not
+ * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after
+ * the outpoint confirms, see [BIP
+ * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK
+ * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height
+ * is reached.
+ *
+ * These are generally the result of a \"revocable\" output to us, spendable only by us unless
+ * it is an output from an old state which we broadcast (which should never happen).
+ *
+ * To derive the delayed payment key which is used to sign this input, you must pass the
+ * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the
+ * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`ChannelSigner::pubkeys`]) and the provided
+ * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be
+ * generated without the secret key using [`chan_utils::derive_public_key`] and only the
+ * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`ChannelSigner::pubkeys`].
+ *
+ * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is
+ * used in the witness script generation), you must pass the counterparty
+ * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to
+ * [`ChannelSigner::provide_channel_parameters`]) and the provided
+ * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to
+ * [`chan_utils::derive_public_revocation_key`].
+ *
+ * The witness script which is hashed and included in the output `script_pubkey` may be
+ * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived
+ * as explained above), our delayed payment pubkey (derived as explained above), and the
+ * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to
+ * [`chan_utils::get_revokeable_redeemscript`].
*/
- bool is_owned;
-} LDKNodeAnnouncement;
+ LDKSpendableOutputDescriptor_DelayedPaymentOutput,
+ /**
+ * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key
+ * which corresponds to the `payment_point` in [`ChannelSigner::pubkeys`]). The witness
+ * in the spending input is, thus, simply:
+ * ```bitcoin
+ * <BIP 143 signature> <payment key>
+ * ```
+ *
+ * These are generally the result of our counterparty having broadcast the current state,
+ * allowing us to claim the non-HTLC-encumbered outputs immediately.
+ */
+ LDKSpendableOutputDescriptor_StaticPaymentOutput,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKSpendableOutputDescriptor_Sentinel,
+} LDKSpendableOutputDescriptor_Tag;
+typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body {
+ /**
+ * The outpoint which is spendable.
+ */
+ struct LDKOutPoint outpoint;
+ /**
+ * The output which is referenced by the given outpoint.
+ */
+ struct LDKTxOut output;
+} LDKSpendableOutputDescriptor_LDKStaticOutput_Body;
+typedef struct MUST_USE_STRUCT LDKSpendableOutputDescriptor {
+ LDKSpendableOutputDescriptor_Tag tag;
+ union {
+ LDKSpendableOutputDescriptor_LDKStaticOutput_Body static_output;
+ struct {
+ struct LDKDelayedPaymentOutputDescriptor delayed_payment_output;
+ };
+ struct {
+ struct LDKStaticPaymentOutputDescriptor static_payment_output;
+ };
+ };
+} LDKSpendableOutputDescriptor;
/**
- * An [`error`] message to be sent to or received from a peer.
- *
- * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
+ * A dynamically-allocated array of crate::lightning::chain::keysinterface::SpendableOutputDescriptors of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct MUST_USE_STRUCT LDKErrorMessage {
+typedef struct LDKCVec_SpendableOutputDescriptorZ {
/**
- * 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.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- LDKnativeErrorMessage *inner;
+ struct LDKSpendableOutputDescriptor *data;
/**
- * 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.
+ * The number of elements pointed to by `data`.
*/
- bool is_owned;
-} LDKErrorMessage;
-
-
+ uintptr_t datalen;
+} LDKCVec_SpendableOutputDescriptorZ;
/**
- * A [`warning`] message to be sent to or received from a peer.
+ * An Event which you should probably take some action in response to.
*
- * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
+ * Note that while Writeable and Readable are implemented for Event, you probably shouldn't use
+ * them directly as they don't round-trip exactly (for example FundingGenerationReady is never
+ * written as it makes no sense to respond to it after reconnecting to peers).
*/
-typedef struct MUST_USE_STRUCT LDKWarningMessage {
+typedef enum LDKEvent_Tag {
/**
- * 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.
+ * Used to indicate that the client should generate a funding transaction with the given
+ * parameters and then call [`ChannelManager::funding_transaction_generated`].
+ * Generated in [`ChannelManager`] message handling.
+ * Note that *all inputs* in the funding transaction must spend SegWit outputs or your
+ * counterparty can steal your funds!
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
*/
- LDKnativeWarningMessage *inner;
+ LDKEvent_FundingGenerationReady,
/**
- * 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.
+ * Indicates that we've been offered a payment and it needs to be claimed via calling
+ * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`].
+ *
+ * Note that if the preimage is not known, you should call
+ * [`ChannelManager::fail_htlc_backwards`] or [`ChannelManager::fail_htlc_backwards_with_reason`]
+ * to free up resources for this HTLC and avoid network congestion.
+ * If you fail to call either [`ChannelManager::claim_funds`], [`ChannelManager::fail_htlc_backwards`],
+ * or [`ChannelManager::fail_htlc_backwards_with_reason`] within the HTLC's timeout, the HTLC will be
+ * automatically failed.
+ *
+ * # Note
+ * LDK will not stop an inbound payment from being paid multiple times, so multiple
+ * `PaymentClaimable` events may be generated for the same payment. In such a case it is
+ * polite (and required in the lightning specification) to fail the payment the second time
+ * and give the sender their money back rather than accepting double payment.
+ *
+ * # Note
+ * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier.
+ *
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
+ * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards
+ * [`ChannelManager::fail_htlc_backwards_with_reason`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards_with_reason
*/
- bool is_owned;
-} LDKWarningMessage;
-
-/**
- * Used to put an error message in a [`LightningError`].
- */
-typedef enum LDKErrorAction_Tag {
+ LDKEvent_PaymentClaimable,
/**
- * The peer took some action which made us think they were useless. Disconnect them.
+ * Indicates a payment has been claimed and we've received money!
+ *
+ * This most likely occurs when [`ChannelManager::claim_funds`] has been called in response
+ * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a
+ * [`ChannelManager::claim_funds`] call you may see this event without a corresponding
+ * [`Event::PaymentClaimable`] event.
+ *
+ * # Note
+ * LDK will not stop an inbound payment from being paid multiple times, so multiple
+ * `PaymentClaimable` events may be generated for the same payment. If you then call
+ * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get
+ * multiple `PaymentClaimed` events.
+ *
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
*/
- LDKErrorAction_DisconnectPeer,
+ LDKEvent_PaymentClaimed,
/**
- * The peer did something harmless that we weren't able to process, just log and ignore
+ * Indicates an outbound payment we made succeeded (i.e. it made it all the way to its target
+ * and we got back the payment preimage for it).
+ *
+ * Note for MPP payments: in rare cases, this event may be preceded by a `PaymentPathFailed`
+ * event. In this situation, you SHOULD treat this payment as having succeeded.
*/
- LDKErrorAction_IgnoreError,
+ LDKEvent_PaymentSent,
/**
- * The peer did something harmless that we weren't able to meaningfully process.
- * If the error is logged, log it at the given level.
+ * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events
+ * provide failure information for each path attempt in the payment, including retries.
+ *
+ * This event is provided once there are no further pending HTLCs for the payment and the
+ * payment is no longer retryable, due either to the [`Retry`] provided or
+ * [`ChannelManager::abandon_payment`] having been called for the corresponding payment.
+ *
+ * [`Retry`]: crate::ln::channelmanager::Retry
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*/
- LDKErrorAction_IgnoreAndLog,
+ LDKEvent_PaymentFailed,
/**
- * The peer provided us with a gossip message which we'd already seen. In most cases this
- * should be ignored, but it may result in the message being forwarded if it is a duplicate of
- * our own channel announcements.
+ * Indicates that a path for an outbound payment was successful.
+ *
+ * Always generated after [`Event::PaymentSent`] and thus useful for scoring channels. See
+ * [`Event::PaymentSent`] for obtaining the payment preimage.
*/
- LDKErrorAction_IgnoreDuplicateGossip,
+ LDKEvent_PaymentPathSuccessful,
/**
- * The peer did something incorrect. Tell them.
+ * Indicates an outbound HTLC we sent failed, likely due to an intermediary node being unable to
+ * handle the HTLC.
+ *
+ * Note that this does *not* indicate that all paths for an MPP payment have failed, see
+ * [`Event::PaymentFailed`].
+ *
+ * See [`ChannelManager::abandon_payment`] for giving up on this payment before its retries have
+ * been exhausted.
+ *
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
*/
- LDKErrorAction_SendErrorMessage,
+ LDKEvent_PaymentPathFailed,
/**
- * The peer did something incorrect. Tell them without closing any channels.
+ * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination.
*/
- LDKErrorAction_SendWarningMessage,
+ LDKEvent_ProbeSuccessful,
+ /**
+ * Indicates that a probe payment we sent failed at an intermediary node on the path.
+ */
+ LDKEvent_ProbeFailed,
+ /**
+ * Used to indicate that [`ChannelManager::process_pending_htlc_forwards`] should be called at
+ * a time in the future.
+ *
+ * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards
+ */
+ LDKEvent_PendingHTLCsForwardable,
+ /**
+ * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if
+ * you've encoded an intercept scid in the receiver's invoice route hints using
+ * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`].
+ *
+ * [`ChannelManager::forward_intercepted_htlc`] or
+ * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See
+ * their docs for more information.
+ *
+ * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
+ * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs
+ * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc
+ * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc
+ */
+ LDKEvent_HTLCIntercepted,
+ /**
+ * Used to indicate that an output which you should know how to spend was confirmed on chain
+ * and is now spendable.
+ * Such an output will *not* ever be spent by rust-lightning, and are not at risk of your
+ * counterparty spending them due to some kind of timeout. Thus, you need to store them
+ * somewhere and spend them when you create on-chain transactions.
+ */
+ LDKEvent_SpendableOutputs,
+ /**
+ * This event is generated when a payment has been successfully forwarded through us and a
+ * forwarding fee earned.
+ */
+ LDKEvent_PaymentForwarded,
+ /**
+ * Used to indicate that a channel with the given `channel_id` is being opened and pending
+ * confirmation on-chain.
+ *
+ * This event is emitted when the funding transaction has been signed and is broadcast to the
+ * network. For 0conf channels it will be immediately followed by the corresponding
+ * [`Event::ChannelReady`] event.
+ */
+ LDKEvent_ChannelPending,
+ /**
+ * Used to indicate that a channel with the given `channel_id` is ready to
+ * be used. This event is emitted either when the funding transaction has been confirmed
+ * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel
+ * establishment.
+ */
+ LDKEvent_ChannelReady,
+ /**
+ * Used to indicate that a previously opened channel with the given `channel_id` is in the
+ * process of closure.
+ */
+ LDKEvent_ChannelClosed,
+ /**
+ * Used to indicate to the user that they can abandon the funding transaction and recycle the
+ * inputs for another purpose.
+ */
+ LDKEvent_DiscardFunding,
+ /**
+ * Indicates a request to open a new channel by a peer.
+ *
+ * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the
+ * request, call [`ChannelManager::force_close_without_broadcasting_txn`].
+ *
+ * The event is only triggered when a new open channel request is received and the
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ LDKEvent_OpenChannelRequest,
+ /**
+ * Indicates that the HTLC was accepted, but could not be processed when or after attempting to
+ * forward it.
+ *
+ * Some scenarios where this event may be sent include:
+ * * Insufficient capacity in the outbound channel
+ * * While waiting to forward the HTLC, the channel it is meant to be forwarded through closes
+ * * When an unknown SCID is requested for forwarding a payment.
+ * * Expected MPP amount has already been reached
+ * * The HTLC has timed out
+ *
+ * This event, however, does not get generated if an HTLC fails to meet the forwarding
+ * requirements (i.e. insufficient fees paid, or a CLTV that is too soon).
+ */
+ LDKEvent_HTLCHandlingFailed,
/**
* Must be last for serialization purposes
*/
- LDKErrorAction_Sentinel,
-} LDKErrorAction_Tag;
+ LDKEvent_Sentinel,
+} LDKEvent_Tag;
-typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
+typedef struct LDKEvent_LDKFundingGenerationReady_Body {
/**
- * An error message which we should make an effort to send before we disconnect.
+ * The random channel_id we picked which you'll need to pass into
+ * [`ChannelManager::funding_transaction_generated`].
+ *
+ * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
+ */
+ struct LDKThirtyTwoBytes temporary_channel_id;
+ /**
+ * The counterparty's node_id, which you'll need to pass back into
+ * [`ChannelManager::funding_transaction_generated`].
*
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated
*/
- struct LDKErrorMessage msg;
-} LDKErrorAction_LDKDisconnectPeer_Body;
-
-typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
+ struct LDKPublicKey counterparty_node_id;
/**
- * The message to send.
+ * The value, in satoshis, that the output should have.
*/
- struct LDKErrorMessage msg;
-} LDKErrorAction_LDKSendErrorMessage_Body;
-
-typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
+ uint64_t channel_value_satoshis;
/**
- * The message to send.
+ * The script which should be used in the transaction output.
*/
- struct LDKWarningMessage msg;
+ struct LDKCVec_u8Z output_script;
/**
- * The peer may have done something harmless that we weren't able to meaningfully process,
- * though we should still tell them about it.
- * If this event is logged, log it at the given level.
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a
+ * random value for an inbound channel. This may be zero for objects serialized with LDK
+ * versions prior to 0.0.113.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
*/
- enum LDKLevel log_level;
-} LDKErrorAction_LDKSendWarningMessage_Body;
-
-typedef struct MUST_USE_STRUCT LDKErrorAction {
- LDKErrorAction_Tag tag;
- union {
- LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
- struct {
- enum LDKLevel ignore_and_log;
- };
- LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
- LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
- };
-} LDKErrorAction;
-
-
+ struct LDKU128 user_channel_id;
+} LDKEvent_LDKFundingGenerationReady_Body;
-/**
- * A [`query_channel_range`] message is used to query a peer for channel
- * UTXOs in a range of blocks. The recipient of a query makes a best
- * effort to reply to the query using one or more [`ReplyChannelRange`]
- * messages.
- *
- * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
- */
-typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
+typedef struct LDKEvent_LDKPaymentClaimable_Body {
/**
- * 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.
+ * The node that will receive the payment after it has been claimed.
+ * This is useful to identify payments received via [phantom nodes].
+ * This field will always be filled in when the event was generated by LDK versions
+ * 0.0.113 and above.
+ *
+ * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKnativeQueryChannelRange *inner;
+ struct LDKPublicKey receiver_node_id;
/**
- * 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.
+ * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will
+ * not stop you from registering duplicate payment hashes for inbound payments.
*/
- bool is_owned;
-} LDKQueryChannelRange;
-
-
-
-/**
- * A [`query_short_channel_ids`] message is used to query a peer for
- * routing gossip messages related to one or more `short_channel_id`s.
- *
- * The query recipient will reply with the latest, if available,
- * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages
- * it maintains for the requested `short_channel_id`s followed by a
- * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in
- * this query are encoded. We only support `encoding_type=0` uncompressed
- * serialization and do not support `encoding_type=1` zlib serialization.
- *
- * [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
- */
-typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * 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.
+ * The fields in the onion which were received with each HTLC. Only fields which were
+ * identical in each HTLC involved in the payment will be included here.
+ *
+ * Payments received on LDK versions prior to 0.0.115 will have this field unset.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKnativeQueryShortChannelIds *inner;
+ struct LDKRecipientOnionFields onion_fields;
/**
- * 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.
+ * The value, in thousandths of a satoshi, that this payment is for.
*/
- bool is_owned;
-} LDKQueryShortChannelIds;
-
-
-
-/**
- * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`]
- * message.
- *
- * Multiple `reply_channel_range` messages can be sent in reply
- * to a single [`QueryChannelRange`] 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. The `short_channel_id`s in the
- * reply are encoded. We only support `encoding_type=0` uncompressed
- * serialization and do not support `encoding_type=1` zlib serialization.
- *
- * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
- */
-typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
+ uint64_t amount_msat;
/**
- * 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.
+ * Information for claiming this received payment, based on whether the purpose of the
+ * payment is to pay an invoice or to send a spontaneous payment.
*/
- LDKnativeReplyChannelRange *inner;
+ struct LDKPaymentPurpose purpose;
/**
- * 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.
+ * The `channel_id` indicating over which channel we received the payment.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- bool is_owned;
-} LDKReplyChannelRange;
-
-
-
-/**
- * A [`gossip_timestamp_filter`] message is used by a node to request
- * gossip relay for messages in the requested time range when the
- * `gossip_queries` feature has been negotiated.
- *
- * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
- */
-typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
+ struct LDKThirtyTwoBytes via_channel_id;
/**
- * 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.
+ * The `user_channel_id` indicating over which channel we received the payment.
*/
- LDKnativeGossipTimestampFilter *inner;
+ struct LDKCOption_u128Z via_user_channel_id;
/**
- * 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.
+ * The block height at which this payment will be failed back and will no longer be
+ * eligible for claiming.
+ *
+ * Prior to this height, a call to [`ChannelManager::claim_funds`] is guaranteed to
+ * succeed, however you should wait for [`Event::PaymentClaimed`] to be sure.
+ *
+ * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds
*/
- bool is_owned;
-} LDKGossipTimestampFilter;
+ struct LDKCOption_u32Z claim_deadline;
+} LDKEvent_LDKPaymentClaimable_Body;
-/**
- * An event generated by ChannelManager which indicates a message should be sent to a peer (or
- * broadcast to most peers).
- * These events are handled by PeerManager::process_events if you are using a PeerManager.
- */
-typedef enum LDKMessageSendEvent_Tag {
+typedef struct LDKEvent_LDKPaymentClaimed_Body {
/**
- * Used to indicate that we've accepted a channel open and should send the accept_channel
- * message provided to the given peer.
+ * The node that received the payment.
+ * This is useful to identify payments which were received via [phantom nodes].
+ * This field will always be filled in when the event was generated by LDK versions
+ * 0.0.113 and above.
+ *
+ * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKMessageSendEvent_SendAcceptChannel,
+ struct LDKPublicKey receiver_node_id;
/**
- * Used to indicate that we've initiated a channel open and should send the open_channel
- * message provided to the given peer.
+ * The payment hash of the claimed payment. Note that LDK will not stop you from
+ * registering duplicate payment hashes for inbound payments.
*/
- LDKMessageSendEvent_SendOpenChannel,
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
+ * The value, in thousandths of a satoshi, that this payment is for.
*/
- LDKMessageSendEvent_SendFundingCreated,
+ uint64_t amount_msat;
/**
- * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
+ * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a
+ * spontaneous payment.
*/
- LDKMessageSendEvent_SendFundingSigned,
+ struct LDKPaymentPurpose purpose;
+} LDKEvent_LDKPaymentClaimed_Body;
+
+typedef struct LDKEvent_LDKPaymentSent_Body {
/**
- * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
+ * The `payment_id` passed to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKMessageSendEvent_SendChannelReady,
+ struct LDKThirtyTwoBytes payment_id;
/**
- * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
+ * The preimage to the hash given to ChannelManager::send_payment.
+ * Note that this serves as a payment receipt, if you wish to have such a thing, you must
+ * store it somehow!
*/
- LDKMessageSendEvent_SendAnnouncementSignatures,
+ struct LDKThirtyTwoBytes payment_preimage;
/**
- * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
- * message should be sent to the peer with the given node_id.
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
- LDKMessageSendEvent_UpdateHTLCs,
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
+ * The total fee which was spent at intermediate hops in this payment, across all paths.
+ *
+ * Note that, like [`Route::get_total_fees`] this does *not* include any potential
+ * overpayment to the recipient node.
+ *
+ * If the recipient or an intermediate node misbehaves and gives us free money, this may
+ * overstate the amount paid, though this is unlikely.
+ *
+ * [`Route::get_total_fees`]: crate::routing::router::Route::get_total_fees
*/
- LDKMessageSendEvent_SendRevokeAndACK,
+ struct LDKCOption_u64Z fee_paid_msat;
+} LDKEvent_LDKPaymentSent_Body;
+
+typedef struct LDKEvent_LDKPaymentFailed_Body {
/**
- * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
+ * The `payment_id` passed to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
- LDKMessageSendEvent_SendClosingSigned,
+ struct LDKThirtyTwoBytes payment_id;
/**
- * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
- LDKMessageSendEvent_SendShutdown,
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
+ * The reason the payment failed. This is only `None` for events generated or serialized
+ * by versions prior to 0.0.115.
*/
- LDKMessageSendEvent_SendChannelReestablish,
+ struct LDKCOption_PaymentFailureReasonZ reason;
+} LDKEvent_LDKPaymentFailed_Body;
+
+typedef struct LDKEvent_LDKPaymentPathSuccessful_Body {
/**
- * Used to send a channel_announcement and channel_update to a specific peer, likely on
- * initial connection to ensure our peers know about our channels.
+ * The `payment_id` passed to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
- LDKMessageSendEvent_SendChannelAnnouncement,
+ struct LDKThirtyTwoBytes payment_id;
/**
- * Used to indicate that a channel_announcement and channel_update should be broadcast to all
- * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
+ * The hash that was given to [`ChannelManager::send_payment`].
*
- * Note that after doing so, you very likely (unless you did so very recently) want to
- * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
- * ensures that any nodes which see our channel_announcement also have a relevant
- * node_announcement, including relevant feature flags which may be important for routing
- * through or to us.
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*
- * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
- */
- LDKMessageSendEvent_BroadcastChannelAnnouncement,
- /**
- * Used to indicate that a channel_update should be broadcast to all peers.
- */
- LDKMessageSendEvent_BroadcastChannelUpdate,
- /**
- * Used to indicate that a node_announcement should be broadcast to all peers.
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKMessageSendEvent_BroadcastNodeAnnouncement,
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * Used to indicate that a channel_update should be sent to a single peer.
- * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
- * private channel and we shouldn't be informing all of our peers of channel parameters.
+ * The payment path that was successful.
+ *
+ * May contain a closed channel if the HTLC sent along the path was fulfilled on chain.
*/
- LDKMessageSendEvent_SendChannelUpdate,
+ struct LDKPath path;
+} LDKEvent_LDKPaymentPathSuccessful_Body;
+
+typedef struct LDKEvent_LDKPaymentPathFailed_Body {
/**
- * Broadcast an error downstream to be handled
+ * The `payment_id` passed to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- LDKMessageSendEvent_HandleError,
+ struct LDKThirtyTwoBytes payment_id;
/**
- * Query a peer for channels with funding transaction UTXOs in a block range.
+ * The hash that was given to [`ChannelManager::send_payment`].
+ *
+ * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
*/
- LDKMessageSendEvent_SendChannelRangeQuery,
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * Request routing gossip messages from a peer for a list of channels identified by
- * their short_channel_ids.
+ * Indicates the payment was rejected for some reason by the recipient. This implies that
+ * the payment has failed, not just the route in question. If this is not set, the payment may
+ * be retried via a different route.
*/
- LDKMessageSendEvent_SendShortIdsQuery,
+ bool payment_failed_permanently;
/**
- * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
- * emitted during processing of the query.
+ * Extra error details based on the failure type. May contain an update that needs to be
+ * applied to the [`NetworkGraph`].
+ *
+ * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
*/
- LDKMessageSendEvent_SendReplyChannelRange,
+ struct LDKPathFailure failure;
/**
- * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
- * enable receiving gossip messages from the peer.
+ * The payment path that failed.
*/
- LDKMessageSendEvent_SendGossipTimestampFilter,
+ struct LDKPath path;
/**
- * Must be last for serialization purposes
+ * The channel responsible for the failed payment path.
+ *
+ * Note that for route hints or for the first hop in a path this may be an SCID alias and
+ * may not refer to a channel in the public network graph. These aliases may also collide
+ * with channels in the public network graph.
+ *
+ * If this is `Some`, then the corresponding channel should be avoided when the payment is
+ * retried. May be `None` for older [`Event`] serializations.
*/
- LDKMessageSendEvent_Sentinel,
-} LDKMessageSendEvent_Tag;
+ struct LDKCOption_u64Z short_channel_id;
+} LDKEvent_LDKPaymentPathFailed_Body;
-typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
- /**
- * The node_id of the node which should receive this message
- */
- struct LDKPublicKey node_id;
+typedef struct LDKEvent_LDKProbeSuccessful_Body {
/**
- * The message which should be sent.
+ * The id returned by [`ChannelManager::send_probe`].
+ *
+ * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
*/
- struct LDKAcceptChannel msg;
-} LDKMessageSendEvent_LDKSendAcceptChannel_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
+ struct LDKThirtyTwoBytes payment_id;
/**
- * The node_id of the node which should receive this message
+ * The hash generated by [`ChannelManager::send_probe`].
+ *
+ * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * The message which should be sent.
+ * The payment path that was successful.
*/
- struct LDKOpenChannel msg;
-} LDKMessageSendEvent_LDKSendOpenChannel_Body;
+ struct LDKPath path;
+} LDKEvent_LDKProbeSuccessful_Body;
-typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
+typedef struct LDKEvent_LDKProbeFailed_Body {
/**
- * The node_id of the node which should receive this message
+ * The id returned by [`ChannelManager::send_probe`].
+ *
+ * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes payment_id;
/**
- * The message which should be sent.
+ * The hash generated by [`ChannelManager::send_probe`].
+ *
+ * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe
*/
- struct LDKFundingCreated msg;
-} LDKMessageSendEvent_LDKSendFundingCreated_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * The node_id of the node which should receive this message
+ * The payment path that failed.
*/
- struct LDKPublicKey node_id;
+ struct LDKPath path;
/**
- * The message which should be sent.
+ * The channel responsible for the failed probe.
+ *
+ * Note that for route hints or for the first hop in a path this may be an SCID alias and
+ * may not refer to a channel in the public network graph. These aliases may also collide
+ * with channels in the public network graph.
*/
- struct LDKFundingSigned msg;
-} LDKMessageSendEvent_LDKSendFundingSigned_Body;
+ struct LDKCOption_u64Z short_channel_id;
+} LDKEvent_LDKProbeFailed_Body;
-typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
+typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body {
/**
- * The node_id of the node which should receive these message(s)
+ * The minimum amount of time that should be waited prior to calling
+ * process_pending_htlc_forwards. To increase the effort required to correlate payments,
+ * you should wait a random amount of time in roughly the range (now + time_forwardable,
+ * now + 5*time_forwardable).
*/
- struct LDKPublicKey node_id;
+ uint64_t time_forwardable;
+} LDKEvent_LDKPendingHTLCsForwardable_Body;
+
+typedef struct LDKEvent_LDKHTLCIntercepted_Body {
/**
- * The channel_ready message which should be sent.
+ * An id to help LDK identify which HTLC is being forwarded or failed.
*/
- struct LDKChannelReady msg;
-} LDKMessageSendEvent_LDKSendChannelReady_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
+ struct LDKThirtyTwoBytes intercept_id;
/**
- * The node_id of the node which should receive these message(s)
+ * The fake scid that was programmed as the next hop's scid, generated using
+ * [`ChannelManager::get_intercept_scid`].
+ *
+ * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
*/
- struct LDKPublicKey node_id;
+ uint64_t requested_next_hop_scid;
/**
- * The announcement_signatures message which should be sent.
+ * The payment hash used for this HTLC.
*/
- struct LDKAnnouncementSignatures msg;
-} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
-
-typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
+ struct LDKThirtyTwoBytes payment_hash;
/**
- * The node_id of the node which should receive these message(s)
+ * How many msats were received on the inbound edge of this HTLC.
*/
- struct LDKPublicKey node_id;
+ uint64_t inbound_amount_msat;
/**
- * The update messages which should be sent. ALL messages in the struct should be sent!
+ * How many msats the payer intended to route to the next node. Depending on the reason you are
+ * intercepting this payment, you might take a fee by forwarding less than this amount.
+ *
+ * Note that LDK will NOT check that expected fees were factored into this value. You MUST
+ * check that whatever fee you want has been included here or subtract it as required. Further,
+ * LDK will not stop you from forwarding more than you received.
*/
- struct LDKCommitmentUpdate updates;
-} LDKMessageSendEvent_LDKUpdateHTLCs_Body;
+ uint64_t expected_outbound_amount_msat;
+} LDKEvent_LDKHTLCIntercepted_Body;
-typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
+typedef struct LDKEvent_LDKSpendableOutputs_Body {
/**
- * The node_id of the node which should receive this message
+ * The outputs which you should store as spendable by you.
*/
- struct LDKPublicKey node_id;
+ struct LDKCVec_SpendableOutputDescriptorZ outputs;
+} LDKEvent_LDKSpendableOutputs_Body;
+
+typedef struct LDKEvent_LDKPaymentForwarded_Body {
/**
- * The message which should be sent.
+ * The incoming channel between the previous node and us. This is only `None` for events
+ * generated or serialized by versions prior to 0.0.107.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKRevokeAndACK msg;
-} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
+ struct LDKThirtyTwoBytes prev_channel_id;
/**
- * The node_id of the node which should receive this message
+ * The outgoing channel between the next node and us. This is only `None` for events
+ * generated or serialized by versions prior to 0.0.107.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes next_channel_id;
/**
- * The message which should be sent.
+ * The fee, in milli-satoshis, which was earned as a result of the payment.
+ *
+ * Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC
+ * was pending, the amount the next hop claimed will have been rounded down to the nearest
+ * whole satoshi. Thus, the fee calculated here may be higher than expected as we still
+ * claimed the full value in millisatoshis from the source. In this case,
+ * `claim_from_onchain_tx` will be set.
+ *
+ * If the channel which sent us the payment has been force-closed, we will claim the funds
+ * via an on-chain transaction. In that case we do not yet know the on-chain transaction
+ * fees which we will spend and will instead set this to `None`. It is possible duplicate
+ * `PaymentForwarded` events are generated for the same payment iff `fee_earned_msat` is
+ * `None`.
*/
- struct LDKClosingSigned msg;
-} LDKMessageSendEvent_LDKSendClosingSigned_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
+ struct LDKCOption_u64Z fee_earned_msat;
/**
- * The node_id of the node which should receive this message
+ * If this is `true`, the forwarded HTLC was claimed by our counterparty via an on-chain
+ * transaction.
*/
- struct LDKPublicKey node_id;
+ bool claim_from_onchain_tx;
/**
- * The message which should be sent.
+ * The final amount forwarded, in milli-satoshis, after the fee is deducted.
+ *
+ * The caveat described above the `fee_earned_msat` field applies here as well.
*/
- struct LDKShutdown msg;
-} LDKMessageSendEvent_LDKSendShutdown_Body;
+ struct LDKCOption_u64Z outbound_amount_forwarded_msat;
+} LDKEvent_LDKPaymentForwarded_Body;
-typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
+typedef struct LDKEvent_LDKChannelPending_Body {
/**
- * The node_id of the node which should receive this message
+ * The `channel_id` of the channel that is pending confirmation.
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes channel_id;
/**
- * The message which should be sent.
- */
- struct LDKChannelReestablish msg;
-} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be randomized for an inbound channel.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
+ */
+ struct LDKU128 user_channel_id;
/**
- * The node_id of the node which should receive this message
+ * The `temporary_channel_id` this channel used to be known by during channel establishment.
+ *
+ * Will be `None` for channels created prior to LDK version 0.0.115.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes former_temporary_channel_id;
/**
- * The channel_announcement which should be sent.
+ * The `node_id` of the channel counterparty.
*/
- struct LDKChannelAnnouncement msg;
+ struct LDKPublicKey counterparty_node_id;
/**
- * The followup channel_update which should be sent.
+ * The outpoint of the channel's funding transaction.
*/
- struct LDKChannelUpdate update_msg;
-} LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
+ struct LDKOutPoint funding_txo;
+} LDKEvent_LDKChannelPending_Body;
-typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
+typedef struct LDKEvent_LDKChannelReady_Body {
/**
- * The channel_announcement which should be sent.
+ * The `channel_id` of the channel that is ready.
*/
- struct LDKChannelAnnouncement msg;
+ struct LDKThirtyTwoBytes channel_id;
/**
- * The followup channel_update which should be sent.
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be randomized for an inbound channel.
*
- * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
*/
- struct LDKChannelUpdate update_msg;
-} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
-
-typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
+ struct LDKU128 user_channel_id;
/**
- * The channel_update which should be sent.
+ * The `node_id` of the channel counterparty.
*/
- struct LDKChannelUpdate msg;
-} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
-
-typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
+ struct LDKPublicKey counterparty_node_id;
/**
- * The node_announcement which should be sent.
+ * The features that this channel will operate with.
*/
- struct LDKNodeAnnouncement msg;
-} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
+ struct LDKChannelTypeFeatures channel_type;
+} LDKEvent_LDKChannelReady_Body;
-typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
+typedef struct LDKEvent_LDKChannelClosed_Body {
/**
- * The node_id of the node which should receive this message
+ * The `channel_id` of the channel which has been closed. Note that on-chain transactions
+ * resolving the channel are likely still awaiting confirmation.
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes channel_id;
/**
- * The channel_update which should be sent.
+ * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound
+ * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if
+ * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
+ * `user_channel_id` will be randomized for inbound channels.
+ * This may be zero for inbound channels serialized prior to 0.0.113 and will always be
+ * zero for objects serialized with LDK versions prior to 0.0.102.
+ *
+ * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
*/
- struct LDKChannelUpdate msg;
-} LDKMessageSendEvent_LDKSendChannelUpdate_Body;
+ struct LDKU128 user_channel_id;
+ /**
+ * The reason the channel was closed.
+ */
+ struct LDKClosureReason reason;
+} LDKEvent_LDKChannelClosed_Body;
-typedef struct LDKMessageSendEvent_LDKHandleError_Body {
+typedef struct LDKEvent_LDKDiscardFunding_Body {
/**
- * The node_id of the node which should receive this message
+ * The channel_id of the channel which has been closed.
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes channel_id;
/**
- * The action which should be taken.
+ * The full transaction received from the user
*/
- struct LDKErrorAction action;
-} LDKMessageSendEvent_LDKHandleError_Body;
+ struct LDKTransaction transaction;
+} LDKEvent_LDKDiscardFunding_Body;
-typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
+typedef struct LDKEvent_LDKOpenChannelRequest_Body {
/**
- * The node_id of this message recipient
+ * The temporary channel ID of the channel requested to be opened.
+ *
+ * When responding to the request, the `temporary_channel_id` should be passed
+ * back to the ChannelManager through [`ChannelManager::accept_inbound_channel`] to accept,
+ * or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes temporary_channel_id;
/**
- * The query_channel_range which should be sent.
+ * The node_id of the counterparty requesting to open the channel.
+ *
+ * When responding to the request, the `counterparty_node_id` should be passed
+ * back to the `ChannelManager` through [`ChannelManager::accept_inbound_channel`] to
+ * accept the request, or through [`ChannelManager::force_close_without_broadcasting_txn`] to reject the
+ * request.
+ *
+ * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
+ * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn
*/
- struct LDKQueryChannelRange msg;
-} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
-
-typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
+ struct LDKPublicKey counterparty_node_id;
/**
- * The node_id of this message recipient
+ * The channel value of the requested channel.
*/
- struct LDKPublicKey node_id;
+ uint64_t funding_satoshis;
/**
- * The query_short_channel_ids which should be sent.
+ * Our starting balance in the channel if the request is accepted, in milli-satoshi.
*/
- struct LDKQueryShortChannelIds msg;
-} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
+ uint64_t push_msat;
+ /**
+ * The features that this channel will operate with. If you reject the channel, a
+ * well-behaved counterparty may automatically re-attempt the channel with a new set of
+ * feature flags.
+ *
+ * Note that if [`ChannelTypeFeatures::supports_scid_privacy`] returns true on this type,
+ * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
+ * 0.0.106.
+ *
+ * Furthermore, note that if [`ChannelTypeFeatures::supports_zero_conf`] returns true on this type,
+ * the resulting [`ChannelManager`] will not be readable by versions of LDK prior to
+ * 0.0.107. Channels setting this type also need to get manually accepted via
+ * [`crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`],
+ * or will be rejected otherwise.
+ *
+ * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
+ */
+ struct LDKChannelTypeFeatures channel_type;
+} LDKEvent_LDKOpenChannelRequest_Body;
-typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
+typedef struct LDKEvent_LDKHTLCHandlingFailed_Body {
/**
- * The node_id of this message recipient
+ * The channel over which the HTLC was received.
*/
- struct LDKPublicKey node_id;
+ struct LDKThirtyTwoBytes prev_channel_id;
/**
- * The reply_channel_range which should be sent.
+ * Destination of the HTLC that failed to be processed.
*/
- struct LDKReplyChannelRange msg;
-} LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
+ struct LDKHTLCDestination failed_next_destination;
+} LDKEvent_LDKHTLCHandlingFailed_Body;
-typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
+typedef struct MUST_USE_STRUCT LDKEvent {
+ LDKEvent_Tag tag;
+ union {
+ LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready;
+ LDKEvent_LDKPaymentClaimable_Body payment_claimable;
+ LDKEvent_LDKPaymentClaimed_Body payment_claimed;
+ LDKEvent_LDKPaymentSent_Body payment_sent;
+ LDKEvent_LDKPaymentFailed_Body payment_failed;
+ LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful;
+ LDKEvent_LDKPaymentPathFailed_Body payment_path_failed;
+ LDKEvent_LDKProbeSuccessful_Body probe_successful;
+ LDKEvent_LDKProbeFailed_Body probe_failed;
+ LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable;
+ LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted;
+ LDKEvent_LDKSpendableOutputs_Body spendable_outputs;
+ LDKEvent_LDKPaymentForwarded_Body payment_forwarded;
+ LDKEvent_LDKChannelPending_Body channel_pending;
+ LDKEvent_LDKChannelReady_Body channel_ready;
+ LDKEvent_LDKChannelClosed_Body channel_closed;
+ LDKEvent_LDKDiscardFunding_Body discard_funding;
+ LDKEvent_LDKOpenChannelRequest_Body open_channel_request;
+ LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed;
+ };
+} LDKEvent;
+
+/**
+ * An enum which can either contain a crate::lightning::events::Event or not
+ */
+typedef enum LDKCOption_EventZ_Tag {
/**
- * The node_id of this message recipient
+ * When we're in this state, this COption_EventZ contains a crate::lightning::events::Event
*/
- struct LDKPublicKey node_id;
+ LDKCOption_EventZ_Some,
/**
- * The gossip_timestamp_filter which should be sent.
+ * When we're in this state, this COption_EventZ contains nothing
*/
- struct LDKGossipTimestampFilter msg;
-} LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
+ LDKCOption_EventZ_None,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKCOption_EventZ_Sentinel,
+} LDKCOption_EventZ_Tag;
-typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
- LDKMessageSendEvent_Tag tag;
+typedef struct LDKCOption_EventZ {
+ LDKCOption_EventZ_Tag tag;
union {
- LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
- LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
- LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
- LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
- LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
- LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
- LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
- LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
- LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
- LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
- LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
- LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
- LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
- LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
- LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
- LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
- LDKMessageSendEvent_LDKHandleError_Body handle_error;
- LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
- LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
- LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
- LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
+ struct {
+ struct LDKEvent some;
+ };
};
-} LDKMessageSendEvent;
+} LDKCOption_EventZ;
/**
- * A dynamically-allocated array of crate::lightning::util::events::MessageSendEvents of arbitrary size.
- * This corresponds to std::vector in C++
+ * The contents of CResult_COption_EventZDecodeErrorZ
*/
-typedef struct LDKCVec_MessageSendEventZ {
+typedef union LDKCResult_COption_EventZDecodeErrorZPtr {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKMessageSendEvent *data;
+ struct LDKCOption_EventZ *result;
/**
- * The number of elements pointed to by `data`.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- uintptr_t datalen;
-} LDKCVec_MessageSendEventZ;
+ struct LDKDecodeError *err;
+} LDKCResult_COption_EventZDecodeErrorZPtr;
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::derived::COption_EventZ 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 LDKC2Tuple_usizeTransactionZ {
+typedef struct LDKCResult_COption_EventZDecodeErrorZ {
/**
- * The element at position 0
+ * The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- uintptr_t a;
+ union LDKCResult_COption_EventZDecodeErrorZPtr contents;
/**
- * The element at position 1
+ * Whether this CResult_COption_EventZDecodeErrorZ represents a success state.
*/
- struct LDKTransaction b;
-} LDKC2Tuple_usizeTransactionZ;
+ bool result_ok;
+} LDKCResult_COption_EventZDecodeErrorZ;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * An [`accept_channel`] message to be sent to or received from a peer.
+ *
+ * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message
*/
-typedef struct LDKCVec_C2Tuple_usizeTransactionZZ {
+typedef struct MUST_USE_STRUCT LDKAcceptChannel {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * 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.
*/
- struct LDKC2Tuple_usizeTransactionZ *data;
+ LDKnativeAcceptChannel *inner;
/**
- * The number of elements pointed to by `data`.
+ * 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.
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_usizeTransactionZZ;
+ bool is_owned;
+} LDKAcceptChannel;
+
+
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * An [`open_channel`] message to be sent to or received from a peer.
+ *
+ * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message
*/
-typedef struct LDKC2Tuple_TxidBlockHashZ {
+typedef struct MUST_USE_STRUCT LDKOpenChannel {
/**
- * The element at position 0
+ * 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.
*/
- struct LDKThirtyTwoBytes a;
+ LDKnativeOpenChannel *inner;
/**
- * The element at position 1
+ * 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.
*/
- struct LDKThirtyTwoBytes b;
-} LDKC2Tuple_TxidBlockHashZ;
+ bool is_owned;
+} LDKOpenChannel;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * A [`funding_created`] message to be sent to or received from a peer.
+ *
+ * [`funding_created`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_created-message
*/
-typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ {
+typedef struct MUST_USE_STRUCT LDKFundingCreated {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * 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.
*/
- struct LDKC2Tuple_TxidBlockHashZ *data;
+ LDKnativeFundingCreated *inner;
/**
- * The number of elements pointed to by `data`.
+ * 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.
*/
- uintptr_t datalen;
-} LDKCVec_C2Tuple_TxidBlockHashZZ;
+ bool is_owned;
+} LDKFundingCreated;
/**
- * Simple structure sent back by `chain::Watch` when an HTLC from a forward channel is detected on
- * chain. Used to update the corresponding HTLC in the backward channel. Failing to pass the
- * preimage claim backward will lead to loss of funds.
+ * A [`funding_signed`] message to be sent to or received from a peer.
+ *
+ * [`funding_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-funding_signed-message
*/
-typedef struct MUST_USE_STRUCT LDKHTLCUpdate {
+typedef struct MUST_USE_STRUCT LDKFundingSigned {
/**
* 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.
*/
- LDKnativeHTLCUpdate *inner;
+ LDKnativeFundingSigned *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;
-} LDKHTLCUpdate;
+} LDKFundingSigned;
+
+
/**
- * An event to be processed by the ChannelManager.
+ * A [`channel_ready`] message to be sent to or received from a peer.
+ *
+ * [`channel_ready`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-channel_ready-message
*/
-typedef enum LDKMonitorEvent_Tag {
- /**
- * A monitor event containing an HTLCUpdate.
- */
- LDKMonitorEvent_HTLCEvent,
+typedef struct MUST_USE_STRUCT LDKChannelReady {
/**
- * A monitor event that the Channel's commitment transaction was confirmed.
+ * 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.
*/
- LDKMonitorEvent_CommitmentTxConfirmed,
+ LDKnativeChannelReady *inner;
/**
- * Indicates a [`ChannelMonitor`] update has completed. See
- * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used.
- *
- * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
+ * 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.
*/
- LDKMonitorEvent_Completed,
+ bool is_owned;
+} LDKChannelReady;
+
+
+
+/**
+ * An [`announcement_signatures`] message to be sent to or received from a peer.
+ *
+ * [`announcement_signatures`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-announcement_signatures-message
+ */
+typedef struct MUST_USE_STRUCT LDKAnnouncementSignatures {
/**
- * Indicates a [`ChannelMonitor`] update has failed. See
- * [`ChannelMonitorUpdateStatus::PermanentFailure`] for more information on how this is used.
- *
- * [`ChannelMonitorUpdateStatus::PermanentFailure`]: super::ChannelMonitorUpdateStatus::PermanentFailure
+ * 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.
*/
- LDKMonitorEvent_UpdateFailed,
+ LDKnativeAnnouncementSignatures *inner;
/**
- * Must be last for serialization purposes
+ * 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.
*/
- LDKMonitorEvent_Sentinel,
-} LDKMonitorEvent_Tag;
+ bool is_owned;
+} LDKAnnouncementSignatures;
-typedef struct LDKMonitorEvent_LDKCompleted_Body {
+
+
+/**
+ * Struct used to return values from [`RevokeAndACK`] messages, containing a bunch of commitment
+ * transaction updates if they were pending.
+ */
+typedef struct MUST_USE_STRUCT LDKCommitmentUpdate {
/**
- * The funding outpoint of the [`ChannelMonitor`] that was updated
+ * 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.
*/
- struct LDKOutPoint funding_txo;
+ LDKnativeCommitmentUpdate *inner;
/**
- * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or
- * [`ChannelMonitor::get_latest_update_id`].
- *
- * Note that this should only be set to a given update's ID if all previous updates for the
- * same [`ChannelMonitor`] have been applied and persisted.
+ * 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.
*/
- uint64_t monitor_update_id;
-} LDKMonitorEvent_LDKCompleted_Body;
+ bool is_owned;
+} LDKCommitmentUpdate;
+
-typedef struct MUST_USE_STRUCT LDKMonitorEvent {
- LDKMonitorEvent_Tag tag;
- union {
- struct {
- struct LDKHTLCUpdate htlc_event;
- };
- struct {
- struct LDKOutPoint commitment_tx_confirmed;
- };
- LDKMonitorEvent_LDKCompleted_Body completed;
- struct {
- struct LDKOutPoint update_failed;
- };
- };
-} LDKMonitorEvent;
/**
- * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size.
- * This corresponds to std::vector in C++
+ * A [`revoke_and_ack`] message to be sent to or received from a peer.
+ *
+ * [`revoke_and_ack`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#completing-the-transition-to-the-updated-state-revoke_and_ack
*/
-typedef struct LDKCVec_MonitorEventZ {
+typedef struct MUST_USE_STRUCT LDKRevokeAndACK {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * 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.
*/
- struct LDKMonitorEvent *data;
+ LDKnativeRevokeAndACK *inner;
/**
- * The number of elements pointed to by `data`.
+ * 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.
*/
- uintptr_t datalen;
-} LDKCVec_MonitorEventZ;
+ bool is_owned;
+} LDKRevokeAndACK;
+
+
/**
- * A tuple of 3 elements. See the individual fields for the types contained.
+ * A [`closing_signed`] message to be sent to or received from a peer.
+ *
+ * [`closing_signed`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-negotiation-closing_signed
*/
-typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ {
+typedef struct MUST_USE_STRUCT LDKClosingSigned {
/**
- * The element at position 0
+ * 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.
*/
- struct LDKOutPoint a;
+ LDKnativeClosingSigned *inner;
/**
- * The element at position 1
+ * 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.
*/
- struct LDKCVec_MonitorEventZ b;
+ bool is_owned;
+} LDKClosingSigned;
+
+
+
+/**
+ * A [`shutdown`] message to be sent to or received from a peer.
+ *
+ * [`shutdown`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#closing-initiation-shutdown
+ */
+typedef struct MUST_USE_STRUCT LDKShutdown {
/**
- * The element at position 2
+ * 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.
*/
- struct LDKPublicKey c;
-} LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ;
+ LDKnativeShutdown *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;
+} LDKShutdown;
+
+
/**
- * A dynamically-allocated array of crate::c_types::derived::C3Tuple_OutPointCVec_MonitorEventZPublicKeyZs of arbitrary size.
- * This corresponds to std::vector in C++
+ * A [`channel_reestablish`] message to be sent to or received from a peer.
+ *
+ * [`channel_reestablish`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#message-retransmission
*/
-typedef struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ {
+typedef struct MUST_USE_STRUCT LDKChannelReestablish {
/**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ * 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.
*/
- struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data;
+ LDKnativeChannelReestablish *inner;
/**
- * The number of elements pointed to by `data`.
+ * 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.
*/
- uintptr_t datalen;
-} LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ;
+ bool is_owned;
+} LDKChannelReestablish;
/**
- * [`Score`] implementation that uses a fixed penalty.
+ * A [`channel_announcement`] message to be sent to or received from a peer.
+ *
+ * [`channel_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_announcement-message
*/
-typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer {
+typedef struct MUST_USE_STRUCT LDKChannelAnnouncement {
/**
* 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.
*/
- LDKnativeFixedPenaltyScorer *inner;
+ LDKnativeChannelAnnouncement *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;
-} LDKFixedPenaltyScorer;
+} LDKChannelAnnouncement;
+
+
/**
- * The contents of CResult_FixedPenaltyScorerDecodeErrorZ
+ * A [`node_announcement`] message to be sent to or received from a peer.
+ *
+ * [`node_announcement`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-node_announcement-message
*/
-typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr {
+typedef struct MUST_USE_STRUCT LDKNodeAnnouncement {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * 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.
*/
- struct LDKFixedPenaltyScorer *result;
+ LDKnativeNodeAnnouncement *inner;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * 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.
*/
- struct LDKDecodeError *err;
-} LDKCResult_FixedPenaltyScorerDecodeErrorZPtr;
+ bool is_owned;
+} LDKNodeAnnouncement;
+
+
/**
- * A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * An [`error`] message to be sent to or received from a peer.
+ *
+ * [`error`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
*/
-typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ {
+typedef struct MUST_USE_STRUCT LDKErrorMessage {
/**
- * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * 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.
*/
- union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents;
+ LDKnativeErrorMessage *inner;
/**
- * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state.
+ * 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 result_ok;
-} LDKCResult_FixedPenaltyScorerDecodeErrorZ;
+ bool is_owned;
+} LDKErrorMessage;
+
+
/**
- * A tuple of 2 elements. See the individual fields for the types contained.
+ * A [`warning`] message to be sent to or received from a peer.
+ *
+ * [`warning`]: https://github.com/lightning/bolts/blob/master/01-messaging.md#the-error-and-warning-messages
*/
-typedef struct LDKC2Tuple_u64u64Z {
+typedef struct MUST_USE_STRUCT LDKWarningMessage {
/**
- * The element at position 0
+ * 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.
*/
- uint64_t a;
+ LDKnativeWarningMessage *inner;
/**
- * The element at position 1
+ * 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.
*/
- uint64_t b;
-} LDKC2Tuple_u64u64Z;
+ bool is_owned;
+} LDKWarningMessage;
/**
- * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not
+ * Used to put an error message in a [`LightningError`].
*/
-typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag {
+typedef enum LDKErrorAction_Tag {
/**
- * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z
+ * The peer took some action which made us think they were useless. Disconnect them.
*/
- LDKCOption_C2Tuple_u64u64ZZ_Some,
+ LDKErrorAction_DisconnectPeer,
/**
- * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing
+ * The peer did something harmless that we weren't able to process, just log and ignore
*/
- LDKCOption_C2Tuple_u64u64ZZ_None,
+ LDKErrorAction_IgnoreError,
/**
- * Must be last for serialization purposes
+ * The peer did something harmless that we weren't able to meaningfully process.
+ * If the error is logged, log it at the given level.
*/
- LDKCOption_C2Tuple_u64u64ZZ_Sentinel,
-} LDKCOption_C2Tuple_u64u64ZZ_Tag;
-
-typedef struct LDKCOption_C2Tuple_u64u64ZZ {
- LDKCOption_C2Tuple_u64u64ZZ_Tag tag;
- union {
- struct {
- struct LDKC2Tuple_u64u64Z some;
- };
- };
-} LDKCOption_C2Tuple_u64u64ZZ;
-
-/**
- * 8 u16s
- */
-typedef struct LDKEightU16s {
+ LDKErrorAction_IgnoreAndLog,
/**
- * The eight 16-bit integers
+ * The peer provided us with a gossip message which we'd already seen. In most cases this
+ * should be ignored, but it may result in the message being forwarded if it is a duplicate of
+ * our own channel announcements.
*/
- uint16_t data[8];
-} LDKEightU16s;
-
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple_Z {
+ LDKErrorAction_IgnoreDuplicateGossip,
/**
- * The element at position 0
+ * The peer did something incorrect. Tell them.
*/
- struct LDKEightU16s a;
+ LDKErrorAction_SendErrorMessage,
/**
- * The element at position 1
+ * The peer did something incorrect. Tell them without closing any channels.
*/
- struct LDKEightU16s b;
-} LDKC2Tuple_Z;
-
-/**
- * A tuple of 2 elements. See the individual fields for the types contained.
- */
-typedef struct LDKC2Tuple__u168_u168Z {
+ LDKErrorAction_SendWarningMessage,
/**
- * The element at position 0
+ * Must be last for serialization purposes
*/
- struct LDKEightU16s a;
+ LDKErrorAction_Sentinel,
+} LDKErrorAction_Tag;
+
+typedef struct LDKErrorAction_LDKDisconnectPeer_Body {
/**
- * The element at position 1
+ * An error message which we should make an effort to send before we disconnect.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- struct LDKEightU16s b;
-} LDKC2Tuple__u168_u168Z;
+ struct LDKErrorMessage msg;
+} LDKErrorAction_LDKDisconnectPeer_Body;
-/**
- * An enum which can either contain a crate::c_types::derived::C2Tuple__u168_u168Z or not
- */
-typedef enum LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag {
+typedef struct LDKErrorAction_LDKSendErrorMessage_Body {
/**
- * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains a crate::c_types::derived::C2Tuple__u168_u168Z
+ * The message to send.
*/
- LDKCOption_C2Tuple_EightU16sEightU16sZZ_Some,
+ struct LDKErrorMessage msg;
+} LDKErrorAction_LDKSendErrorMessage_Body;
+
+typedef struct LDKErrorAction_LDKSendWarningMessage_Body {
/**
- * When we're in this state, this COption_C2Tuple_EightU16sEightU16sZZ contains nothing
+ * The message to send.
*/
- LDKCOption_C2Tuple_EightU16sEightU16sZZ_None,
+ struct LDKWarningMessage msg;
/**
- * Must be last for serialization purposes
+ * The peer may have done something harmless that we weren't able to meaningfully process,
+ * though we should still tell them about it.
+ * If this event is logged, log it at the given level.
*/
- LDKCOption_C2Tuple_EightU16sEightU16sZZ_Sentinel,
-} LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag;
+ enum LDKLevel log_level;
+} LDKErrorAction_LDKSendWarningMessage_Body;
-typedef struct LDKCOption_C2Tuple_EightU16sEightU16sZZ {
- LDKCOption_C2Tuple_EightU16sEightU16sZZ_Tag tag;
+typedef struct MUST_USE_STRUCT LDKErrorAction {
+ LDKErrorAction_Tag tag;
union {
+ LDKErrorAction_LDKDisconnectPeer_Body disconnect_peer;
struct {
- struct LDKC2Tuple__u168_u168Z some;
+ enum LDKLevel ignore_and_log;
};
+ LDKErrorAction_LDKSendErrorMessage_Body send_error_message;
+ LDKErrorAction_LDKSendWarningMessage_Body send_warning_message;
};
-} LDKCOption_C2Tuple_EightU16sEightU16sZZ;
-
-/**
- * A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size.
- * This corresponds to std::vector in C++
- */
-typedef struct LDKCVec_NodeIdZ {
- /**
- * The elements in the array.
- * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
- */
- struct LDKNodeId *data;
- /**
- * The number of elements pointed to by `data`.
- */
- uintptr_t datalen;
-} LDKCVec_NodeIdZ;
+} LDKErrorAction;
/**
- * A Record, unit of logging output with Metadata to enable filtering
- * Module_path, file, line to inform on log's source
+ * A [`query_channel_range`] message is used to query a peer for channel
+ * UTXOs in a range of blocks. The recipient of a query makes a best
+ * effort to reply to the query using one or more [`ReplyChannelRange`]
+ * messages.
+ *
+ * [`query_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
*/
-typedef struct MUST_USE_STRUCT LDKRecord {
+typedef struct MUST_USE_STRUCT LDKQueryChannelRange {
/**
* 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;
+ LDKnativeQueryChannelRange *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;
+} LDKQueryChannelRange;
+
+
/**
- * A trait encapsulating the operations required of a logger
+ * A [`query_short_channel_ids`] message is used to query a peer for
+ * routing gossip messages related to one or more `short_channel_id`s.
+ *
+ * The query recipient will reply with the latest, if available,
+ * [`ChannelAnnouncement`], [`ChannelUpdate`] and [`NodeAnnouncement`] messages
+ * it maintains for the requested `short_channel_id`s followed by a
+ * [`ReplyShortChannelIdsEnd`] message. The `short_channel_id`s sent in
+ * this query are encoded. We only support `encoding_type=0` uncompressed
+ * serialization and do not support `encoding_type=1` zlib serialization.
+ *
+ * [`query_short_channel_ids`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_short_channel_idsreply_short_channel_ids_end-messages
*/
-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;
+typedef struct MUST_USE_STRUCT LDKQueryShortChannelIds {
/**
- * Logs the `Record`
+ * 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.
*/
- void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record);
+ LDKnativeQueryShortChannelIds *inner;
/**
- * 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.
+ * 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.
*/
- void (*free)(void *this_arg);
-} LDKLogger;
+ bool is_owned;
+} LDKQueryShortChannelIds;
/**
- * Represents the network as nodes and channels between them
+ * A [`reply_channel_range`] message is a reply to a [`QueryChannelRange`]
+ * message.
+ *
+ * Multiple `reply_channel_range` messages can be sent in reply
+ * to a single [`QueryChannelRange`] 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. The `short_channel_id`s in the
+ * reply are encoded. We only support `encoding_type=0` uncompressed
+ * serialization and do not support `encoding_type=1` zlib serialization.
+ *
+ * [`reply_channel_range`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-query_channel_range-and-reply_channel_range-messages
*/
-typedef struct MUST_USE_STRUCT LDKNetworkGraph {
+typedef struct MUST_USE_STRUCT LDKReplyChannelRange {
/**
* 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.
*/
- LDKnativeNetworkGraph *inner;
+ LDKnativeReplyChannelRange *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;
-} LDKNetworkGraph;
+} LDKReplyChannelRange;
/**
- * [`Score`] implementation using channel success probability distributions.
- *
- * Channels are tracked with upper and lower liquidity bounds - when an HTLC fails at a channel,
- * we learn that the upper-bound on the available liquidity is lower than the amount of the HTLC.
- * When a payment is forwarded through a channel (but fails later in the route), we learn the
- * lower-bound on the channel's available liquidity must be at least the value of the HTLC.
- *
- * These bounds are then used to determine a success probability using the formula from
- * *Optimally Reliable & Cheap Payment Flows on the Lightning Network* by Rene Pickhardt
- * and Stefan Richter [[1]] (i.e. `(upper_bound - payment_amount) / (upper_bound - lower_bound)`).
- *
- * This probability is combined with the [`liquidity_penalty_multiplier_msat`] and
- * [`liquidity_penalty_amount_multiplier_msat`] parameters to calculate a concrete penalty in
- * milli-satoshis. The penalties, when added across all hops, have the property of being linear in
- * terms of the entire path's success probability. This allows the router to directly compare
- * penalties for different paths. See the documentation of those parameters for the exact formulas.
- *
- * The liquidity bounds are decayed by halving them every [`liquidity_offset_half_life`].
- *
- * Further, we track the history of our upper and lower liquidity bounds for each channel,
- * allowing us to assign a second penalty (using [`historical_liquidity_penalty_multiplier_msat`]
- * and [`historical_liquidity_penalty_amount_multiplier_msat`]) based on the same probability
- * formula, but using the history of a channel rather than our latest estimates for the liquidity
- * bounds.
- *
- * # Note
- *
- * Mixing the `no-std` feature between serialization and deserialization results in undefined
- * behavior.
+ * A [`gossip_timestamp_filter`] message is used by a node to request
+ * gossip relay for messages in the requested time range when the
+ * `gossip_queries` feature has been negotiated.
*
- * [1]: https://arxiv.org/abs/2107.05322
- * [`liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_multiplier_msat
- * [`liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::liquidity_penalty_amount_multiplier_msat
- * [`liquidity_offset_half_life`]: ProbabilisticScoringParameters::liquidity_offset_half_life
- * [`historical_liquidity_penalty_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_multiplier_msat
- * [`historical_liquidity_penalty_amount_multiplier_msat`]: ProbabilisticScoringParameters::historical_liquidity_penalty_amount_multiplier_msat
+ * [`gossip_timestamp_filter`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-gossip_timestamp_filter-message
*/
-typedef struct MUST_USE_STRUCT LDKProbabilisticScorer {
+typedef struct MUST_USE_STRUCT LDKGossipTimestampFilter {
/**
* 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.
*/
- LDKnativeProbabilisticScorer *inner;
+ LDKnativeGossipTimestampFilter *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;
-} LDKProbabilisticScorer;
+} LDKGossipTimestampFilter;
/**
- * The contents of CResult_ProbabilisticScorerDecodeErrorZ
+ * An event generated by ChannelManager which indicates a message should be sent to a peer (or
+ * broadcast to most peers).
+ * These events are handled by PeerManager::process_events if you are using a PeerManager.
*/
-typedef union LDKCResult_ProbabilisticScorerDecodeErrorZPtr {
+typedef enum LDKMessageSendEvent_Tag {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * Used to indicate that we've accepted a channel open and should send the accept_channel
+ * message provided to the given peer.
*/
- struct LDKProbabilisticScorer *result;
+ LDKMessageSendEvent_SendAcceptChannel,
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * Used to indicate that we've initiated a channel open and should send the open_channel
+ * message provided to the given peer.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ProbabilisticScorerDecodeErrorZPtr;
+ LDKMessageSendEvent_SendOpenChannel,
+ /**
+ * Used to indicate that a funding_created message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendFundingCreated,
+ /**
+ * Used to indicate that a funding_signed message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendFundingSigned,
+ /**
+ * Used to indicate that a channel_ready message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendChannelReady,
+ /**
+ * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendAnnouncementSignatures,
+ /**
+ * Used to indicate that a series of HTLC update messages, as well as a commitment_signed
+ * message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_UpdateHTLCs,
+ /**
+ * Used to indicate that a revoke_and_ack message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendRevokeAndACK,
+ /**
+ * Used to indicate that a closing_signed message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendClosingSigned,
+ /**
+ * Used to indicate that a shutdown message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendShutdown,
+ /**
+ * Used to indicate that a channel_reestablish message should be sent to the peer with the given node_id.
+ */
+ LDKMessageSendEvent_SendChannelReestablish,
+ /**
+ * Used to send a channel_announcement and channel_update to a specific peer, likely on
+ * initial connection to ensure our peers know about our channels.
+ */
+ LDKMessageSendEvent_SendChannelAnnouncement,
+ /**
+ * Used to indicate that a channel_announcement and channel_update should be broadcast to all
+ * peers (except the peer with node_id either msg.contents.node_id_1 or msg.contents.node_id_2).
+ *
+ * Note that after doing so, you very likely (unless you did so very recently) want to
+ * broadcast a node_announcement (e.g. via [`PeerManager::broadcast_node_announcement`]). This
+ * ensures that any nodes which see our channel_announcement also have a relevant
+ * node_announcement, including relevant feature flags which may be important for routing
+ * through or to us.
+ *
+ * [`PeerManager::broadcast_node_announcement`]: crate::ln::peer_handler::PeerManager::broadcast_node_announcement
+ */
+ LDKMessageSendEvent_BroadcastChannelAnnouncement,
+ /**
+ * Used to indicate that a channel_update should be broadcast to all peers.
+ */
+ LDKMessageSendEvent_BroadcastChannelUpdate,
+ /**
+ * Used to indicate that a node_announcement should be broadcast to all peers.
+ */
+ LDKMessageSendEvent_BroadcastNodeAnnouncement,
+ /**
+ * Used to indicate that a channel_update should be sent to a single peer.
+ * In contrast to [`Self::BroadcastChannelUpdate`], this is used when the channel is a
+ * private channel and we shouldn't be informing all of our peers of channel parameters.
+ */
+ LDKMessageSendEvent_SendChannelUpdate,
+ /**
+ * Broadcast an error downstream to be handled
+ */
+ LDKMessageSendEvent_HandleError,
+ /**
+ * Query a peer for channels with funding transaction UTXOs in a block range.
+ */
+ LDKMessageSendEvent_SendChannelRangeQuery,
+ /**
+ * Request routing gossip messages from a peer for a list of channels identified by
+ * their short_channel_ids.
+ */
+ LDKMessageSendEvent_SendShortIdsQuery,
+ /**
+ * Sends a reply to a channel range query. This may be one of several SendReplyChannelRange events
+ * emitted during processing of the query.
+ */
+ LDKMessageSendEvent_SendReplyChannelRange,
+ /**
+ * Sends a timestamp filter for inbound gossip. This should be sent on each new connection to
+ * enable receiving gossip messages from the peer.
+ */
+ LDKMessageSendEvent_SendGossipTimestampFilter,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKMessageSendEvent_Sentinel,
+} LDKMessageSendEvent_Tag;
+
+typedef struct LDKMessageSendEvent_LDKSendAcceptChannel_Body {
+ /**
+ * The node_id of the node which should receive this message
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The message which should be sent.
+ */
+ struct LDKAcceptChannel msg;
+} LDKMessageSendEvent_LDKSendAcceptChannel_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendOpenChannel_Body {
+ /**
+ * The node_id of the node which should receive this message
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The message which should be sent.
+ */
+ struct LDKOpenChannel msg;
+} LDKMessageSendEvent_LDKSendOpenChannel_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendFundingCreated_Body {
+ /**
+ * The node_id of the node which should receive this message
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The message which should be sent.
+ */
+ struct LDKFundingCreated msg;
+} LDKMessageSendEvent_LDKSendFundingCreated_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body {
+ /**
+ * The node_id of the node which should receive this message
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The message which should be sent.
+ */
+ struct LDKFundingSigned msg;
+} LDKMessageSendEvent_LDKSendFundingSigned_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body {
+ /**
+ * The node_id of the node which should receive these message(s)
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The channel_ready message which should be sent.
+ */
+ struct LDKChannelReady msg;
+} LDKMessageSendEvent_LDKSendChannelReady_Body;
+
+typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body {
+ /**
+ * The node_id of the node which should receive these message(s)
+ */
+ struct LDKPublicKey node_id;
+ /**
+ * The announcement_signatures message which should be sent.
+ */
+ struct LDKAnnouncementSignatures msg;
+} LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body;
-/**
- * A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::routing::scoring::ProbabilisticScorer 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_ProbabilisticScorerDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKUpdateHTLCs_Body {
/**
- * The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The node_id of the node which should receive these message(s)
*/
- union LDKCResult_ProbabilisticScorerDecodeErrorZPtr contents;
+ struct LDKPublicKey node_id;
/**
- * Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state.
+ * The update messages which should be sent. ALL messages in the struct should be sent!
*/
- bool result_ok;
-} LDKCResult_ProbabilisticScorerDecodeErrorZ;
-
-
+ struct LDKCommitmentUpdate updates;
+} LDKMessageSendEvent_LDKUpdateHTLCs_Body;
-/**
- * Features used within an `init` message.
- */
-typedef struct MUST_USE_STRUCT LDKInitFeatures {
+typedef struct LDKMessageSendEvent_LDKSendRevokeAndACK_Body {
/**
- * 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.
+ * The node_id of the node which should receive this message
*/
- LDKnativeInitFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * 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.
+ * The message which should be sent.
*/
- bool is_owned;
-} LDKInitFeatures;
+ struct LDKRevokeAndACK msg;
+} LDKMessageSendEvent_LDKSendRevokeAndACK_Body;
-/**
- * The contents of CResult_InitFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_InitFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKSendClosingSigned_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of the node which should receive this message
*/
- struct LDKInitFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The message which should be sent.
*/
- struct LDKDecodeError *err;
-} LDKCResult_InitFeaturesDecodeErrorZPtr;
+ struct LDKClosingSigned msg;
+} LDKMessageSendEvent_LDKSendClosingSigned_Body;
-/**
- * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::InitFeatures 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_InitFeaturesDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKSendShutdown_Body {
/**
- * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The node_id of the node which should receive this message
*/
- union LDKCResult_InitFeaturesDecodeErrorZPtr contents;
+ struct LDKPublicKey node_id;
/**
- * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state.
+ * The message which should be sent.
*/
- bool result_ok;
-} LDKCResult_InitFeaturesDecodeErrorZ;
-
-
+ struct LDKShutdown msg;
+} LDKMessageSendEvent_LDKSendShutdown_Body;
-/**
- * Features used within a `channel_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKChannelFeatures {
+typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body {
/**
- * 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.
+ * The node_id of the node which should receive this message
*/
- LDKnativeChannelFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * 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.
+ * The message which should be sent.
*/
- bool is_owned;
-} LDKChannelFeatures;
+ struct LDKChannelReestablish msg;
+} LDKMessageSendEvent_LDKSendChannelReestablish_Body;
-/**
- * The contents of CResult_ChannelFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of the node which should receive this message
*/
- struct LDKChannelFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The channel_announcement which should be sent.
*/
- struct LDKDecodeError *err;
-} LDKCResult_ChannelFeaturesDecodeErrorZPtr;
+ struct LDKChannelAnnouncement msg;
+ /**
+ * The followup channel_update which should be sent.
+ */
+ struct LDKChannelUpdate update_msg;
+} LDKMessageSendEvent_LDKSendChannelAnnouncement_Body;
-/**
- * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::ChannelFeatures 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_ChannelFeaturesDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body {
/**
- * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The channel_announcement which should be sent.
*/
- union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents;
+ struct LDKChannelAnnouncement msg;
/**
- * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state.
+ * The followup channel_update which should be sent.
+ *
+ * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
- bool result_ok;
-} LDKCResult_ChannelFeaturesDecodeErrorZ;
-
-
+ struct LDKChannelUpdate update_msg;
+} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body;
-/**
- * Features used within a `node_announcement` message.
- */
-typedef struct MUST_USE_STRUCT LDKNodeFeatures {
+typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body {
/**
- * 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.
+ * The channel_update which should be sent.
*/
- LDKnativeNodeFeatures *inner;
+ struct LDKChannelUpdate msg;
+} LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body;
+
+typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body {
/**
- * 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.
+ * The node_announcement which should be sent.
*/
- bool is_owned;
-} LDKNodeFeatures;
+ struct LDKNodeAnnouncement msg;
+} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body;
-/**
- * The contents of CResult_NodeFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKSendChannelUpdate_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of the node which should receive this message
*/
- struct LDKNodeFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The channel_update which should be sent.
*/
- struct LDKDecodeError *err;
-} LDKCResult_NodeFeaturesDecodeErrorZPtr;
+ struct LDKChannelUpdate msg;
+} LDKMessageSendEvent_LDKSendChannelUpdate_Body;
-/**
- * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::NodeFeatures 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_NodeFeaturesDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKHandleError_Body {
/**
- * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The node_id of the node which should receive this message
*/
- union LDKCResult_NodeFeaturesDecodeErrorZPtr contents;
+ struct LDKPublicKey node_id;
/**
- * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state.
+ * The action which should be taken.
*/
- bool result_ok;
-} LDKCResult_NodeFeaturesDecodeErrorZ;
-
-
+ struct LDKErrorAction action;
+} LDKMessageSendEvent_LDKHandleError_Body;
-/**
- * Features used within an invoice.
- */
-typedef struct MUST_USE_STRUCT LDKInvoiceFeatures {
+typedef struct LDKMessageSendEvent_LDKSendChannelRangeQuery_Body {
/**
- * 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.
+ * The node_id of this message recipient
*/
- LDKnativeInvoiceFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * 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.
+ * The query_channel_range which should be sent.
*/
- bool is_owned;
-} LDKInvoiceFeatures;
+ struct LDKQueryChannelRange msg;
+} LDKMessageSendEvent_LDKSendChannelRangeQuery_Body;
-/**
- * The contents of CResult_InvoiceFeaturesDecodeErrorZ
- */
-typedef union LDKCResult_InvoiceFeaturesDecodeErrorZPtr {
+typedef struct LDKMessageSendEvent_LDKSendShortIdsQuery_Body {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The node_id of this message recipient
*/
- struct LDKInvoiceFeatures *result;
+ struct LDKPublicKey node_id;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The query_short_channel_ids which should be sent.
*/
- struct LDKDecodeError *err;
-} LDKCResult_InvoiceFeaturesDecodeErrorZPtr;
+ struct LDKQueryShortChannelIds msg;
+} LDKMessageSendEvent_LDKSendShortIdsQuery_Body;
-/**
- * A CResult_InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::InvoiceFeatures 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_InvoiceFeaturesDecodeErrorZ {
+typedef struct LDKMessageSendEvent_LDKSendReplyChannelRange_Body {
/**
- * The contents of this CResult_InvoiceFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The node_id of this message recipient
*/
- union LDKCResult_InvoiceFeaturesDecodeErrorZPtr contents;
+ struct LDKPublicKey node_id;
/**
- * Whether this CResult_InvoiceFeaturesDecodeErrorZ represents a success state.
+ * The reply_channel_range which should be sent.
*/
- bool result_ok;
-} LDKCResult_InvoiceFeaturesDecodeErrorZ;
-
-
+ struct LDKReplyChannelRange msg;
+} LDKMessageSendEvent_LDKSendReplyChannelRange_Body;
-/**
- * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo
- */
-typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures {
+typedef struct LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body {
/**
- * 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.
+ * The node_id of this message recipient
*/
- LDKnativeBlindedHopFeatures *inner;
+ struct LDKPublicKey node_id;
/**
- * 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.
+ * The gossip_timestamp_filter which should be sent.
*/
- bool is_owned;
-} LDKBlindedHopFeatures;
+ struct LDKGossipTimestampFilter msg;
+} LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body;
+
+typedef struct MUST_USE_STRUCT LDKMessageSendEvent {
+ LDKMessageSendEvent_Tag tag;
+ union {
+ LDKMessageSendEvent_LDKSendAcceptChannel_Body send_accept_channel;
+ LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel;
+ LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created;
+ LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed;
+ LDKMessageSendEvent_LDKSendChannelReady_Body send_channel_ready;
+ LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body send_announcement_signatures;
+ LDKMessageSendEvent_LDKUpdateHTLCs_Body update_htl_cs;
+ LDKMessageSendEvent_LDKSendRevokeAndACK_Body send_revoke_and_ack;
+ LDKMessageSendEvent_LDKSendClosingSigned_Body send_closing_signed;
+ LDKMessageSendEvent_LDKSendShutdown_Body send_shutdown;
+ LDKMessageSendEvent_LDKSendChannelReestablish_Body send_channel_reestablish;
+ LDKMessageSendEvent_LDKSendChannelAnnouncement_Body send_channel_announcement;
+ LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body broadcast_channel_announcement;
+ LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update;
+ LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement;
+ LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update;
+ LDKMessageSendEvent_LDKHandleError_Body handle_error;
+ LDKMessageSendEvent_LDKSendChannelRangeQuery_Body send_channel_range_query;
+ LDKMessageSendEvent_LDKSendShortIdsQuery_Body send_short_ids_query;
+ LDKMessageSendEvent_LDKSendReplyChannelRange_Body send_reply_channel_range;
+ LDKMessageSendEvent_LDKSendGossipTimestampFilter_Body send_gossip_timestamp_filter;
+ };
+} LDKMessageSendEvent;
/**
- * The contents of CResult_BlindedHopFeaturesDecodeErrorZ
+ * A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr {
+typedef struct LDKCVec_MessageSendEventZ {
/**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- struct LDKBlindedHopFeatures *result;
+ struct LDKMessageSendEvent *data;
/**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
+ * The number of elements pointed to by `data`.
*/
- struct LDKDecodeError *err;
-} LDKCResult_BlindedHopFeaturesDecodeErrorZPtr;
+ uintptr_t datalen;
+} LDKCVec_MessageSendEventZ;
/**
- * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size.
+ * This corresponds to std::vector in C++
*/
-typedef struct LDKCResult_BlindedHopFeaturesDecodeErrorZ {
+typedef struct LDKCVec_ChainHashZ {
/**
- * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
*/
- union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents;
+ struct LDKThirtyTwoBytes *data;
/**
- * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state.
+ * The number of elements pointed to by `data`.
*/
- bool result_ok;
-} LDKCResult_BlindedHopFeaturesDecodeErrorZ;
+ uintptr_t datalen;
+} LDKCVec_ChainHashZ;
/**
- * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ
+ * The contents of CResult_PublicKeyErrorZ
*/
-typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr {
+typedef union LDKCResult_PublicKeyErrorZPtr {
/**
* A pointer to the contents in the success state.
* Reading from this pointer when `result_ok` is not set is undefined.
*/
- struct LDKChannelTypeFeatures *result;
+ struct LDKPublicKey *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_ChannelTypeFeaturesDecodeErrorZPtr;
+ enum LDKSecp256k1Error *err;
+} LDKCResult_PublicKeyErrorZPtr;
/**
- * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation,
- * containing a crate::lightning::ln::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure.
+ * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
+ * containing a crate::c_types::PublicKey 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_ChannelTypeFeaturesDecodeErrorZ {
+typedef struct LDKCResult_PublicKeyErrorZ {
/**
- * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either
+ * The contents of this CResult_PublicKeyErrorZ, accessible via either
* `err` or `result` depending on the state of `result_ok`.
*/
- union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents;
+ union LDKCResult_PublicKeyErrorZPtr contents;
/**
- * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state.
+ * Whether this CResult_PublicKeyErrorZ represents a success state.
*/
bool result_ok;
-} LDKCResult_ChannelTypeFeaturesDecodeErrorZ;
+} LDKCResult_PublicKeyErrorZ;
/**
* The contents of CResult_NodeIdDecodeErrorZ
} LDKCVec_RecentPaymentDetailsZ;
/**
- * If a payment fails to send with [`ChannelManager::send_payment`], 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.
+ * If a payment fails to send with [`ChannelManager::send_payment_with_route`], 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.
*
- * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment
+ * [`ChannelManager::send_payment_with_route`]: crate::ln::channelmanager::ChannelManager::send_payment_with_route
*/
typedef enum LDKPaymentSendFailure_Tag {
/**
* Because the payment failed outright, no payment tracking is done and no
* [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
*
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
- * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
+ * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
*/
LDKPaymentSendFailure_ParameterError,
/**
* The results here are ordered the same as the paths in the route object which was passed to
* send_payment.
*
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
- * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
+ * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
*/
LDKPaymentSendFailure_PathParameterError,
/**
* Because the payment failed outright, no payment tracking is done and no
* [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated.
*
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
- * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
+ * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
*/
LDKPaymentSendFailure_AllFailedResendSafe,
/**
* yet completed (i.e. generated an [`Event::PaymentSent`] or [`Event::PaymentFailed`]).
*
* [`PaymentId`]: crate::ln::channelmanager::PaymentId
- * [`Event::PaymentSent`]: crate::util::events::Event::PaymentSent
- * [`Event::PaymentFailed`]: crate::util::events::Event::PaymentFailed
+ * [`Event::PaymentSent`]: crate::events::Event::PaymentSent
+ * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed
*/
LDKPaymentSendFailure_DuplicatePayment,
/**
* 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
+ * 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
+ * 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).
+ * serialized). This will result in any channels which have not yet exchanged [`funding_created`] (i.e.,
+ * called [`funding_transaction_generated`] for outbound channels) being closed.
*
- * 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
+ * Note that you can be a bit lazier about writing out `ChannelManager` than you can be with
+ * [`ChannelMonitor`]. With [`ChannelMonitor`] you MUST write each monitor update out to disk before
+ * returning from [`chain::Watch::watch_channel`]/[`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).
+ * [`ChannelMonitor`] 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 the deserializer is only implemented for `(`[`BlockHash`]`, `[`ChannelManager`]`)`, which
+ * tells you the last block hash which was connected. You should get the best block tip before using the manager.
+ * See [`chain::Listen`] and [`chain::Confirm`] for more details.
*
- * 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
+ * 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.
+ * [`timer_tick_occurred`] roughly once per minute, though it doesn't have to be perfect.
*
- * To avoid trivial DoS issues, ChannelManager limits the number of inbound connections and
+ * To avoid trivial DoS issues, `ChannelManager` limits the number of inbound connections and
* inbound channels without confirmed funding transactions. This may result in nodes which we do
* not have a channel with being unable to connect to us or open new channels with us if we have
* many peers with unfunded channels.
* exempted from the count of unfunded channels. Similarly, outbound channels and connections are
* never limited. Please ensure you limit the count of such channels yourself.
*
- * 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
+ * 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.
+ *
+ * [`peer_disconnected`]: msgs::ChannelMessageHandler::peer_disconnected
+ * [`funding_created`]: msgs::FundingCreated
+ * [`funding_transaction_generated`]: Self::funding_transaction_generated
+ * [`BlockHash`]: bitcoin::hash_types::BlockHash
+ * [`update_channel`]: chain::Watch::update_channel
+ * [`ChannelUpdate`]: msgs::ChannelUpdate
+ * [`timer_tick_occurred`]: Self::timer_tick_occurred
+ * [`read`]: ReadableArgs::read
*/
typedef struct MUST_USE_STRUCT LDKChannelManager {
/**
bool result_ok;
} LDKCResult_COption_APIErrorZDecodeErrorZ;
+/**
+ * The contents of CResult_UntrustedStringDecodeErrorZ
+ */
+typedef union LDKCResult_UntrustedStringDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKUntrustedString *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_UntrustedStringDecodeErrorZPtr;
+
+/**
+ * A CResult_UntrustedStringDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::util::string::UntrustedString 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_UntrustedStringDecodeErrorZ {
+ /**
+ * The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_UntrustedStringDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_UntrustedStringDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_UntrustedStringDecodeErrorZ;
+
/**
* The contents of CResult_OutPointDecodeErrorZ
*/
bool result_ok;
} LDKCResult_StringErrorZ;
-/**
- * The contents of CResult_PublicKeyErrorZ
- */
-typedef union LDKCResult_PublicKeyErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- struct LDKPublicKey *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_PublicKeyErrorZPtr;
-
-/**
- * A CResult_PublicKeyErrorZ represents the result of a fallible operation,
- * containing a crate::c_types::PublicKey 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_PublicKeyErrorZ {
- /**
- * The contents of this CResult_PublicKeyErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_PublicKeyErrorZPtr contents;
- /**
- * Whether this CResult_PublicKeyErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_PublicKeyErrorZ;
-
/**
* The contents of CResult_ChannelMonitorUpdateDecodeErrorZ
*/
} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ;
/**
- * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size.
+ * A dynamically-allocated array of crate::lightning::events::Events of arbitrary size.
* This corresponds to std::vector in C++
*/
typedef struct LDKCVec_EventZ {
bool result_ok;
} LDKCResult_NoneSendErrorZ;
+/**
+ * The contents of CResult_BlindedPathNoneZ
+ */
+typedef union LDKCResult_BlindedPathNoneZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKBlindedPath *result;
+ /**
+ * Note that this value is always NULL, as there are no contents in the Err variant
+ */
+ void *err;
+} LDKCResult_BlindedPathNoneZPtr;
+
+/**
+ * A CResult_BlindedPathNoneZ represents the result of a fallible operation,
+ * containing a crate::lightning::blinded_path::BlindedPath on success and a () on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
+ */
+typedef struct LDKCResult_BlindedPathNoneZ {
+ /**
+ * The contents of this CResult_BlindedPathNoneZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_BlindedPathNoneZPtr contents;
+ /**
+ * Whether this CResult_BlindedPathNoneZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_BlindedPathNoneZ;
+
+/**
+ * The contents of CResult_BlindedPathDecodeErrorZ
+ */
+typedef union LDKCResult_BlindedPathDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKBlindedPath *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_BlindedPathDecodeErrorZPtr;
+
+/**
+ * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::blinded_path::BlindedPath 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_BlindedPathDecodeErrorZ {
+ /**
+ * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_BlindedPathDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_BlindedPathDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_BlindedPathDecodeErrorZ;
+
+/**
+ * The contents of CResult_BlindedHopDecodeErrorZ
+ */
+typedef union LDKCResult_BlindedHopDecodeErrorZPtr {
+ /**
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
+ */
+ struct LDKBlindedHop *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_BlindedHopDecodeErrorZPtr;
+
+/**
+ * A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation,
+ * containing a crate::lightning::blinded_path::BlindedHop 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_BlindedHopDecodeErrorZ {
+ /**
+ * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
+ */
+ union LDKCResult_BlindedHopDecodeErrorZPtr contents;
+ /**
+ * Whether this CResult_BlindedHopDecodeErrorZ represents a success state.
+ */
+ bool result_ok;
+} LDKCResult_BlindedHopDecodeErrorZ;
+
/**
* Sub-errors which don't have specific information in them use this type.
*/
* 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)`
+ * 1. using [`InvoiceBuilder`]
+ * 2. using [`Invoice::from_signed`]
+ * 3. using `str::parse::<Invoice>(&str)` (see [`Invoice::from_str`])
+ *
+ * [`Invoice::from_str`]: crate::Invoice#impl-FromStr
*/
typedef struct MUST_USE_STRUCT LDKInvoice {
/**
/**
- * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be
+ * 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`.
+ * The hash has to be either from the deserialized invoice or from the serialized [`RawInvoice`].
*/
typedef struct MUST_USE_STRUCT LDKSignedRawInvoice {
/**
/**
- * Represents an syntactically correct Invoice for a payment on the lightning network,
+ * 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.
+ * Decoding and encoding should not lead to information loss but may lead to different hashes.
*
- * For methods without docs see the corresponding methods in `Invoice`.
+ * For methods without docs see the corresponding methods in [`Invoice`].
*/
typedef struct MUST_USE_STRUCT LDKRawInvoice {
/**
bool result_ok;
} LDKCResult_InvoiceSemanticErrorZ;
+/**
+ * A dynamically-allocated array of crate::c_types::Strs of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_AddressZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKStr *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_AddressZ;
+
/**
bool result_ok;
} LDKCResult_PrivateRouteCreationErrorZ;
-/**
- * All-encompassing standard error type that processing can return
- */
-typedef enum LDKGraphSyncError_Tag {
- /**
- * Error trying to read the update data, typically due to an erroneous data length indication
- * that is greater than the actual amount of data provided
- */
- LDKGraphSyncError_DecodeError,
- /**
- * Error applying the patch to the network graph, usually the result of updates that are too
- * old or missing prerequisite data to the application of updates out of order
- */
- LDKGraphSyncError_LightningError,
- /**
- * Must be last for serialization purposes
- */
- LDKGraphSyncError_Sentinel,
-} LDKGraphSyncError_Tag;
-
-typedef struct MUST_USE_STRUCT LDKGraphSyncError {
- LDKGraphSyncError_Tag tag;
- union {
- struct {
- struct LDKDecodeError decode_error;
- };
- struct {
- struct LDKLightningError lightning_error;
- };
- };
-} LDKGraphSyncError;
-
-/**
- * The contents of CResult_u32GraphSyncErrorZ
- */
-typedef union LDKCResult_u32GraphSyncErrorZPtr {
- /**
- * A pointer to the contents in the success state.
- * Reading from this pointer when `result_ok` is not set is undefined.
- */
- uint32_t *result;
- /**
- * A pointer to the contents in the error state.
- * Reading from this pointer when `result_ok` is set is undefined.
- */
- struct LDKGraphSyncError *err;
-} LDKCResult_u32GraphSyncErrorZPtr;
-
-/**
- * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
- * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
- * `result_ok` indicates the overall state, and the contents are provided via `contents`.
- */
-typedef struct LDKCResult_u32GraphSyncErrorZ {
- /**
- * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
- * `err` or `result` depending on the state of `result_ok`.
- */
- union LDKCResult_u32GraphSyncErrorZPtr contents;
- /**
- * Whether this CResult_u32GraphSyncErrorZ represents a success state.
- */
- bool result_ok;
-} LDKCResult_u32GraphSyncErrorZ;
-
/**
* The contents of CResult_NetAddressDecodeErrorZ
*/
} LDKCVec_PhantomRouteHintsZ;
/**
- * When signing using a fallible method either an user-supplied `SignError` or a `CreationError`
+ * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`]
* may occur.
*/
typedef enum LDKSignOrCreationError_Tag {
+/**
+ * A simple future which can complete once, and calls some callback(s) when it does so.
+ *
+ * Clones can be made and all futures cloned from the same source will complete at the same time.
+ */
+typedef struct MUST_USE_STRUCT LDKFuture {
+ /**
+ * 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.
+ */
+ LDKnativeFuture *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;
+} LDKFuture;
+
+/**
+ * A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size.
+ * This corresponds to std::vector in C++
+ */
+typedef struct LDKCVec_FutureZ {
+ /**
+ * The elements in the array.
+ * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc().
+ */
+ struct LDKFuture *data;
+ /**
+ * The number of elements pointed to by `data`.
+ */
+ uintptr_t datalen;
+} LDKCVec_FutureZ;
+
+
+
/**
* A transaction output watched by a [`ChannelMonitor`] for spends on-chain.
*
} LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ;
/**
- * A trait indicating an object may generate message send events
+ * All-encompassing standard error type that processing can return
*/
-typedef struct LDKMessageSendEventsProvider {
+typedef enum LDKGraphSyncError_Tag {
/**
- * 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.
+ * Error trying to read the update data, typically due to an erroneous data length indication
+ * that is greater than the actual amount of data provided
*/
- void *this_arg;
+ LDKGraphSyncError_DecodeError,
/**
- * Gets the list of pending events which were generated by previous actions, clearing the list
- * in the process.
+ * Error applying the patch to the network graph, usually the result of updates that are too
+ * old or missing prerequisite data to the application of updates out of order
*/
- struct LDKCVec_MessageSendEventZ (*get_and_clear_pending_msg_events)(const void *this_arg);
+ LDKGraphSyncError_LightningError,
/**
- * 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.
+ * Must be last for serialization purposes
*/
- void (*free)(void *this_arg);
-} LDKMessageSendEventsProvider;
+ LDKGraphSyncError_Sentinel,
+} LDKGraphSyncError_Tag;
-/**
- * A trait indicating an object may generate onion messages to send
- */
-typedef struct LDKOnionMessageProvider {
- /**
- * 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 next pending onion message for the peer with the given node id.
- *
- * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
- */
- struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_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);
-} LDKOnionMessageProvider;
+typedef struct MUST_USE_STRUCT LDKGraphSyncError {
+ LDKGraphSyncError_Tag tag;
+ union {
+ struct {
+ struct LDKDecodeError decode_error;
+ };
+ struct {
+ struct LDKLightningError lightning_error;
+ };
+ };
+} LDKGraphSyncError;
/**
- * A trait implemented for objects handling events from [`EventsProvider`].
- *
- * An async variation also exists for implementations of [`EventsProvider`] that support async
- * event handling. The async event handler should satisfy the generic bounds: `F:
- * core::future::Future, H: Fn(Event) -> F`.
+ * The contents of CResult_u32GraphSyncErrorZ
*/
-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;
+typedef union LDKCResult_u32GraphSyncErrorZPtr {
/**
- * Handles the given [`Event`].
- *
- * See [`EventsProvider`] for details that must be considered when implementing this method.
+ * A pointer to the contents in the success state.
+ * Reading from this pointer when `result_ok` is not set is undefined.
*/
- void (*handle_event)(const void *this_arg, struct LDKEvent event);
+ uint32_t *result;
/**
- * 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.
+ * A pointer to the contents in the error state.
+ * Reading from this pointer when `result_ok` is set is undefined.
*/
- void (*free)(void *this_arg);
-} LDKEventHandler;
+ struct LDKGraphSyncError *err;
+} LDKCResult_u32GraphSyncErrorZPtr;
/**
- * A trait indicating an object may generate events.
- *
- * Events are processed by passing an [`EventHandler`] to [`process_pending_events`].
- *
- * Implementations of this trait may also feature an async version of event handling, as shown with
- * [`ChannelManager::process_pending_events_async`] and
- * [`ChainMonitor::process_pending_events_async`].
- *
- * # Requirements
- *
- * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
- * event since the last invocation.
- *
- * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
- * and replay any unhandled events on startup. An [`Event`] is considered handled when
- * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
- * relevant changes to disk *before* returning.
- *
- * Further, because an application may crash between an [`Event`] being handled and the
- * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
- * effect, [`Event`]s may be replayed.
- *
- * 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
- * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
- * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
+ * A CResult_u32GraphSyncErrorZ represents the result of a fallible operation,
+ * containing a u32 on success and a crate::lightning_rapid_gossip_sync::error::GraphSyncError on failure.
+ * `result_ok` indicates the overall state, and the contents are provided via `contents`.
*/
-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;
+typedef struct LDKCResult_u32GraphSyncErrorZ {
/**
- * Processes any events generated since the last call using the given event handler.
- *
- * See the trait-level documentation for requirements.
+ * The contents of this CResult_u32GraphSyncErrorZ, accessible via either
+ * `err` or `result` depending on the state of `result_ok`.
*/
- void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler);
+ union LDKCResult_u32GraphSyncErrorZPtr contents;
/**
- * 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.
+ * Whether this CResult_u32GraphSyncErrorZ represents a success state.
*/
- void (*free)(void *this_arg);
-} LDKEventsProvider;
+ bool result_ok;
+} LDKCResult_u32GraphSyncErrorZ;
/**
- * A simple future which can complete once, and calls some callback(s) when it does so.
+ * A struct which can be used to select across many [`Future`]s at once without relying on a full
+ * async context.
*/
-typedef struct MUST_USE_STRUCT LDKFuture {
+typedef struct MUST_USE_STRUCT LDKSleeper {
/**
* 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.
*/
- LDKnativeFuture *inner;
+ LDKnativeSleeper *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;
-} LDKFuture;
+} LDKSleeper;
* or used independently to monitor channels remotely. See the [module-level documentation] for
* details.
*
+ * Note that `ChainMonitor` should regularly trigger rebroadcasts/fee bumps of pending claims from
+ * a force-closed channel. This is crucial in preventing certain classes of pinning attacks,
+ * detecting substantial mempool feerate changes between blocks, and ensuring reliability if
+ * broadcasting fails. We recommend invoking this every 30 seconds, or lower if running in an
+ * environment with spotty connections, like on mobile.
+ *
* [`ChannelManager`]: crate::ln::channelmanager::ChannelManager
* [module-level documentation]: crate::chain::chainmonitor
+ * [`rebroadcast_pending_claims`]: Self::rebroadcast_pending_claims
*/
typedef struct MUST_USE_STRUCT LDKChainMonitor {
/**
bool is_owned;
} LDKChainMonitor;
+/**
+ * A trait implemented for objects handling events from [`EventsProvider`].
+ *
+ * An async variation also exists for implementations of [`EventsProvider`] that support async
+ * event handling. The async event handler should satisfy the generic bounds: `F:
+ * core::future::Future, H: Fn(Event) -> F`.
+ */
+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, struct LDKEvent 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`].
+ *
+ * Implementations of this trait may also feature an async version of event handling, as shown with
+ * [`ChannelManager::process_pending_events_async`] and
+ * [`ChainMonitor::process_pending_events_async`].
+ *
+ * # Requirements
+ *
+ * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending
+ * event since the last invocation.
+ *
+ * In order to ensure no [`Event`]s are lost, implementors of this trait will persist [`Event`]s
+ * and replay any unhandled events on startup. An [`Event`] is considered handled when
+ * [`process_pending_events`] returns, thus handlers MUST fully handle [`Event`]s and persist any
+ * relevant changes to disk *before* returning.
+ *
+ * Further, because an application may crash between an [`Event`] being handled and the
+ * implementor of this trait being re-serialized, [`Event`] handling must be idempotent - in
+ * effect, [`Event`]s may be replayed.
+ *
+ * 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
+ * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async
+ * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async
+ */
+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.
+ *
+ * See the trait-level documentation for requirements.
+ */
+ 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;
+
/**
* Represents a valid secp256k1 secret key serialized as a 32 byte array.
*/
*
* Each attempt may be multiple HTLCs along multiple paths if the router decides to split up a
* retry, and may retry multiple failed HTLCs at once if they failed around the same time and
- * were retried along a route from a single call to [`Router::find_route`].
+ * were retried along a route from a single call to [`Router::find_route_with_id`].
*/
LDKRetry_Attempts,
/**
};
} LDKRetry;
+/**
+ * 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 to describe an object which can receive channel messages.
*
void (*free)(void *this_arg);
} LDKRoutingMessageHandler;
+/**
+ * A trait indicating an object may generate onion messages to send
+ */
+typedef struct LDKOnionMessageProvider {
+ /**
+ * 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 next pending onion message for the peer with the given node id.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+ struct LDKOnionMessage (*next_onion_message_for_peer)(const void *this_arg, struct LDKPublicKey peer_node_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);
+} LDKOnionMessageProvider;
+
/**
* A trait to describe an object that can receive onion messages.
*/
* 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.
+ * 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
* [`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
+ * 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
+/**
+ * A semantically valid [`Invoice`] that hasn't been signed.
+ */
+typedef struct MUST_USE_STRUCT LDKUnsignedInvoice {
+ /**
+ * 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.
+ */
+ LDKnativeUnsignedInvoice *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;
+} LDKUnsignedInvoice;
+
+
+
+/**
+ * A semantically valid [`InvoiceRequest`] that hasn't been signed.
+ */
+typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest {
+ /**
+ * 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.
+ */
+ LDKnativeUnsignedInvoiceRequest *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;
+} LDKUnsignedInvoiceRequest;
+
+
+
+/**
+ * An `InvoiceRequest` is a request for an [`Invoice`] formulated from an [`Offer`].
+ *
+ * An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
+ * specifies these such that its recipient can send an invoice for payment.
+ *
+ * [`Invoice`]: crate::offers::invoice::Invoice
+ * [`Offer`]: crate::offers::offer::Offer
+ */
+typedef struct MUST_USE_STRUCT LDKInvoiceRequest {
+ /**
+ * 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.
+ */
+ LDKnativeInvoiceRequest *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;
+} LDKInvoiceRequest;
+
+
+
+/**
+ * An `Offer` is a potentially long-lived proposal for payment of a good or service.
+ *
+ * An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a
+ * customer may request an [`Invoice`] for a specific quantity and using an amount sufficient to
+ * cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`].
+ *
+ * Offers may be denominated in currency other than bitcoin but are ultimately paid using the
+ * latter.
+ *
+ * Through the use of [`BlindedPath`]s, offers provide recipient privacy.
+ *
+ * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ * [`Invoice`]: crate::offers::invoice::Invoice
+ */
+typedef struct MUST_USE_STRUCT LDKOffer {
+ /**
+ * 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.
+ */
+ LDKnativeOffer *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;
+} LDKOffer;
+
+
+
+/**
+ * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or
+ * another currency.
+ */
+typedef struct MUST_USE_STRUCT LDKAmount {
+ /**
+ * 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.
+ */
+ LDKnativeAmount *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;
+} LDKAmount;
+
+
+
+/**
+ * Quantity of items supported by an [`Offer`].
+ */
+typedef struct MUST_USE_STRUCT LDKQuantity {
+ /**
+ * 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.
+ */
+ LDKnativeQuantity *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;
+} LDKQuantity;
+
+
+
+/**
+ * A `Refund` is a request to send an [`Invoice`] without a preceding [`Offer`].
+ *
+ * Typically, after an invoice is paid, the recipient may publish a refund allowing the sender to
+ * recoup their funds. A refund may be used more generally as an \"offer for money\", such as with a
+ * bitcoin ATM.
+ *
+ * [`Invoice`]: crate::offers::invoice::Invoice
+ * [`Offer`]: crate::offers::offer::Offer
+ */
+typedef struct MUST_USE_STRUCT LDKRefund {
+ /**
+ * 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.
+ */
+ LDKnativeRefund *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;
+} LDKRefund;
+
+
+
/**
* Receives and validates network updates from peers,
* stores authentic and relevant data as a network graph.
bool is_owned;
} LDKScorerAccountingForInFlightHtlcs;
+/**
+ * Routing hints for the tail of the route.
+ */
+typedef enum LDKHints_Tag {
+ /**
+ * The recipient provided blinded paths and payinfo to reach them. The blinded paths themselves
+ * will be included in the final [`Route`].
+ */
+ LDKHints_Blinded,
+ /**
+ * The recipient included these route hints in their BOLT11 invoice.
+ */
+ LDKHints_Clear,
+ /**
+ * Must be last for serialization purposes
+ */
+ LDKHints_Sentinel,
+} LDKHints_Tag;
+
+typedef struct MUST_USE_STRUCT LDKHints {
+ LDKHints_Tag tag;
+ union {
+ struct {
+ struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ blinded;
+ };
+ struct {
+ struct LDKCVec_RouteHintZ clear;
+ };
+ };
+} LDKHints;
+
/**
* # extern crate bitcoin;
* # use bitcoin::hashes::_export::_core::time::Duration;
* # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey};
+ * # use lightning::blinded_path::BlindedPath;
* # use lightning::chain::keysinterface::KeysManager;
* # use lightning::ln::peer_handler::IgnoringMessageHandler;
- * # use lightning::onion_message::blinded_path::BlindedPath;
* # use lightning::onion_message::messenger::{Destination, OnionMessenger};
* # use lightning::onion_message::packet::{CustomOnionMessageContents, OnionMessageContents};
* # use lightning::util::logger::{Logger, Record};
* // Create a blinded path to yourself, for someone to send an onion message to.
* # let your_node_id = hop_node_id1;
* let hops = [hop_node_id3, hop_node_id4, your_node_id];
- * let blinded_path = BlindedPath::new(&hops, &keys_manager, &secp_ctx).unwrap();
+ * let blinded_path = BlindedPath::new_for_message(&hops, &keys_manager, &secp_ctx).unwrap();
*
* // Send a custom onion message to a blinded path.
* # let intermediate_hops = [hop_node_id1, hop_node_id2];
* * 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 [`ChannelManager::timer_tick_occurred`], [`ChainMonitor::rebroadcast_pending_claims`]
+ * and [`PeerManager::timer_tick_occurred`] at the appropriate intervals.
* * Calling [`NetworkGraph::remove_stale_channels_and_tracking`] (if a [`GossipSync`] with a
* [`NetworkGraph`] is provided to [`BackgroundProcessor::start`]).
*
* unilateral chain closure fees are at risk.
*
* [`ChannelMonitor`]: lightning::chain::channelmonitor::ChannelMonitor
- * [`Event`]: lightning::util::events::Event
+ * [`Event`]: lightning::events::Event
*BackgroundProcessor will immediately stop on drop. It should be stored until shutdown.
*/
typedef struct MUST_USE_STRUCT LDKBackgroundProcessor {
/**
- * Data of the `RawInvoice` that is encoded in the data part
+ * Data of the [`RawInvoice`] that is encoded in the data part
*/
typedef struct MUST_USE_STRUCT LDKRawDataPart {
/**
} LDKFallback_Tag;
typedef struct LDKFallback_LDKSegWitProgram_Body {
- struct LDKU5 version;
+ struct LDKWitnessVersion version;
struct LDKCVec_u8Z program;
} LDKFallback_LDKSegWitProgram_Body;
extern const uint8_t TAG_PAYMENT_SECRET;
+extern const uint8_t TAG_PAYMENT_METADATA;
+
extern const uint8_t TAG_FEATURES;
struct LDKStr _ldk_get_compiled_version(void);
const void *__unmangle_inner_ptr(const void *ptr);
#endif
+/**
+ * Constructs a new COption_DurationZ containing a u64
+ */
+struct LDKCOption_DurationZ COption_DurationZ_some(uint64_t o);
+
+/**
+ * Constructs a new COption_DurationZ containing nothing
+ */
+struct LDKCOption_DurationZ COption_DurationZ_none(void);
+
+/**
+ * Frees any resources associated with the u64, if we are in the Some state
+ */
+void COption_DurationZ_free(struct LDKCOption_DurationZ _res);
+
+/**
+ * Creates a new COption_DurationZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_DurationZ COption_DurationZ_clone(const struct LDKCOption_DurationZ *NONNULL_PTR orig);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_BlindedPathZ_free(struct LDKCVec_BlindedPathZ _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_NoneAPIErrorZ in the success state.
*/
*/
void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res);
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_u8Z_free(struct LDKCVec_u8Z _res);
+
+/**
+ * Constructs a new COption_CVec_u8ZZ containing a crate::c_types::derived::CVec_u8Z
+ */
+struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_some(struct LDKCVec_u8Z o);
+
+/**
+ * Constructs a new COption_CVec_u8ZZ containing nothing
+ */
+struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::c_types::derived::CVec_u8Z, if we are in the Some state
+ */
+void COption_CVec_u8ZZ_free(struct LDKCOption_CVec_u8ZZ _res);
+
+/**
+ * Creates a new COption_CVec_u8ZZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_CVec_u8ZZ COption_CVec_u8ZZ_clone(const struct LDKCOption_CVec_u8ZZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the success state.
+ */
+struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_ok(struct LDKRecipientOnionFields o);
+
+/**
+ * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ in the error state.
+ */
+struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_RecipientOnionFieldsDecodeErrorZ_is_ok(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_RecipientOnionFieldsDecodeErrorZ.
+ */
+void CResult_RecipientOnionFieldsDecodeErrorZ_free(struct LDKCResult_RecipientOnionFieldsDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_RecipientOnionFieldsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_RecipientOnionFieldsDecodeErrorZ CResult_RecipientOnionFieldsDecodeErrorZ_clone(const struct LDKCResult_RecipientOnionFieldsDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim
*/
struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
- */
-void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
-
-/**
- * Creates a new CResult_BlindedPathNoneZ in the success state.
- */
-struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o);
-
-/**
- * Creates a new CResult_BlindedPathNoneZ in the error state.
- */
-struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_BlindedPathNoneZ.
- */
-void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res);
-
-/**
- * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
- */
-struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o);
-
-/**
- * Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
- */
-struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
+ * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the success state.
*/
-void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
- */
-struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
+struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_ok(struct LDKBlindedPayInfo o);
/**
- * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
+ * Creates a new CResult_BlindedPayInfoDecodeErrorZ in the error state.
*/
-struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
+struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
+bool CResult_BlindedPayInfoDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
+ * Frees any resources used by the CResult_BlindedPayInfoDecodeErrorZ.
*/
-void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
+void CResult_BlindedPayInfoDecodeErrorZ_free(struct LDKCResult_BlindedPayInfoDecodeErrorZ _res);
/**
- * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
+ * Creates a new CResult_BlindedPayInfoDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig);
+struct LDKCResult_BlindedPayInfoDecodeErrorZ CResult_BlindedPayInfoDecodeErrorZ_clone(const struct LDKCResult_BlindedPayInfoDecodeErrorZ *NONNULL_PTR orig);
/**
* Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore
*/
struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig);
-/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
- */
-void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _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_InFlightHtlcsDecodeErrorZ in the success state.
*/
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res);
+void CVec_BlindedHopZ_free(struct LDKCVec_BlindedHopZ _res);
+
+/**
+ * Creates a new CResult_BlindedTailDecodeErrorZ in the success state.
+ */
+struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_ok(struct LDKBlindedTail o);
+
+/**
+ * Creates a new CResult_BlindedTailDecodeErrorZ in the error state.
+ */
+struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_BlindedTailDecodeErrorZ_is_ok(const struct LDKCResult_BlindedTailDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_BlindedTailDecodeErrorZ.
+ */
+void CResult_BlindedTailDecodeErrorZ_free(struct LDKCResult_BlindedTailDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_BlindedTailDecodeErrorZ CResult_BlindedTailDecodeErrorZ_clone(const struct LDKCResult_BlindedTailDecodeErrorZ *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_PathZ_free(struct LDKCVec_PathZ _res);
/**
* Creates a new CResult_RouteDecodeErrorZ in the success state.
*/
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);
-
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
*/
struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *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_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_clone(const struct LDKC2Tuple_BlindedPayInfoBlindedPathZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new C2Tuple_BlindedPayInfoBlindedPathZ from the contained elements.
+ */
+struct LDKC2Tuple_BlindedPayInfoBlindedPathZ C2Tuple_BlindedPayInfoBlindedPathZ_new(struct LDKBlindedPayInfo a, struct LDKBlindedPath b);
+
+/**
+ * Frees any resources used by the C2Tuple_BlindedPayInfoBlindedPathZ.
+ */
+void C2Tuple_BlindedPayInfoBlindedPathZ_free(struct LDKC2Tuple_BlindedPayInfoBlindedPathZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_C2Tuple_BlindedPayInfoBlindedPathZZ_free(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ _res);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res);
+
/**
* Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
*/
struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig);
-/**
- * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
- */
-struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
-
-/**
- * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
- */
-struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
- */
-void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
-
-/**
- * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::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::gossip::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);
-
-/**
- * Constructs a new COption_PathFailureZ containing a crate::lightning::util::events::PathFailure
- */
-struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o);
-
-/**
- * Constructs a new COption_PathFailureZ containing nothing
- */
-struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void);
-
-/**
- * Frees any resources associated with the crate::lightning::util::events::PathFailure, if we are in the Some state
- */
-void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res);
-
-/**
- * Creates a new COption_PathFailureZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
- */
-struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o);
-
-/**
- * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
- */
-struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
- */
-void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *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_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination
- */
-struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
-
-/**
- * Constructs a new COption_HTLCDestinationZ containing nothing
- */
-struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
-
-/**
- * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state
- */
-void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
-
-/**
- * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
-
-/**
- * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
- */
-struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
-
-/**
- * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
- */
-struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
- */
-void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
-
-/**
- * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
-
-/**
- * Constructs a new COption_u128Z containing a crate::c_types::U128
- */
-struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o);
-
-/**
- * Constructs a new COption_u128Z containing nothing
- */
-struct LDKCOption_u128Z COption_u128Z_none(void);
-
-/**
- * Frees any resources associated with the crate::c_types::U128, if we are in the Some state
- */
-void COption_u128Z_free(struct LDKCOption_u128Z _res);
-
-/**
- * Creates a new COption_u128Z which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *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);
+void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res);
/**
* Creates a new tuple which has the same data as `orig`
*/
struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o);
+
+/**
+ * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ.
+ */
+void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::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::gossip::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);
+
+/**
+ * Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure
+ */
+struct LDKCOption_PathFailureZ COption_PathFailureZ_some(struct LDKPathFailure o);
+
+/**
+ * Constructs a new COption_PathFailureZ containing nothing
+ */
+struct LDKCOption_PathFailureZ COption_PathFailureZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state
+ */
+void COption_PathFailureZ_free(struct LDKCOption_PathFailureZ _res);
+
+/**
+ * Creates a new COption_PathFailureZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_PathFailureZ COption_PathFailureZ_clone(const struct LDKCOption_PathFailureZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_ok(struct LDKCOption_PathFailureZ o);
+
+/**
+ * Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_PathFailureZDecodeErrorZ_is_ok(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ.
+ */
+void CResult_COption_PathFailureZDecodeErrorZ_free(struct LDKCResult_COption_PathFailureZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_COption_PathFailureZDecodeErrorZ CResult_COption_PathFailureZDecodeErrorZ_clone(const struct LDKCResult_COption_PathFailureZDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_ClosureReasonZ containing a crate::lightning::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::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_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination
+ */
+struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o);
+
+/**
+ * Constructs a new COption_HTLCDestinationZ containing nothing
+ */
+struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state
+ */
+void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res);
+
+/**
+ * Creates a new COption_HTLCDestinationZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state.
+ */
+struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o);
+
+/**
+ * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state.
+ */
+struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ.
+ */
+void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the success state.
+ */
+struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_ok(enum LDKPaymentFailureReason o);
+
+/**
+ * Creates a new CResult_PaymentFailureReasonDecodeErrorZ in the error state.
+ */
+struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_PaymentFailureReasonDecodeErrorZ_is_ok(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_PaymentFailureReasonDecodeErrorZ.
+ */
+void CResult_PaymentFailureReasonDecodeErrorZ_free(struct LDKCResult_PaymentFailureReasonDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_PaymentFailureReasonDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_PaymentFailureReasonDecodeErrorZ CResult_PaymentFailureReasonDecodeErrorZ_clone(const struct LDKCResult_PaymentFailureReasonDecodeErrorZ *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_u128Z containing a crate::c_types::U128
+ */
+struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o);
+
+/**
+ * Constructs a new COption_u128Z containing nothing
+ */
+struct LDKCOption_u128Z COption_u128Z_none(void);
+
+/**
+ * Frees any resources associated with the crate::c_types::U128, if we are in the Some state
+ */
+void COption_u128Z_free(struct LDKCOption_u128Z _res);
+
+/**
+ * Creates a new COption_u128Z which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig);
+
+/**
+ * Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason
+ */
+struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_some(enum LDKPaymentFailureReason o);
+
+/**
+ * Constructs a new COption_PaymentFailureReasonZ containing nothing
+ */
+struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_none(void);
+
+/**
+ * Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state
+ */
+void COption_PaymentFailureReasonZ_free(struct LDKCOption_PaymentFailureReasonZ _res);
+
+/**
+ * Creates a new COption_PaymentFailureReasonZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_PaymentFailureReasonZ COption_PaymentFailureReasonZ_clone(const struct LDKCOption_PaymentFailureReasonZ *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::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::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);
+
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_ChainHashZ_free(struct LDKCVec_ChainHashZ _res);
+
+/**
+ * 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_NodeIdDecodeErrorZ in the success state.
*/
*/
void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res);
+/**
+ * Creates a new COption_ScalarZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCOption_ScalarZ COption_ScalarZ_clone(const struct LDKCOption_ScalarZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_SharedSecretNoneZ in the success state.
*/
*/
void CResult_WriteableEcdsaChannelSignerDecodeErrorZ_free(struct LDKCResult_WriteableEcdsaChannelSignerDecodeErrorZ _res);
-/**
- * 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.
*/
*/
struct LDKCResult_COption_APIErrorZDecodeErrorZ CResult_COption_APIErrorZDecodeErrorZ_clone(const struct LDKCResult_COption_APIErrorZDecodeErrorZ *NONNULL_PTR orig);
+/**
+ * Creates a new CResult_UntrustedStringDecodeErrorZ in the success state.
+ */
+struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_ok(struct LDKUntrustedString o);
+
+/**
+ * Creates a new CResult_UntrustedStringDecodeErrorZ in the error state.
+ */
+struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_err(struct LDKDecodeError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_UntrustedStringDecodeErrorZ_is_ok(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_UntrustedStringDecodeErrorZ.
+ */
+void CResult_UntrustedStringDecodeErrorZ_free(struct LDKCResult_UntrustedStringDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_UntrustedStringDecodeErrorZ CResult_UntrustedStringDecodeErrorZ_clone(const struct LDKCResult_UntrustedStringDecodeErrorZ *NONNULL_PTR orig);
+
/**
* Creates a new CResult_OutPointDecodeErrorZ in the success state.
*/
*/
struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *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_ChannelMonitorUpdateDecodeErrorZ in the success state.
*/
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o);
+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_TxOutUtxoLookupErrorZ in the success state.
+ */
+struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o);
+
+/**
+ * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
+ */
+struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e);
+
+/**
+ * Checks if the given object is currently in the success state
+ */
+bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o);
+
+/**
+ * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
+ */
+void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res);
+
+/**
+ * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig);
+
+/**
+ * Creates a new CResult_NoneSendErrorZ in the success state.
+ */
+struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
+
+/**
+ * Creates a new CResult_NoneSendErrorZ in the error state.
+ */
+struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
/**
- * Frees any resources used by the CResult_NonePeerHandleErrorZ.
+ * Checks if the given object is currently in the success state
*/
-void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res);
+bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
/**
- * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
+ * Frees any resources used by the CResult_NoneSendErrorZ.
*/
-struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig);
+void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
/**
- * Creates a new CResult_boolPeerHandleErrorZ in the success state.
+ * Creates a new CResult_BlindedPathNoneZ in the success state.
*/
-struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o);
+struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o);
/**
- * Creates a new CResult_boolPeerHandleErrorZ in the error state.
+ * Creates a new CResult_BlindedPathNoneZ in the error state.
*/
-struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e);
+struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o);
+bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_boolPeerHandleErrorZ.
+ * Frees any resources used by the CResult_BlindedPathNoneZ.
*/
-void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res);
+void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res);
/**
- * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig`
+ * Creates a new CResult_BlindedPathNoneZ 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);
+struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_TxOutUtxoLookupErrorZ in the success state.
+ * Creates a new CResult_BlindedPathDecodeErrorZ in the success state.
*/
-struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_ok(struct LDKTxOut o);
+struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o);
/**
- * Creates a new CResult_TxOutUtxoLookupErrorZ in the error state.
+ * Creates a new CResult_BlindedPathDecodeErrorZ in the error state.
*/
-struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_err(enum LDKUtxoLookupError e);
+struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_TxOutUtxoLookupErrorZ_is_ok(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR o);
+bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_TxOutUtxoLookupErrorZ.
+ * Frees any resources used by the CResult_BlindedPathDecodeErrorZ.
*/
-void CResult_TxOutUtxoLookupErrorZ_free(struct LDKCResult_TxOutUtxoLookupErrorZ _res);
+void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res);
/**
- * Creates a new CResult_TxOutUtxoLookupErrorZ which has the same data as `orig`
+ * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig`
* but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_TxOutUtxoLookupErrorZ CResult_TxOutUtxoLookupErrorZ_clone(const struct LDKCResult_TxOutUtxoLookupErrorZ *NONNULL_PTR orig);
+struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a new CResult_NoneSendErrorZ in the success state.
+ * Creates a new CResult_BlindedHopDecodeErrorZ in the success state.
*/
-struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void);
+struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o);
/**
- * Creates a new CResult_NoneSendErrorZ in the error state.
+ * Creates a new CResult_BlindedHopDecodeErrorZ in the error state.
*/
-struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e);
+struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e);
/**
* Checks if the given object is currently in the success state
*/
-bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o);
+bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the CResult_NoneSendErrorZ.
+ * Frees any resources used by the CResult_BlindedHopDecodeErrorZ.
*/
-void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res);
+void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res);
+
+/**
+ * Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
+ */
+struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig);
/**
* Creates a new CResult_SiPrefixParseErrorZ in the success state.
*/
struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig);
+/**
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ */
+void CVec_AddressZ_free(struct LDKCVec_AddressZ _res);
+
/**
* Creates a new CResult_DescriptionCreationErrorZ in the success state.
*/
*/
struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig);
-/**
- * Creates a new CResult_u32GraphSyncErrorZ in the success state.
- */
-struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
-
-/**
- * Creates a new CResult_u32GraphSyncErrorZ in the error state.
- */
-struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
-
-/**
- * Checks if the given object is currently in the success state
- */
-bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
-
-/**
- * Frees any resources used by the CResult_u32GraphSyncErrorZ.
- */
-void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
-
/**
* Creates a new CResult_NetAddressDecodeErrorZ in the success state.
*/
/**
* 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 the buffer pointed to by `data` if `datalen` is non-0.
- */
-void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res);
-
-/**
- * Creates a new tuple which has the same data as `orig`
- * but with all dynamically-allocated buffers duplicated in new buffers.
- */
-struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig);
-
-/**
- * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
- */
-struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b);
-
-/**
- * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
- */
-void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res);
+struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees the buffer pointed to by `data` if `datalen` is non-0.
+ * Checks if the given object is currently in the success state
*/
-void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res);
+bool CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
/**
- * Frees any resources used by the PaymentPurpose
+ * Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ.
*/
-void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
+void CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ _res);
/**
- * Creates a copy of the PaymentPurpose
+ * Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
+struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
+ * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state.
*/
-struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
+struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_ok(struct LDKChannelAnnouncement o);
/**
- * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
+ * Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state.
*/
-struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
+struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Checks if two PaymentPurposes contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Checks if the given object is currently in the success state
*/
-bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b);
+bool CResult_ChannelAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR o);
/**
- * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
+ * Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ.
*/
-struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
+void CResult_ChannelAnnouncementDecodeErrorZ_free(struct LDKCResult_ChannelAnnouncementDecodeErrorZ _res);
/**
- * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
+ * Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
+struct LDKCResult_ChannelAnnouncementDecodeErrorZ CResult_ChannelAnnouncementDecodeErrorZ_clone(const struct LDKCResult_ChannelAnnouncementDecodeErrorZ *NONNULL_PTR orig);
/**
- * Frees any resources used by the PathFailure
+ * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state.
*/
-void PathFailure_free(struct LDKPathFailure this_ptr);
+struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_ok(struct LDKUnsignedChannelUpdate o);
/**
- * Creates a copy of the PathFailure
+ * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state.
*/
-struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig);
+struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Utility method to constructs a new InitialSend-variant PathFailure
+ * Checks if the given object is currently in the success state
*/
-struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err);
+bool CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new OnPath-variant PathFailure
+ * Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ.
*/
-struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update);
+void CResult_UnsignedChannelUpdateDecodeErrorZ_free(struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ _res);
/**
- * Checks if two PathFailures contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b);
+struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ CResult_UnsignedChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_UnsignedChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
/**
- * Serialize the PathFailure object into a byte array which can be read by PathFailure_read
+ * Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state.
*/
-struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj);
+struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_ok(struct LDKChannelUpdate o);
/**
- * Read a PathFailure from a byte array, created by PathFailure_write
+ * Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state.
*/
-struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser);
+struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees any resources used by the ClosureReason
+ * Checks if the given object is currently in the success state
*/
-void ClosureReason_free(struct LDKClosureReason this_ptr);
+bool CResult_ChannelUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a copy of the ClosureReason
+ * Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ.
*/
-struct LDKClosureReason ClosureReason_clone(const struct LDKClosureReason *NONNULL_PTR orig);
+void CResult_ChannelUpdateDecodeErrorZ_free(struct LDKCResult_ChannelUpdateDecodeErrorZ _res);
/**
- * Utility method to constructs a new CounterpartyForceClosed-variant ClosureReason
+ * Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKClosureReason ClosureReason_counterparty_force_closed(struct LDKStr peer_msg);
+struct LDKCResult_ChannelUpdateDecodeErrorZ CResult_ChannelUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new HolderForceClosed-variant ClosureReason
+ * Creates a new CResult_ErrorMessageDecodeErrorZ in the success state.
*/
-struct LDKClosureReason ClosureReason_holder_force_closed(void);
+struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_ok(struct LDKErrorMessage o);
/**
- * Utility method to constructs a new CooperativeClosure-variant ClosureReason
+ * Creates a new CResult_ErrorMessageDecodeErrorZ in the error state.
*/
-struct LDKClosureReason ClosureReason_cooperative_closure(void);
+struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Utility method to constructs a new CommitmentTxConfirmed-variant ClosureReason
+ * Checks if the given object is currently in the success state
*/
-struct LDKClosureReason ClosureReason_commitment_tx_confirmed(void);
+bool CResult_ErrorMessageDecodeErrorZ_is_ok(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new FundingTimedOut-variant ClosureReason
+ * Frees any resources used by the CResult_ErrorMessageDecodeErrorZ.
*/
-struct LDKClosureReason ClosureReason_funding_timed_out(void);
+void CResult_ErrorMessageDecodeErrorZ_free(struct LDKCResult_ErrorMessageDecodeErrorZ _res);
/**
- * Utility method to constructs a new ProcessingError-variant ClosureReason
+ * Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKClosureReason ClosureReason_processing_error(struct LDKStr err);
+struct LDKCResult_ErrorMessageDecodeErrorZ CResult_ErrorMessageDecodeErrorZ_clone(const struct LDKCResult_ErrorMessageDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new DisconnectedPeer-variant ClosureReason
+ * Creates a new CResult_WarningMessageDecodeErrorZ in the success state.
*/
-struct LDKClosureReason ClosureReason_disconnected_peer(void);
+struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_ok(struct LDKWarningMessage o);
/**
- * Utility method to constructs a new OutdatedChannelManager-variant ClosureReason
+ * Creates a new CResult_WarningMessageDecodeErrorZ in the error state.
*/
-struct LDKClosureReason ClosureReason_outdated_channel_manager(void);
+struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Checks if two ClosureReasons contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Checks if the given object is currently in the success state
*/
-bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
+bool CResult_WarningMessageDecodeErrorZ_is_ok(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR o);
/**
- * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
+ * Frees any resources used by the CResult_WarningMessageDecodeErrorZ.
*/
-struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
+void CResult_WarningMessageDecodeErrorZ_free(struct LDKCResult_WarningMessageDecodeErrorZ _res);
/**
- * Read a ClosureReason from a byte array, created by ClosureReason_write
+ * Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
+struct LDKCResult_WarningMessageDecodeErrorZ CResult_WarningMessageDecodeErrorZ_clone(const struct LDKCResult_WarningMessageDecodeErrorZ *NONNULL_PTR orig);
/**
- * Frees any resources used by the HTLCDestination
+ * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state.
*/
-void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
+struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(struct LDKUnsignedNodeAnnouncement o);
/**
- * Creates a copy of the HTLCDestination
+ * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state.
*/
-struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
+struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Utility method to constructs a new NextHopChannel-variant HTLCDestination
+ * Checks if the given object is currently in the success state
*/
-struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
+bool CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
+ * Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ.
*/
-struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
+void CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ _res);
/**
- * Utility method to constructs a new InvalidForward-variant HTLCDestination
+ * Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid);
+struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new FailedPayment-variant HTLCDestination
+ * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state.
*/
-struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
+struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_ok(struct LDKNodeAnnouncement o);
/**
- * Checks if two HTLCDestinations contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state.
*/
-bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
+struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
+ * Checks if the given object is currently in the success state
*/
-struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
+bool CResult_NodeAnnouncementDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR o);
/**
- * Read a HTLCDestination from a byte array, created by HTLCDestination_write
+ * Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ.
*/
-struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
+void CResult_NodeAnnouncementDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementDecodeErrorZ _res);
/**
- * Frees any resources used by the Event
+ * Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-void Event_free(struct LDKEvent this_ptr);
+struct LDKCResult_NodeAnnouncementDecodeErrorZ CResult_NodeAnnouncementDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementDecodeErrorZ *NONNULL_PTR orig);
/**
- * Creates a copy of the Event
+ * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state.
*/
-struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig);
+struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_ok(struct LDKQueryShortChannelIds o);
/**
- * Utility method to constructs a new FundingGenerationReady-variant Event
+ * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state.
*/
-struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id);
+struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Utility method to constructs a new PaymentClaimable-variant Event
+ * Checks if the given object is currently in the success state
*/
-struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id);
+bool CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new PaymentClaimed-variant Event
+ * Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ.
*/
-struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose);
+void CResult_QueryShortChannelIdsDecodeErrorZ_free(struct LDKCResult_QueryShortChannelIdsDecodeErrorZ _res);
/**
- * Utility method to constructs a new PaymentSent-variant Event
+ * Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKEvent Event_payment_sent(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z fee_paid_msat);
+struct LDKCResult_QueryShortChannelIdsDecodeErrorZ CResult_QueryShortChannelIdsDecodeErrorZ_clone(const struct LDKCResult_QueryShortChannelIdsDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new PaymentFailed-variant Event
+ * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state.
*/
-struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash);
+struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(struct LDKReplyShortChannelIdsEnd o);
/**
- * Utility method to constructs a new PaymentPathSuccessful-variant Event
+ * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state.
*/
-struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
+struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Utility method to constructs a new PaymentPathFailed-variant Event
+ * Checks if the given object is currently in the success state
*/
-struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry);
+bool CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new ProbeSuccessful-variant Event
+ * Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ.
*/
-struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path);
+void CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ _res);
/**
- * Utility method to constructs a new ProbeFailed-variant Event
+ * Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id);
+struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(const struct LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new PendingHTLCsForwardable-variant Event
+ * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state.
*/
-struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable);
+struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_ok(struct LDKQueryChannelRange o);
/**
- * Utility method to constructs a new HTLCIntercepted-variant Event
+ * Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state.
*/
-struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat);
+struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Utility method to constructs a new SpendableOutputs-variant Event
+ * Checks if the given object is currently in the success state
*/
-struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptorZ outputs);
+bool CResult_QueryChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new PaymentForwarded-variant Event
+ * Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ.
*/
-struct LDKEvent Event_payment_forwarded(struct LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx);
+void CResult_QueryChannelRangeDecodeErrorZ_free(struct LDKCResult_QueryChannelRangeDecodeErrorZ _res);
/**
- * Utility method to constructs a new ChannelReady-variant Event
+ * Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type);
+struct LDKCResult_QueryChannelRangeDecodeErrorZ CResult_QueryChannelRangeDecodeErrorZ_clone(const struct LDKCResult_QueryChannelRangeDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new ChannelClosed-variant Event
+ * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state.
*/
-struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason);
+struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_ok(struct LDKReplyChannelRange o);
/**
- * Utility method to constructs a new DiscardFunding-variant Event
+ * Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state.
*/
-struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction);
+struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Utility method to constructs a new OpenChannelRequest-variant Event
+ * Checks if the given object is currently in the success state
*/
-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);
+bool CResult_ReplyChannelRangeDecodeErrorZ_is_ok(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new HTLCHandlingFailed-variant Event
+ * Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ.
*/
-struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
+void CResult_ReplyChannelRangeDecodeErrorZ_free(struct LDKCResult_ReplyChannelRangeDecodeErrorZ _res);
/**
- * Checks if two Events contain equal inner contents.
- * This ignores pointers and is_owned flags and looks at the values in fields.
+ * Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b);
+struct LDKCResult_ReplyChannelRangeDecodeErrorZ CResult_ReplyChannelRangeDecodeErrorZ_clone(const struct LDKCResult_ReplyChannelRangeDecodeErrorZ *NONNULL_PTR orig);
/**
- * Serialize the Event object into a byte array which can be read by Event_read
+ * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state.
*/
-struct LDKCVec_u8Z Event_write(const struct LDKEvent *NONNULL_PTR obj);
+struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_ok(struct LDKGossipTimestampFilter o);
/**
- * Read a Event from a byte array, created by Event_write
+ * Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state.
*/
-struct LDKCResult_COption_EventZDecodeErrorZ Event_read(struct LDKu8slice ser);
+struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_err(struct LDKDecodeError e);
/**
- * Frees any resources used by the MessageSendEvent
+ * Checks if the given object is currently in the success state
*/
-void MessageSendEvent_free(struct LDKMessageSendEvent this_ptr);
+bool CResult_GossipTimestampFilterDecodeErrorZ_is_ok(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR o);
/**
- * Creates a copy of the MessageSendEvent
+ * Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ.
*/
-struct LDKMessageSendEvent MessageSendEvent_clone(const struct LDKMessageSendEvent *NONNULL_PTR orig);
+void CResult_GossipTimestampFilterDecodeErrorZ_free(struct LDKCResult_GossipTimestampFilterDecodeErrorZ _res);
/**
- * Utility method to constructs a new SendAcceptChannel-variant MessageSendEvent
+ * Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_accept_channel(struct LDKPublicKey node_id, struct LDKAcceptChannel msg);
+struct LDKCResult_GossipTimestampFilterDecodeErrorZ CResult_GossipTimestampFilterDecodeErrorZ_clone(const struct LDKCResult_GossipTimestampFilterDecodeErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new SendOpenChannel-variant MessageSendEvent
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_open_channel(struct LDKPublicKey node_id, struct LDKOpenChannel msg);
+void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res);
/**
- * Utility method to constructs a new SendFundingCreated-variant MessageSendEvent
+ * Creates a new CResult_InvoiceSignOrCreationErrorZ in the success state.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPublicKey node_id, struct LDKFundingCreated msg);
+struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_ok(struct LDKInvoice o);
/**
- * Utility method to constructs a new SendFundingSigned-variant MessageSendEvent
+ * Creates a new CResult_InvoiceSignOrCreationErrorZ in the error state.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg);
+struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e);
/**
- * Utility method to constructs a new SendChannelReady-variant MessageSendEvent
+ * Checks if the given object is currently in the success state
*/
-struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg);
+bool CResult_InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent
+ * Frees any resources used by the CResult_InvoiceSignOrCreationErrorZ.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_announcement_signatures(struct LDKPublicKey node_id, struct LDKAnnouncementSignatures msg);
+void CResult_InvoiceSignOrCreationErrorZ_free(struct LDKCResult_InvoiceSignOrCreationErrorZ _res);
/**
- * Utility method to constructs a new UpdateHTLCs-variant MessageSendEvent
+ * Creates a new CResult_InvoiceSignOrCreationErrorZ which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKMessageSendEvent MessageSendEvent_update_htlcs(struct LDKPublicKey node_id, struct LDKCommitmentUpdate updates);
+struct LDKCResult_InvoiceSignOrCreationErrorZ CResult_InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_InvoiceSignOrCreationErrorZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new SendRevokeAndACK-variant MessageSendEvent
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_revoke_and_ack(struct LDKPublicKey node_id, struct LDKRevokeAndACK msg);
+void CVec_FutureZ_free(struct LDKCVec_FutureZ _res);
/**
- * Utility method to constructs a new SendClosingSigned-variant MessageSendEvent
+ * Constructs a new COption_FilterZ containing a crate::lightning::chain::Filter
*/
-struct LDKMessageSendEvent MessageSendEvent_send_closing_signed(struct LDKPublicKey node_id, struct LDKClosingSigned msg);
+struct LDKCOption_FilterZ COption_FilterZ_some(struct LDKFilter o);
/**
- * Utility method to constructs a new SendShutdown-variant MessageSendEvent
+ * Constructs a new COption_FilterZ containing nothing
*/
-struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey node_id, struct LDKShutdown msg);
+struct LDKCOption_FilterZ COption_FilterZ_none(void);
/**
- * Utility method to constructs a new SendChannelReestablish-variant MessageSendEvent
+ * Frees any resources associated with the crate::lightning::chain::Filter, if we are in the Some state
*/
-struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg);
+void COption_FilterZ_free(struct LDKCOption_FilterZ _res);
/**
- * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent
+ * Creates a new CResult_LockedChannelMonitorNoneZ in the success state.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
+struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_ok(struct LDKLockedChannelMonitor o);
/**
- * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent
+ * Creates a new CResult_LockedChannelMonitorNoneZ in the error state.
*/
-struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg);
+struct LDKCResult_LockedChannelMonitorNoneZ CResult_LockedChannelMonitorNoneZ_err(void);
/**
- * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent
+ * Checks if the given object is currently in the success state
*/
-struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate msg);
+bool CResult_LockedChannelMonitorNoneZ_is_ok(const struct LDKCResult_LockedChannelMonitorNoneZ *NONNULL_PTR o);
/**
- * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent
+ * Frees any resources used by the CResult_LockedChannelMonitorNoneZ.
*/
-struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg);
+void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonitorNoneZ _res);
/**
- * Utility method to constructs a new SendChannelUpdate-variant MessageSendEvent
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_channel_update(struct LDKPublicKey node_id, struct LDKChannelUpdate msg);
+void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res);
/**
- * Utility method to constructs a new HandleError-variant MessageSendEvent
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKMessageSendEvent MessageSendEvent_handle_error(struct LDKPublicKey node_id, struct LDKErrorAction action);
+void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res);
/**
- * Utility method to constructs a new SendChannelRangeQuery-variant MessageSendEvent
+ * Creates a new tuple which has the same data as `orig`
+ * but with all dynamically-allocated buffers duplicated in new buffers.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_channel_range_query(struct LDKPublicKey node_id, struct LDKQueryChannelRange msg);
+struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig);
/**
- * Utility method to constructs a new SendShortIdsQuery-variant MessageSendEvent
+ * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_short_ids_query(struct LDKPublicKey node_id, struct LDKQueryShortChannelIds msg);
+struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b);
/**
- * Utility method to constructs a new SendReplyChannelRange-variant MessageSendEvent
+ * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_reply_channel_range(struct LDKPublicKey node_id, struct LDKReplyChannelRange msg);
+void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res);
/**
- * Utility method to constructs a new SendGossipTimestampFilter-variant MessageSendEvent
+ * Frees the buffer pointed to by `data` if `datalen` is non-0.
*/
-struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct LDKPublicKey node_id, struct LDKGossipTimestampFilter msg);
+void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res);
/**
- * Calls the free function if one is set
+ * Creates a new CResult_u32GraphSyncErrorZ in the success state.
*/
-void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
+struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o);
/**
- * Calls the free function if one is set
+ * Creates a new CResult_u32GraphSyncErrorZ in the error state.
*/
-void OnionMessageProvider_free(struct LDKOnionMessageProvider this_ptr);
+struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e);
/**
- * Calls the free function if one is set
+ * Checks if the given object is currently in the success state
*/
-void EventsProvider_free(struct LDKEventsProvider this_ptr);
+bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o);
/**
- * Calls the free function if one is set
+ * Frees any resources used by the CResult_u32GraphSyncErrorZ.
*/
-void EventHandler_free(struct LDKEventHandler this_ptr);
+void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res);
/**
* Frees any resources used by the APIError
*/
void Persister_free(struct LDKPersister this_ptr);
+/**
+ * Frees any resources used by the UntrustedString, if is_owned is set and inner is non-NULL.
+ */
+void UntrustedString_free(struct LDKUntrustedString this_obj);
+
+struct LDKStr UntrustedString_get_a(const struct LDKUntrustedString *NONNULL_PTR this_ptr);
+
+void UntrustedString_set_a(struct LDKUntrustedString *NONNULL_PTR this_ptr, struct LDKStr val);
+
+/**
+ * Constructs a new UntrustedString given each field
+ */
+MUST_USE_RES struct LDKUntrustedString UntrustedString_new(struct LDKStr a_arg);
+
+/**
+ * Creates a copy of the UntrustedString
+ */
+struct LDKUntrustedString UntrustedString_clone(const struct LDKUntrustedString *NONNULL_PTR orig);
+
+/**
+ * Checks if two UntrustedStrings 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 UntrustedString_eq(const struct LDKUntrustedString *NONNULL_PTR a, const struct LDKUntrustedString *NONNULL_PTR b);
+
+/**
+ * Serialize the UntrustedString object into a byte array which can be read by UntrustedString_read
+ */
+struct LDKCVec_u8Z UntrustedString_write(const struct LDKUntrustedString *NONNULL_PTR obj);
+
+/**
+ * Read a UntrustedString from a byte array, created by UntrustedString_write
+ */
+struct LDKCResult_UntrustedStringDecodeErrorZ UntrustedString_read(struct LDKu8slice ser);
+
/**
* Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL.
*/
*/
void Future_free(struct LDKFuture this_obj);
+/**
+ * Creates a copy of the Future
+ */
+struct LDKFuture Future_clone(const struct LDKFuture *NONNULL_PTR orig);
+
/**
* Registers a callback to be called upon completion of this future. If the future has already
* completed, the callback will be called immediately.
*/
void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback);
+/**
+ * Waits until this [`Future`] completes.
+ */
+void Future_wait(struct LDKFuture this_arg);
+
+/**
+ * Waits until this [`Future`] completes or the given amount of time has elapsed.
+ *
+ * Returns true if the [`Future`] completed, false if the time elapsed.
+ */
+MUST_USE_RES bool Future_wait_timeout(struct LDKFuture this_arg, uint64_t max_wait);
+
+/**
+ * Frees any resources used by the Sleeper, if is_owned is set and inner is non-NULL.
+ */
+void Sleeper_free(struct LDKSleeper this_obj);
+
+/**
+ * Constructs a new sleeper from one future, allowing blocking on it.
+ */
+MUST_USE_RES struct LDKSleeper Sleeper_from_single_future(struct LDKFuture future);
+
+/**
+ * Constructs a new sleeper from two futures, allowing blocking on both at once.
+ */
+MUST_USE_RES struct LDKSleeper Sleeper_from_two_futures(struct LDKFuture fut_a, struct LDKFuture fut_b);
+
+/**
+ * Constructs a new sleeper on many futures, allowing blocking on all at once.
+ */
+MUST_USE_RES struct LDKSleeper Sleeper_new(struct LDKCVec_FutureZ futures);
+
+/**
+ * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed.
+ */
+void Sleeper_wait(const struct LDKSleeper *NONNULL_PTR this_arg);
+
+/**
+ * Wait until one of the [`Future`]s registered with this [`Sleeper`] has completed or the
+ * given amount of time has elapsed. Returns true if a [`Future`] completed, false if the time
+ * elapsed.
+ */
+MUST_USE_RES bool Sleeper_wait_timeout(const struct LDKSleeper *NONNULL_PTR this_arg, uint64_t max_wait);
+
/**
* Creates a copy of the Level
*/
bool Level_eq(const enum LDKLevel *NONNULL_PTR a, const enum LDKLevel *NONNULL_PTR b);
/**
- * Checks if two Levels contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Level.
*/
uint64_t Level_hash(const enum LDKLevel *NONNULL_PTR o);
*/
void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val);
+/**
+ * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
+ *
+ * Increasing the value can help improve liquidity and stability in
+ * routing at the cost of higher long term disk / DB usage.
+ *
+ * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
+ * other than the default value.
+ *
+ * Default value: 50
+ * Maximum value: 483, any values larger will be treated as 483.
+ * This is the BOLT #2 spec limit on `max_accepted_htlcs`.
+ */
+uint16_t ChannelHandshakeConfig_get_our_max_accepted_htlcs(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr);
+
+/**
+ * The maximum number of HTLCs in-flight from our counterparty towards us at the same time.
+ *
+ * Increasing the value can help improve liquidity and stability in
+ * routing at the cost of higher long term disk / DB usage.
+ *
+ * Note: Versions of LDK earlier than v0.0.115 will fail to read channels with a configuration
+ * other than the default value.
+ *
+ * Default value: 50
+ * Maximum value: 483, any values larger will be treated as 483.
+ * This is the BOLT #2 spec limit on `max_accepted_htlcs`.
+ */
+void ChannelHandshakeConfig_set_our_max_accepted_htlcs(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint16_t 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, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg);
+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, uint8_t max_inbound_htlc_value_in_flight_percent_of_channel_arg, bool negotiate_scid_privacy_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint32_t their_channel_reserve_proportional_millionths_arg, uint16_t our_max_accepted_htlcs_arg);
/**
* Creates a copy of the ChannelHandshakeConfig
*
* Default value: false.
*
- * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
+ * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
* [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
* [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
*/
*
* Default value: false.
*
- * [`Event::OpenChannelRequest`]: crate::util::events::Event::OpenChannelRequest
+ * [`Event::OpenChannelRequest`]: crate::events::Event::OpenChannelRequest
* [`msgs::OpenChannel`]: crate::ln::msgs::OpenChannel
* [`msgs::AcceptChannel`]: crate::ln::msgs::AcceptChannel
*/
* Default value: false.
*
* [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
- * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted
+ * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
*/
bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr);
* Default value: false.
*
* [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid
- * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted
+ * [`Event::HTLCIntercepted`]: crate::events::Event::HTLCIntercepted
*/
void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val);
bool WatchedOutput_eq(const struct LDKWatchedOutput *NONNULL_PTR a, const struct LDKWatchedOutput *NONNULL_PTR b);
/**
- * Checks if two WatchedOutputs contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the WatchedOutput.
*/
uint64_t WatchedOutput_hash(const struct LDKWatchedOutput *NONNULL_PTR o);
enum LDKConfirmationTarget ConfirmationTarget_high_priority(void);
/**
- * Checks if two ConfirmationTargets contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the ConfirmationTarget.
*/
uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o);
struct LDKMonitorUpdateId MonitorUpdateId_clone(const struct LDKMonitorUpdateId *NONNULL_PTR orig);
/**
- * Checks if two MonitorUpdateIds contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the MonitorUpdateId.
*/
uint64_t MonitorUpdateId_hash(const struct LDKMonitorUpdateId *NONNULL_PTR o);
*/
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);
+/**
+ * Gets a [`Future`] that completes when an event is available either via
+ * [`chain::Watch::release_pending_monitor_events`] or
+ * [`EventsProvider::process_pending_events`].
+ *
+ * Note that callbacks registered on the [`Future`] MUST NOT call back into this
+ * [`ChainMonitor`] and should instead register actions to be taken later.
+ *
+ * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events
+ */
+MUST_USE_RES struct LDKFuture ChainMonitor_get_update_future(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+
+/**
+ * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
+ * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
+ * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
+ * invoking this every 30 seconds, or lower if running in an environment with spotty
+ * connections, like on mobile.
+ */
+void ChainMonitor_rebroadcast_pending_claims(const struct LDKChainMonitor *NONNULL_PTR this_arg);
+
/**
* 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
/**
* 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.
+ * increasing and increase by one for each new update, with two exceptions specified below.
*
* This sequence number is also used to track up to which points updates which returned
* [`ChannelMonitorUpdateStatus::InProgress`] 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.
+ * The only instances we allow where update_id values are not strictly increasing have a
+ * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
+ * will force close the channel by broadcasting the latest commitment transaction or
+ * special post-force-close updates, like providing preimages necessary to claim outputs on the
+ * broadcast commitment transaction. See its docs for more details.
*
* [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
*/
/**
* 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.
+ * increasing and increase by one for each new update, with two exceptions specified below.
*
* This sequence number is also used to track up to which points updates which returned
* [`ChannelMonitorUpdateStatus::InProgress`] 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.
+ * The only instances we allow where update_id values are not strictly increasing have a
+ * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that
+ * will force close the channel by broadcasting the latest commitment transaction or
+ * special post-force-close updates, like providing preimages necessary to claim outputs on the
+ * broadcast commitment transaction. See its docs for more details.
*
* [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress
*/
*/
struct LDKChannelMonitorUpdate ChannelMonitorUpdate_clone(const struct LDKChannelMonitorUpdate *NONNULL_PTR orig);
+/**
+ * Checks if two ChannelMonitorUpdates 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 ChannelMonitorUpdate_eq(const struct LDKChannelMonitorUpdate *NONNULL_PTR a, const struct LDKChannelMonitorUpdate *NONNULL_PTR b);
+
/**
* Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read
*/
* This is called by the [`EventsProvider::process_pending_events`] implementation for
* [`ChainMonitor`].
*
- * [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events
+ * [`EventsProvider::process_pending_events`]: crate::events::EventsProvider::process_pending_events
* [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor
*/
MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
*/
MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct LDKChannelMonitor *NONNULL_PTR this_arg);
+/**
+ * Triggers rebroadcasts/fee-bumps of pending claims from a force-closed channel. This is
+ * crucial in preventing certain classes of pinning attacks, detecting substantial mempool
+ * feerate changes between blocks, and ensuring reliability if broadcasting fails. We recommend
+ * invoking this every 30 seconds, or lower if running in an environment with spotty
+ * connections, like on mobile.
+ */
+void ChannelMonitor_rebroadcast_pending_claims(const struct LDKChannelMonitor *NONNULL_PTR this_arg, struct LDKBroadcasterInterface broadcaster, struct LDKFeeEstimator fee_estimator, struct LDKLogger logger);
+
/**
* Gets the balances in this channel which are either claimable by us if we were to
* force-close the channel now or which are claimable on-chain (possibly awaiting
bool OutPoint_eq(const struct LDKOutPoint *NONNULL_PTR a, const struct LDKOutPoint *NONNULL_PTR b);
/**
- * Checks if two OutPoints contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the OutPoint.
*/
uint64_t OutPoint_hash(const struct LDKOutPoint *NONNULL_PTR o);
/**
* Creates a new [`InMemorySigner`].
*/
-MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id);
+MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id, struct LDKThirtyTwoBytes rand_bytes_unique_start);
/**
* Returns the counterparty's pubkeys.
*/
MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor);
+/**
+ * Constructs a new EntropySource which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned EntropySource must be freed before this_arg is
+ */
+struct LDKEntropySource InMemorySigner_as_EntropySource(const struct LDKInMemorySigner *NONNULL_PTR this_arg);
+
/**
* Constructs a new ChannelSigner which calls the relevant methods on this_arg.
* This copies the `inner` pointer in this_arg and thus the returned ChannelSigner must be freed before this_arg is
/**
* Read a InMemorySigner from a byte array, created by InMemorySigner_write
*/
-struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser);
+struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8slice ser, struct LDKEntropySource arg);
/**
* Frees any resources used by the KeysManager, if is_owned is set and inner is non-NULL.
*/
void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val);
+/**
+ * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
+ * which is applied to commitment and HTLC transactions.
+ *
+ * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
+ */
+struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const struct LDKChannelDetails *NONNULL_PTR this_ptr);
+
+/**
+ * The currently negotiated fee rate denominated in satoshi per 1000 weight units,
+ * which is applied to commitment and HTLC transactions.
+ *
+ * This value will be `None` for objects serialized with LDK versions prior to 0.0.115.
+ */
+void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val);
+
/**
* Our total balance. This is the amount we would get if we close the channel.
* This value is not exact. Due to various in-flight changes and feerate changes, exactly this
/**
* Constructs a new ChannelDetails given each field
*/
-MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg);
+MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg);
/**
* Creates a copy of the ChannelDetails
struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRouteHints *NONNULL_PTR orig);
/**
- * Constructs a new ChannelManager to hold several channels and route between them.
+ * Constructs a new `ChannelManager` to hold several channels and route between them.
*
* This is the main \"logic hub\" for all channel-related actions, and implements
- * ChannelMessageHandler.
+ * [`ChannelMessageHandler`].
*
* Non-proportional fees are fixed according to our risk using the provided fee estimator.
*
- * Users need to notify the new ChannelManager when a new block is connected or
- * disconnected using its `block_connected` and `block_disconnected` methods, starting
- * from after `params.latest_hash`.
+ * Users need to notify the new `ChannelManager` when a new block is connected or
+ * disconnected using its [`block_connected`] and [`block_disconnected`] methods, starting
+ * from after [`params.best_block.block_hash`]. See [`chain::Listen`] and [`chain::Confirm`] for
+ * more details.
+ *
+ * [`block_connected`]: chain::Listen::block_connected
+ * [`block_disconnected`]: chain::Listen::block_disconnected
+ * [`params.best_block.block_hash`]: chain::BestBlock::block_hash
*/
MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params);
MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKUserConfig override_config);
/**
- * Gets the list of open channels, in random order. See ChannelDetail field documentation for
+ * Gets the list of open channels, in random order. See [`ChannelDetails`] field documentation for
* more information.
*/
MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
*/
MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg);
+/**
+ * Gets the list of channels we have with a given counterparty, in random order.
+ */
+MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels_with_counterparty(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id);
+
/**
* Returns in an undefined order recent payments that -- if not fulfilled -- have yet to find a
* successful path, or have unresolved HTLCs.
* would appear on a force-closure transaction, whichever is lower. We will allow our
* counterparty to pay as much fee as they'd like, however.
*
- * May generate a SendShutdown message event on success, which should be relayed.
+ * May generate a [`SendShutdown`] message event on success, which should be relayed.
*
* [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
* [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
* [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+ * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
*/
MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id);
* transaction feerate below `target_feerate_sat_per_1000_weight` (or the feerate which
* will appear on a force-closure transaction, whichever is lower).
*
- * May generate a SendShutdown message event on success, which should be relayed.
+ * May generate a [`SendShutdown`] message event on success, which should be relayed.
*
* [`ChannelConfig::force_close_avoidance_max_fee_satoshis`]: crate::util::config::ChannelConfig::force_close_avoidance_max_fee_satoshis
* [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background
* [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal
+ * [`SendShutdown`]: crate::events::MessageSendEvent::SendShutdown
*/
MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel_with_target_feerate(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id, uint32_t target_feerate_sats_per_1000_weight);
* Value parameters are provided via the last hop in route, see documentation for [`RouteHop`]
* fields for more info.
*
- * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via
+ * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via
* [`PeerManager::process_events`]).
*
* # Avoiding Duplicate Payments
*
* # Possible Error States on [`PaymentSendFailure`]
*
- * Each path may have a different return value, and PaymentSendValue may return a Vec with
+ * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with
* each entry matching the corresponding-index entry in the route paths, see
* [`PaymentSendFailure`] for more info.
*
* * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the
* relevant updates.
*
- * Note that depending on the type of the PaymentSendFailure the HTLC may have been
+ * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been
* irrevocably committed to on our end. In such a case, do NOT retry the payment with a
* different route unless you intend to pay twice!
*
- * # A caution on `payment_secret`
- *
- * `payment_secret` is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
- * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
- * attacks. For newer nodes, it will be provided to you in the invoice. If you do not have one,
- * the [`Route`] must not contain multiple paths as multi-path payments require a
- * recipient-provided `payment_secret`.
- *
- * If a `payment_secret` *is* provided, we assume that the invoice had the payment_secret
- * feature bit set (either as required or as available). If multiple paths are present in the
- * [`Route`], we assume the invoice had the basic_mpp feature set.
- *
* [`Event::PaymentSent`]: events::Event::PaymentSent
* [`Event::PaymentFailed`]: events::Event::PaymentFailed
+ * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs
* [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events
* [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress
- *
- * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id);
+MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id);
/**
* Similar to [`ChannelManager::send_payment`], but will automatically find a route based on
* `route_params` and retry failed payment paths based on `retry_strategy`.
- *
- * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
+MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
/**
* Signals that no further retries for the given payment should occur. Useful if you have a
*
* Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id);
+MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id);
/**
* Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route
*
* Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
-MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
+MUST_USE_RES struct LDKCResult_PaymentHashRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy);
/**
* Send a payment that is probing the given route for liquidity. We calculate the
* [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows
* us to easily discern them from real payments.
*/
-MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCVec_RouteHopZ hops);
+MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path);
/**
* Call this upon creation of a funding transaction for the given channel.
* implemented by Bitcoin Core wallet. See <https://bitcoinops.org/en/topics/fee-sniping/>
* for more details.
*
- * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady
- * [`Event::ChannelClosed`]: crate::util::events::Event::ChannelClosed
+ * [`Event::FundingGenerationReady`]: crate::events::Event::FundingGenerationReady
+ * [`Event::ChannelClosed`]: crate::events::Event::ChannelClosed
*/
MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_generated(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, struct LDKTransaction funding_transaction);
*
* This currently includes:
* * Increasing or decreasing the on-chain feerate estimates for our outbound channels,
- * * Broadcasting `ChannelUpdate` messages if we've been disconnected from our peer for more
+ * * Broadcasting [`ChannelUpdate`] messages if we've been disconnected from our peer for more
* than a minute, informing the network that they should no longer attempt to route over
* the channel.
- * * Expiring a channel's previous `ChannelConfig` if necessary to only allow forwarding HTLCs
- * with the current `ChannelConfig`.
+ * * Expiring a channel's previous [`ChannelConfig`] if necessary to only allow forwarding HTLCs
+ * with the current [`ChannelConfig`].
* * Removing peers which have disconnected but and no longer have any channels.
*
- * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate
+ * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate
* estimate fetches.
+ *
+ * [`ChannelUpdate`]: msgs::ChannelUpdate
+ * [`ChannelConfig`]: crate::util::config::ChannelConfig
*/
void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_PTR this_arg);
* Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any
* [`MessageSendEvent`]s needed to claim the payment.
*
- * Note that calling this method does *not* guarantee that the payment has been claimed. You
- * *must* wait for an [`Event::PaymentClaimed`] event which upon a successful claim will be
- * provided to your [`EventHandler`] when [`process_pending_events`] is next called.
+ * This method is guaranteed to ensure the payment has been claimed but only if the current
+ * height is strictly below [`Event::PaymentClaimable::claim_deadline`]. To avoid race
+ * conditions, you should wait for an [`Event::PaymentClaimed`] before considering the payment
+ * successful. It will generally be available in the next [`process_pending_events`] call.
*
* Note that if you did not set an `amount_msat` when calling [`create_inbound_payment`] or
* [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable`
* event matches your expectation. If you fail to do so and call this method, you may provide
* the sender \"proof-of-payment\" when they did not fulfill the full expected payment.
*
- * [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable
- * [`Event::PaymentClaimed`]: crate::util::events::Event::PaymentClaimed
+ * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
+ * [`Event::PaymentClaimable::claim_deadline`]: crate::events::Event::PaymentClaimable::claim_deadline
+ * [`Event::PaymentClaimed`]: crate::events::Event::PaymentClaimed
* [`process_pending_events`]: EventsProvider::process_pending_events
* [`create_inbound_payment`]: Self::create_inbound_payment
* [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash
struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONNULL_PTR this_arg);
/**
- * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool
- * indicating whether persistence is necessary. Only one listener on
- * [`await_persistable_update`], [`await_persistable_update_timeout`], or a future returned by
- * [`get_persistable_update_future`] is guaranteed to be woken up.
- *
- * Note that this method is not available with the `no-std` feature.
+ * Gets a [`Future`] that completes when this [`ChannelManager`] needs to be persisted.
*
- * [`await_persistable_update`]: Self::await_persistable_update
- * [`await_persistable_update_timeout`]: Self::await_persistable_update_timeout
- * [`get_persistable_update_future`]: Self::get_persistable_update_future
- */
-MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait);
-
-/**
- * Blocks until ChannelManager needs to be persisted. Only one listener on
- * [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by
- * [`get_persistable_update_future`] is guaranteed to be woken up.
+ * Note that callbacks registered on the [`Future`] MUST NOT call back into this
+ * [`ChannelManager`] and should instead register actions to be taken later.
*
- * [`await_persistable_update`]: Self::await_persistable_update
- * [`get_persistable_update_future`]: Self::get_persistable_update_future
- */
-void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg);
-
-/**
- * Gets a [`Future`] that completes when a persistable update is available. Note that
- * callbacks registered on the [`Future`] MUST NOT call back into this [`ChannelManager`] and
- * should instead register actions to be taken later.
*/
MUST_USE_RES struct LDKFuture ChannelManager_get_persistable_update_future(const struct LDKChannelManager *NONNULL_PTR this_arg);
*
* This should be sanitized before use. There is no guarantee of uniqueness.
*/
-const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr))[32];
+struct LDKNodeAlias UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr);
/**
* An alias, for UI purposes.
*
* This should be sanitized before use. There is no guarantee of uniqueness.
*/
-void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
/**
* List of addresses on which this node is reachable
void PeerManager_free(struct LDKPeerManager this_obj);
/**
- * Constructs a new PeerManager with the given message handlers and node_id secret key
- * ephemeral_random_data is used to derive per-connection ephemeral keys and must be
+ * Constructs a new `PeerManager` with the given message handlers.
+ *
+ * `ephemeral_random_data` is used to derive per-connection ephemeral keys and must be
* cryptographically secure random bytes.
*
* `current_time` is used as an always-increasing counter that survives across restarts and is
* Returns a small number of bytes to send to the remote node (currently always 50).
*
* Panics if descriptor is duplicative with some other descriptor which has not yet been
- * [`socket_disconnected()`].
+ * [`socket_disconnected`].
*
- * [`socket_disconnected()`]: PeerManager::socket_disconnected
+ * [`socket_disconnected`]: PeerManager::socket_disconnected
*/
MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKPublicKey their_node_id, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
* the connection immediately.
*
* Panics if descriptor is duplicative with some other descriptor which has not yet been
- * [`socket_disconnected()`].
+ * [`socket_disconnected`].
*
- * [`socket_disconnected()`]: PeerManager::socket_disconnected
+ * [`socket_disconnected`]: PeerManager::socket_disconnected
*/
MUST_USE_RES struct LDKCResult_NonePeerHandleErrorZ PeerManager_new_inbound_connection(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKSocketDescriptor descriptor, struct LDKCOption_NetAddressZ remote_network_address);
* May call [`send_data`] on the descriptor passed in (or an equal descriptor) before
* returning. Thus, be very careful with reentrancy issues! The invariants around calling
* [`write_buffer_space_avail`] in case a write did not fully complete must still hold - be
- * ready to call `[write_buffer_space_avail`] again if a write call generated here isn't
+ * ready to call [`write_buffer_space_avail`] again if a write call generated here isn't
* sufficient!
*
* [`send_data`]: SocketDescriptor::send_data
*/
struct LDKChannelTransactionParameters ChannelTransactionParameters_clone(const struct LDKChannelTransactionParameters *NONNULL_PTR orig);
+/**
+ * Checks if two ChannelTransactionParameterss 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 ChannelTransactionParameters_eq(const struct LDKChannelTransactionParameters *NONNULL_PTR a, const struct LDKChannelTransactionParameters *NONNULL_PTR b);
+
/**
* Frees any resources used by the CounterpartyChannelTransactionParameters, if is_owned is set and inner is non-NULL.
*/
*/
struct LDKCounterpartyChannelTransactionParameters CounterpartyChannelTransactionParameters_clone(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR orig);
+/**
+ * Checks if two CounterpartyChannelTransactionParameterss 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 CounterpartyChannelTransactionParameters_eq(const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR a, const struct LDKCounterpartyChannelTransactionParameters *NONNULL_PTR b);
+
/**
* Whether the late bound parameters are populated.
*/
MUST_USE_RES struct LDKThirtyTwoBytes BuiltCommitmentTransaction_get_sighash_all(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
/**
- * Sign a transaction, either because we are counter-signing the counterparty's transaction or
- * because we are about to broadcast a holder transaction.
+ * Signs the counterparty's commitment transaction.
+ */
+MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_counterparty_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
+
+/**
+ * Signs the holder commitment transaction because we are about to broadcast it.
*/
-MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis);
+MUST_USE_RES struct LDKSignature BuiltCommitmentTransaction_sign_holder_commitment(const struct LDKBuiltCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*funding_key)[32], struct LDKu8slice funding_redeemscript, uint64_t channel_value_satoshis, const struct LDKEntropySource *NONNULL_PTR entropy_source);
/**
* Frees any resources used by the ClosingTransaction, if is_owned is set and inner is non-NULL.
struct LDKClosingTransaction ClosingTransaction_clone(const struct LDKClosingTransaction *NONNULL_PTR orig);
/**
- * Checks if two ClosingTransactions contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the ClosingTransaction.
*/
uint64_t ClosingTransaction_hash(const struct LDKClosingTransaction *NONNULL_PTR o);
*
* This function is only valid in the holder commitment context, it always uses EcdsaSighashType::All.
*/
-MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters);
+MUST_USE_RES struct LDKCResult_CVec_SignatureZNoneZ TrustedCommitmentTransaction_get_htlc_sigs(const struct LDKTrustedCommitmentTransaction *NONNULL_PTR this_arg, const uint8_t (*htlc_base_key)[32], const struct LDKDirectedChannelTransactionParameters *NONNULL_PTR channel_parameters, const struct LDKEntropySource *NONNULL_PTR entropy_source);
/**
* Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
*/
MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg);
+/**
+ * Set this feature as optional.
+ */
+void InvoiceFeatures_set_payment_metadata_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Set this feature as required.
+ */
+void InvoiceFeatures_set_payment_metadata_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is supported.
+ */
+MUST_USE_RES bool InvoiceFeatures_supports_payment_metadata(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
+/**
+ * Checks if this feature is required.
+ */
+MUST_USE_RES bool InvoiceFeatures_requires_payment_metadata(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg);
+
/**
* Set this feature as optional.
*/
bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b);
/**
- * Checks if two Retrys contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Retry.
*/
uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o);
*/
struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id);
+/**
+ * Frees any resources used by the RecipientOnionFields, if is_owned is set and inner is non-NULL.
+ */
+void RecipientOnionFields_free(struct LDKRecipientOnionFields this_obj);
+
+/**
+ * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
+ * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
+ * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
+ * attacks.
+ *
+ * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
+ * multi-path payments require a recipient-provided secret.
+ *
+ * Note that for spontaneous payments most lightning nodes do not currently support MPP
+ * receives, thus you should generally never be providing a secret here for spontaneous
+ * payments.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKThirtyTwoBytes RecipientOnionFields_get_payment_secret(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
+
+/**
+ * The [`PaymentSecret`] is an arbitrary 32 bytes provided by the recipient for us to repeat
+ * in the onion. It is unrelated to `payment_hash` (or [`PaymentPreimage`]) and exists to
+ * authenticate the sender to the recipient and prevent payment-probing (deanonymization)
+ * attacks.
+ *
+ * If you do not have one, the [`Route`] you pay over must not contain multiple paths as
+ * multi-path payments require a recipient-provided secret.
+ *
+ * Note that for spontaneous payments most lightning nodes do not currently support MPP
+ * receives, thus you should generally never be providing a secret here for spontaneous
+ * payments.
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void RecipientOnionFields_set_payment_secret(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val);
+
+/**
+ * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
+ * arbitrary length. This gives recipients substantially more flexibility to receive
+ * additional data.
+ *
+ * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
+ * scheme to authenticate received payments against expected payments and invoices, this field
+ * is not used in LDK for received payments, and can be used to store arbitrary data in
+ * invoices which will be received with the payment.
+ *
+ * Note that this field was added to the lightning specification more recently than
+ * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
+ * may not be supported as universally.
+ *
+ * Returns a copy of the field.
+ */
+struct LDKCOption_CVec_u8ZZ RecipientOnionFields_get_payment_metadata(const struct LDKRecipientOnionFields *NONNULL_PTR this_ptr);
+
+/**
+ * The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of
+ * arbitrary length. This gives recipients substantially more flexibility to receive
+ * additional data.
+ *
+ * In LDK, while the [`Self::payment_secret`] is fixed based on an internal authentication
+ * scheme to authenticate received payments against expected payments and invoices, this field
+ * is not used in LDK for received payments, and can be used to store arbitrary data in
+ * invoices which will be received with the payment.
+ *
+ * Note that this field was added to the lightning specification more recently than
+ * [`Self::payment_secret`] and while nearly all lightning senders support secrets, metadata
+ * may not be supported as universally.
+ */
+void RecipientOnionFields_set_payment_metadata(struct LDKRecipientOnionFields *NONNULL_PTR this_ptr, struct LDKCOption_CVec_u8ZZ val);
+
+/**
+ * Constructs a new RecipientOnionFields given each field
+ */
+MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKCOption_CVec_u8ZZ payment_metadata_arg);
+
+/**
+ * Creates a copy of the RecipientOnionFields
+ */
+struct LDKRecipientOnionFields RecipientOnionFields_clone(const struct LDKRecipientOnionFields *NONNULL_PTR orig);
+
+/**
+ * Checks if two RecipientOnionFieldss 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 RecipientOnionFields_eq(const struct LDKRecipientOnionFields *NONNULL_PTR a, const struct LDKRecipientOnionFields *NONNULL_PTR b);
+
+/**
+ * Serialize the RecipientOnionFields object into a byte array which can be read by RecipientOnionFields_read
+ */
+struct LDKCVec_u8Z RecipientOnionFields_write(const struct LDKRecipientOnionFields *NONNULL_PTR obj);
+
+/**
+ * Read a RecipientOnionFields from a byte array, created by RecipientOnionFields_write
+ */
+struct LDKCResult_RecipientOnionFieldsDecodeErrorZ RecipientOnionFields_read(struct LDKu8slice ser);
+
+/**
+ * Creates a [`RecipientOnionFields`] from only a [`PaymentSecret`]. This is the most common
+ * set of onion fields for today's BOLT11 invoices - most nodes require a [`PaymentSecret`]
+ * but do not require or provide any further data.
+ */
+MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_secret_only(struct LDKThirtyTwoBytes payment_secret);
+
+/**
+ * Creates a new [`RecipientOnionFields`] with no fields. This generally does not create
+ * payable HTLCs except for spontaneous payments, i.e. this should generally only be used for
+ * calls to [`ChannelManager::send_spontaneous_payment`].
+ *
+ * [`ChannelManager::send_spontaneous_payment`]: super::channelmanager::ChannelManager::send_spontaneous_payment
+ */
+MUST_USE_RES struct LDKRecipientOnionFields RecipientOnionFields_spontaneous_empty(void);
+
/**
* Calls the free function if one is set
*/
*/
void Type_free(struct LDKType this_ptr);
+/**
+ * Frees any resources used by the UnsignedInvoice, if is_owned is set and inner is non-NULL.
+ */
+void UnsignedInvoice_free(struct LDKUnsignedInvoice this_obj);
+
+/**
+ * The public key corresponding to the key needed to sign the invoice.
+ */
+MUST_USE_RES struct LDKPublicKey UnsignedInvoice_signing_pubkey(const struct LDKUnsignedInvoice *NONNULL_PTR this_arg);
+
+/**
+ * Frees any resources used by the BlindedPayInfo, if is_owned is set and inner is non-NULL.
+ */
+void BlindedPayInfo_free(struct LDKBlindedPayInfo this_obj);
+
+/**
+ * Base fee charged (in millisatoshi) for the entire blinded path.
+ */
+uint32_t BlindedPayInfo_get_fee_base_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
+
+/**
+ * Base fee charged (in millisatoshi) for the entire blinded path.
+ */
+void BlindedPayInfo_set_fee_base_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
+ * (i.e., 10,000 is 1%).
+ */
+uint32_t BlindedPayInfo_get_fee_proportional_millionths(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
+
+/**
+ * Liquidity fee charged (in millionths of the amount transferred) for the entire blinded path
+ * (i.e., 10,000 is 1%).
+ */
+void BlindedPayInfo_set_fee_proportional_millionths(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
+ * path.
+ */
+uint16_t BlindedPayInfo_get_cltv_expiry_delta(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
+
+/**
+ * Number of blocks subtracted from an incoming HTLC's `cltv_expiry` for the entire blinded
+ * path.
+ */
+void BlindedPayInfo_set_cltv_expiry_delta(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint16_t val);
+
+/**
+ * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
+ * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
+ * seen by the recipient.
+ */
+uint64_t BlindedPayInfo_get_htlc_minimum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
+
+/**
+ * The minimum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
+ * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
+ * seen by the recipient.
+ */
+void BlindedPayInfo_set_htlc_minimum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
+ * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
+ * seen by the recipient.
+ */
+uint64_t BlindedPayInfo_get_htlc_maximum_msat(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
+
+/**
+ * The maximum HTLC value (in millisatoshi) that is acceptable to all channel peers on the
+ * blinded path from the introduction node to the recipient, accounting for any fees, i.e., as
+ * seen by the recipient.
+ */
+void BlindedPayInfo_set_htlc_maximum_msat(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
+ * onion payload.
+ */
+struct LDKBlindedHopFeatures BlindedPayInfo_get_features(const struct LDKBlindedPayInfo *NONNULL_PTR this_ptr);
+
+/**
+ * Features set in `encrypted_data_tlv` for the `encrypted_recipient_data` TLV record in an
+ * onion payload.
+ */
+void BlindedPayInfo_set_features(struct LDKBlindedPayInfo *NONNULL_PTR this_ptr, struct LDKBlindedHopFeatures val);
+
+/**
+ * Constructs a new BlindedPayInfo given each field
+ */
+MUST_USE_RES struct LDKBlindedPayInfo BlindedPayInfo_new(uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKBlindedHopFeatures features_arg);
+
+/**
+ * Creates a copy of the BlindedPayInfo
+ */
+struct LDKBlindedPayInfo BlindedPayInfo_clone(const struct LDKBlindedPayInfo *NONNULL_PTR orig);
+
+/**
+ * Generates a non-cryptographic 64-bit hash of the BlindedPayInfo.
+ */
+uint64_t BlindedPayInfo_hash(const struct LDKBlindedPayInfo *NONNULL_PTR o);
+
+/**
+ * Checks if two BlindedPayInfos 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 BlindedPayInfo_eq(const struct LDKBlindedPayInfo *NONNULL_PTR a, const struct LDKBlindedPayInfo *NONNULL_PTR b);
+
+/**
+ * Serialize the BlindedPayInfo object into a byte array which can be read by BlindedPayInfo_read
+ */
+struct LDKCVec_u8Z BlindedPayInfo_write(const struct LDKBlindedPayInfo *NONNULL_PTR obj);
+
+/**
+ * Read a BlindedPayInfo from a byte array, created by BlindedPayInfo_write
+ */
+struct LDKCResult_BlindedPayInfoDecodeErrorZ BlindedPayInfo_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL.
+ */
+void UnsignedInvoiceRequest_free(struct LDKUnsignedInvoiceRequest this_obj);
+
+/**
+ * Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL.
+ */
+void InvoiceRequest_free(struct LDKInvoiceRequest this_obj);
+
+/**
+ * Creates a copy of the InvoiceRequest
+ */
+struct LDKInvoiceRequest InvoiceRequest_clone(const struct LDKInvoiceRequest *NONNULL_PTR orig);
+
+/**
+ * An unpredictable series of bytes, typically containing information about the derivation of
+ * [`payer_id`].
+ *
+ * [`payer_id`]: Self::payer_id
+ */
+MUST_USE_RES struct LDKu8slice InvoiceRequest_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
+
+/**
+ * A chain from [`Offer::chains`] that the offer is valid for.
+ */
+MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
+
+/**
+ * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
+ * must be greater than or equal to [`Offer::amount`], converted if necessary.
+ *
+ * [`chain`]: Self::chain
+ */
+MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
+
+/**
+ * Features pertaining to requesting an invoice.
+ */
+MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequest_features(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
+
+/**
+ * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
+ */
+MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
+
+/**
+ * A possibly transient pubkey used to sign the invoice request.
+ */
+MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
+
+/**
+ * A payer-provided note which will be seen by the recipient and reflected back in the invoice
+ * response.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg);
+
+/**
+ * Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
+ */
+struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj);
+
+/**
+ * Frees any resources used by the Offer, if is_owned is set and inner is non-NULL.
+ */
+void Offer_free(struct LDKOffer this_obj);
+
+/**
+ * Creates a copy of the Offer
+ */
+struct LDKOffer Offer_clone(const struct LDKOffer *NONNULL_PTR orig);
+
+/**
+ * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
+ * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
+ * for the selected chain.
+ */
+MUST_USE_RES struct LDKCVec_ChainHashZ Offer_chains(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * Returns whether the given chain is supported by the offer.
+ */
+MUST_USE_RES bool Offer_supports_chain(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes chain);
+
+/**
+ * Opaque bytes set by the originator. Useful for authentication and validating fields since it
+ * is reflected in `invoice_request` messages along with all the other fields from the `offer`.
+ */
+MUST_USE_RES struct LDKCOption_CVec_u8ZZ Offer_metadata(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * The minimum amount required for a successful payment of a single item.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKAmount Offer_amount(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * A complete description of the purpose of the payment. Intended to be displayed to the user
+ * but with the caveat that it has not been verified in any way.
+ */
+MUST_USE_RES struct LDKPrintableString Offer_description(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * Features pertaining to the offer.
+ */
+MUST_USE_RES struct LDKOfferFeatures Offer_features(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * Duration since the Unix epoch when an invoice should no longer be requested.
+ *
+ * If `None`, the offer does not expire.
+ */
+MUST_USE_RES struct LDKCOption_DurationZ Offer_absolute_expiry(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * Whether the offer has expired.
+ */
+MUST_USE_RES bool Offer_is_expired(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
+ * displayed to the user but with the caveat that it has not been verified in any way.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKPrintableString Offer_issuer(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
+ * recipient privacy by obfuscating its node id.
+ */
+MUST_USE_RES struct LDKCVec_BlindedPathZ Offer_paths(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * The quantity of items supported.
+ */
+MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * Returns whether the given quantity is valid for the offer.
+ */
+MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR this_arg, uint64_t quantity);
+
+/**
+ * Returns whether a quantity is expected in an [`InvoiceRequest`] for the offer.
+ *
+ * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
+ */
+MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * The public key used by the recipient to sign invoices.
+ */
+MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg);
+
+/**
+ * Serialize the Offer object into a byte array which can be read by Offer_read
+ */
+struct LDKCVec_u8Z Offer_write(const struct LDKOffer *NONNULL_PTR obj);
+
+/**
+ * Frees any resources used by the Amount, if is_owned is set and inner is non-NULL.
+ */
+void Amount_free(struct LDKAmount this_obj);
+
+/**
+ * Creates a copy of the Amount
+ */
+struct LDKAmount Amount_clone(const struct LDKAmount *NONNULL_PTR orig);
+
+/**
+ * Frees any resources used by the Quantity, if is_owned is set and inner is non-NULL.
+ */
+void Quantity_free(struct LDKQuantity this_obj);
+
+/**
+ * Creates a copy of the Quantity
+ */
+struct LDKQuantity Quantity_clone(const struct LDKQuantity *NONNULL_PTR orig);
+
+/**
+ * Frees any resources used by the Refund, if is_owned is set and inner is non-NULL.
+ */
+void Refund_free(struct LDKRefund this_obj);
+
+/**
+ * Creates a copy of the Refund
+ */
+struct LDKRefund Refund_clone(const struct LDKRefund *NONNULL_PTR orig);
+
+/**
+ * A complete description of the purpose of the refund. Intended to be displayed to the user
+ * but with the caveat that it has not been verified in any way.
+ */
+MUST_USE_RES struct LDKPrintableString Refund_description(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * Duration since the Unix epoch when an invoice should no longer be sent.
+ *
+ * If `None`, the refund does not expire.
+ */
+MUST_USE_RES struct LDKCOption_DurationZ Refund_absolute_expiry(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * Whether the refund has expired.
+ */
+MUST_USE_RES bool Refund_is_expired(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * The issuer of the refund, possibly beginning with `user@domain` or `domain`. Intended to be
+ * displayed to the user but with the caveat that it has not been verified in any way.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKPrintableString Refund_issuer(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * Paths to the sender originating from publicly reachable nodes. Blinded paths provide sender
+ * privacy by obfuscating its node id.
+ */
+MUST_USE_RES struct LDKCVec_BlindedPathZ Refund_paths(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * An unpredictable series of bytes, typically containing information about the derivation of
+ * [`payer_id`].
+ *
+ * [`payer_id`]: Self::payer_id
+ */
+MUST_USE_RES struct LDKu8slice Refund_metadata(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * A chain that the refund is valid for.
+ */
+MUST_USE_RES struct LDKThirtyTwoBytes Refund_chain(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * The amount to refund in msats (i.e., the minimum lightning-payable unit for [`chain`]).
+ *
+ * [`chain`]: Self::chain
+ */
+MUST_USE_RES uint64_t Refund_amount_msats(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * Features pertaining to requesting an invoice.
+ */
+MUST_USE_RES struct LDKInvoiceRequestFeatures Refund_features(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * The quantity of an item that refund is for.
+ */
+MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * A public node id to send to in the case where there are no [`paths`]. Otherwise, a possibly
+ * transient pubkey.
+ *
+ * [`paths`]: Self::paths
+ */
+MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * Payer provided note to include in the invoice.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKPrintableString Refund_payer_note(const struct LDKRefund *NONNULL_PTR this_arg);
+
+/**
+ * Serialize the Refund object into a byte array which can be read by Refund_read
+ */
+struct LDKCVec_u8Z Refund_write(const struct LDKRefund *NONNULL_PTR obj);
+
/**
* Creates a copy of the UtxoLookupError
*/
MUST_USE_RES struct LDKu8slice NodeId_as_slice(const struct LDKNodeId *NONNULL_PTR this_arg);
/**
- * Checks if two NodeIds contain equal inner contents.
+ * Get the public key from this NodeId
+ */
+MUST_USE_RES struct LDKCResult_PublicKeyErrorZ NodeId_as_pubkey(const struct LDKNodeId *NONNULL_PTR this_arg);
+
+/**
+ * Generates a non-cryptographic 64-bit hash of the NodeId.
*/
uint64_t NodeId_hash(const struct LDKNodeId *NONNULL_PTR o);
/**
* Creates a new tracker of the actual state of the network of channels and nodes,
- * assuming an existing Network Graph.
+ * assuming an existing [`NetworkGraph`].
* UTXO lookup is used to make sure announced channels exist on-chain, channel data is
* correct, and the announcement is signed with channel owners' keys.
*/
/**
* Handles any network updates originating from [`Event`]s.
*
- * [`Event`]: crate::util::events::Event
+ * [`Event`]: crate::events::Event
*/
void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update);
struct LDKRoutingFees RoutingFees_clone(const struct LDKRoutingFees *NONNULL_PTR orig);
/**
- * Checks if two RoutingFeess contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the RoutingFees.
*/
uint64_t RoutingFees_hash(const struct LDKRoutingFees *NONNULL_PTR o);
*/
void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKNodeAlias val);
-/**
- * Internet-level addresses via which one can connect to the node
- *
- * Returns a copy of the field.
- */
-struct LDKCVec_NetAddressZ NodeAnnouncementInfo_get_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr);
-
-/**
- * Internet-level addresses via which one can connect to the node
- */
-void NodeAnnouncementInfo_set_addresses(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKCVec_NetAddressZ val);
-
/**
* An initial announcement of the node
* Mostly redundant with the data we store in fields explicitly.
/**
* Constructs a new NodeAnnouncementInfo given each field
*/
-MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg);
+MUST_USE_RES struct LDKNodeAnnouncementInfo NodeAnnouncementInfo_new(struct LDKNodeFeatures features_arg, uint32_t last_update_arg, struct LDKThreeBytes rgb_arg, struct LDKNodeAlias alias_arg, struct LDKNodeAnnouncement announcement_message_arg);
/**
* Creates a copy of the NodeAnnouncementInfo
*/
bool NodeAnnouncementInfo_eq(const struct LDKNodeAnnouncementInfo *NONNULL_PTR a, const struct LDKNodeAnnouncementInfo *NONNULL_PTR b);
+/**
+ * Internet-level addresses via which one can connect to the node
+ */
+MUST_USE_RES struct LDKCVec_NetAddressZ NodeAnnouncementInfo_addresses(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_arg);
+
/**
* Serialize the NodeAnnouncementInfo object into a byte array which can be read by NodeAnnouncementInfo_read
*/
MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_add_channel_from_partial_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, uint64_t timestamp, struct LDKChannelFeatures features, struct LDKPublicKey node_id_1, struct LDKPublicKey node_id_2);
/**
- * Marks a channel in the graph as failed if a corresponding HTLC fail was sent.
- * If permanent, removes a channel from the local storage.
- * May cause the removal of nodes too, if this was their last channel.
- * If not permanent, makes channels unavailable for routing.
+ * Marks a channel in the graph as failed permanently.
+ *
+ * The channel and any node for which this was their last channel are removed from the graph.
*/
-void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent);
+void NetworkGraph_channel_failed_permanent(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id);
/**
* Marks a node in the graph as permanently failed, effectively removing it and its channels
*/
MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void);
+/**
+ * Takes in a path with payer's node id and adds the path's details to `InFlightHtlcs`.
+ */
+void InFlightHtlcs_process_path(struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKPath *NONNULL_PTR path, struct LDKPublicKey payer_node_id);
+
/**
* Returns liquidity in msat given the public key of the HTLC source, target, and short channel
* id.
/**
* The fee taken on this hop (for paying for the use of the *next* channel in the path).
- * For the last hop, this should be the full value of the payment (might be more than
- * requested if we had to match htlc_minimum_msat).
+ * If this is the last hop in [`Path::hops`]:
+ * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
+ * * otherwise, this is the full value of this [`Path`]'s part of the payment
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
*/
uint64_t RouteHop_get_fee_msat(const struct LDKRouteHop *NONNULL_PTR this_ptr);
/**
* The fee taken on this hop (for paying for the use of the *next* channel in the path).
- * For the last hop, this should be the full value of the payment (might be more than
- * requested if we had to match htlc_minimum_msat).
+ * If this is the last hop in [`Path::hops`]:
+ * * if we're sending to a [`BlindedPath`], this is the fee paid for use of the entire blinded path
+ * * otherwise, this is the full value of this [`Path`]'s part of the payment
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
*/
void RouteHop_set_fee_msat(struct LDKRouteHop *NONNULL_PTR this_ptr, uint64_t val);
/**
- * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
- * expected at the destination, in excess of the current block height.
+ * The CLTV delta added for this hop.
+ * If this is the last hop in [`Path::hops`]:
+ * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
+ * * otherwise, this is the CLTV delta expected at the destination
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
*/
uint32_t RouteHop_get_cltv_expiry_delta(const struct LDKRouteHop *NONNULL_PTR this_ptr);
/**
- * The CLTV delta added for this hop. For the last hop, this should be the full CLTV value
- * expected at the destination, in excess of the current block height.
+ * The CLTV delta added for this hop.
+ * If this is the last hop in [`Path::hops`]:
+ * * if we're sending to a [`BlindedPath`], this is the CLTV delta for the entire blinded path
+ * * otherwise, this is the CLTV delta expected at the destination
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
*/
void RouteHop_set_cltv_expiry_delta(struct LDKRouteHop *NONNULL_PTR this_ptr, uint32_t val);
struct LDKRouteHop RouteHop_clone(const struct LDKRouteHop *NONNULL_PTR orig);
/**
- * Checks if two RouteHops contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the RouteHop.
*/
uint64_t RouteHop_hash(const struct LDKRouteHop *NONNULL_PTR o);
*/
struct LDKCResult_RouteHopDecodeErrorZ RouteHop_read(struct LDKu8slice ser);
+/**
+ * Frees any resources used by the BlindedTail, if is_owned is set and inner is non-NULL.
+ */
+void BlindedTail_free(struct LDKBlindedTail this_obj);
+
+/**
+ * The hops of the [`BlindedPath`] provided by the recipient.
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
+ */
+struct LDKCVec_BlindedHopZ BlindedTail_get_hops(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
+
+/**
+ * The hops of the [`BlindedPath`] provided by the recipient.
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
+ */
+void BlindedTail_set_hops(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKCVec_BlindedHopZ val);
+
+/**
+ * The blinding point of the [`BlindedPath`] provided by the recipient.
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
+ */
+struct LDKPublicKey BlindedTail_get_blinding_point(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
+
+/**
+ * The blinding point of the [`BlindedPath`] provided by the recipient.
+ *
+ * [`BlindedPath`]: crate::blinded_path::BlindedPath
+ */
+void BlindedTail_set_blinding_point(struct LDKBlindedTail *NONNULL_PTR this_ptr, struct LDKPublicKey val);
+
+/**
+ * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
+ * inferring the destination. May be 0.
+ */
+uint32_t BlindedTail_get_excess_final_cltv_expiry_delta(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
+
+/**
+ * Excess CLTV delta added to the recipient's CLTV expiry to deter intermediate nodes from
+ * inferring the destination. May be 0.
+ */
+void BlindedTail_set_excess_final_cltv_expiry_delta(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint32_t val);
+
+/**
+ * The total amount paid on this [`Path`], excluding the fees.
+ */
+uint64_t BlindedTail_get_final_value_msat(const struct LDKBlindedTail *NONNULL_PTR this_ptr);
+
+/**
+ * The total amount paid on this [`Path`], excluding the fees.
+ */
+void BlindedTail_set_final_value_msat(struct LDKBlindedTail *NONNULL_PTR this_ptr, uint64_t val);
+
+/**
+ * Constructs a new BlindedTail given each field
+ */
+MUST_USE_RES struct LDKBlindedTail BlindedTail_new(struct LDKCVec_BlindedHopZ hops_arg, struct LDKPublicKey blinding_point_arg, uint32_t excess_final_cltv_expiry_delta_arg, uint64_t final_value_msat_arg);
+
+/**
+ * Creates a copy of the BlindedTail
+ */
+struct LDKBlindedTail BlindedTail_clone(const struct LDKBlindedTail *NONNULL_PTR orig);
+
+/**
+ * Generates a non-cryptographic 64-bit hash of the BlindedTail.
+ */
+uint64_t BlindedTail_hash(const struct LDKBlindedTail *NONNULL_PTR o);
+
+/**
+ * Checks if two BlindedTails 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 BlindedTail_eq(const struct LDKBlindedTail *NONNULL_PTR a, const struct LDKBlindedTail *NONNULL_PTR b);
+
+/**
+ * Serialize the BlindedTail object into a byte array which can be read by BlindedTail_read
+ */
+struct LDKCVec_u8Z BlindedTail_write(const struct LDKBlindedTail *NONNULL_PTR obj);
+
+/**
+ * Read a BlindedTail from a byte array, created by BlindedTail_write
+ */
+struct LDKCResult_BlindedTailDecodeErrorZ BlindedTail_read(struct LDKu8slice ser);
+
+/**
+ * Frees any resources used by the Path, if is_owned is set and inner is non-NULL.
+ */
+void Path_free(struct LDKPath this_obj);
+
+/**
+ * The list of unblinded hops in this [`Path`]. Must be at least length one.
+ */
+struct LDKCVec_RouteHopZ Path_get_hops(const struct LDKPath *NONNULL_PTR this_ptr);
+
+/**
+ * The list of unblinded hops in this [`Path`]. Must be at least length one.
+ */
+void Path_set_hops(struct LDKPath *NONNULL_PTR this_ptr, struct LDKCVec_RouteHopZ val);
+
+/**
+ * The blinded path at which this path terminates, if we're sending to one, and its metadata.
+ *
+ * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+struct LDKBlindedTail Path_get_blinded_tail(const struct LDKPath *NONNULL_PTR this_ptr);
+
+/**
+ * The blinded path at which this path terminates, if we're sending to one, and its metadata.
+ *
+ * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+void Path_set_blinded_tail(struct LDKPath *NONNULL_PTR this_ptr, struct LDKBlindedTail val);
+
+/**
+ * Constructs a new Path given each field
+ */
+MUST_USE_RES struct LDKPath Path_new(struct LDKCVec_RouteHopZ hops_arg, struct LDKBlindedTail blinded_tail_arg);
+
+/**
+ * Creates a copy of the Path
+ */
+struct LDKPath Path_clone(const struct LDKPath *NONNULL_PTR orig);
+
+/**
+ * Generates a non-cryptographic 64-bit hash of the Path.
+ */
+uint64_t Path_hash(const struct LDKPath *NONNULL_PTR o);
+
+/**
+ * Checks if two Paths 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 Path_eq(const struct LDKPath *NONNULL_PTR a, const struct LDKPath *NONNULL_PTR b);
+
+/**
+ * Gets the fees for a given path, excluding any excess paid to the recipient.
+ */
+MUST_USE_RES uint64_t Path_fee_msat(const struct LDKPath *NONNULL_PTR this_arg);
+
+/**
+ * Gets the total amount paid on this [`Path`], excluding the fees.
+ */
+MUST_USE_RES uint64_t Path_final_value_msat(const struct LDKPath *NONNULL_PTR this_arg);
+
+/**
+ * Gets the final hop's CLTV expiry delta.
+ */
+MUST_USE_RES struct LDKCOption_u32Z Path_final_cltv_expiry_delta(const struct LDKPath *NONNULL_PTR this_arg);
+
/**
* Frees any resources used by the Route, if is_owned is set and inner is non-NULL.
*/
void Route_free(struct LDKRoute this_obj);
/**
- * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
- * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
- * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
- * least length one. While the maximum length of any given path is variable, keeping the length
- * of any path less or equal to 19 should currently ensure it is viable.
+ * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
+ * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
+ * the same.
*/
-struct LDKCVec_CVec_RouteHopZZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
+struct LDKCVec_PathZ Route_get_paths(const struct LDKRoute *NONNULL_PTR this_ptr);
/**
- * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
- * last RouteHop in each path must be the same. Each entry represents a list of hops, NOT
- * INCLUDING our own, where the last hop is the destination. Thus, this must always be at
- * least length one. While the maximum length of any given path is variable, keeping the length
- * of any path less or equal to 19 should currently ensure it is viable.
+ * The list of [`Path`]s taken for a single (potentially-)multi-part payment. If no
+ * [`BlindedTail`]s are present, then the pubkey of the last [`RouteHop`] in each path must be
+ * the same.
*/
-void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val);
+void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_PathZ val);
/**
* The `payment_params` parameter passed to [`find_route`].
* This is used by `ChannelManager` to track information which may be required for retries,
* provided back to you via [`Event::PaymentPathFailed`].
*
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
* This is used by `ChannelManager` to track information which may be required for retries,
* provided back to you via [`Event::PaymentPathFailed`].
*
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
*
* Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
/**
* Constructs a new Route given each field
*/
-MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_CVec_RouteHopZZ paths_arg, struct LDKPaymentParameters payment_params_arg);
+MUST_USE_RES struct LDKRoute Route_new(struct LDKCVec_PathZ paths_arg, struct LDKPaymentParameters payment_params_arg);
/**
* Creates a copy of the Route
struct LDKRoute Route_clone(const struct LDKRoute *NONNULL_PTR orig);
/**
- * Checks if two Routes contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Route.
*/
uint64_t Route_hash(const struct LDKRoute *NONNULL_PTR o);
MUST_USE_RES uint64_t Route_get_total_fees(const struct LDKRoute *NONNULL_PTR this_arg);
/**
- * Returns the total amount paid on this [`Route`], excluding the fees.
+ * Returns the total amount paid on this [`Route`], excluding the fees. Might be more than
+ * requested if we had to reach htlc_minimum_msat.
*/
MUST_USE_RES uint64_t Route_get_total_amount(const struct LDKRoute *NONNULL_PTR this_arg);
/**
* Hints for routing to the payee, containing channels connecting the payee to public nodes.
*/
-struct LDKCVec_RouteHintZ PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
+struct LDKHints PaymentParameters_get_route_hints(const struct LDKPaymentParameters *NONNULL_PTR this_ptr);
/**
* Hints for routing to the payee, containing channels connecting the payee to public nodes.
*/
-void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_RouteHintZ val);
+void PaymentParameters_set_route_hints(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKHints val);
/**
* Expiration of a payment to the payee, in seconds relative to the UNIX epoch.
/**
* Constructs a new PaymentParameters given each field
*/
-MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKCVec_RouteHintZ route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg, uint32_t final_cltv_expiry_delta_arg);
+MUST_USE_RES struct LDKPaymentParameters PaymentParameters_new(struct LDKPublicKey payee_pubkey_arg, struct LDKInvoiceFeatures features_arg, struct LDKHints route_hints_arg, struct LDKCOption_u64Z expiry_time_arg, uint32_t max_total_cltv_expiry_delta_arg, uint8_t max_path_count_arg, uint8_t max_channel_saturation_power_of_half_arg, struct LDKCVec_u64Z previously_failed_channels_arg, uint32_t final_cltv_expiry_delta_arg);
/**
* Creates a copy of the PaymentParameters
struct LDKPaymentParameters PaymentParameters_clone(const struct LDKPaymentParameters *NONNULL_PTR orig);
/**
- * Checks if two PaymentParameterss contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the PaymentParameters.
*/
uint64_t PaymentParameters_hash(const struct LDKPaymentParameters *NONNULL_PTR o);
*/
MUST_USE_RES struct LDKPaymentParameters PaymentParameters_for_keysend(struct LDKPublicKey payee_pubkey, uint32_t final_cltv_expiry_delta);
+/**
+ * Frees any resources used by the Hints
+ */
+void Hints_free(struct LDKHints this_ptr);
+
+/**
+ * Creates a copy of the Hints
+ */
+struct LDKHints Hints_clone(const struct LDKHints *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Blinded-variant Hints
+ */
+struct LDKHints Hints_blinded(struct LDKCVec_C2Tuple_BlindedPayInfoBlindedPathZZ a);
+
+/**
+ * Utility method to constructs a new Clear-variant Hints
+ */
+struct LDKHints Hints_clear(struct LDKCVec_RouteHintZ a);
+
+/**
+ * Generates a non-cryptographic 64-bit hash of the Hints.
+ */
+uint64_t Hints_hash(const struct LDKHints *NONNULL_PTR o);
+
+/**
+ * Checks if two Hintss contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool Hints_eq(const struct LDKHints *NONNULL_PTR a, const struct LDKHints *NONNULL_PTR b);
+
/**
* Frees any resources used by the RouteHint, if is_owned is set and inner is non-NULL.
*/
struct LDKRouteHint RouteHint_clone(const struct LDKRouteHint *NONNULL_PTR orig);
/**
- * Checks if two RouteHints contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the RouteHint.
*/
uint64_t RouteHint_hash(const struct LDKRouteHint *NONNULL_PTR o);
struct LDKRouteHintHop RouteHintHop_clone(const struct LDKRouteHintHop *NONNULL_PTR orig);
/**
- * Checks if two RouteHintHops contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the RouteHintHop.
*/
uint64_t RouteHintHop_hash(const struct LDKRouteHintHop *NONNULL_PTR o);
* [`ChannelManager::list_usable_channels`] will never include such channels.
*
* [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
- * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+ * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
* [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
*
* Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b, struct LDKLogger arg_c);
+/**
+ * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
+ */
+void OnionMessenger_free(struct LDKOnionMessenger this_obj);
+
+/**
+ * Frees any resources used by the Destination
+ */
+void Destination_free(struct LDKDestination this_ptr);
+
+/**
+ * Creates a copy of the Destination
+ */
+struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Node-variant Destination
+ */
+struct LDKDestination Destination_node(struct LDKPublicKey a);
+
+/**
+ * Utility method to constructs a new BlindedPath-variant Destination
+ */
+struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a);
+
+/**
+ * Frees any resources used by the SendError
+ */
+void SendError_free(struct LDKSendError this_ptr);
+
+/**
+ * Creates a copy of the SendError
+ */
+struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new Secp256k1-variant SendError
+ */
+struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
+
+/**
+ * Utility method to constructs a new TooBigPacket-variant SendError
+ */
+struct LDKSendError SendError_too_big_packet(void);
+
+/**
+ * Utility method to constructs a new TooFewBlindedHops-variant SendError
+ */
+struct LDKSendError SendError_too_few_blinded_hops(void);
+
+/**
+ * Utility method to constructs a new InvalidFirstHop-variant SendError
+ */
+struct LDKSendError SendError_invalid_first_hop(void);
+
+/**
+ * Utility method to constructs a new InvalidMessage-variant SendError
+ */
+struct LDKSendError SendError_invalid_message(void);
+
+/**
+ * Utility method to constructs a new BufferFull-variant SendError
+ */
+struct LDKSendError SendError_buffer_full(void);
+
+/**
+ * Utility method to constructs a new GetNodeIdFailed-variant SendError
+ */
+struct LDKSendError SendError_get_node_id_failed(void);
+
+/**
+ * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
+ */
+struct LDKSendError SendError_blinded_path_advance_failed(void);
+
+/**
+ * Checks if two SendErrors contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
+
+/**
+ * Calls the free function if one is set
+ */
+void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
+
+/**
+ * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
+ * their respective handlers.
+ */
+MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
+
+/**
+ * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
+ * See [`OnionMessenger`] for example usage.
+ *
+ * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
+ */
+MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path);
+
+/**
+ * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
+ */
+struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
+
+/**
+ * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
+ * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
+ */
+struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
+
+/**
+ * Frees any resources used by the OnionMessageContents
+ */
+void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
+
+/**
+ * Utility method to constructs a new Custom-variant OnionMessageContents
+ */
+struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a);
+
+/**
+ * Calls the free function if one is set
+ */
+void CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
+
/**
* Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL.
*/
*/
struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig);
+/**
+ * Generates a non-cryptographic 64-bit hash of the BlindedPath.
+ */
+uint64_t BlindedPath_hash(const struct LDKBlindedPath *NONNULL_PTR o);
+
+/**
+ * Checks if two BlindedPaths 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 BlindedPath_eq(const struct LDKBlindedPath *NONNULL_PTR a, const struct LDKBlindedPath *NONNULL_PTR b);
+
/**
* Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL.
*/
struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig);
/**
- * Create a blinded path to be forwarded along `node_pks`. The last node pubkey in `node_pks`
- * will be the destination node.
+ * Generates a non-cryptographic 64-bit hash of the BlindedHop.
+ */
+uint64_t BlindedHop_hash(const struct LDKBlindedHop *NONNULL_PTR o);
+
+/**
+ * Checks if two BlindedHops 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 BlindedHop_eq(const struct LDKBlindedHop *NONNULL_PTR a, const struct LDKBlindedHop *NONNULL_PTR b);
+
+/**
+ * Create a blinded path for an onion message, to be forwarded along `node_pks`. The last node
+ * pubkey in `node_pks` will be the destination node.
*
* Errors if less than two hops are provided or if `node_pk`(s) are invalid.
*/
-MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source);
+MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_new_for_message(struct LDKCVec_PublicKeyZ node_pks, const struct LDKEntropySource *NONNULL_PTR entropy_source);
/**
* Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read
struct LDKCResult_BlindedHopDecodeErrorZ BlindedHop_read(struct LDKu8slice ser);
/**
- * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL.
+ * Frees any resources used by the PaymentPurpose
*/
-void OnionMessenger_free(struct LDKOnionMessenger this_obj);
+void PaymentPurpose_free(struct LDKPaymentPurpose this_ptr);
/**
- * Frees any resources used by the Destination
+ * Creates a copy of the PaymentPurpose
*/
-void Destination_free(struct LDKDestination this_ptr);
+struct LDKPaymentPurpose PaymentPurpose_clone(const struct LDKPaymentPurpose *NONNULL_PTR orig);
/**
- * Creates a copy of the Destination
+ * Utility method to constructs a new InvoicePayment-variant PaymentPurpose
*/
-struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig);
+struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_secret);
/**
- * Utility method to constructs a new Node-variant Destination
+ * Utility method to constructs a new SpontaneousPayment-variant PaymentPurpose
*/
-struct LDKDestination Destination_node(struct LDKPublicKey a);
+struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a);
/**
- * Utility method to constructs a new BlindedPath-variant Destination
+ * Checks if two PaymentPurposes contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
*/
-struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a);
+bool PaymentPurpose_eq(const struct LDKPaymentPurpose *NONNULL_PTR a, const struct LDKPaymentPurpose *NONNULL_PTR b);
/**
- * Frees any resources used by the SendError
+ * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read
*/
-void SendError_free(struct LDKSendError this_ptr);
+struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj);
/**
- * Creates a copy of the SendError
+ * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write
*/
-struct LDKSendError SendError_clone(const struct LDKSendError *NONNULL_PTR orig);
+struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser);
/**
- * Utility method to constructs a new Secp256k1-variant SendError
+ * Frees any resources used by the PathFailure
*/
-struct LDKSendError SendError_secp256k1(enum LDKSecp256k1Error a);
+void PathFailure_free(struct LDKPathFailure this_ptr);
/**
- * Utility method to constructs a new TooBigPacket-variant SendError
+ * Creates a copy of the PathFailure
*/
-struct LDKSendError SendError_too_big_packet(void);
+struct LDKPathFailure PathFailure_clone(const struct LDKPathFailure *NONNULL_PTR orig);
/**
- * Utility method to constructs a new TooFewBlindedHops-variant SendError
+ * Utility method to constructs a new InitialSend-variant PathFailure
*/
-struct LDKSendError SendError_too_few_blinded_hops(void);
+struct LDKPathFailure PathFailure_initial_send(struct LDKAPIError err);
/**
- * Utility method to constructs a new InvalidFirstHop-variant SendError
+ * Utility method to constructs a new OnPath-variant PathFailure
*/
-struct LDKSendError SendError_invalid_first_hop(void);
+struct LDKPathFailure PathFailure_on_path(struct LDKCOption_NetworkUpdateZ network_update);
/**
- * Utility method to constructs a new InvalidMessage-variant SendError
+ * Checks if two PathFailures contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
*/
-struct LDKSendError SendError_invalid_message(void);
+bool PathFailure_eq(const struct LDKPathFailure *NONNULL_PTR a, const struct LDKPathFailure *NONNULL_PTR b);
/**
- * Utility method to constructs a new BufferFull-variant SendError
+ * Serialize the PathFailure object into a byte array which can be read by PathFailure_read
*/
-struct LDKSendError SendError_buffer_full(void);
+struct LDKCVec_u8Z PathFailure_write(const struct LDKPathFailure *NONNULL_PTR obj);
/**
- * Utility method to constructs a new GetNodeIdFailed-variant SendError
+ * Read a PathFailure from a byte array, created by PathFailure_write
*/
-struct LDKSendError SendError_get_node_id_failed(void);
+struct LDKCResult_COption_PathFailureZDecodeErrorZ PathFailure_read(struct LDKu8slice ser);
/**
- * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError
+ * Frees any resources used by the ClosureReason
*/
-struct LDKSendError SendError_blinded_path_advance_failed(void);
+void ClosureReason_free(struct LDKClosureReason this_ptr);
/**
- * Checks if two SendErrors contain equal inner contents.
+ * 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 LDKUntrustedString 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);
+
+/**
+ * Checks if two ClosureReasons contain equal inner contents.
* This ignores pointers and is_owned flags and looks at the values in fields.
*/
-bool SendError_eq(const struct LDKSendError *NONNULL_PTR a, const struct LDKSendError *NONNULL_PTR b);
+bool ClosureReason_eq(const struct LDKClosureReason *NONNULL_PTR a, const struct LDKClosureReason *NONNULL_PTR b);
/**
- * Calls the free function if one is set
+ * Serialize the ClosureReason object into a byte array which can be read by ClosureReason_read
*/
-void CustomOnionMessageHandler_free(struct LDKCustomOnionMessageHandler this_ptr);
+struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PTR obj);
/**
- * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to
- * their respective handlers.
+ * Read a ClosureReason from a byte array, created by ClosureReason_write
*/
-MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKCustomOnionMessageHandler custom_handler);
+struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser);
/**
- * Send an onion message with contents `message` to `destination`, routing it through `intermediate_nodes`.
- * See [`OnionMessenger`] for example usage.
- *
- * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
+ * Frees any resources used by the HTLCDestination
*/
-MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path);
+void HTLCDestination_free(struct LDKHTLCDestination this_ptr);
/**
- * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned OnionMessageHandler must be freed before this_arg is
+ * Creates a copy of the HTLCDestination
*/
-struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
+struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig);
/**
- * Constructs a new OnionMessageProvider which calls the relevant methods on this_arg.
- * This copies the `inner` pointer in this_arg and thus the returned OnionMessageProvider must be freed before this_arg is
+ * Utility method to constructs a new NextHopChannel-variant HTLCDestination
*/
-struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg);
+struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id);
/**
- * Frees any resources used by the OnionMessageContents
+ * Utility method to constructs a new UnknownNextHop-variant HTLCDestination
*/
-void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr);
+struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid);
/**
- * Utility method to constructs a new Custom-variant OnionMessageContents
+ * Utility method to constructs a new InvalidForward-variant HTLCDestination
*/
-struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a);
+struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid);
+
+/**
+ * Utility method to constructs a new FailedPayment-variant HTLCDestination
+ */
+struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash);
+
+/**
+ * Checks if two HTLCDestinations contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool HTLCDestination_eq(const struct LDKHTLCDestination *NONNULL_PTR a, const struct LDKHTLCDestination *NONNULL_PTR b);
+
+/**
+ * Serialize the HTLCDestination object into a byte array which can be read by HTLCDestination_read
+ */
+struct LDKCVec_u8Z HTLCDestination_write(const struct LDKHTLCDestination *NONNULL_PTR obj);
+
+/**
+ * Read a HTLCDestination from a byte array, created by HTLCDestination_write
+ */
+struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(struct LDKu8slice ser);
+
+/**
+ * Creates a copy of the PaymentFailureReason
+ */
+enum LDKPaymentFailureReason PaymentFailureReason_clone(const enum LDKPaymentFailureReason *NONNULL_PTR orig);
+
+/**
+ * Utility method to constructs a new RecipientRejected-variant PaymentFailureReason
+ */
+enum LDKPaymentFailureReason PaymentFailureReason_recipient_rejected(void);
+
+/**
+ * Utility method to constructs a new UserAbandoned-variant PaymentFailureReason
+ */
+enum LDKPaymentFailureReason PaymentFailureReason_user_abandoned(void);
+
+/**
+ * Utility method to constructs a new RetriesExhausted-variant PaymentFailureReason
+ */
+enum LDKPaymentFailureReason PaymentFailureReason_retries_exhausted(void);
+
+/**
+ * Utility method to constructs a new PaymentExpired-variant PaymentFailureReason
+ */
+enum LDKPaymentFailureReason PaymentFailureReason_payment_expired(void);
+
+/**
+ * Utility method to constructs a new RouteNotFound-variant PaymentFailureReason
+ */
+enum LDKPaymentFailureReason PaymentFailureReason_route_not_found(void);
+
+/**
+ * Utility method to constructs a new UnexpectedError-variant PaymentFailureReason
+ */
+enum LDKPaymentFailureReason PaymentFailureReason_unexpected_error(void);
+
+/**
+ * Checks if two PaymentFailureReasons contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool PaymentFailureReason_eq(const enum LDKPaymentFailureReason *NONNULL_PTR a, const enum LDKPaymentFailureReason *NONNULL_PTR b);
+
+/**
+ * Serialize the PaymentFailureReason object into a byte array which can be read by PaymentFailureReason_read
+ */
+struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason *NONNULL_PTR obj);
+
+/**
+ * Read a PaymentFailureReason from a byte array, created by PaymentFailureReason_write
+ */
+struct LDKCResult_PaymentFailureReasonDecodeErrorZ PaymentFailureReason_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, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, struct LDKU128 user_channel_id);
+
+/**
+ * Utility method to constructs a new PaymentClaimable-variant Event
+ */
+struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline);
+
+/**
+ * Utility method to constructs a new PaymentClaimed-variant Event
+ */
+struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, 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 PaymentFailed-variant Event
+ */
+struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_PaymentFailureReasonZ reason);
+
+/**
+ * Utility method to constructs a new PaymentPathSuccessful-variant Event
+ */
+struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path);
+
+/**
+ * Utility method to constructs a new PaymentPathFailed-variant Event
+ */
+struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKPathFailure failure, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
+
+/**
+ * Utility method to constructs a new ProbeSuccessful-variant Event
+ */
+struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path);
+
+/**
+ * Utility method to constructs a new ProbeFailed-variant Event
+ */
+struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKPath path, struct LDKCOption_u64Z short_channel_id);
+
+/**
+ * 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 HTLCIntercepted-variant Event
+ */
+struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat);
+
+/**
+ * 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 LDKThirtyTwoBytes prev_channel_id, struct LDKThirtyTwoBytes next_channel_id, struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat);
+
+/**
+ * Utility method to constructs a new ChannelPending-variant Event
+ */
+struct LDKEvent Event_channel_pending(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKThirtyTwoBytes former_temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKOutPoint funding_txo);
+
+/**
+ * Utility method to constructs a new ChannelReady-variant Event
+ */
+struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type);
+
+/**
+ * Utility method to constructs a new ChannelClosed-variant Event
+ */
+struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 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 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);
+
+/**
+ * Utility method to constructs a new HTLCHandlingFailed-variant Event
+ */
+struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination);
+
+/**
+ * Checks if two Events contain equal inner contents.
+ * This ignores pointers and is_owned flags and looks at the values in fields.
+ */
+bool Event_eq(const struct LDKEvent *NONNULL_PTR a, const struct LDKEvent *NONNULL_PTR b);
+
+/**
+ * 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 SendChannelReady-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady 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 SendChannelAnnouncement-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_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 BroadcastChannelUpdate-variant MessageSendEvent
+ */
+struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_update(struct LDKChannelUpdate 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 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 CustomOnionMessageContents_free(struct LDKCustomOnionMessageContents this_ptr);
+void MessageSendEventsProvider_free(struct LDKMessageSendEventsProvider this_ptr);
+
+/**
+ * Calls the free function if one is set
+ */
+void OnionMessageProvider_free(struct LDKOnionMessageProvider 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 FilesystemPersister, if is_owned is set and inner is non-NULL.
struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig);
/**
- * Checks if two Invoices contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Invoice.
*/
uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o);
struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig);
/**
- * Checks if two SignedRawInvoices contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the SignedRawInvoice.
*/
uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o);
struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig);
/**
- * Checks if two RawInvoices contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the RawInvoice.
*/
uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o);
struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig);
/**
- * Checks if two RawDataParts contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the RawDataPart.
*/
uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o);
struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig);
/**
- * Checks if two PositiveTimestamps contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the PositiveTimestamp.
*/
uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o);
bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b);
/**
- * Checks if two SiPrefixs contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the SiPrefix.
*/
uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o);
enum LDKCurrency Currency_signet(void);
/**
- * Checks if two Currencys contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Currency.
*/
uint64_t Currency_hash(const enum LDKCurrency *NONNULL_PTR o);
struct LDKSha256 Sha256_clone(const struct LDKSha256 *NONNULL_PTR orig);
/**
- * Checks if two Sha256s contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Sha256.
*/
uint64_t Sha256_hash(const struct LDKSha256 *NONNULL_PTR o);
*/
bool Sha256_eq(const struct LDKSha256 *NONNULL_PTR a, const struct LDKSha256 *NONNULL_PTR b);
+/**
+ * Constructs a new [`Sha256`] from the given bytes, which are assumed to be the output of a
+ * single sha256 hash.
+ */
+MUST_USE_RES struct LDKSha256 Sha256_from_bytes(const uint8_t (*bytes)[32]);
+
/**
* Frees any resources used by the Description, if is_owned is set and inner is non-NULL.
*/
struct LDKDescription Description_clone(const struct LDKDescription *NONNULL_PTR orig);
/**
- * Checks if two Descriptions contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Description.
*/
uint64_t Description_hash(const struct LDKDescription *NONNULL_PTR o);
struct LDKPayeePubKey PayeePubKey_clone(const struct LDKPayeePubKey *NONNULL_PTR orig);
/**
- * Checks if two PayeePubKeys contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the PayeePubKey.
*/
uint64_t PayeePubKey_hash(const struct LDKPayeePubKey *NONNULL_PTR o);
struct LDKExpiryTime ExpiryTime_clone(const struct LDKExpiryTime *NONNULL_PTR orig);
/**
- * Checks if two ExpiryTimes contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the ExpiryTime.
*/
uint64_t ExpiryTime_hash(const struct LDKExpiryTime *NONNULL_PTR o);
struct LDKMinFinalCltvExpiryDelta MinFinalCltvExpiryDelta_clone(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR orig);
/**
- * Checks if two MinFinalCltvExpiryDeltas contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the MinFinalCltvExpiryDelta.
*/
uint64_t MinFinalCltvExpiryDelta_hash(const struct LDKMinFinalCltvExpiryDelta *NONNULL_PTR o);
/**
* Utility method to constructs a new SegWitProgram-variant Fallback
*/
-struct LDKFallback Fallback_seg_wit_program(struct LDKU5 version, struct LDKCVec_u8Z program);
+struct LDKFallback Fallback_seg_wit_program(struct LDKWitnessVersion version, struct LDKCVec_u8Z program);
/**
* Utility method to constructs a new PubKeyHash-variant Fallback
struct LDKFallback Fallback_script_hash(struct LDKTwentyBytes a);
/**
- * Checks if two Fallbacks contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the Fallback.
*/
uint64_t Fallback_hash(const struct LDKFallback *NONNULL_PTR o);
struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig);
/**
- * Checks if two InvoiceSignatures contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the InvoiceSignature.
*/
uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o);
struct LDKPrivateRoute PrivateRoute_clone(const struct LDKPrivateRoute *NONNULL_PTR orig);
/**
- * Checks if two PrivateRoutes contain equal inner contents.
+ * Generates a non-cryptographic 64-bit hash of the PrivateRoute.
*/
uint64_t PrivateRoute_hash(const struct LDKPrivateRoute *NONNULL_PTR o);
MUST_USE_RES struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ SignedRawInvoice_into_parts(struct LDKSignedRawInvoice this_arg);
/**
- * The `RawInvoice` which was signed.
+ * The [`RawInvoice`] which was signed.
*/
MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
/**
- * The hash of the `RawInvoice` that was signed.
+ * The hash of the [`RawInvoice`] that was signed.
*/
MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32];
/**
- * InvoiceSignature for the invoice.
+ * Signature for the invoice.
*/
MUST_USE_RES struct LDKInvoiceSignature SignedRawInvoice_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg);
*/
MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_payment_secret(const struct LDKRawInvoice *NONNULL_PTR this_arg);
+MUST_USE_RES struct LDKCOption_CVec_u8ZZ RawInvoice_payment_metadata(const struct LDKRawInvoice *NONNULL_PTR this_arg);
+
/**
*
* Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
*/
MUST_USE_RES uint64_t PositiveTimestamp_as_time(const struct LDKPositiveTimestamp *NONNULL_PTR this_arg);
+/**
+ * The hash of the [`RawInvoice`] that was signed.
+ */
+MUST_USE_RES struct LDKThirtyTwoBytes Invoice_signable_hash(const struct LDKInvoice *NONNULL_PTR this_arg);
+
/**
* Transform the `Invoice` into it's unchecked version
*/
MUST_USE_RES struct LDKCResult_NoneSemanticErrorZ Invoice_check_signature(const struct LDKInvoice *NONNULL_PTR this_arg);
/**
- * Constructs an `Invoice` from a `SignedRawInvoice` by checking all its invariants.
+ * Constructs an `Invoice` from a [`SignedRawInvoice`] by checking all its invariants.
* ```
* use lightning_invoice::*;
*
*/
MUST_USE_RES const uint8_t (*Invoice_payment_secret(const struct LDKInvoice *NONNULL_PTR this_arg))[32];
+/**
+ * Get the payment metadata blob if one was included in the invoice
+ */
+MUST_USE_RES struct LDKCOption_CVec_u8ZZ Invoice_payment_metadata(const struct LDKInvoice *NONNULL_PTR this_arg);
+
/**
* Get the invoice features if they were included in the invoice
*
*/
MUST_USE_RES struct LDKPublicKey Invoice_recover_payee_pub_key(const struct LDKInvoice *NONNULL_PTR this_arg);
+/**
+ * Returns the Duration since the Unix epoch at which the invoice expires.
+ * Returning None if overflow occurred.
+ */
+MUST_USE_RES struct LDKCOption_DurationZ Invoice_expires_at(const struct LDKInvoice *NONNULL_PTR this_arg);
+
/**
* Returns the invoice's expiry time, if present, otherwise [`DEFAULT_EXPIRY_TIME`].
*/
*/
MUST_USE_RES bool Invoice_is_expired(const struct LDKInvoice *NONNULL_PTR this_arg);
+/**
+ * Returns the Duration remaining until the invoice expires.
+ */
+MUST_USE_RES uint64_t Invoice_duration_until_expiry(const struct LDKInvoice *NONNULL_PTR this_arg);
+
+/**
+ * Returns the Duration remaining until the invoice expires given the current time.
+ * `time` is the timestamp as a duration since the Unix epoch.
+ */
+MUST_USE_RES uint64_t Invoice_expiration_remaining_from_epoch(const struct LDKInvoice *NONNULL_PTR this_arg, uint64_t time);
+
/**
* Returns whether the expiry time would pass at the given point in time.
* `at_time` is the timestamp as a duration since the Unix epoch.
*/
MUST_USE_RES uint64_t Invoice_min_final_cltv_expiry_delta(const struct LDKInvoice *NONNULL_PTR this_arg);
+/**
+ * Returns a list of all fallback addresses as [`Address`]es
+ */
+MUST_USE_RES struct LDKCVec_AddressZ Invoice_fallback_addresses(const struct LDKInvoice *NONNULL_PTR this_arg);
+
/**
* Returns a list of all routes included in the invoice
*/
/**
* Creates a new `Description` if `description` is at most 1023 __bytes__ long,
- * returns `CreationError::DescriptionTooLong` otherwise
+ * returns [`CreationError::DescriptionTooLong`] otherwise
*
* Please note that single characters may use more than one byte due to UTF8 encoding.
*/
MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description);
/**
- * Returns the underlying description `String`
+ * Returns the underlying description [`String`]
*/
MUST_USE_RES struct LDKStr Description_into_inner(struct LDKDescription this_arg);
MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_seconds(uint64_t seconds);
/**
- * Construct an `ExpiryTime` from a `Duration`, dropping the sub-second part.
+ * Construct an `ExpiryTime` from a [`Duration`], dropping the sub-second part.
*/
MUST_USE_RES struct LDKExpiryTime ExpiryTime_from_duration(uint64_t duration);
MUST_USE_RES uint64_t ExpiryTime_as_seconds(const struct LDKExpiryTime *NONNULL_PTR this_arg);
/**
- * Returns a reference to the underlying `Duration` (=expiry time)
+ * Returns a reference to the underlying [`Duration`] (=expiry time)
*/
MUST_USE_RES uint64_t ExpiryTime_as_duration(const struct LDKExpiryTime *NONNULL_PTR this_arg);
*/
MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger);
-/**
- * Update network graph from binary data.
- * Returns the last sync timestamp to be used the next time rapid sync data is queried.
- *
- * `update_data`: `&[u8]` binary stream that comprises the update data
- */
-MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_update_network_graph(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKu8slice update_data);
-
/**
* Update network graph from binary data.
* Returns the last sync timestamp to be used the next time rapid sync data is queried.