X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=lightning-c-bindings%2Finclude%2Flightning.h;h=05f07eb7f62c15edb65a2a8e5c59f813f2a2318e;hb=709706e247c4210ce80f54b597b4e5d5607f3fed;hp=5a1ea3cf9428760df98636cde15f9487a4cfc78c;hpb=3fafbe3b1625eb163737b705bac7e2f911b53bdb;p=ldk-c-bindings diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 5a1ea3c..05f07eb 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -1,7 +1,7 @@ #ifndef LDK_C_BINDINGS_H #define LDK_C_BINDINGS_H -/* Generated with cbindgen:0.20.0 */ +/* Generated with cbindgen:0.24.3 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -340,6 +340,10 @@ typedef enum LDKSecp256k1Error { * Bad secret key */ LDKSecp256k1Error_InvalidSecretKey, + /** + * Bad shared secret. + */ + LDKSecp256k1Error_InvalidSharedSecret, /** * Bad recovery id */ @@ -348,14 +352,18 @@ typedef enum LDKSecp256k1Error { * Invalid tweak for add_assign or mul_assign */ LDKSecp256k1Error_InvalidTweak, - /** - * tweak_add_check failed on an xonly public key - */ - LDKSecp256k1Error_TweakCheckFailed, /** * Didn't pass enough memory to context creation with preallocated memory */ LDKSecp256k1Error_NotEnoughMemory, + /** + * Bad set of public keys. + */ + LDKSecp256k1Error_InvalidPublicKeySum, + /** + * The only valid parity values are 0 or 1. + */ + LDKSecp256k1Error_InvalidParityValue, /** * Must be last for serialization purposes */ @@ -572,6 +580,192 @@ typedef struct LDKTxOut { uint64_t value; } LDKTxOut; +/** + * 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 routes, which serve to hide the identity of + * the recipient. + */ +typedef struct MUST_USE_STRUCT LDKBlindedRoute { + /** + * 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. + */ + LDKnativeBlindedRoute *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; +} LDKBlindedRoute; + +/** + * The contents of CResult_BlindedRouteNoneZ + */ +typedef union LDKCResult_BlindedRouteNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedRoute *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_BlindedRouteNoneZPtr; + +/** + * A CResult_BlindedRouteNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::blinded_route::BlindedRoute on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedRouteNoneZ { + /** + * The contents of this CResult_BlindedRouteNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedRouteNoneZPtr contents; + /** + * Whether this CResult_BlindedRouteNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedRouteNoneZ; + + + +/** + * An error in decoding a message or struct. + */ +typedef struct MUST_USE_STRUCT LDKDecodeError { + /** + * 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. + */ + LDKnativeDecodeError *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; +} LDKDecodeError; + +/** + * The contents of CResult_BlindedRouteDecodeErrorZ + */ +typedef union LDKCResult_BlindedRouteDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedRoute *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_BlindedRouteDecodeErrorZPtr; + +/** + * A CResult_BlindedRouteDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::blinded_route::BlindedRoute 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_BlindedRouteDecodeErrorZ { + /** + * The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedRouteDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedRouteDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedRouteDecodeErrorZ; + + + +/** + * Used to construct the blinded hops portion of a blinded route. 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; + +/** + * 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::onion_message::blinded_route::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; + /** * The contents of CResult_NoneNoneZ */ @@ -607,7 +801,7 @@ typedef struct LDKCResult_NoneNoneZ { /** * Implements the per-commitment secret storage scheme from - * [BOLT 3](https://github.com/lightningnetwork/lightning-rfc/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). + * [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. @@ -627,26 +821,6 @@ typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { bool is_owned; } LDKCounterpartyCommitmentSecrets; - - -/** - * An error in decoding a message or struct. - */ -typedef struct MUST_USE_STRUCT LDKDecodeError { - /** - * 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. - */ - LDKnativeDecodeError *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; -} LDKDecodeError; - /** * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ */ @@ -723,16 +897,6 @@ typedef struct LDKCResult_SecretKeyErrorZ { bool result_ok; } LDKCResult_SecretKeyErrorZ; -/** - * 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; - /** * The contents of CResult_PublicKeyErrorZ */ @@ -1448,7 +1612,7 @@ typedef struct LDKCResult_CVec_SignatureZNoneZ { /** * A script pubkey for shutting down a channel as defined by [BOLT #2]. * - * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ typedef struct MUST_USE_STRUCT LDKShutdownScript { /** @@ -1551,37 +1715,45 @@ typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ { bool result_ok; } LDKCResult_ShutdownScriptInvalidShutdownScriptZ; + + /** - * The contents of CResult_NoneErrorZ + * Represents the compressed public key of a node */ -typedef union LDKCResult_NoneErrorZPtr { +typedef struct MUST_USE_STRUCT LDKNodeId { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * 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 *result; + LDKnativeNodeId *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. */ - enum LDKIOError *err; -} LDKCResult_NoneErrorZPtr; + bool is_owned; +} LDKNodeId; + + /** - * A CResult_NoneErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::c_types::IOError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. */ -typedef struct LDKCResult_NoneErrorZ { +typedef struct MUST_USE_STRUCT LDKChannelUsage { /** - * The contents of this CResult_NoneErrorZ, 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_NoneErrorZPtr contents; + LDKnativeChannelUsage *inner; /** - * Whether this CResult_NoneErrorZ 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_NoneErrorZ; + bool is_owned; +} LDKChannelUsage; @@ -1603,39 +1775,6 @@ typedef struct MUST_USE_STRUCT LDKRouteHop { bool is_owned; } LDKRouteHop; -/** - * The contents of CResult_RouteHopDecodeErrorZ - */ -typedef union LDKCResult_RouteHopDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRouteHop *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_RouteHopDecodeErrorZPtr; - -/** - * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::RouteHop 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_RouteHopDecodeErrorZ { - /** - * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteHopDecodeErrorZPtr contents; - /** - * Whether this CResult_RouteHopDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteHopDecodeErrorZ; - /** * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. * This corresponds to std::vector in C++ @@ -1653,8 +1792,203 @@ typedef struct LDKCVec_RouteHopZ { } LDKCVec_RouteHopZ; /** - * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size. - * This corresponds to std::vector in C++ + * An interface used to score payment channels for path finding. + * + *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel. + */ +typedef struct LDKScore { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the + * given channel in the direction from `source` to `target`. + * + * The channel's capacity (less any other MPP parts that are also being considered for use in + * the same payment) is given by `capacity_msat`. It may be determined from various sources + * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near + * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. + * Thus, implementations should be overflow-safe. + */ + uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, struct LDKChannelUsage usage); + /** + * Handles updating channel penalties after failing to route through a channel. + */ + void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + /** + * Handles updating channel penalties after successfully routing along a path. + */ + void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path); + /** + * 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); + /** + * Handles updating channel penalties after a probe over the given path succeeded. + */ + void (*probe_successful)(void *this_arg, struct LDKCVec_RouteHopZ path); + /** + * Serialize the object into a byte array + */ + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKScore; + +/** + * A scorer that is accessed under a lock. + * + * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while + * having shared ownership of a scorer but without requiring internal locking in [`Score`] + * implementations. Internal locking would be detrimental to route finding performance and could + * result in [`Score::channel_penalty_msat`] returning a different value for the same channel. + * + * [`find_route`]: crate::routing::router::find_route + */ +typedef struct LDKLockableScore { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns the locked scorer. + */ + struct LDKScore (*lock)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKLockableScore; + +/** + * Refers to a scorer that is accessible under lock and also writeable to disk + * + * We need this trait to be able to pass in a scorer to `lightning-background-processor` that will enable us to + * use the Persister to persist it. + */ +typedef struct LDKWriteableScore { + /** + * 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; + /** + * Implementation of LockableScore for this object. + */ + struct LDKLockableScore LockableScore; + /** + * Serialize the object into a byte array + */ + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKWriteableScore; + +/** + * An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not + */ +typedef enum LDKCOption_WriteableScoreZ_Tag { + /** + * When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore + */ + LDKCOption_WriteableScoreZ_Some, + /** + * When we're in this state, this COption_WriteableScoreZ contains nothing + */ + LDKCOption_WriteableScoreZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_WriteableScoreZ_Sentinel, +} LDKCOption_WriteableScoreZ_Tag; + +typedef struct LDKCOption_WriteableScoreZ { + LDKCOption_WriteableScoreZ_Tag tag; + union { + struct { + struct LDKWriteableScore some; + }; + }; +} LDKCOption_WriteableScoreZ; + +/** + * The contents of CResult_NoneErrorZ + */ +typedef union LDKCResult_NoneErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_NoneErrorZPtr; + +/** + * A CResult_NoneErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneErrorZ { + /** + * The contents of this CResult_NoneErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneErrorZPtr contents; + /** + * Whether this CResult_NoneErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneErrorZ; + +/** + * The contents of CResult_RouteHopDecodeErrorZ + */ +typedef union LDKCResult_RouteHopDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRouteHop *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_RouteHopDecodeErrorZPtr; + +/** + * A CResult_RouteHopDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::RouteHop 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_RouteHopDecodeErrorZ { + /** + * The contents of this CResult_RouteHopDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RouteHopDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteHopDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteHopDecodeErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size. + * This corresponds to std::vector in C++ */ typedef struct LDKCVec_CVec_RouteHopZZ { /** @@ -1727,8 +2061,8 @@ typedef struct LDKCResult_RouteDecodeErrorZ { /** * Parameters needed to find a [`Route`]. * - * Passed to [`find_route`] and also provided in [`Event::PaymentPathFailed`] for retrying a failed - * payment path. + * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in + * [`Event::PaymentPathFailed`] for retrying a failed payment path. * * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed */ @@ -1843,6 +2177,22 @@ typedef struct LDKCOption_u64Z { }; } LDKCOption_u64Z; +/** + * A dynamically-allocated array of u64s of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_u64Z { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + uint64_t *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_u64Z; + /** @@ -2088,277 +2438,105 @@ typedef struct LDKCResult_RouteLightningErrorZ { } LDKCResult_RouteLightningErrorZ; /** - * The contents of CResult_TxOutAccessErrorZ + * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to + * look up the corresponding function in rust-lightning's docs. */ -typedef union LDKCResult_TxOutAccessErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTxOut *result; +typedef struct LDKThirtyTwoBytes { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The thirty-two bytes */ - enum LDKAccessError *err; -} LDKCResult_TxOutAccessErrorZPtr; + uint8_t data[32]; +} LDKThirtyTwoBytes; /** - * A CResult_TxOutAccessErrorZ represents the result of a fallible operation, - * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * 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 struct LDKCResult_TxOutAccessErrorZ { - /** - * The contents of this CResult_TxOutAccessErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_TxOutAccessErrorZPtr contents; +typedef enum LDKPaymentPurpose_Tag { /** - * Whether this CResult_TxOutAccessErrorZ represents a success state. + * Information for receiving a payment that we generated an invoice for. */ - bool result_ok; -} LDKCResult_TxOutAccessErrorZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_usizeTransactionZ { + LDKPaymentPurpose_InvoicePayment, /** - * The element at position 0 + * Because this is a spontaneous payment, the payer generated their own preimage rather than us + * (the payee) providing a preimage. */ - uintptr_t a; + LDKPaymentPurpose_SpontaneousPayment, /** - * The element at position 1 + * Must be last for serialization purposes */ - struct LDKTransaction b; -} LDKC2Tuple_usizeTransactionZ; + LDKPaymentPurpose_Sentinel, +} LDKPaymentPurpose_Tag; -/** - * 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 { +typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * 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 */ - struct LDKC2Tuple_usizeTransactionZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C2Tuple_usizeTransactionZZ; - -/** - * Arbitrary 32 bytes, which could represent one of a few different things. You probably want to - * look up the corresponding function in rust-lightning's docs. - */ -typedef struct LDKThirtyTwoBytes { - /** - * The thirty-two bytes - */ - uint8_t data[32]; -} LDKThirtyTwoBytes; - -/** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_TxidZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKThirtyTwoBytes *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_TxidZ; - -/** - * The contents of CResult_NoneChannelMonitorUpdateErrZ - */ -typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr { - /** - * Note that this value is always NULL, as there are no contents in the OK variant - */ - void *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKChannelMonitorUpdateErr *err; -} LDKCResult_NoneChannelMonitorUpdateErrZPtr; - -/** - * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ { - /** - * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents; - /** - * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state. - */ - bool result_ok; -} LDKCResult_NoneChannelMonitorUpdateErrZ; - - - -/** - * 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 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. - */ - 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; -} LDKHTLCUpdate; - - - -/** - * 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. - */ -typedef struct MUST_USE_STRUCT LDKOutPoint { - /** - * 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; - /** - * 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; - -/** - * An event to be processed by the ChannelManager. - */ -typedef enum LDKMonitorEvent_Tag { - /** - * A monitor event containing an HTLCUpdate. - */ - LDKMonitorEvent_HTLCEvent, - /** - * A monitor event that the Channel's commitment transaction was confirmed. - */ - LDKMonitorEvent_CommitmentTxConfirmed, - /** - * Indicates a [`ChannelMonitor`] update has completed. See - * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used. - * - * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure - */ - LDKMonitorEvent_UpdateCompleted, - /** - * Indicates a [`ChannelMonitor`] update has failed. See - * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used. - * - * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure - */ - LDKMonitorEvent_UpdateFailed, - /** - * Must be last for serialization purposes - */ - LDKMonitorEvent_Sentinel, -} LDKMonitorEvent_Tag; - -typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body { - /** - * The funding outpoint of the [`ChannelMonitor`] that was updated - */ - struct LDKOutPoint funding_txo; + struct LDKThirtyTwoBytes payment_preimage; /** - * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or - * [`ChannelMonitor::get_latest_update_id`]. + * 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`]. * - * 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. + * [`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 */ - uint64_t monitor_update_id; -} LDKMonitorEvent_LDKUpdateCompleted_Body; + struct LDKThirtyTwoBytes payment_secret; +} LDKPaymentPurpose_LDKInvoicePayment_Body; -typedef struct MUST_USE_STRUCT LDKMonitorEvent { - LDKMonitorEvent_Tag tag; +typedef struct MUST_USE_STRUCT LDKPaymentPurpose { + LDKPaymentPurpose_Tag tag; union { + LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment; struct { - struct LDKHTLCUpdate htlc_event; - }; - struct { - struct LDKOutPoint commitment_tx_confirmed; - }; - LDKMonitorEvent_LDKUpdateCompleted_Body update_completed; - struct { - struct LDKOutPoint update_failed; + struct LDKThirtyTwoBytes spontaneous_payment; }; }; -} LDKMonitorEvent; +} LDKPaymentPurpose; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_PaymentPurposeDecodeErrorZ */ -typedef struct LDKCVec_MonitorEventZ { +typedef union LDKCResult_PaymentPurposeDecodeErrorZPtr { /** - * 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 LDKMonitorEvent *data; + struct LDKPaymentPurpose *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_MonitorEventZ; + struct LDKDecodeError *err; +} LDKCResult_PaymentPurposeDecodeErrorZPtr; /** - * An enum which can either contain a crate::c_types::derived::C2Tuple_usizeTransactionZ or not + * 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`. */ -typedef enum LDKCOption_C2Tuple_usizeTransactionZZ_Tag { +typedef struct LDKCResult_PaymentPurposeDecodeErrorZ { /** - * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains a crate::c_types::derived::C2Tuple_usizeTransactionZ - */ - LDKCOption_C2Tuple_usizeTransactionZZ_Some, - /** - * When we're in this state, this COption_C2Tuple_usizeTransactionZZ contains nothing + * The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_C2Tuple_usizeTransactionZZ_None, + union LDKCResult_PaymentPurposeDecodeErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. */ - LDKCOption_C2Tuple_usizeTransactionZZ_Sentinel, -} LDKCOption_C2Tuple_usizeTransactionZZ_Tag; - -typedef struct LDKCOption_C2Tuple_usizeTransactionZZ { - LDKCOption_C2Tuple_usizeTransactionZZ_Tag tag; - union { - struct { - struct LDKC2Tuple_usizeTransactionZ some; - }; - }; -} LDKCOption_C2Tuple_usizeTransactionZZ; + bool result_ok; +} LDKCResult_PaymentPurposeDecodeErrorZ; /** * The reason the channel was closed. See individual variants more details. @@ -2397,11 +2575,11 @@ typedef enum LDKClosureReason_Tag { */ LDKClosureReason_ProcessingError, /** - * The `PeerManager` informed us that we've disconnected from the peer. We close channels - * if the `PeerManager` informed us that it is unlikely we'll be able to connect to the - * peer again in the future or if the peer disconnected before we finished negotiating - * the channel open. The first case may be caused by incompatible features which our - * counterparty, or we, require. + * 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. + * + * 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. */ LDKClosureReason_DisconnectedPeer, /** @@ -2501,72 +2679,199 @@ typedef struct LDKCResult_COption_ClosureReasonZDecodeErrorZ { bool result_ok; } LDKCResult_COption_ClosureReasonZDecodeErrorZ; - - /** - * A channel_update message to be sent or received from a peer + * Intended destination of a failed HTLC as indicated in [`Event::HTLCHandlingFailed`]. */ -typedef struct MUST_USE_STRUCT LDKChannelUpdate { +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. */ - LDKnativeChannelUpdate *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; -} 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/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md - */ -typedef enum LDKNetworkUpdate_Tag { + LDKHTLCDestination_UnknownNextHop, /** - * An error indicating a `channel_update` messages should be applied via - * [`NetworkGraph::update_channel`]. + * 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 */ - LDKNetworkUpdate_ChannelUpdateMessage, + LDKHTLCDestination_FailedPayment, /** - * An error indicating only that a channel has been closed, which should be applied via - * [`NetworkGraph::close_channel_from_update`]. + * Must be last for serialization purposes */ - LDKNetworkUpdate_ChannelClosed, + LDKHTLCDestination_Sentinel, +} LDKHTLCDestination_Tag; + +typedef struct LDKHTLCDestination_LDKNextHopChannel_Body { /** - * An error indicating only that a node has failed, which should be applied via - * [`NetworkGraph::fail_node`]. + * 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 */ - LDKNetworkUpdate_NodeFailure, + struct LDKPublicKey node_id; /** - * Must be last for serialization purposes + * The outgoing `channel_id` between us and the next node. */ - LDKNetworkUpdate_Sentinel, -} LDKNetworkUpdate_Tag; + struct LDKThirtyTwoBytes channel_id; +} LDKHTLCDestination_LDKNextHopChannel_Body; -typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { +typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { /** - * The update to apply via [`NetworkGraph::update_channel`]. + * Short channel id we are requesting to forward an HTLC to. */ - struct LDKChannelUpdate msg; -} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; + uint64_t requested_forward_scid; +} LDKHTLCDestination_LDKUnknownNextHop_Body; -typedef struct LDKNetworkUpdate_LDKChannelClosed_Body { +typedef struct LDKHTLCDestination_LDKFailedPayment_Body { /** - * The short channel id of the closed channel. + * The payment hash of the payment we attempted to process. */ - uint64_t short_channel_id; + 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_LDKFailedPayment_Body failed_payment; + }; +} LDKHTLCDestination; + +/** + * An enum which can either contain a crate::lightning::util::events::HTLCDestination or not + */ +typedef enum LDKCOption_HTLCDestinationZ_Tag { /** - * Whether the channel should be permanently removed or temporarily disabled until a new - * `channel_update` message is received. + * When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::util::events::HTLCDestination + */ + LDKCOption_HTLCDestinationZ_Some, + /** + * When we're in this state, this COption_HTLCDestinationZ contains nothing + */ + 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; + +/** + * The contents of CResult_COption_HTLCDestinationZDecodeErrorZ + */ +typedef union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCOption_HTLCDestinationZ *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_HTLCDestinationZDecodeErrorZPtr; + +/** + * 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 LDKCResult_COption_HTLCDestinationZDecodeErrorZ { + /** + * The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_COption_HTLCDestinationZDecodeErrorZPtr contents; + /** + * Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_COption_HTLCDestinationZDecodeErrorZ; + + + +/** + * A channel_update message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKChannelUpdate { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelUpdate *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKChannelUpdate; + +/** + * Update to the [`NetworkGraph`] based on payment failure information conveyed via the Onion + * return packet by a node along the route. See [BOLT #4] for details. + * + * [BOLT #4]: https://github.com/lightning/bolts/blob/master/04-onion-routing.md + */ +typedef enum LDKNetworkUpdate_Tag { + /** + * An error indicating a `channel_update` messages should be applied via + * [`NetworkGraph::update_channel`]. + */ + LDKNetworkUpdate_ChannelUpdateMessage, + /** + * An error indicating that a channel failed to route a payment, which should be applied via + * [`NetworkGraph::channel_failed`]. + */ + LDKNetworkUpdate_ChannelFailure, + /** + * An error indicating that a node failed to route a payment, which should be applied via + * [`NetworkGraph::node_failed`]. + */ + LDKNetworkUpdate_NodeFailure, + /** + * Must be last for serialization purposes + */ + LDKNetworkUpdate_Sentinel, +} LDKNetworkUpdate_Tag; + +typedef struct LDKNetworkUpdate_LDKChannelUpdateMessage_Body { + /** + * The update to apply via [`NetworkGraph::update_channel`]. + */ + struct LDKChannelUpdate msg; +} LDKNetworkUpdate_LDKChannelUpdateMessage_Body; + +typedef struct LDKNetworkUpdate_LDKChannelFailure_Body { + /** + * The short channel id of the closed channel. + */ + uint64_t short_channel_id; + /** + * Whether the channel should be permanently removed or temporarily disabled until a new + * `channel_update` message is received. */ bool is_permanent; -} LDKNetworkUpdate_LDKChannelClosed_Body; +} LDKNetworkUpdate_LDKChannelFailure_Body; typedef struct LDKNetworkUpdate_LDKNodeFailure_Body { /** @@ -2584,17 +2889,17 @@ typedef struct MUST_USE_STRUCT LDKNetworkUpdate { LDKNetworkUpdate_Tag tag; union { LDKNetworkUpdate_LDKChannelUpdateMessage_Body channel_update_message; - LDKNetworkUpdate_LDKChannelClosed_Body channel_closed; + LDKNetworkUpdate_LDKChannelFailure_Body channel_failure; LDKNetworkUpdate_LDKNodeFailure_Body node_failure; }; } LDKNetworkUpdate; /** - * An enum which can either contain a crate::lightning::routing::network_graph::NetworkUpdate or not + * An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not */ typedef enum LDKCOption_NetworkUpdateZ_Tag { /** - * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::network_graph::NetworkUpdate + * When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate */ LDKCOption_NetworkUpdateZ_Some, /** @@ -2618,6 +2923,29 @@ typedef struct LDKCOption_NetworkUpdateZ { +/** + * 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. + */ +typedef struct MUST_USE_STRUCT LDKOutPoint { + /** + * 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; + /** + * 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; + + + /** * Information about a spendable output to a P2WSH script. See * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this. @@ -2761,63 +3089,6 @@ typedef struct LDKCVec_SpendableOutputDescriptorZ { uintptr_t datalen; } LDKCVec_SpendableOutputDescriptorZ; -/** - * 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 { - /** - * Information for receiving a payment that we generated an invoice for. - */ - LDKPaymentPurpose_InvoicePayment, - /** - * Because this is a spontaneous payment, the payer generated their own preimage rather than us - * (the payee) providing a preimage. - */ - LDKPaymentPurpose_SpontaneousPayment, - /** - * Must be last for serialization purposes - */ - LDKPaymentPurpose_Sentinel, -} LDKPaymentPurpose_Tag; - -typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { - /** - * 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 - */ - struct LDKThirtyTwoBytes payment_preimage; - /** - * 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 - */ - struct LDKThirtyTwoBytes payment_secret; -} LDKPaymentPurpose_LDKInvoicePayment_Body; - -typedef struct MUST_USE_STRUCT LDKPaymentPurpose { - LDKPaymentPurpose_Tag tag; - union { - LDKPaymentPurpose_LDKInvoicePayment_Body invoice_payment; - struct { - struct LDKThirtyTwoBytes spontaneous_payment; - }; - }; -} LDKPaymentPurpose; - /** @@ -2867,8 +3138,9 @@ typedef enum LDKEvent_Tag { */ LDKEvent_FundingGenerationReady, /** - * Indicates we've received money! Just gotta dig out that payment preimage and feed it to - * [`ChannelManager::claim_funds`] to get it.... + * Indicates we've received (an offer of) money! Just gotta dig out that payment preimage and + * feed it to [`ChannelManager::claim_funds`] to get it.... + * * Note that if the preimage is not known, you should call * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid * network congestion. @@ -2884,6 +3156,23 @@ typedef enum LDKEvent_Tag { * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards */ LDKEvent_PaymentReceived, + /** + * 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::PaymentReceived`]. However, if we previously crashed during a + * [`ChannelManager::claim_funds`] call you may see this event without a corresponding + * [`Event::PaymentReceived`] event. + * + * # Note + * LDK will not stop an inbound payment from being paid multiple times, so multiple + * `PaymentReceived` events may be generated for the same payment. If you then call + * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentReceived`] you may get + * multiple `PaymentClaimed` events. + * + * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds + */ + LDKEvent_PaymentClaimed, /** * 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). @@ -2892,6 +3181,24 @@ typedef enum LDKEvent_Tag { * event. In this situation, you SHOULD treat this payment as having succeeded. */ LDKEvent_PaymentSent, + /** + * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events + * provide failure information for each MPP part in the payment. + * + * This event is provided once there are no further pending HTLCs for the payment and the + * payment is no longer retryable, either due to a several-block timeout or because + * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment. + * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + */ + LDKEvent_PaymentFailed, + /** + * 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. + */ + LDKEvent_PaymentPathSuccessful, /** * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped * something. You may wish to retry with a different route. @@ -2903,16 +3210,13 @@ typedef enum LDKEvent_Tag { */ LDKEvent_PaymentPathFailed, /** - * Indicates an outbound payment failed. Individual [`Event::PaymentPathFailed`] events - * provide failure information for each MPP part in the payment. - * - * This event is provided once there are no further pending HTLCs for the payment and the - * payment is no longer retryable, either due to a several-block timeout or because - * [`ChannelManager::abandon_payment`] was previously called for the corresponding payment. - * - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * Indicates that a probe payment we sent returned successful, i.e., only failed at the destination. */ - LDKEvent_PaymentFailed, + 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. @@ -2934,7 +3238,8 @@ typedef enum LDKEvent_Tag { */ LDKEvent_PaymentForwarded, /** - * Used to indicate that a channel with the given `channel_id` is in the process of closure. + * Used to indicate that a previously opened channel with the given `channel_id` is in the + * process of closure. */ LDKEvent_ChannelClosed, /** @@ -2942,27 +3247,35 @@ typedef enum LDKEvent_Tag { * inputs for another purpose. */ LDKEvent_DiscardFunding, - /** - * 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. - */ - LDKEvent_PaymentPathSuccessful, /** * 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_channel`]. + * 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_channel`]: crate::ln::channelmanager::ChannelManager::force_close_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. + * * 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). + */ + LDKEvent_HTLCHandlingFailed, /** * Must be last for serialization purposes */ @@ -2972,9 +3285,18 @@ typedef enum LDKEvent_Tag { 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`]. + * + * [`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`]. + * + * [`ChannelManager::funding_transaction_generated`]: crate::ln::channelmanager::ChannelManager::funding_transaction_generated + */ + struct LDKPublicKey counterparty_node_id; /** * The value, in satoshis, that the output should have. */ @@ -3001,7 +3323,7 @@ typedef struct LDKEvent_LDKPaymentReceived_Body { /** * The value, in thousandths of a satoshi, that this payment is for. */ - uint64_t amt; + uint64_t amount_msat; /** * 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. @@ -3009,6 +3331,23 @@ typedef struct LDKEvent_LDKPaymentReceived_Body { struct LDKPaymentPurpose purpose; } LDKEvent_LDKPaymentReceived_Body; +typedef struct LDKEvent_LDKPaymentClaimed_Body { + /** + * The payment hash of the claimed payment. Note that LDK will not stop you from + * registering duplicate payment hashes for inbound payments. + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The value, in thousandths of a satoshi, that this payment is for. + */ + uint64_t amount_msat; + /** + * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a + * spontaneous payment. + */ + struct LDKPaymentPurpose purpose; +} LDKEvent_LDKPaymentClaimed_Body; + typedef struct LDKEvent_LDKPaymentSent_Body { /** * The id returned by [`ChannelManager::send_payment`] and used with @@ -3046,7 +3385,7 @@ typedef struct LDKEvent_LDKPaymentSent_Body { struct LDKCOption_u64Z fee_paid_msat; } LDKEvent_LDKPaymentSent_Body; -typedef struct LDKEvent_LDKPaymentPathFailed_Body { +typedef struct LDKEvent_LDKPaymentFailed_Body { /** * The id returned by [`ChannelManager::send_payment`] and used with * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. @@ -3054,8 +3393,6 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_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 */ struct LDKThirtyTwoBytes payment_id; /** @@ -3064,21 +3401,65 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment */ struct LDKThirtyTwoBytes payment_hash; +} LDKEvent_LDKPaymentFailed_Body; + +typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { /** - * 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, you may - * retry the payment via a different route. + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment */ - bool rejected_by_dest; + struct LDKThirtyTwoBytes payment_id; /** - * Any failure information conveyed via the Onion return packet by a node along the failed - * payment route. + * 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 + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The payment path that was successful. + * + * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. + */ + struct LDKCVec_RouteHopZ path; +} LDKEvent_LDKPaymentPathSuccessful_Body; + +typedef struct LDKEvent_LDKPaymentPathFailed_Body { + /** + * The id returned by [`ChannelManager::send_payment`] and used with + * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_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 + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash that was given to [`ChannelManager::send_payment`]. + * + * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * 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, you may + * retry the payment via a different route. + */ + bool payment_failed_permanently; + /** + * Any failure information conveyed via the Onion return packet by a node along the failed + * payment route. * * Should be applied to the [`NetworkGraph`] so that routing decisions can take into - * account the update. [`NetGraphMsgHandler`] is capable of doing this. + * account the update. * - * [`NetworkGraph`]: crate::routing::network_graph::NetworkGraph - * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler + * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph */ struct LDKCOption_NetworkUpdateZ network_update; /** @@ -3108,6 +3489,10 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { /** * 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. */ @@ -3125,23 +3510,51 @@ typedef struct LDKEvent_LDKPaymentPathFailed_Body { struct LDKRouteParameters retry; } LDKEvent_LDKPaymentPathFailed_Body; -typedef struct LDKEvent_LDKPaymentFailed_Body { +typedef struct LDKEvent_LDKProbeSuccessful_Body { /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`] and [`ChannelManager::abandon_payment`]. + * The id returned by [`ChannelManager::send_probe`]. * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment - * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe */ struct LDKThirtyTwoBytes payment_id; /** - * The hash that was given to [`ChannelManager::send_payment`]. + * The hash generated by [`ChannelManager::send_probe`]. * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe */ struct LDKThirtyTwoBytes payment_hash; -} LDKEvent_LDKPaymentFailed_Body; + /** + * The payment path that was successful. + */ + struct LDKCVec_RouteHopZ path; +} LDKEvent_LDKProbeSuccessful_Body; + +typedef struct LDKEvent_LDKProbeFailed_Body { + /** + * The id returned by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + struct LDKThirtyTwoBytes payment_id; + /** + * The hash generated by [`ChannelManager::send_probe`]. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * The payment path that failed. + */ + struct LDKCVec_RouteHopZ path; + /** + * 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 LDKCOption_u64Z short_channel_id; +} LDKEvent_LDKProbeFailed_Body; typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { /** @@ -3161,6 +3574,20 @@ typedef struct LDKEvent_LDKSpendableOutputs_Body { } LDKEvent_LDKSpendableOutputs_Body; typedef struct LDKEvent_LDKPaymentForwarded_Body { + /** + * 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 LDKThirtyTwoBytes prev_channel_id; + /** + * 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 LDKThirtyTwoBytes next_channel_id; /** * The fee, in milli-satoshis, which was earned as a result of the payment. * @@ -3219,45 +3646,28 @@ typedef struct LDKEvent_LDKDiscardFunding_Body { struct LDKTransaction transaction; } LDKEvent_LDKDiscardFunding_Body; -typedef struct LDKEvent_LDKPaymentPathSuccessful_Body { - /** - * The id returned by [`ChannelManager::send_payment`] and used with - * [`ChannelManager::retry_payment`]. - * - * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment - * [`ChannelManager::retry_payment`]: crate::ln::channelmanager::ChannelManager::retry_payment - */ - struct LDKThirtyTwoBytes payment_id; - /** - * 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 - */ - struct LDKThirtyTwoBytes payment_hash; - /** - * The payment path that was successful. - * - * May contain a closed channel if the HTLC sent along the path was fulfilled on chain. - */ - struct LDKCVec_RouteHopZ path; -} LDKEvent_LDKPaymentPathSuccessful_Body; - typedef struct LDKEvent_LDKOpenChannelRequest_Body { /** * 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 with [`ChannelManager::accept_inbound_channel`] to accept, - * or to [`ChannelManager::force_close_channel`] to reject. + * 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_channel`]: crate::ln::channelmanager::ChannelManager::force_close_channel + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn */ struct LDKThirtyTwoBytes temporary_channel_id; /** * 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 LDKPublicKey counterparty_node_id; /** @@ -3277,26 +3687,47 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { * 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 LDKEvent_LDKHTLCHandlingFailed_Body { + /** + * The channel over which the HTLC was received. + */ + struct LDKThirtyTwoBytes prev_channel_id; + /** + * Destination of the HTLC that failed to be processed. + */ + struct LDKHTLCDestination failed_next_destination; +} LDKEvent_LDKHTLCHandlingFailed_Body; + typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_Tag tag; union { LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; LDKEvent_LDKPaymentReceived_Body payment_received; + LDKEvent_LDKPaymentClaimed_Body payment_claimed; LDKEvent_LDKPaymentSent_Body payment_sent; - LDKEvent_LDKPaymentPathFailed_Body payment_path_failed; 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_LDKSpendableOutputs_Body spendable_outputs; LDKEvent_LDKPaymentForwarded_Body payment_forwarded; LDKEvent_LDKChannelClosed_Body channel_closed; LDKEvent_LDKDiscardFunding_Body discard_funding; - LDKEvent_LDKPaymentPathSuccessful_Body payment_path_successful; LDKEvent_LDKOpenChannelRequest_Body open_channel_request; + LDKEvent_LDKHTLCHandlingFailed_Body htlc_handling_failed; }; } LDKEvent; @@ -3443,22 +3874,22 @@ typedef struct MUST_USE_STRUCT LDKFundingSigned { /** - * A funding_locked message to be sent or received from a peer + * A channel_ready message to be sent or received from a peer */ -typedef struct MUST_USE_STRUCT LDKFundingLocked { +typedef struct MUST_USE_STRUCT LDKChannelReady { /** * 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. */ - LDKnativeFundingLocked *inner; + LDKnativeChannelReady *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; -} LDKFundingLocked; +} LDKChannelReady; @@ -3603,26 +4034,6 @@ typedef struct MUST_USE_STRUCT LDKChannelAnnouncement { -/** - * A node_announcement message to be sent or received from a peer - */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { - /** - * 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. - */ - LDKnativeNodeAnnouncement *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; -} LDKNodeAnnouncement; - - - /** * An error message to be sent or received from a peer */ @@ -3862,9 +4273,9 @@ typedef enum LDKMessageSendEvent_Tag { */ LDKMessageSendEvent_SendFundingSigned, /** - * Used to indicate that a funding_locked message should be sent to the peer with the given node_id. + * Used to indicate that a channel_ready message should be sent to the peer with the given node_id. */ - LDKMessageSendEvent_SendFundingLocked, + LDKMessageSendEvent_SendChannelReady, /** * Used to indicate that an announcement_signatures message should be sent to the peer with the given node_id. */ @@ -3890,21 +4301,24 @@ typedef enum LDKMessageSendEvent_Tag { * 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 call - * ChannelManager::broadcast_node_announcement to trigger a BroadcastNodeAnnouncement event. - * This ensures that any nodes which see our channel_announcement also have a relevant + * 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 node_announcement should be broadcast to all peers. - */ - LDKMessageSendEvent_BroadcastNodeAnnouncement, /** * Used to indicate that a channel_update should be broadcast to all peers. */ @@ -3988,16 +4402,16 @@ typedef struct LDKMessageSendEvent_LDKSendFundingSigned_Body { struct LDKFundingSigned msg; } LDKMessageSendEvent_LDKSendFundingSigned_Body; -typedef struct LDKMessageSendEvent_LDKSendFundingLocked_Body { +typedef struct LDKMessageSendEvent_LDKSendChannelReady_Body { /** * The node_id of the node which should receive these message(s) */ struct LDKPublicKey node_id; /** - * The funding_locked message which should be sent. + * The channel_ready message which should be sent. */ - struct LDKFundingLocked msg; -} LDKMessageSendEvent_LDKSendFundingLocked_Body; + struct LDKChannelReady msg; +} LDKMessageSendEvent_LDKSendChannelReady_Body; typedef struct LDKMessageSendEvent_LDKSendAnnouncementSignatures_Body { /** @@ -4065,7 +4479,11 @@ typedef struct LDKMessageSendEvent_LDKSendChannelReestablish_Body { struct LDKChannelReestablish msg; } LDKMessageSendEvent_LDKSendChannelReestablish_Body; -typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { +typedef struct LDKMessageSendEvent_LDKSendChannelAnnouncement_Body { + /** + * The node_id of the node which should receive this message + */ + struct LDKPublicKey node_id; /** * The channel_announcement which should be sent. */ @@ -4074,14 +4492,18 @@ typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { * The followup channel_update which should be sent. */ struct LDKChannelUpdate update_msg; -} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; +} LDKMessageSendEvent_LDKSendChannelAnnouncement_Body; -typedef struct LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body { +typedef struct LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body { + /** + * The channel_announcement which should be sent. + */ + struct LDKChannelAnnouncement msg; /** - * The node_announcement which should be sent. + * The followup channel_update which should be sent. */ - struct LDKNodeAnnouncement msg; -} LDKMessageSendEvent_LDKBroadcastNodeAnnouncement_Body; + struct LDKChannelUpdate update_msg; +} LDKMessageSendEvent_LDKBroadcastChannelAnnouncement_Body; typedef struct LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body { /** @@ -4163,15 +4585,15 @@ typedef struct MUST_USE_STRUCT LDKMessageSendEvent { LDKMessageSendEvent_LDKSendOpenChannel_Body send_open_channel; LDKMessageSendEvent_LDKSendFundingCreated_Body send_funding_created; LDKMessageSendEvent_LDKSendFundingSigned_Body send_funding_signed; - LDKMessageSendEvent_LDKSendFundingLocked_Body send_funding_locked; + 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_LDKBroadcastNodeAnnouncement_Body broadcast_node_announcement; LDKMessageSendEvent_LDKBroadcastChannelUpdate_Body broadcast_channel_update; LDKMessageSendEvent_LDKSendChannelUpdate_Body send_channel_update; LDKMessageSendEvent_LDKHandleError_Body handle_error; @@ -4198,176 +4620,402 @@ typedef struct LDKCVec_MessageSendEventZ { uintptr_t datalen; } LDKCVec_MessageSendEventZ; - - /** - * [`Score`] implementation that uses a fixed penalty. - */ -typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer { - /** - * 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; - /** - * 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; - -/** - * The contents of CResult_FixedPenaltyScorerDecodeErrorZ + * The contents of CResult_TxOutAccessErrorZ */ -typedef union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr { +typedef union LDKCResult_TxOutAccessErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKFixedPenaltyScorer *result; + struct LDKTxOut *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_FixedPenaltyScorerDecodeErrorZPtr; + enum LDKAccessError *err; +} LDKCResult_TxOutAccessErrorZPtr; /** - * 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. + * A CResult_TxOutAccessErrorZ represents the result of a fallible operation, + * containing a crate::c_types::TxOut on success and a crate::lightning::chain::AccessError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ { +typedef struct LDKCResult_TxOutAccessErrorZ { /** - * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either + * The contents of this CResult_TxOutAccessErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents; + union LDKCResult_TxOutAccessErrorZPtr contents; /** - * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state. + * Whether this CResult_TxOutAccessErrorZ represents a success state. */ bool result_ok; -} LDKCResult_FixedPenaltyScorerDecodeErrorZ; - - +} LDKCResult_TxOutAccessErrorZ; /** - * Parameters for configuring [`Scorer`]. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKScoringParameters { +typedef struct LDKC2Tuple_usizeTransactionZ { /** - * 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 element at position 0 */ - LDKnativeScoringParameters *inner; + uintptr_t a; /** - * 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 element at position 1 */ - bool is_owned; -} LDKScoringParameters; + struct LDKTransaction b; +} LDKC2Tuple_usizeTransactionZ; /** - * The contents of CResult_ScoringParametersDecodeErrorZ + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_ScoringParametersDecodeErrorZPtr { +typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { /** - * 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 LDKScoringParameters *result; + struct LDKC2Tuple_usizeTransactionZ *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_ScoringParametersDecodeErrorZPtr; + uintptr_t datalen; +} LDKCVec_C2Tuple_usizeTransactionZZ; /** - * A CResult_ScoringParametersDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::scoring::ScoringParameters 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_ScoringParametersDecodeErrorZ { +typedef struct LDKCVec_TxidZ { /** - * The contents of this CResult_ScoringParametersDecodeErrorZ, 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_ScoringParametersDecodeErrorZPtr contents; + struct LDKThirtyTwoBytes *data; /** - * Whether this CResult_ScoringParametersDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_ScoringParametersDecodeErrorZ; - - + uintptr_t datalen; +} LDKCVec_TxidZ; /** - * [`Score`] implementation that provides reasonable default behavior. - * - * Used to apply a fixed penalty to each channel, thus avoiding long paths when shorter paths with - * slightly higher fees are available. Will further penalize channels that fail to relay payments. - * - * See [module-level documentation] for usage and [`ScoringParameters`] for customization. - * - * # Note - * - * Mixing the `no-std` feature between serialization and deserialization results in undefined - * behavior. - * - * [module-level documentation]: crate::routing::scoring + * The contents of CResult_NoneChannelMonitorUpdateErrZ */ -typedef struct MUST_USE_STRUCT LDKScorer { +typedef union LDKCResult_NoneChannelMonitorUpdateErrZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKChannelMonitorUpdateErr *err; +} LDKCResult_NoneChannelMonitorUpdateErrZPtr; + +/** + * A CResult_NoneChannelMonitorUpdateErrZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::chain::ChannelMonitorUpdateErr on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NoneChannelMonitorUpdateErrZ { + /** + * The contents of this CResult_NoneChannelMonitorUpdateErrZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NoneChannelMonitorUpdateErrZPtr contents; + /** + * Whether this CResult_NoneChannelMonitorUpdateErrZ represents a success state. + */ + bool result_ok; +} LDKCResult_NoneChannelMonitorUpdateErrZ; + + + +/** + * 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 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. + */ + 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; +} LDKHTLCUpdate; + +/** + * An event to be processed by the ChannelManager. + */ +typedef enum LDKMonitorEvent_Tag { + /** + * A monitor event containing an HTLCUpdate. + */ + LDKMonitorEvent_HTLCEvent, + /** + * A monitor event that the Channel's commitment transaction was confirmed. + */ + LDKMonitorEvent_CommitmentTxConfirmed, + /** + * Indicates a [`ChannelMonitor`] update has completed. See + * [`ChannelMonitorUpdateErr::TemporaryFailure`] for more information on how this is used. + * + * [`ChannelMonitorUpdateErr::TemporaryFailure`]: super::ChannelMonitorUpdateErr::TemporaryFailure + */ + LDKMonitorEvent_UpdateCompleted, + /** + * Indicates a [`ChannelMonitor`] update has failed. See + * [`ChannelMonitorUpdateErr::PermanentFailure`] for more information on how this is used. + * + * [`ChannelMonitorUpdateErr::PermanentFailure`]: super::ChannelMonitorUpdateErr::PermanentFailure + */ + LDKMonitorEvent_UpdateFailed, + /** + * Must be last for serialization purposes + */ + LDKMonitorEvent_Sentinel, +} LDKMonitorEvent_Tag; + +typedef struct LDKMonitorEvent_LDKUpdateCompleted_Body { + /** + * The funding outpoint of the [`ChannelMonitor`] that was updated + */ + struct LDKOutPoint funding_txo; + /** + * 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. + */ + uint64_t monitor_update_id; +} LDKMonitorEvent_LDKUpdateCompleted_Body; + +typedef struct MUST_USE_STRUCT LDKMonitorEvent { + LDKMonitorEvent_Tag tag; + union { + struct { + struct LDKHTLCUpdate htlc_event; + }; + struct { + struct LDKOutPoint commitment_tx_confirmed; + }; + LDKMonitorEvent_LDKUpdateCompleted_Body update_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++ + */ +typedef struct LDKCVec_MonitorEventZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKMonitorEvent *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_MonitorEventZ; + +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { + /** + * The element at position 0 + */ + struct LDKOutPoint a; + /** + * The element at position 1 + */ + struct LDKCVec_MonitorEventZ b; + /** + * The element at position 2 + */ + struct LDKPublicKey c; +} LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ; + +/** + * 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 elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ; + + + +/** + * [`Score`] implementation that uses a fixed penalty. + */ +typedef struct MUST_USE_STRUCT LDKFixedPenaltyScorer { /** * 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. */ - LDKnativeScorer *inner; + LDKnativeFixedPenaltyScorer *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; -} LDKScorer; +} LDKFixedPenaltyScorer; /** - * The contents of CResult_ScorerDecodeErrorZ + * The contents of CResult_FixedPenaltyScorerDecodeErrorZ */ -typedef union LDKCResult_ScorerDecodeErrorZPtr { +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 LDKScorer *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_ScorerDecodeErrorZPtr; +} LDKCResult_FixedPenaltyScorerDecodeErrorZPtr; /** - * A CResult_ScorerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::scoring::Scorer 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_ScorerDecodeErrorZ { +typedef struct LDKCResult_FixedPenaltyScorerDecodeErrorZ { /** - * The contents of this CResult_ScorerDecodeErrorZ, accessible via either + * The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ScorerDecodeErrorZPtr contents; + union LDKCResult_FixedPenaltyScorerDecodeErrorZPtr contents; /** - * Whether this CResult_ScorerDecodeErrorZ represents a success state. + * Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ScorerDecodeErrorZ; +} LDKCResult_FixedPenaltyScorerDecodeErrorZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u64u64Z { + /** + * The element at position 0 + */ + uint64_t a; + /** + * The element at position 1 + */ + uint64_t b; +} LDKC2Tuple_u64u64Z; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not + */ +typedef enum LDKCOption_C2Tuple_u64u64ZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z + */ + LDKCOption_C2Tuple_u64u64ZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing + */ + LDKCOption_C2Tuple_u64u64ZZ_None, + /** + * Must be last for serialization purposes + */ + 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; + +/** + * 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; + + + +/** + * A Record, unit of logging output with Metadata to enable filtering + * Module_path, file, line to inform on log's source + */ +typedef struct MUST_USE_STRUCT LDKRecord { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRecord *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKRecord; + +/** + * A trait encapsulating the operations required of a logger + */ +typedef struct LDKLogger { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Logs the `Record` + */ + void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKLogger; @@ -4709,2188 +5357,2136 @@ typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { } LDKCResult_ChannelTypeFeaturesDecodeErrorZ; /** - * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ + * The contents of CResult_NodeIdDecodeErrorZ */ -typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { +typedef union LDKCResult_NodeIdDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKDelayedPaymentOutputDescriptor *result; + struct LDKNodeId *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr; +} LDKCResult_NodeIdDecodeErrorZPtr; /** - * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ { +typedef struct LDKCResult_NodeIdDecodeErrorZ { /** - * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either + * The contents of this CResult_NodeIdDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents; + union LDKCResult_NodeIdDecodeErrorZPtr contents; /** - * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state. + * Whether this CResult_NodeIdDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ; +} LDKCResult_NodeIdDecodeErrorZ; /** - * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ + * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ */ -typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { +typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKStaticPaymentOutputDescriptor *result; + struct LDKCOption_NetworkUpdateZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr; /** - * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ { +typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ { /** - * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either + * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents; + union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr contents; /** - * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state. + * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ; +} LDKCResult_COption_NetworkUpdateZDecodeErrorZ; /** - * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ + * The `Access` trait defines behavior for accessing chain data and state, such as blocks and + * UTXOs. */ -typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr { +typedef struct LDKAccess { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * 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. */ - struct LDKSpendableOutputDescriptor *result; + void *this_arg; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. + * Returns an error if `genesis_hash` is for a different chain or if such a transaction output + * is unknown. + * + * [`short_channel_id`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#definition-of-short_channel_id */ - struct LDKDecodeError *err; -} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr; + struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKAccess; /** - * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor 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 enum which can either contain a crate::lightning::chain::Access or not */ -typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ { +typedef enum LDKCOption_AccessZ_Tag { /** - * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access */ - union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents; + LDKCOption_AccessZ_Some, /** - * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state. + * When we're in this state, this COption_AccessZ contains nothing */ - bool result_ok; -} LDKCResult_SpendableOutputDescriptorDecodeErrorZ; + LDKCOption_AccessZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_AccessZ_Sentinel, +} LDKCOption_AccessZ_Tag; + +typedef struct LDKCOption_AccessZ { + LDKCOption_AccessZ_Tag tag; + union { + struct { + struct LDKAccess some; + }; + }; +} LDKCOption_AccessZ; /** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_boolLightningErrorZ */ -typedef struct LDKCVec_PaymentPreimageZ { +typedef union LDKCResult_boolLightningErrorZPtr { /** - * 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 LDKThirtyTwoBytes *data; + bool *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_PaymentPreimageZ; + struct LDKLightningError *err; +} LDKCResult_boolLightningErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_boolLightningErrorZ represents the result of a fallible operation, + * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ { +typedef struct LDKCResult_boolLightningErrorZ { /** - * The element at position 0 + * The contents of this CResult_boolLightningErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKSignature a; + union LDKCResult_boolLightningErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_boolLightningErrorZ represents a success state. */ - struct LDKCVec_SignatureZ b; -} LDKC2Tuple_SignatureCVec_SignatureZZ; + bool result_ok; +} LDKCResult_boolLightningErrorZ; /** - * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { +typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { /** - * 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 LDKC2Tuple_SignatureCVec_SignatureZZ *result; + struct LDKChannelAnnouncement a; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * The element at position 1 */ - void *err; -} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr; + struct LDKChannelUpdate b; + /** + * The element at position 2 + */ + struct LDKChannelUpdate c; +} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; /** - * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not */ -typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { +typedef enum LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag { /** - * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ */ - union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents; + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Some, /** - * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state. + * When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing */ - bool result_ok; -} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Sentinel, +} LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag; + +typedef struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_Tag tag; + union { + struct { + struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ some; + }; + }; +} LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; /** - * The contents of CResult_SignatureNoneZ + * The contents of CResult_NoneLightningErrorZ */ -typedef union LDKCResult_SignatureNoneZPtr { +typedef union LDKCResult_NoneLightningErrorZPtr { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKSignature *result; + void *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_SignatureNoneZPtr; + struct LDKLightningError *err; +} LDKCResult_NoneLightningErrorZPtr; /** - * A CResult_SignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Signature on success and a () on failure. + * A CResult_NoneLightningErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SignatureNoneZ { +typedef struct LDKCResult_NoneLightningErrorZ { /** - * The contents of this CResult_SignatureNoneZ, accessible via either + * The contents of this CResult_NoneLightningErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SignatureNoneZPtr contents; + union LDKCResult_NoneLightningErrorZPtr contents; /** - * Whether this CResult_SignatureNoneZ represents a success state. + * Whether this CResult_NoneLightningErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SignatureNoneZ; +} LDKCResult_NoneLightningErrorZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Details about one direction of a channel as received within a [`ChannelUpdate`]. */ -typedef struct LDKC2Tuple_SignatureSignatureZ { +typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo { /** - * 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 LDKSignature a; + LDKnativeChannelUpdateInfo *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 LDKSignature b; -} LDKC2Tuple_SignatureSignatureZ; + bool is_owned; +} LDKChannelUpdateInfo; /** - * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ + * The contents of CResult_ChannelUpdateInfoDecodeErrorZ */ -typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr { +typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_SignatureSignatureZ *result; + struct LDKChannelUpdateInfo *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_ChannelUpdateInfoDecodeErrorZPtr; /** - * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure. + * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ { +typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ { /** - * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either + * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents; + union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents; /** - * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state. + * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_SignatureSignatureZNoneZ; +} LDKCResult_ChannelUpdateInfoDecodeErrorZ; + + /** - * The contents of CResult_SecretKeyNoneZ + * Details about a channel (both directions). + * Received within a channel announcement. */ -typedef union LDKCResult_SecretKeyNoneZPtr { +typedef struct MUST_USE_STRUCT LDKChannelInfo { /** - * 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 LDKSecretKey *result; + LDKnativeChannelInfo *inner; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * 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 *err; -} LDKCResult_SecretKeyNoneZPtr; + bool is_owned; +} LDKChannelInfo; /** - * A CResult_SecretKeyNoneZ represents the result of a fallible operation, - * containing a crate::c_types::SecretKey on success and a () on failure. + * The contents of CResult_ChannelInfoDecodeErrorZ + */ +typedef union LDKCResult_ChannelInfoDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelInfo *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ChannelInfoDecodeErrorZPtr; + +/** + * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SecretKeyNoneZ { +typedef struct LDKCResult_ChannelInfoDecodeErrorZ { /** - * The contents of this CResult_SecretKeyNoneZ, accessible via either + * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SecretKeyNoneZPtr contents; + union LDKCResult_ChannelInfoDecodeErrorZPtr contents; /** - * Whether this CResult_SecretKeyNoneZ represents a success state. + * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SecretKeyNoneZ; +} LDKCResult_ChannelInfoDecodeErrorZ; /** - * This class tracks the per-transaction information needed to build a closing transaction and will - * actually build it and sign. - * - * This class can be used inside a signer implementation to generate a signature given the relevant - * secret key. + * Fees for routing via a given channel or a node */ -typedef struct MUST_USE_STRUCT LDKClosingTransaction { +typedef struct MUST_USE_STRUCT LDKRoutingFees { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeClosingTransaction *inner; + LDKnativeRoutingFees *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKClosingTransaction; +} LDKRoutingFees; + +/** + * The contents of CResult_RoutingFeesDecodeErrorZ + */ +typedef union LDKCResult_RoutingFeesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRoutingFees *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_RoutingFeesDecodeErrorZPtr; +/** + * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_RoutingFeesDecodeErrorZ { + /** + * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RoutingFeesDecodeErrorZPtr contents; + /** + * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RoutingFeesDecodeErrorZ; +/** + * A 4-byte byte array. + */ +typedef struct LDKFourBytes { + /** + * The four bytes + */ + uint8_t data[4]; +} LDKFourBytes; /** - * The unsigned part of a channel_announcement + * A 16-byte byte array. */ -typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { +typedef struct LDKSixteenBytes { + /** + * The sixteen bytes + */ + uint8_t data[16]; +} LDKSixteenBytes; + +/** + * A 12-byte byte array. + */ +typedef struct LDKTwelveBytes { + /** + * The twelve bytes + */ + uint8_t data[12]; +} LDKTwelveBytes; + + + +/** + * Represents a hostname for serialization purposes. + * Only the character set and length will be validated. + * The character set consists of ASCII alphanumeric characters, hyphens, and periods. + * Its length is guaranteed to be representable by a single byte. + * This serialization is used by BOLT 7 hostnames. + */ +typedef struct MUST_USE_STRUCT LDKHostname { /** * 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. */ - LDKnativeUnsignedChannelAnnouncement *inner; + LDKnativeHostname *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; -} LDKUnsignedChannelAnnouncement; +} LDKHostname; /** - * A trait to sign lightning channel transactions as described in BOLT 3. - * - * Signing services could be implemented on a hardware wallet. In this case, - * the current Sign would be a front-end on top of a communication - * channel connected to your secure device and lightning key material wouldn't - * reside on a hot server. Nevertheless, a this deployment would still need - * to trust the ChannelManager to avoid loss of funds as this latest component - * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys. - * - * A more secure iteration would be to use hashlock (or payment points) to pair - * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager - * at the price of more state and computation on the hardware wallet side. In the future, - * we are looking forward to design such interface. - * - * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted - * to act, as liveness and breach reply correctness are always going to be hard requirements - * of LN security model, orthogonal of key management issues. + * An address which can be used to connect to a remote peer */ -typedef struct LDKBaseSign { +typedef enum LDKNetAddress_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. + * An IPv4 address/port on which the peer is listening. */ - void *this_arg; + LDKNetAddress_IPv4, /** - * Gets the per-commitment point for a specific commitment number - * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * An IPv6 address/port on which the peer is listening. */ - struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); + LDKNetAddress_IPv6, /** - * Gets the commitment secret for a specific commitment number as part of the revocation process - * - * An external signer implementation should error here if the commitment was already signed - * and should refuse to sign it in the future. - * - * May be called more than once for the same index. + * An old-style Tor onion address/port on which the peer is listening. * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * This field is deprecated and the Tor network generally no longer supports V2 Onion + * addresses. Thus, the details are not parsed here. */ - struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); + LDKNetAddress_OnionV2, /** - * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. - * - * This is required in order for the signer to make sure that releasing a commitment - * secret won't leave us without a broadcastable holder transaction. - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. - * - * NOTE: all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. + * A new-style Tor onion address/port on which the peer is listening. + * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, + * wrap as base32 and append \".onion\". */ - struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages); + LDKNetAddress_OnionV3, /** - * Gets the holder's channel public keys and basepoints + * A hostname/port on which the peer is listening. */ - struct LDKChannelPublicKeys pubkeys; + LDKNetAddress_Hostname, /** - * Fill in the pubkeys field as a reference to it will be given to Rust after this returns - * Note that this takes a pointer to this object, not the this_ptr like other methods do - * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. + * Must be last for serialization purposes */ - void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR ); + LDKNetAddress_Sentinel, +} LDKNetAddress_Tag; + +typedef struct LDKNetAddress_LDKIPv4_Body { /** - * Gets an arbitrary identifier describing the set of keys which are provided back to you in - * some SpendableOutputDescriptor types. This should be sufficient to identify this - * Sign object uniquely and lookup or re-derive its keys. + * The 4-byte IPv4 address */ - struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); + struct LDKFourBytes addr; /** - * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. - * - * Note that if signing fails or is rejected, the channel will be force-closed. - * - * Policy checks should be implemented in this function, including checking the amount - * sent to us and checking the HTLCs. - * - * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. - * A validating signer should ensure that an HTLC output is removed only when the matching - * preimage is provided, or when the value to holder is restored. - * - * NOTE: all the relevant preimages will be provided, but there may also be additional - * irrelevant or duplicate preimages. + * The port on which the node is listening */ - struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages); + uint16_t port; +} LDKNetAddress_LDKIPv4_Body; + +typedef struct LDKNetAddress_LDKIPv6_Body { /** - * Validate the counterparty's revocation. - * - * This is required in order for the signer to make sure that the state has moved - * forward and it is safe to sign the next counterparty commitment. + * The 16-byte IPv6 address */ - struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); + struct LDKSixteenBytes addr; /** - * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. - * This will only ever be called with a non-revoked commitment_tx. This will be called with the - * latest commitment_tx when we initiate a force-close. - * This will be called with the previous latest, just to get claiming HTLC signatures, if we are - * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to - * the latest. - * This may be called multiple times for the same transaction. - * - * An external signer implementation should check that the commitment has not been revoked. - * - * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. + * The port on which the node is listening */ - struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); + uint16_t port; +} LDKNetAddress_LDKIPv6_Body; + +typedef struct LDKNetAddress_LDKOnionV3_Body { /** - * Create a signature for the given input in a transaction spending an HTLC transaction output - * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * per_commitment_key is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do - * so). + * The ed25519 long-term public key of the peer */ - struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); + struct LDKThirtyTwoBytes ed25519_pubkey; /** - * Create a signature for the given input in a transaction spending a commitment transaction - * HTLC output when our counterparty broadcasts an old state. - * - * A justice transaction may claim multiple outputs at the same time if timelocks are - * similar, but only a signature for the input at index `input` should be signed for here. - * It may be called multiple times for same output(s) if a fee-bump is needed with regards - * to an upcoming timelock expiration. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * per_commitment_key is revocation secret which was provided by our counterparty when they - * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does - * not allow the spending of any funds by itself (you need our holder revocation_secret to do - * so). - * - * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script - * (which is committed to in the BIP 143 signatures). - */ - struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); - /** - * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment - * transaction, either offered or received. - * - * Such a transaction may claim multiples offered outputs at same time if we know the - * preimage for each when we create it, but only the input at index `input` should be - * signed for here. It may be called multiple times for same output(s) if a fee-bump is - * needed with regards to an upcoming timelock expiration. - * - * Witness_script is either a offered or received script as defined in BOLT3 for HTLC - * outputs. - * - * Amount is value of the output spent by this input, committed to in the BIP 143 signature. - * - * Per_commitment_point is the dynamic point corresponding to the channel state - * detected onchain. It has been generated by our counterparty and is used to derive - * channel state keys, which are then included in the witness script and committed to in the - * BIP 143 signature. + * The checksum of the pubkey and version, as included in the onion address */ - struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); + uint16_t checksum; /** - * Create a signature for a (proposed) closing transaction. - * - * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have - * chosen to forgo their output as dust. + * The version byte, as defined by the Tor Onion v3 spec. */ - struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); + uint8_t version; /** - * Signs a channel announcement message with our funding key and our node secret key (aka - * node_id or network_key), proving it comes from one of the channel participants. - * - * The first returned signature should be from our node secret key, the second from our - * funding key. - * - * Note that if this fails or is rejected, the channel will not be publicly announced and - * our counterparty may (though likely will not) close the channel on us for violating the - * protocol. + * The port on which the node is listening */ - struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + uint16_t port; +} LDKNetAddress_LDKOnionV3_Body; + +typedef struct LDKNetAddress_LDKHostname_Body { /** - * Set the counterparty static channel data, including basepoints, - * counterparty_selected/holder_selected_contest_delay and funding outpoint. - * This is done as soon as the funding outpoint is known. Since these are static channel data, - * they MUST NOT be allowed to change to different values once set. - * - * channel_parameters.is_populated() MUST be true. - * - * We bind holder_selected_contest_delay late here for API convenience. - * - * Will be called before any signatures are applied. + * The hostname on which the node is listening. */ - void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + struct LDKHostname hostname; /** - * 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. + * The port on which the node is listening. */ - void (*free)(void *this_arg); -} LDKBaseSign; + uint16_t port; +} LDKNetAddress_LDKHostname_Body; + +typedef struct MUST_USE_STRUCT LDKNetAddress { + LDKNetAddress_Tag tag; + union { + LDKNetAddress_LDKIPv4_Body i_pv4; + LDKNetAddress_LDKIPv6_Body i_pv6; + struct { + struct LDKTwelveBytes onion_v2; + }; + LDKNetAddress_LDKOnionV3_Body onion_v3; + LDKNetAddress_LDKHostname_Body hostname; + }; +} LDKNetAddress; /** - * A cloneable signer. - * - * Although we require signers to be cloneable, it may be useful for developers to be able to use - * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait, - * which implies Sized, into this derived trait. + * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKSign { - /** - * 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 LDKCVec_NetAddressZ { /** - * Implementation of BaseSign for this object. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKBaseSign BaseSign; + struct LDKNetAddress *data; /** - * Serialize the object into a byte array + * The number of elements pointed to by `data`. */ - struct LDKCVec_u8Z (*write)(const void *this_arg); + uintptr_t datalen; +} LDKCVec_NetAddressZ; + + + +/** + * Information received in the latest node_announcement from this node. + */ +typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { /** - * Called, if set, after this Sign has been cloned into a duplicate object. - * The new Sign is provided, and should be mutated as needed to perform a - * deep copy of the object pointed to by this_arg or avoid any double-freeing. + * 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 (*cloned)(struct LDKSign *NONNULL_PTR new_Sign); + LDKnativeNodeAnnouncementInfo *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); -} LDKSign; + bool is_owned; +} LDKNodeAnnouncementInfo; /** - * The contents of CResult_SignDecodeErrorZ + * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ */ -typedef union LDKCResult_SignDecodeErrorZPtr { +typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKSign *result; + struct LDKNodeAnnouncementInfo *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_SignDecodeErrorZPtr; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr; /** - * A CResult_SignDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::Sign on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SignDecodeErrorZ { +typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ { /** - * The contents of this CResult_SignDecodeErrorZ, accessible via either + * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SignDecodeErrorZPtr contents; + union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents; /** - * Whether this CResult_SignDecodeErrorZ represents a success state. + * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SignDecodeErrorZ; +} LDKCResult_NodeAnnouncementInfoDecodeErrorZ; + -/** - * Integer in the range `0..32` - */ -typedef struct LDKu5 { - uint8_t _0; -} LDKu5; /** - * A dynamically-allocated array of crate::c_types::u5s of arbitrary size. - * This corresponds to std::vector in C++ + * A user-defined name for a node, which may be used when displaying the node in a graph. + * + * Since node aliases are provided by third parties, they are a potential avenue for injection + * attacks. Care must be taken when processing. */ -typedef struct LDKCVec_u5Z { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKu5 *data; +typedef struct MUST_USE_STRUCT LDKNodeAlias { /** - * The number of elements pointed to by `data`. + * 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. */ - uintptr_t datalen; -} LDKCVec_u5Z; - -/** - * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which - * allows recovering the exact public key which created the signature given the message. - */ -typedef struct LDKRecoverableSignature { + LDKnativeNodeAlias *inner; /** - * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for - * recovery. + * 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. */ - uint8_t serialized_form[68]; -} LDKRecoverableSignature; + bool is_owned; +} LDKNodeAlias; /** - * The contents of CResult_RecoverableSignatureNoneZ + * The contents of CResult_NodeAliasDecodeErrorZ */ -typedef union LDKCResult_RecoverableSignatureNoneZPtr { +typedef union LDKCResult_NodeAliasDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKRecoverableSignature *result; + struct LDKNodeAlias *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_RecoverableSignatureNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_NodeAliasDecodeErrorZPtr; /** - * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::RecoverableSignature on success and a () on failure. + * A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::NodeAlias 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_RecoverableSignatureNoneZ { +typedef struct LDKCResult_NodeAliasDecodeErrorZ { /** - * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either + * The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RecoverableSignatureNoneZPtr contents; + union LDKCResult_NodeAliasDecodeErrorZPtr contents; /** - * Whether this CResult_RecoverableSignatureNoneZ represents a success state. + * Whether this CResult_NodeAliasDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RecoverableSignatureNoneZ; +} LDKCResult_NodeAliasDecodeErrorZ; + + /** - * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. - * This corresponds to std::vector in C++ + * Details about a node in the network, known from the network announcement. */ -typedef struct LDKCVec_CVec_u8ZZ { +typedef struct MUST_USE_STRUCT LDKNodeInfo { /** - * 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 LDKCVec_u8Z *data; + LDKnativeNodeInfo *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_CVec_u8ZZ; + bool is_owned; +} LDKNodeInfo; /** - * The contents of CResult_CVec_CVec_u8ZZNoneZ + * The contents of CResult_NodeInfoDecodeErrorZ */ -typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { +typedef union LDKCResult_NodeInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_CVec_u8ZZ *result; + struct LDKNodeInfo *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_CVec_CVec_u8ZZNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_NodeInfoDecodeErrorZPtr; /** - * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure. + * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { +typedef struct LDKCResult_NodeInfoDecodeErrorZ { /** - * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either + * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; + union LDKCResult_NodeInfoDecodeErrorZPtr contents; /** - * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state. + * Whether this CResult_NodeInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_CVec_u8ZZNoneZ; - - - -/** - * A simple implementation of Sign that just keeps the private keys in memory. - * - * This implementation performs no policy checks and is insufficient by itself as - * a secure external signer. - */ -typedef struct MUST_USE_STRUCT LDKInMemorySigner { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInMemorySigner *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKInMemorySigner; +} LDKCResult_NodeInfoDecodeErrorZ; /** - * The contents of CResult_InMemorySignerDecodeErrorZ + * The contents of CResult_NetworkGraphDecodeErrorZ */ -typedef union LDKCResult_InMemorySignerDecodeErrorZPtr { +typedef union LDKCResult_NetworkGraphDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInMemorySigner *result; + struct LDKNetworkGraph *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_InMemorySignerDecodeErrorZPtr; +} LDKCResult_NetworkGraphDecodeErrorZPtr; /** - * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InMemorySignerDecodeErrorZ { +typedef struct LDKCResult_NetworkGraphDecodeErrorZ { /** - * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either + * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InMemorySignerDecodeErrorZPtr contents; + union LDKCResult_NetworkGraphDecodeErrorZPtr contents; /** - * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. + * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InMemorySignerDecodeErrorZ; +} LDKCResult_NetworkGraphDecodeErrorZ; /** - * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size. - * This corresponds to std::vector in C++ + * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not */ -typedef struct LDKCVec_TxOutZ { +typedef enum LDKCOption_CVec_NetAddressZZ_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ */ - struct LDKTxOut *data; + LDKCOption_CVec_NetAddressZZ_Some, /** - * The number of elements pointed to by `data`. + * When we're in this state, this COption_CVec_NetAddressZZ contains nothing */ - uintptr_t datalen; -} LDKCVec_TxOutZ; + LDKCOption_CVec_NetAddressZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_CVec_NetAddressZZ_Sentinel, +} LDKCOption_CVec_NetAddressZZ_Tag; + +typedef struct LDKCOption_CVec_NetAddressZZ { + LDKCOption_CVec_NetAddressZZ_Tag tag; + union { + struct { + struct LDKCVec_NetAddressZ some; + }; + }; +} LDKCOption_CVec_NetAddressZZ; /** - * The contents of CResult_TransactionNoneZ + * The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ */ -typedef union LDKCResult_TransactionNoneZPtr { +typedef union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKTransaction *result; + struct LDKDelayedPaymentOutputDescriptor *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - void *err; -} LDKCResult_TransactionNoneZPtr; + struct LDKDecodeError *err; +} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr; /** - * A CResult_TransactionNoneZ represents the result of a fallible operation, - * containing a crate::c_types::Transaction on success and a () on failure. + * A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor 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_TransactionNoneZ { +typedef struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ { /** - * The contents of this CResult_TransactionNoneZ, accessible via either + * The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_TransactionNoneZPtr contents; + union LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr contents; /** - * Whether this CResult_TransactionNoneZ represents a success state. + * Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_TransactionNoneZ; +} LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ; +/** + * The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ + */ +typedef union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKStaticPaymentOutputDescriptor *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_StaticPaymentOutputDescriptorDecodeErrorZPtr; +/** + * A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor 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_StaticPaymentOutputDescriptorDecodeErrorZ { + /** + * The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZPtr contents; + /** + * Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ; /** - * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates - * on-chain transactions to ensure no loss of funds occurs. - * - * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date - * information and are actively monitoring the chain. - * - * Pending Events or updated HTLCs which have not yet been read out by - * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and - * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events - * gotten are fully handled before re-serializing the new state. - * - * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the - * returned block hash and the the current chain and then reconnecting blocks to get to the - * best chain) upon deserializing the object! + * The contents of CResult_SpendableOutputDescriptorDecodeErrorZ */ -typedef struct MUST_USE_STRUCT LDKChannelMonitor { +typedef union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr { /** - * 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. */ - LDKnativeChannelMonitor *inner; + struct LDKSpendableOutputDescriptor *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; -} LDKChannelMonitor; + struct LDKDecodeError *err; +} LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::SpendableOutputDescriptor 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_BlockHashChannelMonitorZ { +typedef struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ { /** - * The element at position 0 + * The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes a; + union LDKCResult_SpendableOutputDescriptorDecodeErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state. */ - struct LDKChannelMonitor b; -} LDKC2Tuple_BlockHashChannelMonitorZ; + bool result_ok; +} LDKCResult_SpendableOutputDescriptorDecodeErrorZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size. + * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ { +typedef struct LDKCVec_PaymentPreimageZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *data; + struct LDKThirtyTwoBytes *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ; +} LDKCVec_PaymentPreimageZ; /** - * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { +typedef struct LDKC2Tuple_SignatureCVec_SignatureZZ { + /** + * The element at position 0 + */ + struct LDKSignature a; + /** + * The element at position 1 + */ + struct LDKCVec_SignatureZ b; +} LDKC2Tuple_SignatureCVec_SignatureZZ; + +/** + * The contents of CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ + */ +typedef union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result; + struct LDKC2Tuple_SignatureCVec_SignatureZZ *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - enum LDKIOError *err; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr; + void *err; +} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr; /** - * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure. + * A CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_SignatureCVec_SignatureZZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { +typedef struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { /** - * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either + * The contents of this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents; + union LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZPtr contents; /** - * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state. + * Whether this CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; +} LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; /** - * An enum which can either contain a u16 or not + * The contents of CResult_SignatureNoneZ */ -typedef enum LDKCOption_u16Z_Tag { +typedef union LDKCResult_SignatureNoneZPtr { /** - * When we're in this state, this COption_u16Z contains a u16 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_u16Z_Some, + struct LDKSignature *result; /** - * When we're in this state, this COption_u16Z contains nothing + * Note that this value is always NULL, as there are no contents in the Err variant */ - LDKCOption_u16Z_None, + void *err; +} LDKCResult_SignatureNoneZPtr; + +/** + * A CResult_SignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Signature on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SignatureNoneZ { /** - * Must be last for serialization purposes + * The contents of this CResult_SignatureNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_u16Z_Sentinel, -} LDKCOption_u16Z_Tag; - -typedef struct LDKCOption_u16Z { - LDKCOption_u16Z_Tag tag; - union { - struct { - uint16_t some; - }; - }; -} LDKCOption_u16Z; + union LDKCResult_SignatureNoneZPtr contents; + /** + * Whether this CResult_SignatureNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_SignatureNoneZ; /** - * Indicates an error on the client's part (usually some variant of attempting to use too-low or - * too-high values) + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef enum LDKAPIError_Tag { - /** - * Indicates the API was wholly misused (see err for more). Cases where these can be returned - * are documented, but generally indicates some precondition of a function was violated. - */ - LDKAPIError_APIMisuseError, - /** - * Due to a high feerate, we were unable to complete the request. - * For example, this may be returned if the feerate implies we cannot open a channel at the - * requested value, but opening a larger channel would succeed. - */ - LDKAPIError_FeeRateTooHigh, - /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). - */ - LDKAPIError_RouteError, - /** - * We were unable to complete the request as the Channel required to do so is unable to - * complete the request (or was not found). This can take many forms, including disconnected - * peer, channel at capacity, channel shutting down, etc. - */ - LDKAPIError_ChannelUnavailable, - /** - * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the - * attempted action to fail. - */ - LDKAPIError_MonitorUpdateFailed, - /** - * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible - * with the channel counterparty as negotiated in [`InitFeatures`]. - * - * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open - * a channel or cooperatively close one with this peer (and will have to force-close instead). - * - * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey - * [`InitFeatures`]: crate::ln::features::InitFeatures - */ - LDKAPIError_IncompatibleShutdownScript, +typedef struct LDKC2Tuple_SignatureSignatureZ { /** - * Must be last for serialization purposes + * The element at position 0 */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; - -typedef struct LDKAPIError_LDKAPIMisuseError_Body { + struct LDKSignature a; /** - * A human-readable error message + * The element at position 1 */ - struct LDKStr err; -} LDKAPIError_LDKAPIMisuseError_Body; + struct LDKSignature b; +} LDKC2Tuple_SignatureSignatureZ; -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { - /** - * A human-readable error message - */ - struct LDKStr err; +/** + * The contents of CResult_C2Tuple_SignatureSignatureZNoneZ + */ +typedef union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr { /** - * The feerate which was too high. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; - -typedef struct LDKAPIError_LDKRouteError_Body { + struct LDKC2Tuple_SignatureSignatureZ *result; /** - * A human-readable error message + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKStr err; -} LDKAPIError_LDKRouteError_Body; + void *err; +} LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr; -typedef struct LDKAPIError_LDKChannelUnavailable_Body { +/** + * A CResult_C2Tuple_SignatureSignatureZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_SignatureSignatureZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ { /** - * A human-readable error message + * The contents of this CResult_C2Tuple_SignatureSignatureZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKStr err; -} LDKAPIError_LDKChannelUnavailable_Body; - -typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { + union LDKCResult_C2Tuple_SignatureSignatureZNoneZPtr contents; /** - * The incompatible shutdown script. + * Whether this CResult_C2Tuple_SignatureSignatureZNoneZ represents a success state. */ - struct LDKShutdownScript script; -} LDKAPIError_LDKIncompatibleShutdownScript_Body; - -typedef struct MUST_USE_STRUCT LDKAPIError { - LDKAPIError_Tag tag; - union { - LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; - LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKRouteError_Body route_error; - LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; - LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; - }; -} LDKAPIError; + bool result_ok; +} LDKCResult_C2Tuple_SignatureSignatureZNoneZ; /** - * The contents of CResult_NoneAPIErrorZ + * The contents of CResult_SecretKeyNoneZ */ -typedef union LDKCResult_NoneAPIErrorZPtr { +typedef union LDKCResult_SecretKeyNoneZPtr { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *result; + struct LDKSecretKey *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKAPIError *err; -} LDKCResult_NoneAPIErrorZPtr; + void *err; +} LDKCResult_SecretKeyNoneZPtr; /** - * A CResult_NoneAPIErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::util::errors::APIError on failure. + * A CResult_SecretKeyNoneZ represents the result of a fallible operation, + * containing a crate::c_types::SecretKey on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneAPIErrorZ { +typedef struct LDKCResult_SecretKeyNoneZ { /** - * The contents of this CResult_NoneAPIErrorZ, accessible via either + * The contents of this CResult_SecretKeyNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneAPIErrorZPtr contents; + union LDKCResult_SecretKeyNoneZPtr contents; /** - * Whether this CResult_NoneAPIErrorZ represents a success state. + * Whether this CResult_SecretKeyNoneZ represents a success state. */ bool result_ok; -} LDKCResult_NoneAPIErrorZ; +} LDKCResult_SecretKeyNoneZ; /** - * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. - * This corresponds to std::vector in C++ + * Represents a scalar value between zero and the secp256k1 curve order, in big endian. */ -typedef struct LDKCVec_CResult_NoneAPIErrorZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKCResult_NoneAPIErrorZ *data; +typedef struct LDKBigEndianScalar { /** - * The number of elements pointed to by `data`. + * The bytes of the scalar value. */ - uintptr_t datalen; -} LDKCVec_CResult_NoneAPIErrorZZ; + uint8_t big_endian_bytes[32]; +} LDKBigEndianScalar; /** - * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. - * This corresponds to std::vector in C++ + * An enum which can either contain a crate::c_types::BigEndianScalar or not */ -typedef struct LDKCVec_APIErrorZ { +typedef enum LDKCOption_ScalarZ_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * When we're in this state, this COption_ScalarZ contains a crate::c_types::BigEndianScalar */ - struct LDKAPIError *data; + LDKCOption_ScalarZ_Some, /** - * The number of elements pointed to by `data`. + * When we're in this state, this COption_ScalarZ contains nothing */ - uintptr_t datalen; -} LDKCVec_APIErrorZ; + LDKCOption_ScalarZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_ScalarZ_Sentinel, +} LDKCOption_ScalarZ_Tag; + +typedef struct LDKCOption_ScalarZ { + LDKCOption_ScalarZ_Tag tag; + union { + struct { + struct LDKBigEndianScalar some; + }; + }; +} LDKCOption_ScalarZ; /** - * The contents of CResult__u832APIErrorZ + * The contents of CResult_SharedSecretNoneZ */ -typedef union LDKCResult__u832APIErrorZPtr { +typedef union LDKCResult_SharedSecretNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ struct LDKThirtyTwoBytes *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKAPIError *err; -} LDKCResult__u832APIErrorZPtr; + void *err; +} LDKCResult_SharedSecretNoneZPtr; /** - * A CResult__u832APIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * A CResult_SharedSecretNoneZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult__u832APIErrorZ { +typedef struct LDKCResult_SharedSecretNoneZ { /** - * The contents of this CResult__u832APIErrorZ, accessible via either + * The contents of this CResult_SharedSecretNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult__u832APIErrorZPtr contents; + union LDKCResult_SharedSecretNoneZPtr contents; /** - * Whether this CResult__u832APIErrorZ represents a success state. + * Whether this CResult_SharedSecretNoneZ represents a success state. */ bool result_ok; -} LDKCResult__u832APIErrorZ; +} LDKCResult_SharedSecretNoneZ; + + /** - * If a payment fails to send, it can be in one of several states. This enum is returned as the - * Err() type describing which state the payment is in, see the description of individual enum - * states for more. + * This class tracks the per-transaction information needed to build a closing transaction and will + * actually build it and sign. + * + * This class can be used inside a signer implementation to generate a signature given the relevant + * secret key. */ -typedef enum LDKPaymentSendFailure_Tag { +typedef struct MUST_USE_STRUCT LDKClosingTransaction { /** - * A parameter which was passed to send_payment was invalid, preventing us from attempting to - * send the payment at all. No channel state has been changed or messages sent to peers, and - * once you've changed the parameter at error, you can freely retry the payment in full. + * 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. */ - LDKPaymentSendFailure_ParameterError, + LDKnativeClosingTransaction *inner; /** - * A parameter in a single path which was passed to send_payment was invalid, preventing us - * from attempting to send the payment at all. No channel state has been changed or messages - * sent to peers, and once you've changed the parameter at error, you can freely retry the - * payment in full. - * - * The results here are ordered the same as the paths in the route object which was passed to - * send_payment. + * 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. */ - LDKPaymentSendFailure_PathParameterError, + bool is_owned; +} LDKClosingTransaction; + + + +/** + * The unsigned part of a channel_announcement + */ +typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { /** - * All paths which were attempted failed to send, with no channel state change taking place. - * You can freely retry the payment in full (though you probably want to do so over different - * paths than the ones selected). + * 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. */ - LDKPaymentSendFailure_AllFailedRetrySafe, + LDKnativeUnsignedChannelAnnouncement *inner; /** - * Some paths which were attempted failed to send, though possibly not all. At least some - * paths have irrevocably committed to the HTLC and retrying the payment in full would result - * in over-/re-payment. - * - * The results here are ordered the same as the paths in the route object which was passed to - * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely - * retried (though there is currently no API with which to do so). - * - * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried - * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the - * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel - * with the latest update_id. - */ - LDKPaymentSendFailure_PartialFailure, - /** - * Must be last for serialization purposes + * 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. */ - LDKPaymentSendFailure_Sentinel, -} LDKPaymentSendFailure_Tag; + bool is_owned; +} LDKUnsignedChannelAnnouncement; -typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body { +/** + * A trait to sign lightning channel transactions as described in BOLT 3. + * + * Signing services could be implemented on a hardware wallet. In this case, + * the current Sign would be a front-end on top of a communication + * channel connected to your secure device and lightning key material wouldn't + * reside on a hot server. Nevertheless, a this deployment would still need + * to trust the ChannelManager to avoid loss of funds as this latest component + * could ask to sign commitment transaction with HTLCs paying to attacker pubkeys. + * + * A more secure iteration would be to use hashlock (or payment points) to pair + * invoice/incoming HTLCs with outgoing HTLCs to implement a no-trust-ChannelManager + * at the price of more state and computation on the hardware wallet side. In the future, + * we are looking forward to design such interface. + * + * In any case, ChannelMonitor or fallback watchtowers are always going to be trusted + * to act, as liveness and breach reply correctness are always going to be hard requirements + * of LN security model, orthogonal of key management issues. + */ +typedef struct LDKBaseSign { /** - * The errors themselves, in the same order as the route hops. + * 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. */ - struct LDKCVec_CResult_NoneAPIErrorZZ results; + void *this_arg; /** - * If some paths failed without irrevocably committing to the new HTLC(s), this will - * contain a [`RouteParameters`] object which can be used to calculate a new route that - * will pay all remaining unpaid balance. + * Gets the per-commitment point for a specific commitment number * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. */ - struct LDKRouteParameters failed_paths_retry; + struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); /** - * The payment id for the payment, which is now at least partially pending. + * Gets the commitment secret for a specific commitment number as part of the revocation process + * + * An external signer implementation should error here if the commitment was already signed + * and should refuse to sign it in the future. + * + * May be called more than once for the same index. + * + * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. */ - struct LDKThirtyTwoBytes payment_id; -} LDKPaymentSendFailure_LDKPartialFailure_Body; - -typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { - LDKPaymentSendFailure_Tag tag; - union { - struct { - struct LDKAPIError parameter_error; - }; - struct { - struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; - }; - struct { - struct LDKCVec_APIErrorZ all_failed_retry_safe; - }; - LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; - }; -} LDKPaymentSendFailure; - -/** - * The contents of CResult_PaymentIdPaymentSendFailureZ - */ -typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { + struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Validate the counterparty's signatures on the holder commitment transaction and HTLCs. + * + * This is required in order for the signer to make sure that releasing a commitment + * secret won't leave us without a broadcastable holder transaction. + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + * + * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * A validating signer should ensure that an HTLC output is removed only when the matching + * preimage is provided, or when the value to holder is restored. + * + * NOTE: all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. */ - struct LDKThirtyTwoBytes *result; + struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages); /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Gets the holder's channel public keys and basepoints */ - struct LDKPaymentSendFailure *err; -} LDKCResult_PaymentIdPaymentSendFailureZPtr; - -/** - * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_PaymentIdPaymentSendFailureZ { + struct LDKChannelPublicKeys pubkeys; /** - * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Fill in the pubkeys field as a reference to it will be given to Rust after this returns + * Note that this takes a pointer to this object, not the this_ptr like other methods do + * This function pointer may be NULL if pubkeys is filled in when this object is created and never needs updating. */ - union LDKCResult_PaymentIdPaymentSendFailureZPtr contents; + void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR ); /** - * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state. + * Gets an arbitrary identifier describing the set of keys which are provided back to you in + * some SpendableOutputDescriptor types. This should be sufficient to identify this + * Sign object uniquely and lookup or re-derive its keys. */ - bool result_ok; -} LDKCResult_PaymentIdPaymentSendFailureZ; - -/** - * The contents of CResult_NonePaymentSendFailureZ - */ -typedef union LDKCResult_NonePaymentSendFailureZPtr { + struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); /** - * Note that this value is always NULL, as there are no contents in the OK variant + * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. + * + * Note that if signing fails or is rejected, the channel will be force-closed. + * + * Policy checks should be implemented in this function, including checking the amount + * sent to us and checking the HTLCs. + * + * The preimages of outgoing HTLCs that were fulfilled since the last commitment are provided. + * A validating signer should ensure that an HTLC output is removed only when the matching + * preimage is provided, or when the value to holder is restored. + * + * NOTE: all the relevant preimages will be provided, but there may also be additional + * irrelevant or duplicate preimages. */ - void *result; + struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages); /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Validate the counterparty's revocation. + * + * This is required in order for the signer to make sure that the state has moved + * forward and it is safe to sign the next counterparty commitment. */ - struct LDKPaymentSendFailure *err; -} LDKCResult_NonePaymentSendFailureZPtr; - -/** - * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NonePaymentSendFailureZ { + struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); /** - * The contents of this CResult_NonePaymentSendFailureZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Create a signatures for a holder's commitment transaction and its claiming HTLC transactions. + * This will only ever be called with a non-revoked commitment_tx. This will be called with the + * latest commitment_tx when we initiate a force-close. + * This will be called with the previous latest, just to get claiming HTLC signatures, if we are + * reacting to a ChannelMonitor replica that decided to broadcast before it had been updated to + * the latest. + * This may be called multiple times for the same transaction. + * + * An external signer implementation should check that the commitment has not been revoked. + * + * May return Err if key derivation fails. Callers, such as ChannelMonitor, will panic in such a case. */ - union LDKCResult_NonePaymentSendFailureZPtr contents; + struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** - * Whether this CResult_NonePaymentSendFailureZ represents a success state. + * Create a signature for the given input in a transaction spending an HTLC transaction output + * or a commitment transaction `to_local` output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * per_commitment_key is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * so). */ - bool result_ok; -} LDKCResult_NonePaymentSendFailureZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { + struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_output)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); /** - * The element at position 0 + * Create a signature for the given input in a transaction spending a commitment transaction + * HTLC output when our counterparty broadcasts an old state. + * + * A justice transaction may claim multiple outputs at the same time if timelocks are + * similar, but only a signature for the input at index `input` should be signed for here. + * It may be called multiple times for same output(s) if a fee-bump is needed with regards + * to an upcoming timelock expiration. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * per_commitment_key is revocation secret which was provided by our counterparty when they + * revoked the state which they eventually broadcast. It's not a _holder_ secret key and does + * not allow the spending of any funds by itself (you need our holder revocation_secret to do + * so). + * + * htlc holds HTLC elements (hash, timelock), thus changing the format of the witness script + * (which is committed to in the BIP 143 signatures). */ - struct LDKThirtyTwoBytes a; + struct LDKCResult_SignatureNoneZ (*sign_justice_revoked_htlc)(const void *this_arg, struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** - * The element at position 1 + * Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment + * transaction, either offered or received. + * + * Such a transaction may claim multiples offered outputs at same time if we know the + * preimage for each when we create it, but only the input at index `input` should be + * signed for here. It may be called multiple times for same output(s) if a fee-bump is + * needed with regards to an upcoming timelock expiration. + * + * Witness_script is either a offered or received script as defined in BOLT3 for HTLC + * outputs. + * + * Amount is value of the output spent by this input, committed to in the BIP 143 signature. + * + * Per_commitment_point is the dynamic point corresponding to the channel state + * detected onchain. It has been generated by our counterparty and is used to derive + * channel state keys, which are then included in the witness script and committed to in the + * BIP 143 signature. */ - struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentIdZ; - -/** - * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ - */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { + struct LDKCResult_SignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Create a signature for a (proposed) closing transaction. + * + * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have + * chosen to forgo their output as dust. */ - struct LDKC2Tuple_PaymentHashPaymentIdZ *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKPaymentSendFailure *err; -} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr; - -/** - * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { - /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents; - /** - * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. - */ - bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; - -/** - * A 4-byte byte array. - */ -typedef struct LDKFourBytes { + struct LDKCResult_SignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** - * The four bytes + * Signs a channel announcement message with our funding key and our node secret key (aka + * node_id or network_key), proving it comes from one of the channel participants. + * + * The first returned signature should be from our node secret key, the second from our + * funding key. + * + * Note that if this fails or is rejected, the channel will not be publicly announced and + * our counterparty may (though likely will not) close the channel on us for violating the + * protocol. */ - uint8_t data[4]; -} LDKFourBytes; - -/** - * A 16-byte byte array. - */ -typedef struct LDKSixteenBytes { + struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** - * The sixteen bytes + * Set the counterparty static channel data, including basepoints, + * counterparty_selected/holder_selected_contest_delay and funding outpoint. + * This is done as soon as the funding outpoint is known. Since these are static channel data, + * they MUST NOT be allowed to change to different values once set. + * + * channel_parameters.is_populated() MUST be true. + * + * We bind holder_selected_contest_delay late here for API convenience. + * + * Will be called before any signatures are applied. */ - uint8_t data[16]; -} LDKSixteenBytes; - -/** - * A 12-byte byte array. - */ -typedef struct LDKTwelveBytes { + void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); /** - * The twelve bytes + * 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. */ - uint8_t data[12]; -} LDKTwelveBytes; + void (*free)(void *this_arg); +} LDKBaseSign; /** - * An address which can be used to connect to a remote peer + * A cloneable signer. + * + * Although we require signers to be cloneable, it may be useful for developers to be able to use + * signers in an un-sized way, for example as `dyn BaseSign`. Therefore we separate the Clone trait, + * which implies Sized, into this derived trait. */ -typedef enum LDKNetAddress_Tag { - /** - * An IPv4 address/port on which the peer is listening. - */ - LDKNetAddress_IPv4, - /** - * An IPv6 address/port on which the peer is listening. - */ - LDKNetAddress_IPv6, +typedef struct LDKSign { /** - * An old-style Tor onion address/port on which the peer is listening. - * - * This field is deprecated and the Tor network generally no longer supports V2 Onion - * addresses. Thus, the details are not parsed here. + * 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. */ - LDKNetAddress_OnionV2, + void *this_arg; /** - * A new-style Tor onion address/port on which the peer is listening. - * To create the human-readable \"hostname\", concatenate ed25519_pubkey, checksum, and version, - * wrap as base32 and append \".onion\". + * Implementation of BaseSign for this object. */ - LDKNetAddress_OnionV3, + struct LDKBaseSign BaseSign; /** - * Must be last for serialization purposes + * Serialize the object into a byte array */ - LDKNetAddress_Sentinel, -} LDKNetAddress_Tag; - -typedef struct LDKNetAddress_LDKIPv4_Body { + struct LDKCVec_u8Z (*write)(const void *this_arg); /** - * The 4-byte IPv4 address + * Called, if set, after this Sign has been cloned into a duplicate object. + * The new Sign is provided, and should be mutated as needed to perform a + * deep copy of the object pointed to by this_arg or avoid any double-freeing. */ - struct LDKFourBytes addr; + void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign); /** - * The port on which the node is listening + * 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. */ - uint16_t port; -} LDKNetAddress_LDKIPv4_Body; + void (*free)(void *this_arg); +} LDKSign; -typedef struct LDKNetAddress_LDKIPv6_Body { +/** + * The contents of CResult_SignDecodeErrorZ + */ +typedef union LDKCResult_SignDecodeErrorZPtr { /** - * The 16-byte IPv6 address + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKSixteenBytes addr; + struct LDKSign *result; /** - * The port on which the node is listening + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uint16_t port; -} LDKNetAddress_LDKIPv6_Body; + struct LDKDecodeError *err; +} LDKCResult_SignDecodeErrorZPtr; -typedef struct LDKNetAddress_LDKOnionV3_Body { - /** - * The ed25519 long-term public key of the peer - */ - struct LDKThirtyTwoBytes ed25519_pubkey; - /** - * The checksum of the pubkey and version, as included in the onion address - */ - uint16_t checksum; +/** + * A CResult_SignDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::Sign 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_SignDecodeErrorZ { /** - * The version byte, as defined by the Tor Onion v3 spec. + * The contents of this CResult_SignDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint8_t version; + union LDKCResult_SignDecodeErrorZPtr contents; /** - * The port on which the node is listening + * Whether this CResult_SignDecodeErrorZ represents a success state. */ - uint16_t port; -} LDKNetAddress_LDKOnionV3_Body; + bool result_ok; +} LDKCResult_SignDecodeErrorZ; -typedef struct MUST_USE_STRUCT LDKNetAddress { - LDKNetAddress_Tag tag; - union { - LDKNetAddress_LDKIPv4_Body i_pv4; - LDKNetAddress_LDKIPv6_Body i_pv6; - struct { - struct LDKTwelveBytes onion_v2; - }; - LDKNetAddress_LDKOnionV3_Body onion_v3; - }; -} LDKNetAddress; +/** + * Integer in the range `0..32` + */ +typedef struct LDKu5 { + uint8_t _0; +} LDKu5; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::NetAddresss of arbitrary size. + * A dynamically-allocated array of crate::c_types::u5s of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_NetAddressZ { +typedef struct LDKCVec_u5Z { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKNetAddress *data; + struct LDKu5 *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_NetAddressZ; +} LDKCVec_u5Z; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which + * allows recovering the exact public key which created the signature given the message. */ -typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { - /** - * The element at position 0 - */ - struct LDKThirtyTwoBytes a; +typedef struct LDKRecoverableSignature { /** - * The element at position 1 + * The bytes of the signature in "compact" form plus a "Recovery ID" which allows for + * recovery. */ - struct LDKThirtyTwoBytes b; -} LDKC2Tuple_PaymentHashPaymentSecretZ; + uint8_t serialized_form[68]; +} LDKRecoverableSignature; /** - * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ + * The contents of CResult_RecoverableSignatureNoneZ */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { +typedef union LDKCResult_RecoverableSignatureNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_PaymentHashPaymentSecretZ *result; + struct LDKRecoverableSignature *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr; +} LDKCResult_RecoverableSignatureNoneZPtr; /** - * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure. + * A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::RecoverableSignature on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { +typedef struct LDKCResult_RecoverableSignatureNoneZ { /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either + * The contents of this CResult_RecoverableSignatureNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents; + union LDKCResult_RecoverableSignatureNoneZPtr contents; /** - * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state. + * Whether this CResult_RecoverableSignatureNoneZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ; +} LDKCResult_RecoverableSignatureNoneZ; /** - * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ + * A dynamically-allocated array of crate::c_types::derived::CVec_u8Zs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { +typedef struct LDKCVec_CVec_u8ZZ { /** - * 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 LDKC2Tuple_PaymentHashPaymentSecretZ *result; + struct LDKCVec_u8Z *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 LDKAPIError *err; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr; + uintptr_t datalen; +} LDKCVec_CVec_u8ZZ; /** - * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * The contents of CResult_CVec_CVec_u8ZZNoneZ */ -typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { - /** - * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents; - /** - * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ; - -/** - * The contents of CResult_PaymentSecretNoneZ - */ -typedef union LDKCResult_PaymentSecretNoneZPtr { +typedef union LDKCResult_CVec_CVec_u8ZZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKCVec_CVec_u8ZZ *result; /** * Note that this value is always NULL, as there are no contents in the Err variant */ void *err; -} LDKCResult_PaymentSecretNoneZPtr; +} LDKCResult_CVec_CVec_u8ZZNoneZPtr; /** - * A CResult_PaymentSecretNoneZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. + * A CResult_CVec_CVec_u8ZZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_CVec_u8ZZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentSecretNoneZ { +typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { /** - * The contents of this CResult_PaymentSecretNoneZ, accessible via either + * The contents of this CResult_CVec_CVec_u8ZZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentSecretNoneZPtr contents; + union LDKCResult_CVec_CVec_u8ZZNoneZPtr contents; /** - * Whether this CResult_PaymentSecretNoneZ represents a success state. + * Whether this CResult_CVec_CVec_u8ZZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentSecretNoneZ; +} LDKCResult_CVec_CVec_u8ZZNoneZ; + -/** - * The contents of CResult_PaymentSecretAPIErrorZ - */ -typedef union LDKCResult_PaymentSecretAPIErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKThirtyTwoBytes *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult_PaymentSecretAPIErrorZPtr; /** - * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A simple implementation of Sign that just keeps the private keys in memory. + * + * This implementation performs no policy checks and is insufficient by itself as + * a secure external signer. */ -typedef struct LDKCResult_PaymentSecretAPIErrorZ { +typedef struct MUST_USE_STRUCT LDKInMemorySigner { /** - * The contents of this CResult_PaymentSecretAPIErrorZ, 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_PaymentSecretAPIErrorZPtr contents; + LDKnativeInMemorySigner *inner; /** - * Whether this CResult_PaymentSecretAPIErrorZ 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_PaymentSecretAPIErrorZ; + bool is_owned; +} LDKInMemorySigner; /** - * The contents of CResult_PaymentPreimageAPIErrorZ + * The contents of CResult_InMemorySignerDecodeErrorZ */ -typedef union LDKCResult_PaymentPreimageAPIErrorZPtr { +typedef union LDKCResult_InMemorySignerDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKInMemorySigner *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKAPIError *err; -} LDKCResult_PaymentPreimageAPIErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_InMemorySignerDecodeErrorZPtr; /** - * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::keysinterface::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentPreimageAPIErrorZ { +typedef struct LDKCResult_InMemorySignerDecodeErrorZ { /** - * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either + * The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentPreimageAPIErrorZPtr contents; + union LDKCResult_InMemorySignerDecodeErrorZPtr contents; /** - * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state. + * Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentPreimageAPIErrorZ; - - +} LDKCResult_InMemorySignerDecodeErrorZ; /** - * Information needed for constructing an invoice route hint for this channel. + * A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo { +typedef struct LDKCVec_TxOutZ { /** - * 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(). */ - LDKnativeCounterpartyForwardingInfo *inner; + struct LDKTxOut *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; -} LDKCounterpartyForwardingInfo; + uintptr_t datalen; +} LDKCVec_TxOutZ; /** - * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ + * The contents of CResult_TransactionNoneZ */ -typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr { +typedef union LDKCResult_TransactionNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCounterpartyForwardingInfo *result; + struct LDKTransaction *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKDecodeError *err; -} LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr; + void *err; +} LDKCResult_TransactionNoneZPtr; /** - * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_TransactionNoneZ represents the result of a fallible operation, + * containing a crate::c_types::Transaction on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ { +typedef struct LDKCResult_TransactionNoneZ { /** - * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either + * The contents of this CResult_TransactionNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents; + union LDKCResult_TransactionNoneZPtr contents; /** - * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. + * Whether this CResult_TransactionNoneZ represents a success state. */ bool result_ok; -} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ; +} LDKCResult_TransactionNoneZ; /** - * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] - * to better separate parameters. + * A ChannelMonitor handles chain events (blocks connected and disconnected) and generates + * on-chain transactions to ensure no loss of funds occurs. + * + * You MUST ensure that no ChannelMonitors for a given channel anywhere contain out-of-date + * information and are actively monitoring the chain. + * + * Pending Events or updated HTLCs which have not yet been read out by + * get_and_clear_pending_monitor_events or get_and_clear_pending_events are serialized to disk and + * reloaded at deserialize-time. Thus, you must ensure that, when handling events, all events + * gotten are fully handled before re-serializing the new state. + * + * Note that the deserializer is only implemented for (BlockHash, ChannelMonitor), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie disconnecting blocks until you find a common ancestor from both the + * returned block hash and the the current chain and then reconnecting blocks to get to the + * best chain) upon deserializing the object! */ -typedef struct MUST_USE_STRUCT LDKChannelCounterparty { +typedef struct MUST_USE_STRUCT LDKChannelMonitor { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeChannelCounterparty *inner; + LDKnativeChannelMonitor *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKChannelCounterparty; +} LDKChannelMonitor; /** - * The contents of CResult_ChannelCounterpartyDecodeErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr { +typedef struct LDKC2Tuple_BlockHashChannelMonitorZ { /** - * 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 LDKChannelCounterparty *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_ChannelCounterpartyDecodeErrorZPtr; + struct LDKChannelMonitor b; +} LDKC2Tuple_BlockHashChannelMonitorZ; /** - * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ { +typedef struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ { /** - * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, 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_ChannelCounterpartyDecodeErrorZPtr contents; + struct LDKC2Tuple_BlockHashChannelMonitorZ *data; /** - * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_ChannelCounterpartyDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_BlockHashChannelMonitorZZ; /** - * The contents of CResult_ChannelDetailsDecodeErrorZ + * The contents of CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ */ -typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr { +typedef union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelDetails *result; + struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_ChannelDetailsDecodeErrorZPtr; + enum LDKIOError *err; +} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr; /** - * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C2Tuple_BlockHashChannelMonitorZZ on success and a crate::c_types::IOError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelDetailsDecodeErrorZ { +typedef struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { /** - * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either + * The contents of this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelDetailsDecodeErrorZPtr contents; + union LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZPtr contents; /** - * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. + * Whether this CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelDetailsDecodeErrorZ; - - +} LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; /** - * Route hints used in constructing invoices for [phantom node payents]. - * - * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * An enum which can either contain a u16 or not */ -typedef struct MUST_USE_STRUCT LDKPhantomRouteHints { +typedef enum LDKCOption_u16Z_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_u16Z contains a u16 */ - LDKnativePhantomRouteHints *inner; + LDKCOption_u16Z_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_u16Z contains nothing */ - bool is_owned; -} LDKPhantomRouteHints; - -/** - * The contents of CResult_PhantomRouteHintsDecodeErrorZ - */ -typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr { + LDKCOption_u16Z_None, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Must be last for serialization purposes */ - struct LDKPhantomRouteHints *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKDecodeError *err; -} LDKCResult_PhantomRouteHintsDecodeErrorZPtr; + LDKCOption_u16Z_Sentinel, +} LDKCOption_u16Z_Tag; + +typedef struct LDKCOption_u16Z { + LDKCOption_u16Z_Tag tag; + union { + struct { + uint16_t some; + }; + }; +} LDKCOption_u16Z; /** - * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) */ -typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ { +typedef enum LDKAPIError_Tag { /** - * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. */ - union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents; + LDKAPIError_APIMisuseError, /** - * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state. + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. */ - bool result_ok; -} LDKCResult_PhantomRouteHintsDecodeErrorZ; - -/** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_ChannelMonitorZ { + LDKAPIError_FeeRateTooHigh, /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). */ - struct LDKChannelMonitor *data; + LDKAPIError_RouteError, /** - * The number of elements pointed to by `data`. + * We were unable to complete the request as the Channel required to do so is unable to + * complete the request (or was not found). This can take many forms, including disconnected + * peer, channel at capacity, channel shutting down, etc. */ - uintptr_t datalen; -} LDKCVec_ChannelMonitorZ; - + LDKAPIError_ChannelUnavailable, + /** + * An attempt to call watch/update_channel returned an Err (ie you did this!), causing the + * attempted action to fail. + */ + LDKAPIError_MonitorUpdateFailed, + /** + * [`KeysInterface::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible + * with the channel counterparty as negotiated in [`InitFeatures`]. + * + * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open + * a channel or cooperatively close one with this peer (and will have to force-close instead). + * + * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + * [`InitFeatures`]: crate::ln::features::InitFeatures + */ + LDKAPIError_IncompatibleShutdownScript, + /** + * Must be last for serialization purposes + */ + LDKAPIError_Sentinel, +} LDKAPIError_Tag; +typedef struct LDKAPIError_LDKAPIMisuseError_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKAPIMisuseError_Body; -/** - * An update generated by the underlying Channel itself which contains some new information the - * ChannelMonitor should be made aware of. - */ -typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { +typedef struct LDKAPIError_LDKFeeRateTooHigh_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. + * A human-readable error message */ - LDKnativeChannelMonitorUpdate *inner; + struct LDKStr err; /** - * 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 feerate which was too high. */ - bool is_owned; -} LDKChannelMonitorUpdate; + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; -/** - * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as - * blocks are connected and disconnected. - * - * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are - * responsible for maintaining a set of monitors such that they can be updated accordingly as - * channel state changes and HTLCs are resolved. See method documentation for specific - * requirements. - * - * Implementations **must** ensure that updates are successfully applied and persisted upon method - * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down - * without taking any further action such as persisting the current state. - * - * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing - * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it - * could result in a revoked transaction being broadcast, allowing the counterparty to claim all - * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle - * multiple instances. - * - * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure - */ -typedef struct LDKWatch { +typedef struct LDKAPIError_LDKRouteError_Body { /** - * 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. + * A human-readable error message */ - void *this_arg; + struct LDKStr err; +} LDKAPIError_LDKRouteError_Body; + +typedef struct LDKAPIError_LDKChannelUnavailable_Body { /** - * Watches a channel identified by `funding_txo` using `monitor`. - * - * Implementations are responsible for watching the chain for the funding transaction along - * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means - * calling [`block_connected`] and [`block_disconnected`] on the monitor. - * - * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if - * the given `funding_txo` has previously been registered via `watch_channel`. - * - * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch - * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected - * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected + * A human-readable error message */ - struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); + struct LDKStr err; +} LDKAPIError_LDKChannelUnavailable_Body; + +typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { /** - * Updates a channel identified by `funding_txo` by applying `update` to its monitor. - * - * Implementations must call [`update_monitor`] with the given update. See - * [`ChannelMonitorUpdateErr`] for invariants around returning an error. - * - * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor + * The incompatible shutdown script. */ - struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); + struct LDKShutdownScript script; +} LDKAPIError_LDKIncompatibleShutdownScript_Body; + +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; + union { + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKRouteError_Body route_error; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; + LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; + }; +} LDKAPIError; + +/** + * The contents of CResult_NoneAPIErrorZ + */ +typedef union LDKCResult_NoneAPIErrorZPtr { /** - * Returns any monitor events since the last call. Subsequent calls must only return new - * events. - * - * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no - * further events may be returned here until the [`ChannelMonitor`] has been fully persisted - * to disk. - * - * For details on asynchronous [`ChannelMonitor`] updating and returning - * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKCVec_MonitorEventZ (*release_pending_monitor_events)(const void *this_arg); + void *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); -} LDKWatch; + struct LDKAPIError *err; +} LDKCResult_NoneAPIErrorZPtr; /** - * An interface to send a transaction to the Bitcoin network. + * A CResult_NoneAPIErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::util::errors::APIError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKBroadcasterInterface { +typedef struct LDKCResult_NoneAPIErrorZ { /** - * 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. + * The contents of this CResult_NoneAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void *this_arg; + union LDKCResult_NoneAPIErrorZPtr contents; /** - * Sends a transaction out to (hopefully) be mined. + * Whether this CResult_NoneAPIErrorZ represents a success state. */ - void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); + bool result_ok; +} LDKCResult_NoneAPIErrorZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_CResult_NoneAPIErrorZZ { /** - * 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. + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - void (*free)(void *this_arg); -} LDKBroadcasterInterface; + struct LDKCResult_NoneAPIErrorZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_CResult_NoneAPIErrorZZ; /** - * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not - * own the memory pointed to by data. + * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKu8slice { +typedef struct LDKCVec_APIErrorZ { /** - * A pointer to the byte buffer + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - const uint8_t *data; + struct LDKAPIError *data; /** - * The number of bytes pointed to by `data`. + * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKu8slice; +} LDKCVec_APIErrorZ; /** - * A trait to describe an object which can get user secrets and key material. + * The contents of CResult__u832APIErrorZ */ -typedef struct LDKKeysInterface { +typedef union LDKCResult__u832APIErrorZPtr { /** - * 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. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *this_arg; + struct LDKThirtyTwoBytes *result; /** - * Get node secret key (aka node_id or network_key) based on the provided [`Recipient`]. - * - * This method must return the same value each time it is called with a given `Recipient` - * parameter. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient); + struct LDKAPIError *err; +} LDKCResult__u832APIErrorZPtr; + +/** + * A CResult__u832APIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult__u832APIErrorZ { /** - * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. + * The contents of this CResult__u832APIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); + union LDKCResult__u832APIErrorZPtr contents; /** - * Get a script pubkey which we will send funds to when closing a channel. - * - * This method should return a different value each time it is called, to avoid linking - * on-chain funds across channels as controlled to the same user. + * Whether this CResult__u832APIErrorZ represents a success state. */ - struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg); + bool result_ok; +} LDKCResult__u832APIErrorZ; + +/** + * If a payment fails to send, it can be in one of several states. This enum is returned as the + * Err() type describing which state the payment is in, see the description of individual enum + * states for more. + */ +typedef enum LDKPaymentSendFailure_Tag { /** - * Get a new set of Sign for per-channel secrets. These MUST be unique even if you - * restarted with some stale data! - * - * This method must return a different value each time it is called. + * A parameter which was passed to send_payment was invalid, preventing us from attempting to + * send the payment at all. No channel state has been changed or messages sent to peers, and + * once you've changed the parameter at error, you can freely retry the payment in full. */ - struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + LDKPaymentSendFailure_ParameterError, /** - * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting - * onion packets and for temporary channel IDs. There is no requirement that these be - * persisted anywhere, though they must be unique across restarts. + * A parameter in a single path which was passed to send_payment was invalid, preventing us + * from attempting to send the payment at all. No channel state has been changed or messages + * sent to peers, and once you've changed the parameter at error, you can freely retry the + * payment in full. * - * This method must return a different value each time it is called. - */ - struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); - /** - * Reads a `Signer` for this `KeysInterface` from the given input stream. - * This is only called during deserialization of other objects which contain - * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). - * The bytes are exactly those which `::write()` writes, and - * contain no versioning scheme. You may wish to include your own version prefix and ensure - * you've read all of the provided bytes to ensure no corruption occurred. + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment. */ - struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); + LDKPaymentSendFailure_PathParameterError, /** - * Sign an invoice. - * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of - * this trait to parse the invoice and make sure they're signing what they expect, rather than - * blindly signing the hash. - * The hrp is ascii bytes, while the invoice data is base32. - * - * The secret key used to sign the invoice is dependent on the [`Recipient`]. + * All paths which were attempted failed to send, with no channel state change taking place. + * You can freely retry the payment in full (though you probably want to do so over different + * paths than the ones selected). */ - struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient); + LDKPaymentSendFailure_AllFailedRetrySafe, /** - * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. - * - * If the implementor of this trait supports [phantom node payments], then every node that is - * intended to be included in the phantom invoice route hints must return the same value from - * this method. + * Some paths which were attempted failed to send, though possibly not all. At least some + * paths have irrevocably committed to the HTLC and retrying the payment in full would result + * in over-/re-payment. * - * This method must return the same value each time it is called. + * The results here are ordered the same as the paths in the route object which was passed to + * send_payment, and any Errs which are not APIError::MonitorUpdateFailed can be safely + * retried (though there is currently no API with which to do so). * - * [phantom node payments]: PhantomKeysManager + * Any entries which contain Err(APIError::MonitorUpdateFailed) or Ok(()) MUST NOT be retried + * as they will result in over-/re-payment. These HTLCs all either successfully sent (in the + * case of Ok(())) or will send once channel_monitor_updated is called on the next-hop channel + * with the latest update_id. */ - struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg); + LDKPaymentSendFailure_PartialFailure, /** - * 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); -} LDKKeysInterface; + LDKPaymentSendFailure_Sentinel, +} LDKPaymentSendFailure_Tag; -/** - * A trait which should be implemented to provide feerate information on a number of time - * horizons. - * - * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're - * called from inside the library in response to chain events, P2P events, or timer events). - */ -typedef struct LDKFeeEstimator { +typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body { /** - * 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. + * The errors themselves, in the same order as the route hops. */ - void *this_arg; + struct LDKCVec_CResult_NoneAPIErrorZZ results; /** - * Gets estimated satoshis of fee required per 1000 Weight-Units. - * - * Must return a value no smaller than 253 (ie 1 satoshi-per-byte rounded up to ensure later - * round-downs don't put us below 1 satoshi-per-byte). + * If some paths failed without irrevocably committing to the new HTLC(s), this will + * contain a [`RouteParameters`] object which can be used to calculate a new route that + * will pay all remaining unpaid balance. * - * This method can be implemented with the following unit conversions: - * * max(satoshis-per-byte * 250, 253) - * * max(satoshis-per-kbyte / 4, 253) + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ - uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); + struct LDKRouteParameters failed_paths_retry; /** - * 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. + * The payment id for the payment, which is now at least partially pending. */ - void (*free)(void *this_arg); -} LDKFeeEstimator; - + struct LDKThirtyTwoBytes payment_id; +} LDKPaymentSendFailure_LDKPartialFailure_Body; +typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { + LDKPaymentSendFailure_Tag tag; + union { + struct { + struct LDKAPIError parameter_error; + }; + struct { + struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; + }; + struct { + struct LDKCVec_APIErrorZ all_failed_retry_safe; + }; + LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; + }; +} LDKPaymentSendFailure; /** - * A Record, unit of logging output with Metadata to enable filtering - * Module_path, file, line to inform on log's source + * The contents of CResult_PaymentIdPaymentSendFailureZ */ -typedef struct MUST_USE_STRUCT LDKRecord { +typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { /** - * 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. */ - LDKnativeRecord *inner; + struct LDKThirtyTwoBytes *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; -} LDKRecord; + struct LDKPaymentSendFailure *err; +} LDKCResult_PaymentIdPaymentSendFailureZPtr; /** - * A trait encapsulating the operations required of a logger + * A CResult_PaymentIdPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct 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 LDKCResult_PaymentIdPaymentSendFailureZ { /** - * Logs the `Record` + * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - void (*log)(const void *this_arg, const struct LDKRecord *NONNULL_PTR record); + union LDKCResult_PaymentIdPaymentSendFailureZPtr 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_PaymentIdPaymentSendFailureZ represents a success state. */ - void (*free)(void *this_arg); -} LDKLogger; - - + bool result_ok; +} LDKCResult_PaymentIdPaymentSendFailureZ; /** - * Manager which keeps track of a number of channels and sends messages to the appropriate - * channel, also tracking HTLC preimages and forwarding onion packets appropriately. - * - * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through - * to individual Channels. - * - * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for - * all peers during write/read (though does not modify this instance, only the instance being - * serialized). This will result in any channels which have not yet exchanged funding_created (ie - * called funding_transaction_generated for outbound channels). - * - * Note that you can be a bit lazier about writing out ChannelManager than you can be with - * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before - * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates - * happens out-of-band (and will prevent any other ChannelManager operations from occurring during - * the serialization process). If the deserialized version is out-of-date compared to the - * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the - * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). - * - * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which - * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along - * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call - * block_connected() to step towards your best block) upon deserialization before using the - * object! - * - * Note that ChannelManager is responsible for tracking liveness of its channels and generating - * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid - * spam due to quick disconnection/reconnection, updates are not sent until the channel has been - * offline for a full minute. In order to track this, you must call - * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. - * - * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager - * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but - * essentially you should default to using a SimpleRefChannelManager, and use a - * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when - * you're using lightning-net-tokio. + * The contents of CResult_NonePaymentSendFailureZ */ -typedef struct MUST_USE_STRUCT LDKChannelManager { +typedef union LDKCResult_NonePaymentSendFailureZPtr { /** - * 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. + * Note that this value is always NULL, as there are no contents in the OK variant */ - LDKnativeChannelManager *inner; + void *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; -} LDKChannelManager; + struct LDKPaymentSendFailure *err; +} LDKCResult_NonePaymentSendFailureZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_BlockHashChannelManagerZ { +typedef struct LDKCResult_NonePaymentSendFailureZ { + /** + * The contents of this CResult_NonePaymentSendFailureZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NonePaymentSendFailureZPtr contents; + /** + * Whether this CResult_NonePaymentSendFailureZ represents a success state. + */ + bool result_ok; +} LDKCResult_NonePaymentSendFailureZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_PaymentHashPaymentIdZ { /** * The element at position 0 */ @@ -6898,1375 +7494,1567 @@ typedef struct LDKC2Tuple_BlockHashChannelManagerZ { /** * The element at position 1 */ - struct LDKChannelManager b; -} LDKC2Tuple_BlockHashChannelManagerZ; + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_PaymentHashPaymentIdZ; /** - * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ + * The contents of CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelManagerZ *result; + struct LDKC2Tuple_PaymentHashPaymentIdZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr; + struct LDKPaymentSendFailure *err; +} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr; /** - * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentIdZ on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; - +} LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +/** + * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ThirtyTwoBytesZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKThirtyTwoBytes *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ThirtyTwoBytesZ; /** - * Options which apply on a per-channel basis and may change at runtime or based on negotiation - * with our counterparty. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKChannelConfig { +typedef struct LDKC2Tuple_PaymentHashPaymentSecretZ { /** - * 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 element at position 0 */ - LDKnativeChannelConfig *inner; + struct LDKThirtyTwoBytes a; /** - * 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 element at position 1 */ - bool is_owned; -} LDKChannelConfig; + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_PaymentHashPaymentSecretZ; /** - * The contents of CResult_ChannelConfigDecodeErrorZ + * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ */ -typedef union LDKCResult_ChannelConfigDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelConfig *result; + struct LDKC2Tuple_PaymentHashPaymentSecretZ *result; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKDecodeError *err; -} LDKCResult_ChannelConfigDecodeErrorZPtr; + void *err; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr; /** - * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a () on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelConfigDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { /** - * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelConfigDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZPtr contents; /** - * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelConfigDecodeErrorZ; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ; /** - * The contents of CResult_OutPointDecodeErrorZ + * The contents of CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ */ -typedef union LDKCResult_OutPointDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKOutPoint *result; + struct LDKC2Tuple_PaymentHashPaymentSecretZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_OutPointDecodeErrorZPtr; + struct LDKAPIError *err; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr; /** - * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_PaymentHashPaymentSecretZ on success and a crate::lightning::util::errors::APIError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_OutPointDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { /** - * The contents of this CResult_OutPointDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_OutPointDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZPtr contents; /** - * Whether this CResult_OutPointDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_OutPointDecodeErrorZ; +} LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ; /** - * Defines a type identifier for sending messages over the wire. - * - * Messages implementing this trait specify a type and must be [`Writeable`]. + * The contents of CResult_PaymentSecretNoneZ */ -typedef struct LDKType { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef union LDKCResult_PaymentSecretNoneZPtr { /** - * Returns the type identifying the message payload. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint16_t (*type_id)(const void *this_arg); + struct LDKThirtyTwoBytes *result; /** - * Return a human-readable "debug" string describing this object + * Note that this value is always NULL, as there are no contents in the Err variant */ - struct LDKStr (*debug_str)(const void *this_arg); + void *err; +} LDKCResult_PaymentSecretNoneZPtr; + +/** + * A CResult_PaymentSecretNoneZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentSecretNoneZ { /** - * Serialize the object into a byte array + * The contents of this CResult_PaymentSecretNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKCVec_u8Z (*write)(const void *this_arg); + union LDKCResult_PaymentSecretNoneZPtr 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_PaymentSecretNoneZ represents a success state. */ - void (*free)(void *this_arg); -} LDKType; + bool result_ok; +} LDKCResult_PaymentSecretNoneZ; /** - * An enum which can either contain a crate::lightning::ln::wire::Type or not + * The contents of CResult_PaymentSecretAPIErrorZ */ -typedef enum LDKCOption_TypeZ_Tag { +typedef union LDKCResult_PaymentSecretAPIErrorZPtr { /** - * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_TypeZ_Some, + struct LDKThirtyTwoBytes *result; /** - * When we're in this state, this COption_TypeZ contains nothing + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKCOption_TypeZ_None, + struct LDKAPIError *err; +} LDKCResult_PaymentSecretAPIErrorZPtr; + +/** + * A CResult_PaymentSecretAPIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PaymentSecretAPIErrorZ { /** - * Must be last for serialization purposes + * The contents of this CResult_PaymentSecretAPIErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKCOption_TypeZ_Sentinel, -} LDKCOption_TypeZ_Tag; - -typedef struct LDKCOption_TypeZ { - LDKCOption_TypeZ_Tag tag; - union { - struct { - struct LDKType some; - }; - }; -} LDKCOption_TypeZ; + union LDKCResult_PaymentSecretAPIErrorZPtr contents; + /** + * Whether this CResult_PaymentSecretAPIErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PaymentSecretAPIErrorZ; /** - * The contents of CResult_COption_TypeZDecodeErrorZ + * The contents of CResult_PaymentPreimageAPIErrorZ */ -typedef union LDKCResult_COption_TypeZDecodeErrorZPtr { +typedef union LDKCResult_PaymentPreimageAPIErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_TypeZ *result; + struct LDKThirtyTwoBytes *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_COption_TypeZDecodeErrorZPtr; + struct LDKAPIError *err; +} LDKCResult_PaymentPreimageAPIErrorZPtr; /** - * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_PaymentPreimageAPIErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::util::errors::APIError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_COption_TypeZDecodeErrorZ { +typedef struct LDKCResult_PaymentPreimageAPIErrorZ { /** - * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either + * The contents of this CResult_PaymentPreimageAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_TypeZDecodeErrorZPtr contents; + union LDKCResult_PaymentPreimageAPIErrorZPtr contents; /** - * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. + * Whether this CResult_PaymentPreimageAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_TypeZDecodeErrorZ; +} LDKCResult_PaymentPreimageAPIErrorZ; + + /** - * An error that may occur when making a payment. + * Information needed for constructing an invoice route hint for this channel. */ -typedef enum LDKPaymentError_Tag { - /** - * An error resulting from the provided [`Invoice`] or payment hash. - */ - LDKPaymentError_Invoice, +typedef struct MUST_USE_STRUCT LDKCounterpartyForwardingInfo { /** - * An error occurring when finding a route. + * 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. */ - LDKPaymentError_Routing, + LDKnativeCounterpartyForwardingInfo *inner; /** - * An error occurring when sending a 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. */ - LDKPaymentError_Sending, - /** - * Must be last for serialization purposes - */ - LDKPaymentError_Sentinel, -} LDKPaymentError_Tag; - -typedef struct MUST_USE_STRUCT LDKPaymentError { - LDKPaymentError_Tag tag; - union { - struct { - struct LDKStr invoice; - }; - struct { - struct LDKLightningError routing; - }; - struct { - struct LDKPaymentSendFailure sending; - }; - }; -} LDKPaymentError; + bool is_owned; +} LDKCounterpartyForwardingInfo; /** - * The contents of CResult_PaymentIdPaymentErrorZ + * The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ */ -typedef union LDKCResult_PaymentIdPaymentErrorZPtr { +typedef union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes *result; + struct LDKCounterpartyForwardingInfo *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPaymentError *err; -} LDKCResult_PaymentIdPaymentErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr; /** - * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure. + * A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PaymentIdPaymentErrorZ { +typedef struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ { /** - * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either + * The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentIdPaymentErrorZPtr contents; + union LDKCResult_CounterpartyForwardingInfoDecodeErrorZPtr contents; /** - * Whether this CResult_PaymentIdPaymentErrorZ represents a success state. + * Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentIdPaymentErrorZ; +} LDKCResult_CounterpartyForwardingInfoDecodeErrorZ; + + /** - * Sub-errors which don't have specific information in them use this type. + * Channel parameters which apply to our counterparty. These are split out from [`ChannelDetails`] + * to better separate parameters. */ -typedef struct LDKError { +typedef struct MUST_USE_STRUCT LDKChannelCounterparty { /** - * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here + * 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. */ - uint8_t _dummy; -} LDKError; + LDKnativeChannelCounterparty *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKChannelCounterparty; /** - * Errors that indicate what is wrong with the invoice. They have some granularity for debug - * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user. + * The contents of CResult_ChannelCounterpartyDecodeErrorZ */ -typedef enum LDKParseError_Tag { - LDKParseError_Bech32Error, - LDKParseError_ParseAmountError, - LDKParseError_MalformedSignature, - LDKParseError_BadPrefix, - LDKParseError_UnknownCurrency, - LDKParseError_UnknownSiPrefix, - LDKParseError_MalformedHRP, - LDKParseError_TooShortDataPart, - LDKParseError_UnexpectedEndOfTaggedFields, - LDKParseError_DescriptionDecodeError, - LDKParseError_PaddingError, - LDKParseError_IntegerOverflowError, - LDKParseError_InvalidSegWitProgramLength, - LDKParseError_InvalidPubKeyHashLength, - LDKParseError_InvalidScriptHashLength, - LDKParseError_InvalidRecoveryId, - LDKParseError_InvalidSliceLength, +typedef union LDKCResult_ChannelCounterpartyDecodeErrorZPtr { /** - * Not an error, but used internally to signal that a part of the invoice should be ignored - * according to BOLT11 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKParseError_Skip, + struct LDKChannelCounterparty *result; /** - * Must be last for serialization purposes + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKParseError_Sentinel, -} LDKParseError_Tag; + struct LDKDecodeError *err; +} LDKCResult_ChannelCounterpartyDecodeErrorZPtr; -typedef struct MUST_USE_STRUCT LDKParseError { - LDKParseError_Tag tag; - union { - struct { - struct LDKBech32Error bech32_error; - }; - struct { - struct LDKError parse_amount_error; - }; - struct { - enum LDKSecp256k1Error malformed_signature; - }; - struct { - struct LDKError description_decode_error; - }; - struct { - struct LDKStr invalid_slice_length; - }; - }; -} LDKParseError; +/** + * A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelCounterpartyDecodeErrorZ { + /** + * The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelCounterpartyDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelCounterpartyDecodeErrorZ; /** - * The contents of CResult_SiPrefixParseErrorZ + * The contents of CResult_ChannelDetailsDecodeErrorZ */ -typedef union LDKCResult_SiPrefixParseErrorZPtr { +typedef union LDKCResult_ChannelDetailsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - enum LDKSiPrefix *result; + struct LDKChannelDetails *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKParseError *err; -} LDKCResult_SiPrefixParseErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_ChannelDetailsDecodeErrorZPtr; /** - * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure. + * A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SiPrefixParseErrorZ { +typedef struct LDKCResult_ChannelDetailsDecodeErrorZ { /** - * The contents of this CResult_SiPrefixParseErrorZ, accessible via either + * The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SiPrefixParseErrorZPtr contents; + union LDKCResult_ChannelDetailsDecodeErrorZPtr contents; /** - * Whether this CResult_SiPrefixParseErrorZ represents a success state. + * Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SiPrefixParseErrorZ; +} LDKCResult_ChannelDetailsDecodeErrorZ; /** - * Represents a syntactically and semantically correct lightning BOLT11 invoice. + * Route hints used in constructing invoices for [phantom node payents]. * - * There are three ways to construct an `Invoice`: - * 1. using `InvoiceBuilder` - * 2. using `Invoice::from_signed(SignedRawInvoice)` - * 3. using `str::parse::(&str)` + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager */ -typedef struct MUST_USE_STRUCT LDKInvoice { +typedef struct MUST_USE_STRUCT LDKPhantomRouteHints { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInvoice *inner; + LDKnativePhantomRouteHints *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKInvoice; - -/** - * Indicates that something went wrong while parsing or validating the invoice. Parsing errors - * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors - * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice. - */ -typedef enum LDKParseOrSemanticError_Tag { - /** - * The invoice couldn't be decoded - */ - LDKParseOrSemanticError_ParseError, - /** - * The invoice could be decoded but violates the BOLT11 standard - */ - LDKParseOrSemanticError_SemanticError, - /** - * Must be last for serialization purposes - */ - LDKParseOrSemanticError_Sentinel, -} LDKParseOrSemanticError_Tag; - -typedef struct MUST_USE_STRUCT LDKParseOrSemanticError { - LDKParseOrSemanticError_Tag tag; - union { - struct { - struct LDKParseError parse_error; - }; - struct { - enum LDKSemanticError semantic_error; - }; - }; -} LDKParseOrSemanticError; +} LDKPhantomRouteHints; /** - * The contents of CResult_InvoiceParseOrSemanticErrorZ + * The contents of CResult_PhantomRouteHintsDecodeErrorZ */ -typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr { +typedef union LDKCResult_PhantomRouteHintsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoice *result; + struct LDKPhantomRouteHints *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKParseOrSemanticError *err; -} LDKCResult_InvoiceParseOrSemanticErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_PhantomRouteHintsDecodeErrorZPtr; /** - * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure. + * A CResult_PhantomRouteHintsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::channelmanager::PhantomRouteHints on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ { +typedef struct LDKCResult_PhantomRouteHintsDecodeErrorZ { /** - * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either + * The contents of this CResult_PhantomRouteHintsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents; + union LDKCResult_PhantomRouteHintsDecodeErrorZPtr contents; /** - * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. + * Whether this CResult_PhantomRouteHintsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceParseOrSemanticErrorZ; +} LDKCResult_PhantomRouteHintsDecodeErrorZ; + +/** + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::ChannelMonitors of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ChannelMonitorZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKChannelMonitor *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ChannelMonitorZ; /** - * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be - * invalid. + * An update generated by the underlying channel itself which contains some new information the + * [`ChannelMonitor`] should be made aware of. * - * # Invariants - * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`. + * Because this represents only a small number of updates to the underlying state, it is generally + * much smaller than a full [`ChannelMonitor`]. However, for large single commitment transaction + * updates (e.g. ones during which there are hundreds of HTLCs pending on the commitment + * transaction), a single update may reach upwards of 1 MiB in serialized size. */ -typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { +typedef struct MUST_USE_STRUCT LDKChannelMonitorUpdate { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeSignedRawInvoice *inner; + LDKnativeChannelMonitorUpdate *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKSignedRawInvoice; +} LDKChannelMonitorUpdate; /** - * The contents of CResult_SignedRawInvoiceParseErrorZ + * The `Watch` trait defines behavior for watching on-chain activity pertaining to channels as + * blocks are connected and disconnected. + * + * Each channel is associated with a [`ChannelMonitor`]. Implementations of this trait are + * responsible for maintaining a set of monitors such that they can be updated accordingly as + * channel state changes and HTLCs are resolved. See method documentation for specific + * requirements. + * + * Implementations **must** ensure that updates are successfully applied and persisted upon method + * completion. If an update fails with a [`PermanentFailure`], then it must immediately shut down + * without taking any further action such as persisting the current state. + * + * If an implementation maintains multiple instances of a channel's monitor (e.g., by storing + * backup copies), then it must ensure that updates are applied across all instances. Otherwise, it + * could result in a revoked transaction being broadcast, allowing the counterparty to claim all + * funds in the channel. See [`ChannelMonitorUpdateErr`] for more details about how to handle + * multiple instances. + * + * [`PermanentFailure`]: ChannelMonitorUpdateErr::PermanentFailure */ -typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr { +typedef struct LDKWatch { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * 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. */ - struct LDKSignedRawInvoice *result; + void *this_arg; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Watches a channel identified by `funding_txo` using `monitor`. + * + * Implementations are responsible for watching the chain for the funding transaction along + * with any spends of outputs returned by [`get_outputs_to_watch`]. In practice, this means + * calling [`block_connected`] and [`block_disconnected`] on the monitor. + * + * Note: this interface MUST error with `ChannelMonitorUpdateErr::PermanentFailure` if + * the given `funding_txo` has previously been registered via `watch_channel`. + * + * [`get_outputs_to_watch`]: channelmonitor::ChannelMonitor::get_outputs_to_watch + * [`block_connected`]: channelmonitor::ChannelMonitor::block_connected + * [`block_disconnected`]: channelmonitor::ChannelMonitor::block_disconnected */ - struct LDKParseError *err; -} LDKCResult_SignedRawInvoiceParseErrorZPtr; - -/** - * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_SignedRawInvoiceParseErrorZ { + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*watch_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor); /** - * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Updates a channel identified by `funding_txo` by applying `update` to its monitor. + * + * Implementations must call [`update_monitor`] with the given update. See + * [`ChannelMonitorUpdateErr`] for invariants around returning an error. + * + * [`update_monitor`]: channelmonitor::ChannelMonitor::update_monitor */ - union LDKCResult_SignedRawInvoiceParseErrorZPtr contents; + struct LDKCResult_NoneChannelMonitorUpdateErrZ (*update_channel)(const void *this_arg, struct LDKOutPoint funding_txo, struct LDKChannelMonitorUpdate update); /** - * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. + * Returns any monitor events since the last call. Subsequent calls must only return new + * events. + * + * Note that after any block- or transaction-connection calls to a [`ChannelMonitor`], no + * further events may be returned here until the [`ChannelMonitor`] has been fully persisted + * to disk. + * + * For details on asynchronous [`ChannelMonitor`] updating and returning + * [`MonitorEvent::UpdateCompleted`] here, see [`ChannelMonitorUpdateErr::TemporaryFailure`]. */ - bool result_ok; -} LDKCResult_SignedRawInvoiceParseErrorZ; - - + struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ (*release_pending_monitor_events)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKWatch; /** - * Represents an syntactically correct Invoice for a payment on the lightning network, - * but without the signature information. - * De- and encoding should not lead to information loss but may lead to different hashes. - * - * For methods without docs see the corresponding methods in `Invoice`. + * An interface to send a transaction to the Bitcoin network. */ -typedef struct MUST_USE_STRUCT LDKRawInvoice { +typedef struct LDKBroadcasterInterface { /** - * 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 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. */ - LDKnativeRawInvoice *inner; + void *this_arg; /** - * 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. + * Sends a transaction out to (hopefully) be mined. */ - bool is_owned; -} LDKRawInvoice; - - + void (*broadcast_transaction)(const void *this_arg, struct LDKTransaction tx); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKBroadcasterInterface; /** - * Recoverable signature + * A "slice" referencing some byte array. This is simply a length-tagged pointer which does not + * own the memory pointed to by data. */ -typedef struct MUST_USE_STRUCT LDKInvoiceSignature { +typedef struct LDKu8slice { /** - * 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 byte buffer */ - LDKnativeInvoiceSignature *inner; + const uint8_t *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 bytes pointed to by `data`. */ - bool is_owned; -} LDKInvoiceSignature; + uintptr_t datalen; +} LDKu8slice; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * A trait to describe an object which can get user secrets and key material. */ -typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { +typedef struct LDKKeysInterface { /** - * The element at position 0 + * 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. */ - struct LDKRawInvoice a; + void *this_arg; /** - * The element at position 1 + * Get node secret key based on the provided [`Recipient`]. + * + * The node_id/network_key is the public key that corresponds to this secret key. + * + * This method must return the same value each time it is called with a given `Recipient` + * parameter. */ - struct LDKThirtyTwoBytes b; + struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient); /** - * The element at position 2 + * Gets the ECDH shared secret of our [`node secret`] and `other_key`, multiplying by `tweak` if + * one is provided. Note that this tweak can be applied to `other_key` instead of our node + * secret, though this is less efficient. + * + * [`node secret`]: Self::get_node_secret */ - struct LDKInvoiceSignature c; -} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; - - - -/** - * Payee public key - */ -typedef struct MUST_USE_STRUCT LDKPayeePubKey { + struct LDKCResult_SharedSecretNoneZ (*ecdh)(const void *this_arg, enum LDKRecipient recipient, struct LDKPublicKey other_key, struct LDKCOption_ScalarZ tweak); /** - * 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. + * Get a script pubkey which we send funds to when claiming on-chain contestable outputs. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. */ - LDKnativePayeePubKey *inner; + struct LDKCVec_u8Z (*get_destination_script)(const void *this_arg); /** - * 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. + * Get a script pubkey which we will send funds to when closing a channel. + * + * This method should return a different value each time it is called, to avoid linking + * on-chain funds across channels as controlled to the same user. */ - bool is_owned; -} LDKPayeePubKey; - -/** - * The contents of CResult_PayeePubKeyErrorZ - */ -typedef union LDKCResult_PayeePubKeyErrorZPtr { + struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg); /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Get a new set of Sign for per-channel secrets. These MUST be unique even if you + * restarted with some stale data! + * + * This method must return a different value each time it is called. */ - struct LDKPayeePubKey *result; + struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Gets a unique, cryptographically-secure, random 32 byte value. This is used for encrypting + * onion packets and for temporary channel IDs. There is no requirement that these be + * persisted anywhere, though they must be unique across restarts. + * + * This method must return a different value each time it is called. */ - enum LDKSecp256k1Error *err; -} LDKCResult_PayeePubKeyErrorZPtr; - -/** - * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_PayeePubKeyErrorZ { + struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); /** - * The contents of this CResult_PayeePubKeyErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Reads a `Signer` for this `KeysInterface` from the given input stream. + * This is only called during deserialization of other objects which contain + * `Sign`-implementing objects (ie `ChannelMonitor`s and `ChannelManager`s). + * The bytes are exactly those which `::write()` writes, and + * contain no versioning scheme. You may wish to include your own version prefix and ensure + * you've read all of the provided bytes to ensure no corruption occurred. */ - union LDKCResult_PayeePubKeyErrorZPtr contents; + struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); /** - * Whether this CResult_PayeePubKeyErrorZ represents a success state. + * Sign an invoice. + * By parameterizing by the raw invoice bytes instead of the hash, we allow implementors of + * this trait to parse the invoice and make sure they're signing what they expect, rather than + * blindly signing the hash. + * The hrp is ascii bytes, while the invoice data is base32. + * + * The secret key used to sign the invoice is dependent on the [`Recipient`]. */ - bool result_ok; -} LDKCResult_PayeePubKeyErrorZ; - - + struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient); + /** + * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * + * If the implementor of this trait supports [phantom node payments], then every node that is + * intended to be included in the phantom invoice route hints must return the same value from + * this method. + * + * This method must return the same value each time it is called. + * + * [phantom node payments]: PhantomKeysManager + */ + struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKKeysInterface; /** - * Private routing information - * - * # Invariants - * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) + * A trait which should be implemented to provide feerate information on a number of time + * horizons. * + * Note that all of the functions implemented here *must* be reentrant-safe (obviously - they're + * called from inside the library in response to chain events, P2P events, or timer events). */ -typedef struct MUST_USE_STRUCT LDKPrivateRoute { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativePrivateRoute *inner; +typedef struct LDKFeeEstimator { /** - * 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 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. */ - bool is_owned; -} LDKPrivateRoute; - -/** - * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PrivateRouteZ { + void *this_arg; /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Gets estimated satoshis of fee required per 1000 Weight-Units. + * + * LDK will wrap this method and ensure that the value returned is no smaller than 253 + * (ie 1 satoshi-per-byte rounded up to ensure later round-downs don't put us below 1 satoshi-per-byte). + * + * The following unit conversions can be used to convert to sats/KW: + * * satoshis-per-byte * 250 + * * satoshis-per-kbyte / 4 */ - struct LDKPrivateRoute *data; + uint32_t (*get_est_sat_per_1000_weight)(const void *this_arg, enum LDKConfirmationTarget confirmation_target); /** - * The number of elements pointed to by `data`. + * 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. */ - uintptr_t datalen; -} LDKCVec_PrivateRouteZ; + void (*free)(void *this_arg); +} LDKFeeEstimator; /** - * A timestamp that refers to a date after 1 January 1970. + * 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. * - * # Invariants + * Implements ChannelMessageHandler, handling the multi-channel parts and passing things through + * to individual Channels. * - * The Unix timestamp representing the stored time has to be positive and no greater than - * [`MAX_TIMESTAMP`]. + * Implements Writeable to write out all channel state to disk. Implies peer_disconnected() for + * all peers during write/read (though does not modify this instance, only the instance being + * serialized). This will result in any channels which have not yet exchanged funding_created (ie + * called funding_transaction_generated for outbound channels). + * + * Note that you can be a bit lazier about writing out ChannelManager than you can be with + * ChannelMonitors. With ChannelMonitors you MUST write each monitor update out to disk before + * returning from chain::Watch::watch_/update_channel, with ChannelManagers, writing updates + * happens out-of-band (and will prevent any other ChannelManager operations from occurring during + * the serialization process). If the deserialized version is out-of-date compared to the + * ChannelMonitors passed by reference to read(), those channels will be force-closed based on the + * ChannelMonitor state and no funds will be lost (mod on-chain transaction fees). + * + * Note that the deserializer is only implemented for (BlockHash, ChannelManager), which + * tells you the last block hash which was block_connect()ed. You MUST rescan any blocks along + * the \"reorg path\" (ie call block_disconnected() until you get to a common block and then call + * block_connected() to step towards your best block) upon deserialization before using the + * object! + * + * Note that ChannelManager is responsible for tracking liveness of its channels and generating + * ChannelUpdate messages informing peers that the channel is temporarily disabled. To avoid + * spam due to quick disconnection/reconnection, updates are not sent until the channel has been + * offline for a full minute. In order to track this, you must call + * timer_tick_occurred roughly once per minute, though it doesn't have to be perfect. + * + * Rather than using a plain ChannelManager, it is preferable to use either a SimpleArcChannelManager + * a SimpleRefChannelManager, for conciseness. See their documentation for more details, but + * essentially you should default to using a SimpleRefChannelManager, and use a + * SimpleArcChannelManager when you require a ChannelManager with a static lifetime, such as when + * you're using lightning-net-tokio. */ -typedef struct MUST_USE_STRUCT LDKPositiveTimestamp { +typedef struct MUST_USE_STRUCT LDKChannelManager { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativePositiveTimestamp *inner; + LDKnativeChannelManager *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKPositiveTimestamp; - -/** - * The contents of CResult_PositiveTimestampCreationErrorZ - */ -typedef union LDKCResult_PositiveTimestampCreationErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKPositiveTimestamp *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKCreationError *err; -} LDKCResult_PositiveTimestampCreationErrorZPtr; - -/** - * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_PositiveTimestampCreationErrorZ { - /** - * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PositiveTimestampCreationErrorZPtr contents; - /** - * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_PositiveTimestampCreationErrorZ; - -/** - * The contents of CResult_NoneSemanticErrorZ - */ -typedef union LDKCResult_NoneSemanticErrorZPtr { - /** - * Note that this value is always NULL, as there are no contents in the OK variant - */ - void *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKSemanticError *err; -} LDKCResult_NoneSemanticErrorZPtr; +} LDKChannelManager; /** - * A CResult_NoneSemanticErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning_invoice::SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCResult_NoneSemanticErrorZ { +typedef struct LDKC2Tuple_BlockHashChannelManagerZ { /** - * The contents of this CResult_NoneSemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The element at position 0 */ - union LDKCResult_NoneSemanticErrorZPtr contents; + struct LDKThirtyTwoBytes a; /** - * Whether this CResult_NoneSemanticErrorZ represents a success state. + * The element at position 1 */ - bool result_ok; -} LDKCResult_NoneSemanticErrorZ; + struct LDKChannelManager b; +} LDKC2Tuple_BlockHashChannelManagerZ; /** - * The contents of CResult_InvoiceSemanticErrorZ + * The contents of CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ */ -typedef union LDKCResult_InvoiceSemanticErrorZPtr { +typedef union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoice *result; + struct LDKC2Tuple_BlockHashChannelManagerZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKSemanticError *err; -} LDKCResult_InvoiceSemanticErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr; /** - * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. + * A CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BlockHashChannelManagerZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InvoiceSemanticErrorZ { +typedef struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { /** - * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either + * The contents of this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceSemanticErrorZPtr contents; + union LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZPtr contents; /** - * Whether this CResult_InvoiceSemanticErrorZ represents a success state. + * Whether this CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceSemanticErrorZ; +} LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; /** - * Description string - * - * # Invariants - * The description can be at most 639 __bytes__ long + * Options which apply on a per-channel basis and may change at runtime or based on negotiation + * with our counterparty. */ -typedef struct MUST_USE_STRUCT LDKDescription { +typedef struct MUST_USE_STRUCT LDKChannelConfig { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDescription *inner; + LDKnativeChannelConfig *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKDescription; +} LDKChannelConfig; /** - * The contents of CResult_DescriptionCreationErrorZ + * The contents of CResult_ChannelConfigDecodeErrorZ */ -typedef union LDKCResult_DescriptionCreationErrorZPtr { +typedef union LDKCResult_ChannelConfigDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKDescription *result; + struct LDKChannelConfig *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKCreationError *err; -} LDKCResult_DescriptionCreationErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_ChannelConfigDecodeErrorZPtr; /** - * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. + * A CResult_ChannelConfigDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::config::ChannelConfig on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_DescriptionCreationErrorZ { +typedef struct LDKCResult_ChannelConfigDecodeErrorZ { /** - * The contents of this CResult_DescriptionCreationErrorZ, accessible via either + * The contents of this CResult_ChannelConfigDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_DescriptionCreationErrorZPtr contents; + union LDKCResult_ChannelConfigDecodeErrorZPtr contents; /** - * Whether this CResult_DescriptionCreationErrorZ represents a success state. + * Whether this CResult_ChannelConfigDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_DescriptionCreationErrorZ; +} LDKCResult_ChannelConfigDecodeErrorZ; /** - * The contents of CResult_PrivateRouteCreationErrorZ + * The contents of CResult_OutPointDecodeErrorZ */ -typedef union LDKCResult_PrivateRouteCreationErrorZPtr { +typedef union LDKCResult_OutPointDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPrivateRoute *result; + struct LDKOutPoint *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKCreationError *err; -} LDKCResult_PrivateRouteCreationErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_OutPointDecodeErrorZPtr; /** - * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. + * A CResult_OutPointDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_PrivateRouteCreationErrorZ { +typedef struct LDKCResult_OutPointDecodeErrorZ { /** - * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either + * The contents of this CResult_OutPointDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PrivateRouteCreationErrorZPtr contents; + union LDKCResult_OutPointDecodeErrorZPtr contents; /** - * Whether this CResult_PrivateRouteCreationErrorZ represents a success state. + * Whether this CResult_OutPointDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_PrivateRouteCreationErrorZ; +} LDKCResult_OutPointDecodeErrorZ; /** - * The contents of CResult_StringErrorZ + * Defines a type identifier for sending messages over the wire. + * + * Messages implementing this trait specify a type and must be [`Writeable`]. */ -typedef union LDKCResult_StringErrorZPtr { +typedef struct LDKType { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * 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. */ - struct LDKStr *result; + void *this_arg; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Returns the type identifying the message payload. */ - enum LDKSecp256k1Error *err; -} LDKCResult_StringErrorZPtr; - -/** - * A CResult_StringErrorZ represents the result of a fallible operation, - * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_StringErrorZ { + uint16_t (*type_id)(const void *this_arg); /** - * The contents of this CResult_StringErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Return a human-readable "debug" string describing this object */ - union LDKCResult_StringErrorZPtr contents; + struct LDKStr (*debug_str)(const void *this_arg); /** - * Whether this CResult_StringErrorZ represents a success state. + * Serialize the object into a byte array */ - bool result_ok; -} LDKCResult_StringErrorZ; + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKType; /** - * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ + * An enum which can either contain a crate::lightning::ln::wire::Type or not */ -typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { +typedef enum LDKCOption_TypeZ_Tag { + /** + * When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type + */ + LDKCOption_TypeZ_Some, + /** + * When we're in this state, this COption_TypeZ contains nothing + */ + LDKCOption_TypeZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_TypeZ_Sentinel, +} LDKCOption_TypeZ_Tag; + +typedef struct LDKCOption_TypeZ { + LDKCOption_TypeZ_Tag tag; + union { + struct { + struct LDKType some; + }; + }; +} LDKCOption_TypeZ; + +/** + * The contents of CResult_COption_TypeZDecodeErrorZ + */ +typedef union LDKCResult_COption_TypeZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelMonitorUpdate *result; + struct LDKCOption_TypeZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr; +} LDKCResult_COption_TypeZDecodeErrorZPtr; /** - * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { +typedef struct LDKCResult_COption_TypeZDecodeErrorZ { /** - * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either + * The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; + union LDKCResult_COption_TypeZDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + * Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; +} LDKCResult_COption_TypeZDecodeErrorZ; /** - * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not + * An error that may occur when making a payment. */ -typedef enum LDKCOption_MonitorEventZ_Tag { +typedef enum LDKPaymentError_Tag { /** - * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + * An error resulting from the provided [`Invoice`] or payment hash. */ - LDKCOption_MonitorEventZ_Some, + LDKPaymentError_Invoice, /** - * When we're in this state, this COption_MonitorEventZ contains nothing + * An error occurring when finding a route. */ - LDKCOption_MonitorEventZ_None, + LDKPaymentError_Routing, + /** + * An error occurring when sending a payment. + */ + LDKPaymentError_Sending, /** * Must be last for serialization purposes */ - LDKCOption_MonitorEventZ_Sentinel, -} LDKCOption_MonitorEventZ_Tag; + LDKPaymentError_Sentinel, +} LDKPaymentError_Tag; -typedef struct LDKCOption_MonitorEventZ { - LDKCOption_MonitorEventZ_Tag tag; +typedef struct MUST_USE_STRUCT LDKPaymentError { + LDKPaymentError_Tag tag; union { struct { - struct LDKMonitorEvent some; + struct LDKStr invoice; + }; + struct { + struct LDKLightningError routing; + }; + struct { + struct LDKPaymentSendFailure sending; }; }; -} LDKCOption_MonitorEventZ; +} LDKPaymentError; /** - * The contents of CResult_COption_MonitorEventZDecodeErrorZ + * The contents of CResult_PaymentIdPaymentErrorZ */ -typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr { +typedef union LDKCResult_PaymentIdPaymentErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_MonitorEventZ *result; + struct LDKThirtyTwoBytes *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_COption_MonitorEventZDecodeErrorZPtr; + struct LDKPaymentError *err; +} LDKCResult_PaymentIdPaymentErrorZPtr; /** - * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_PaymentIdPaymentErrorZ represents the result of a fallible operation, + * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning_invoice::payment::PaymentError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ { +typedef struct LDKCResult_PaymentIdPaymentErrorZ { /** - * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either + * The contents of this CResult_PaymentIdPaymentErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents; + union LDKCResult_PaymentIdPaymentErrorZPtr contents; /** - * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. + * Whether this CResult_PaymentIdPaymentErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_MonitorEventZDecodeErrorZ; +} LDKCResult_PaymentIdPaymentErrorZ; + + /** - * The contents of CResult_HTLCUpdateDecodeErrorZ + * A map with liquidity value (in msat) keyed by a short channel id and the direction the HTLC + * is traveling in. The direction boolean is determined by checking if the HTLC source's public + * key is less than its destination. See [`InFlightHtlcs::used_liquidity_msat`] for more + * details. */ -typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKInFlightHtlcs { + /** + * 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. + */ + LDKnativeInFlightHtlcs *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; +} LDKInFlightHtlcs; + +/** + * The contents of CResult_InFlightHtlcsDecodeErrorZ + */ +typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKHTLCUpdate *result; + struct LDKInFlightHtlcs *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_HTLCUpdateDecodeErrorZPtr; +} LDKCResult_InFlightHtlcsDecodeErrorZPtr; /** - * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::payment::InFlightHtlcs on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { +typedef struct LDKCResult_InFlightHtlcsDecodeErrorZ { /** - * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either + * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; + union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents; /** - * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_HTLCUpdateDecodeErrorZ; +} LDKCResult_InFlightHtlcsDecodeErrorZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Sub-errors which don't have specific information in them use this type. */ -typedef struct LDKC2Tuple_OutPointScriptZ { - /** - * The element at position 0 - */ - struct LDKOutPoint a; +typedef struct LDKError { /** - * The element at position 1 + * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_OutPointScriptZ; + uint8_t _dummy; +} LDKError; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Errors that indicate what is wrong with the invoice. They have some granularity for debug + * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user. */ -typedef struct LDKC2Tuple_u32ScriptZ { +typedef enum LDKParseError_Tag { + LDKParseError_Bech32Error, + LDKParseError_ParseAmountError, + LDKParseError_MalformedSignature, + LDKParseError_BadPrefix, + LDKParseError_UnknownCurrency, + LDKParseError_UnknownSiPrefix, + LDKParseError_MalformedHRP, + LDKParseError_TooShortDataPart, + LDKParseError_UnexpectedEndOfTaggedFields, + LDKParseError_DescriptionDecodeError, + LDKParseError_PaddingError, + LDKParseError_IntegerOverflowError, + LDKParseError_InvalidSegWitProgramLength, + LDKParseError_InvalidPubKeyHashLength, + LDKParseError_InvalidScriptHashLength, + LDKParseError_InvalidRecoveryId, + LDKParseError_InvalidSliceLength, /** - * The element at position 0 + * Not an error, but used internally to signal that a part of the invoice should be ignored + * according to BOLT11 */ - uint32_t a; + LDKParseError_Skip, /** - * The element at position 1 + * Must be last for serialization purposes */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_u32ScriptZ; + LDKParseError_Sentinel, +} LDKParseError_Tag; + +typedef struct MUST_USE_STRUCT LDKParseError { + LDKParseError_Tag tag; + union { + struct { + struct LDKBech32Error bech32_error; + }; + struct { + struct LDKError parse_amount_error; + }; + struct { + enum LDKSecp256k1Error malformed_signature; + }; + struct { + struct LDKError description_decode_error; + }; + struct { + struct LDKStr invalid_slice_length; + }; + }; +} LDKParseError; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_SiPrefixParseErrorZ */ -typedef struct LDKCVec_C2Tuple_u32ScriptZZ { +typedef union LDKCResult_SiPrefixParseErrorZPtr { /** - * 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 LDKC2Tuple_u32ScriptZ *data; + enum LDKSiPrefix *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_C2Tuple_u32ScriptZZ; + struct LDKParseError *err; +} LDKCResult_SiPrefixParseErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_SiPrefixParseErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::ParseError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +typedef struct LDKCResult_SiPrefixParseErrorZ { /** - * The element at position 0 + * The contents of this CResult_SiPrefixParseErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKThirtyTwoBytes a; + union LDKCResult_SiPrefixParseErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_SiPrefixParseErrorZ represents a success state. */ - struct LDKCVec_C2Tuple_u32ScriptZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; + bool result_ok; +} LDKCResult_SiPrefixParseErrorZ; + + /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. - * This corresponds to std::vector in C++ + * 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::(&str)` */ -typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +typedef struct MUST_USE_STRUCT LDKInvoice { /** - * 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_TxidCVec_C2Tuple_u32ScriptZZZ *data; + LDKnativeInvoice *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_TxidCVec_C2Tuple_u32ScriptZZZZ; + bool is_owned; +} LDKInvoice; /** - * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. - * This corresponds to std::vector in C++ + * Indicates that something went wrong while parsing or validating the invoice. Parsing errors + * should be mostly seen as opaque and are only there for debugging reasons. Semantic errors + * like wrong signatures, missing fields etc. could mean that someone tampered with the invoice. */ -typedef struct LDKCVec_EventZ { +typedef enum LDKParseOrSemanticError_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * The invoice couldn't be decoded */ - struct LDKEvent *data; + LDKParseOrSemanticError_ParseError, /** - * The number of elements pointed to by `data`. + * The invoice could be decoded but violates the BOLT11 standard */ - uintptr_t datalen; -} LDKCVec_EventZ; + LDKParseOrSemanticError_SemanticError, + /** + * Must be last for serialization purposes + */ + LDKParseOrSemanticError_Sentinel, +} LDKParseOrSemanticError_Tag; + +typedef struct MUST_USE_STRUCT LDKParseOrSemanticError { + LDKParseOrSemanticError_Tag tag; + union { + struct { + struct LDKParseError parse_error; + }; + struct { + enum LDKSemanticError semantic_error; + }; + }; +} LDKParseOrSemanticError; /** - * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_InvoiceParseOrSemanticErrorZ */ -typedef struct LDKCVec_TransactionZ { +typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr { /** - * 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 LDKTransaction *data; + struct LDKInvoice *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_TransactionZ; + struct LDKParseOrSemanticError *err; +} LDKCResult_InvoiceParseOrSemanticErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKC2Tuple_u32TxOutZ { +typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ { /** - * The element at position 0 + * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint32_t a; + union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. */ - struct LDKTxOut b; -} LDKC2Tuple_u32TxOutZ; + bool result_ok; +} LDKCResult_InvoiceParseOrSemanticErrorZ; + + /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. - * This corresponds to std::vector in C++ + * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be + * invalid. + * + * # Invariants + * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`. */ -typedef struct LDKCVec_C2Tuple_u32TxOutZZ { +typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { /** - * 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_u32TxOutZ *data; + LDKnativeSignedRawInvoice *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_u32TxOutZZ; + bool is_owned; +} LDKSignedRawInvoice; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * The contents of CResult_SignedRawInvoiceParseErrorZ */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr { /** - * The element at position 0 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKThirtyTwoBytes a; + struct LDKSignedRawInvoice *result; /** - * The element at position 1 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKCVec_C2Tuple_u32TxOutZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; + struct LDKParseError *err; +} LDKCResult_SignedRawInvoiceParseErrorZPtr; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_SignedRawInvoiceParseErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::SignedRawInvoice on success and a crate::lightning_invoice::ParseError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_TransactionOutputsZ { +typedef struct LDKCResult_SignedRawInvoiceParseErrorZ { /** - * 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_SignedRawInvoiceParseErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *data; + union LDKCResult_SignedRawInvoiceParseErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_TransactionOutputsZ; + bool result_ok; +} LDKCResult_SignedRawInvoiceParseErrorZ; + + /** - * Details about the balance(s) available for spending once the channel appears on chain. + * 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. * - * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not - * be provided. + * For methods without docs see the corresponding methods in `Invoice`. */ -typedef enum LDKBalance_Tag { - /** - * The channel is not yet closed (or the commitment or closing transaction has not yet - * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is - * force-closed now. - */ - LDKBalance_ClaimableOnChannelClose, +typedef struct MUST_USE_STRUCT LDKRawInvoice { /** - * The channel has been closed, and the given balance is ours but awaiting confirmations until - * we consider it spendable. + * 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. */ - LDKBalance_ClaimableAwaitingConfirmations, + LDKnativeRawInvoice *inner; /** - * The channel has been closed, and the given balance should be ours but awaiting spending - * transaction confirmation. If the spending transaction does not confirm in time, it is - * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. - * - * Once the spending transaction confirms, before it has reached enough confirmations to be - * considered safe from chain reorganizations, the balance will instead be provided via - * [`Balance::ClaimableAwaitingConfirmations`]. + * 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. */ - LDKBalance_ContentiousClaimable, + bool is_owned; +} LDKRawInvoice; + + + +/** + * Recoverable signature + */ +typedef struct MUST_USE_STRUCT LDKInvoiceSignature { /** - * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain - * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat - * likely to be claimed by our counterparty before we do. + * 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. */ - LDKBalance_MaybeClaimableHTLCAwaitingTimeout, + LDKnativeInvoiceSignature *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. */ - LDKBalance_Sentinel, -} LDKBalance_Tag; + bool is_owned; +} LDKInvoiceSignature; -typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * The element at position 0 */ - uint64_t claimable_amount_satoshis; -} LDKBalance_LDKClaimableOnChannelClose_Body; - -typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { + struct LDKRawInvoice a; /** - * The amount available to claim, in satoshis, possibly excluding the on-chain fees which - * were spent in broadcasting the transaction. + * The element at position 1 */ - uint64_t claimable_amount_satoshis; + struct LDKThirtyTwoBytes b; /** - * The height at which an [`Event::SpendableOutputs`] event will be generated for this - * amount. + * The element at position 2 */ - uint32_t confirmation_height; -} LDKBalance_LDKClaimableAwaitingConfirmations_Body; + struct LDKInvoiceSignature c; +} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; -typedef struct LDKBalance_LDKContentiousClaimable_Body { + + +/** + * Payee public key + */ +typedef struct MUST_USE_STRUCT LDKPayeePubKey { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * 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 claimable_amount_satoshis; + LDKnativePayeePubKey *inner; /** - * The height at which the counterparty may be able to claim the balance if we have not - * done so. + * 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. */ - uint32_t timeout_height; -} LDKBalance_LDKContentiousClaimable_Body; + bool is_owned; +} LDKPayeePubKey; -typedef struct LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body { +/** + * The contents of CResult_PayeePubKeyErrorZ + */ +typedef union LDKCResult_PayeePubKeyErrorZPtr { /** - * The amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint64_t claimable_amount_satoshis; + struct LDKPayeePubKey *result; /** - * The height at which we will be able to claim the balance if our counterparty has not - * done so. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - uint32_t claimable_height; -} LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body; + enum LDKSecp256k1Error *err; +} LDKCResult_PayeePubKeyErrorZPtr; + +/** + * A CResult_PayeePubKeyErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PayeePubKey on success and a crate::c_types::Secp256k1Error on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_PayeePubKeyErrorZ { + /** + * The contents of this CResult_PayeePubKeyErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_PayeePubKeyErrorZPtr contents; + /** + * Whether this CResult_PayeePubKeyErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_PayeePubKeyErrorZ; + -typedef struct MUST_USE_STRUCT LDKBalance { - LDKBalance_Tag tag; - union { - LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close; - LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations; - LDKBalance_LDKContentiousClaimable_Body contentious_claimable; - LDKBalance_LDKMaybeClaimableHTLCAwaitingTimeout_Body maybe_claimable_htlc_awaiting_timeout; - }; -} LDKBalance; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. + * Private routing information + * + * # Invariants + * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) + * + */ +typedef struct MUST_USE_STRUCT LDKPrivateRoute { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePrivateRoute *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKPrivateRoute; + +/** + * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_BalanceZ { +typedef struct LDKCVec_PrivateRouteZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKBalance *data; + struct LDKPrivateRoute *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_BalanceZ; +} LDKCVec_PrivateRouteZ; + + /** - * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ + * A timestamp that refers to a date after 1 January 1970. + * + * # Invariants + * + * The Unix timestamp representing the stored time has to be positive and no greater than + * [`MAX_TIMESTAMP`]. */ -typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKPositiveTimestamp { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePositiveTimestamp *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKPositiveTimestamp; + +/** + * The contents of CResult_PositiveTimestampCreationErrorZ + */ +typedef union LDKCResult_PositiveTimestampCreationErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *result; + struct LDKPositiveTimestamp *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; + enum LDKCreationError *err; +} LDKCResult_PositiveTimestampCreationErrorZPtr; /** - * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_PositiveTimestampCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PositiveTimestamp on success and a crate::lightning_invoice::CreationError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +typedef struct LDKCResult_PositiveTimestampCreationErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; + union LDKCResult_PositiveTimestampCreationErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +} LDKCResult_PositiveTimestampCreationErrorZ; /** - * The contents of CResult_NoneLightningErrorZ + * The contents of CResult_NoneSemanticErrorZ */ -typedef union LDKCResult_NoneLightningErrorZPtr { +typedef union LDKCResult_NoneSemanticErrorZPtr { /** * Note that this value is always NULL, as there are no contents in the OK variant */ @@ -8275,819 +9063,1012 @@ typedef union LDKCResult_NoneLightningErrorZPtr { * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKLightningError *err; -} LDKCResult_NoneLightningErrorZPtr; + enum LDKSemanticError *err; +} LDKCResult_NoneSemanticErrorZPtr; /** - * A CResult_NoneLightningErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. + * A CResult_NoneSemanticErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning_invoice::SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneLightningErrorZ { +typedef struct LDKCResult_NoneSemanticErrorZ { /** - * The contents of this CResult_NoneLightningErrorZ, accessible via either + * The contents of this CResult_NoneSemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneLightningErrorZPtr contents; + union LDKCResult_NoneSemanticErrorZPtr contents; /** - * Whether this CResult_NoneLightningErrorZ represents a success state. + * Whether this CResult_NoneSemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneLightningErrorZ; +} LDKCResult_NoneSemanticErrorZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * The contents of CResult_InvoiceSemanticErrorZ */ -typedef struct LDKC2Tuple_PublicKeyTypeZ { +typedef union LDKCResult_InvoiceSemanticErrorZPtr { /** - * The element at position 0 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKPublicKey a; + struct LDKInvoice *result; /** - * The element at position 1 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKType b; -} LDKC2Tuple_PublicKeyTypeZ; + enum LDKSemanticError *err; +} LDKCResult_InvoiceSemanticErrorZPtr; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { +typedef struct LDKCResult_InvoiceSemanticErrorZ { /** - * 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_InvoiceSemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKC2Tuple_PublicKeyTypeZ *data; + union LDKCResult_InvoiceSemanticErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_InvoiceSemanticErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_PublicKeyTypeZZ; + bool result_ok; +} LDKCResult_InvoiceSemanticErrorZ; + + /** - * The contents of CResult_boolLightningErrorZ + * Description string + * + * # Invariants + * The description can be at most 639 __bytes__ long */ -typedef union LDKCResult_boolLightningErrorZPtr { +typedef struct MUST_USE_STRUCT LDKDescription { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDescription *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKDescription; + +/** + * The contents of CResult_DescriptionCreationErrorZ + */ +typedef union LDKCResult_DescriptionCreationErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - bool *result; + struct LDKDescription *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKLightningError *err; -} LDKCResult_boolLightningErrorZPtr; + enum LDKCreationError *err; +} LDKCResult_DescriptionCreationErrorZPtr; /** - * A CResult_boolLightningErrorZ represents the result of a fallible operation, - * containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. + * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_boolLightningErrorZ { +typedef struct LDKCResult_DescriptionCreationErrorZ { /** - * The contents of this CResult_boolLightningErrorZ, accessible via either + * The contents of this CResult_DescriptionCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_boolLightningErrorZPtr contents; + union LDKCResult_DescriptionCreationErrorZPtr contents; /** - * Whether this CResult_boolLightningErrorZ represents a success state. + * Whether this CResult_DescriptionCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_boolLightningErrorZ; +} LDKCResult_DescriptionCreationErrorZ; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * The contents of CResult_PrivateRouteCreationErrorZ */ -typedef struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - /** - * The element at position 0 - */ - struct LDKChannelAnnouncement a; +typedef union LDKCResult_PrivateRouteCreationErrorZPtr { /** - * The element at position 1 + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKChannelUpdate b; + struct LDKPrivateRoute *result; /** - * The element at position 2 + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKChannelUpdate c; -} LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; + enum LDKCreationError *err; +} LDKCResult_PrivateRouteCreationErrorZPtr; /** - * A dynamically-allocated array of crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZs of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { +typedef struct LDKCResult_PrivateRouteCreationErrorZ { /** - * 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_PrivateRouteCreationErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *data; + union LDKCResult_PrivateRouteCreationErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_PrivateRouteCreationErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; + bool result_ok; +} LDKCResult_PrivateRouteCreationErrorZ; /** - * A dynamically-allocated array of crate::lightning::ln::msgs::NodeAnnouncements of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_StringErrorZ */ -typedef struct LDKCVec_NodeAnnouncementZ { +typedef union LDKCResult_StringErrorZPtr { /** - * 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 LDKNodeAnnouncement *data; + struct LDKStr *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_NodeAnnouncementZ; + enum LDKSecp256k1Error *err; +} LDKCResult_StringErrorZPtr; /** - * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. - * This corresponds to std::vector in C++ + * A CResult_StringErrorZ represents the result of a fallible operation, + * containing a crate::c_types::Str on success and a crate::c_types::Secp256k1Error on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCVec_PublicKeyZ { +typedef struct LDKCResult_StringErrorZ { /** - * 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_StringErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKPublicKey *data; + union LDKCResult_StringErrorZPtr contents; /** - * The number of elements pointed to by `data`. + * Whether this CResult_StringErrorZ represents a success state. */ - uintptr_t datalen; -} LDKCVec_PublicKeyZ; + bool result_ok; +} LDKCResult_StringErrorZ; /** - * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not + * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ */ -typedef enum LDKCOption_NetAddressZ_Tag { - /** - * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress - */ - LDKCOption_NetAddressZ_Some, +typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { /** - * When we're in this state, this COption_NetAddressZ contains nothing + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKCOption_NetAddressZ_None, + struct LDKChannelMonitorUpdate *result; /** - * Must be last for serialization purposes + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKCOption_NetAddressZ_Sentinel, -} LDKCOption_NetAddressZ_Tag; - -typedef struct LDKCOption_NetAddressZ { - LDKCOption_NetAddressZ_Tag tag; - union { - struct { - struct LDKNetAddress some; - }; - }; -} LDKCOption_NetAddressZ; - - + struct LDKDecodeError *err; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr; /** - * Error for PeerManager errors. If you get one of these, you must disconnect the socket and - * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the - * descriptor. + * A CResult_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct MUST_USE_STRUCT LDKPeerHandleError { +typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { /** - * 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_ChannelMonitorUpdateDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativePeerHandleError *inner; + union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr 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_ChannelMonitorUpdateDecodeErrorZ represents a success state. */ - bool is_owned; -} LDKPeerHandleError; + bool result_ok; +} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; /** - * The contents of CResult_CVec_u8ZPeerHandleErrorZ + * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not */ -typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_u8Z *result; +typedef enum LDKCOption_MonitorEventZ_Tag { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent */ - struct LDKPeerHandleError *err; -} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; - -/** - * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { + LDKCOption_MonitorEventZ_Some, /** - * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_MonitorEventZ contains nothing */ - union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; + LDKCOption_MonitorEventZ_None, /** - * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. + * Must be last for serialization purposes */ - bool result_ok; -} LDKCResult_CVec_u8ZPeerHandleErrorZ; + LDKCOption_MonitorEventZ_Sentinel, +} LDKCOption_MonitorEventZ_Tag; + +typedef struct LDKCOption_MonitorEventZ { + LDKCOption_MonitorEventZ_Tag tag; + union { + struct { + struct LDKMonitorEvent some; + }; + }; +} LDKCOption_MonitorEventZ; /** - * The contents of CResult_NonePeerHandleErrorZ + * The contents of CResult_COption_MonitorEventZDecodeErrorZ */ -typedef union LDKCResult_NonePeerHandleErrorZPtr { +typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - void *result; + struct LDKCOption_MonitorEventZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPeerHandleError *err; -} LDKCResult_NonePeerHandleErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_COption_MonitorEventZDecodeErrorZPtr; /** - * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * A CResult_COption_MonitorEventZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_MonitorEventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NonePeerHandleErrorZ { +typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ { /** - * The contents of this CResult_NonePeerHandleErrorZ, accessible via either + * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePeerHandleErrorZPtr contents; + union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents; /** - * Whether this CResult_NonePeerHandleErrorZ represents a success state. + * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NonePeerHandleErrorZ; +} LDKCResult_COption_MonitorEventZDecodeErrorZ; /** - * The contents of CResult_boolPeerHandleErrorZ + * The contents of CResult_HTLCUpdateDecodeErrorZ */ -typedef union LDKCResult_boolPeerHandleErrorZPtr { +typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - bool *result; + struct LDKHTLCUpdate *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPeerHandleError *err; -} LDKCResult_boolPeerHandleErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_HTLCUpdateDecodeErrorZPtr; /** - * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, - * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * A CResult_HTLCUpdateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::channelmonitor::HTLCUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_boolPeerHandleErrorZ { +typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { /** - * The contents of this CResult_boolPeerHandleErrorZ, accessible via either + * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_boolPeerHandleErrorZPtr contents; + union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; /** - * Whether this CResult_boolPeerHandleErrorZ represents a success state. + * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_boolPeerHandleErrorZ; - - +} LDKCResult_HTLCUpdateDecodeErrorZ; /** - * Represents the compressed public key of a node + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKNodeId { +typedef struct LDKC2Tuple_OutPointScriptZ { /** - * 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 element at position 0 */ - LDKnativeNodeId *inner; + struct LDKOutPoint a; /** - * 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 element at position 1 */ - bool is_owned; -} LDKNodeId; + struct LDKCVec_u8Z b; +} LDKC2Tuple_OutPointScriptZ; /** - * The contents of CResult_NodeIdDecodeErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_NodeIdDecodeErrorZPtr { +typedef struct LDKC2Tuple_u32ScriptZ { /** - * 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 LDKNodeId *result; + uint32_t 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_NodeIdDecodeErrorZPtr; + struct LDKCVec_u8Z b; +} LDKC2Tuple_u32ScriptZ; /** - * A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_NodeIdDecodeErrorZ { +typedef struct LDKCVec_C2Tuple_u32ScriptZZ { /** - * The contents of this CResult_NodeIdDecodeErrorZ, 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_NodeIdDecodeErrorZPtr contents; + struct LDKC2Tuple_u32ScriptZ *data; /** - * Whether this CResult_NodeIdDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_NodeIdDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_u32ScriptZZ; /** - * The contents of CResult_COption_NetworkUpdateZDecodeErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_COption_NetworkUpdateZDecodeErrorZPtr { +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { /** - * 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 LDKCOption_NetworkUpdateZ *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_COption_NetworkUpdateZDecodeErrorZPtr; + struct LDKCVec_C2Tuple_u32ScriptZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; /** - * A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ { +typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { /** - * The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, 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_COption_NetworkUpdateZDecodeErrorZPtr contents; + struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; /** - * Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_COption_NetworkUpdateZDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; /** - * The `Access` trait defines behavior for accessing chain data and state, such as blocks and - * UTXOs. + * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKAccess { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef struct LDKCVec_EventZ { /** - * Returns the transaction output of a funding transaction encoded by [`short_channel_id`]. - * Returns an error if `genesis_hash` is for a different chain or if such a transaction output - * is unknown. - * - * [`short_channel_id`]: https://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md#definition-of-short_channel_id + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCResult_TxOutAccessErrorZ (*get_utxo)(const void *this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id); + struct LDKEvent *data; /** - * 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. + * The number of elements pointed to by `data`. */ - void (*free)(void *this_arg); -} LDKAccess; + uintptr_t datalen; +} LDKCVec_EventZ; /** - * An enum which can either contain a crate::lightning::chain::Access or not + * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef enum LDKCOption_AccessZ_Tag { - /** - * When we're in this state, this COption_AccessZ contains a crate::lightning::chain::Access - */ - LDKCOption_AccessZ_Some, +typedef struct LDKCVec_TransactionZ { /** - * When we're in this state, this COption_AccessZ contains nothing + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - LDKCOption_AccessZ_None, + struct LDKTransaction *data; /** - * Must be last for serialization purposes + * The number of elements pointed to by `data`. */ - LDKCOption_AccessZ_Sentinel, -} LDKCOption_AccessZ_Tag; - -typedef struct LDKCOption_AccessZ { - LDKCOption_AccessZ_Tag tag; - union { - struct { - struct LDKAccess some; - }; - }; -} LDKCOption_AccessZ; - - + uintptr_t datalen; +} LDKCVec_TransactionZ; /** - * Details about one direction of a channel as received within a [`ChannelUpdate`]. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKChannelUpdateInfo { +typedef struct LDKC2Tuple_u32TxOutZ { /** - * 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 element at position 0 */ - LDKnativeChannelUpdateInfo *inner; + uint32_t a; /** - * 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 element at position 1 */ - bool is_owned; -} LDKChannelUpdateInfo; + struct LDKTxOut b; +} LDKC2Tuple_u32TxOutZ; /** - * The contents of CResult_ChannelUpdateInfoDecodeErrorZ + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr { +typedef struct LDKCVec_C2Tuple_u32TxOutZZ { /** - * 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 LDKChannelUpdateInfo *result; + struct LDKC2Tuple_u32TxOutZ *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_ChannelUpdateInfoDecodeErrorZPtr; + uintptr_t datalen; +} LDKCVec_C2Tuple_u32TxOutZZ; /** - * A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCResult_ChannelUpdateInfoDecodeErrorZ { +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { /** - * The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The element at position 0 */ - union LDKCResult_ChannelUpdateInfoDecodeErrorZPtr contents; + struct LDKThirtyTwoBytes a; /** - * Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state. + * The element at position 1 */ - bool result_ok; -} LDKCResult_ChannelUpdateInfoDecodeErrorZ; - - + struct LDKCVec_C2Tuple_u32TxOutZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; /** - * Details about a channel (both directions). - * Received within a channel announcement. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKChannelInfo { +typedef struct LDKCVec_TransactionOutputsZ { /** - * 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(). */ - LDKnativeChannelInfo *inner; + struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *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; -} LDKChannelInfo; + uintptr_t datalen; +} LDKCVec_TransactionOutputsZ; /** - * The contents of CResult_ChannelInfoDecodeErrorZ + * Details about the balance(s) available for spending once the channel appears on chain. + * + * See [`ChannelMonitor::get_claimable_balances`] for more details on when these will or will not + * be provided. */ -typedef union LDKCResult_ChannelInfoDecodeErrorZPtr { +typedef enum LDKBalance_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The channel is not yet closed (or the commitment or closing transaction has not yet + * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is + * force-closed now. */ - struct LDKChannelInfo *result; + LDKBalance_ClaimableOnChannelClose, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The channel has been closed, and the given balance is ours but awaiting confirmations until + * we consider it spendable. */ - struct LDKDecodeError *err; -} LDKCResult_ChannelInfoDecodeErrorZPtr; - -/** - * A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelInfoDecodeErrorZ { + LDKBalance_ClaimableAwaitingConfirmations, /** - * The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The channel has been closed, and the given balance should be ours but awaiting spending + * transaction confirmation. If the spending transaction does not confirm in time, it is + * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. + * + * Once the spending transaction confirms, before it has reached enough confirmations to be + * considered safe from chain reorganizations, the balance will instead be provided via + * [`Balance::ClaimableAwaitingConfirmations`]. */ - union LDKCResult_ChannelInfoDecodeErrorZPtr contents; + LDKBalance_ContentiousClaimable, /** - * Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. + * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain + * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat + * likely to be claimed by our counterparty before we do. */ - bool result_ok; -} LDKCResult_ChannelInfoDecodeErrorZ; - - - -/** - * Fees for routing via a given channel or a node - */ -typedef struct MUST_USE_STRUCT LDKRoutingFees { + LDKBalance_MaybeTimeoutClaimableHTLC, /** - * 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. + * HTLCs which we received from our counterparty which are claimable with a preimage which we + * do not currently have. This will only be claimable if we receive the preimage from the node + * to which we forwarded this HTLC before the timeout. */ - LDKnativeRoutingFees *inner; + LDKBalance_MaybePreimageClaimableHTLC, /** - * 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 has been closed, and our counterparty broadcasted a revoked commitment + * transaction. + * + * Thus, we're able to claim all outputs in the commitment transaction, one of which has the + * following amount. */ - bool is_owned; -} LDKRoutingFees; - -/** - * The contents of CResult_RoutingFeesDecodeErrorZ - */ -typedef union LDKCResult_RoutingFeesDecodeErrorZPtr { + LDKBalance_CounterpartyRevokedOutputClaimable, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Must be last for serialization purposes */ - struct LDKRoutingFees *result; + LDKBalance_Sentinel, +} LDKBalance_Tag; + +typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - struct LDKDecodeError *err; -} LDKCResult_RoutingFeesDecodeErrorZPtr; + uint64_t claimable_amount_satoshis; +} LDKBalance_LDKClaimableOnChannelClose_Body; -/** - * A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_RoutingFeesDecodeErrorZ { +typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { /** - * The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The amount available to claim, in satoshis, possibly excluding the on-chain fees which + * were spent in broadcasting the transaction. */ - union LDKCResult_RoutingFeesDecodeErrorZPtr contents; + uint64_t claimable_amount_satoshis; /** - * Whether this CResult_RoutingFeesDecodeErrorZ represents a success state. + * The height at which an [`Event::SpendableOutputs`] event will be generated for this + * amount. */ - bool result_ok; -} LDKCResult_RoutingFeesDecodeErrorZ; + uint32_t confirmation_height; +} LDKBalance_LDKClaimableAwaitingConfirmations_Body; +typedef struct LDKBalance_LDKContentiousClaimable_Body { + /** + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. + */ + uint64_t claimable_amount_satoshis; + /** + * The height at which the counterparty may be able to claim the balance if we have not + * done so. + */ + uint32_t timeout_height; +} LDKBalance_LDKContentiousClaimable_Body; + +typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body { + /** + * The amount potentially available to claim, in satoshis, excluding the on-chain fees + * which will be required to do so. + */ + uint64_t claimable_amount_satoshis; + /** + * The height at which we will be able to claim the balance if our counterparty has not + * done so. + */ + uint32_t claimable_height; +} LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body; + +typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body { + /** + * The amount potentially available to claim, in satoshis, excluding the on-chain fees + * which will be required to do so. + */ + uint64_t claimable_amount_satoshis; + /** + * The height at which our counterparty will be able to claim the balance if we have not + * yet received the preimage and claimed it ourselves. + */ + uint32_t expiry_height; +} LDKBalance_LDKMaybePreimageClaimableHTLC_Body; + +typedef struct LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body { + /** + * The amount, in satoshis, of the output which we can claim. + * + * Note that for outputs from HTLC balances this may be excluding some on-chain fees that + * were already spent. + */ + uint64_t claimable_amount_satoshis; +} LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body; +typedef struct MUST_USE_STRUCT LDKBalance { + LDKBalance_Tag tag; + union { + LDKBalance_LDKClaimableOnChannelClose_Body claimable_on_channel_close; + LDKBalance_LDKClaimableAwaitingConfirmations_Body claimable_awaiting_confirmations; + LDKBalance_LDKContentiousClaimable_Body contentious_claimable; + LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body maybe_timeout_claimable_htlc; + LDKBalance_LDKMaybePreimageClaimableHTLC_Body maybe_preimage_claimable_htlc; + LDKBalance_LDKCounterpartyRevokedOutputClaimable_Body counterparty_revoked_output_claimable; + }; +} LDKBalance; /** - * Information received in the latest node_announcement from this node. + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKNodeAnnouncementInfo { +typedef struct LDKCVec_BalanceZ { /** - * 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(). */ - LDKnativeNodeAnnouncementInfo *inner; + struct LDKBalance *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; -} LDKNodeAnnouncementInfo; + uintptr_t datalen; +} LDKCVec_BalanceZ; /** - * The contents of CResult_NodeAnnouncementInfoDecodeErrorZ + * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ */ -typedef union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr { +typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNodeAnnouncementInfo *result; + struct LDKC2Tuple_BlockHashChannelMonitorZ *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; /** - * A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ { +typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { /** - * The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either + * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NodeAnnouncementInfoDecodeErrorZPtr contents; + union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; /** - * Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state. + * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NodeAnnouncementInfoDecodeErrorZ; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; /** - * A dynamically-allocated array of u64s of arbitrary size. + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_PublicKeyTypeZ { + /** + * The element at position 0 + */ + struct LDKPublicKey a; + /** + * The element at position 1 + */ + struct LDKType b; +} LDKC2Tuple_PublicKeyTypeZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_u64Z { +typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - uint64_t *data; + struct LDKC2Tuple_PublicKeyTypeZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_u64Z; +} LDKCVec_C2Tuple_PublicKeyTypeZZ; + +/** + * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not + */ +typedef enum LDKCOption_NetAddressZ_Tag { + /** + * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress + */ + LDKCOption_NetAddressZ_Some, + /** + * When we're in this state, this COption_NetAddressZ contains nothing + */ + LDKCOption_NetAddressZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_NetAddressZ_Sentinel, +} LDKCOption_NetAddressZ_Tag; + +typedef struct LDKCOption_NetAddressZ { + LDKCOption_NetAddressZ_Tag tag; + union { + struct { + struct LDKNetAddress some; + }; + }; +} LDKCOption_NetAddressZ; /** - * Details about a node in the network, known from the network announcement. + * Error for PeerManager errors. If you get one of these, you must disconnect the socket and + * generate no further read_event/write_buffer_space_avail/socket_disconnected calls for the + * descriptor. */ -typedef struct MUST_USE_STRUCT LDKNodeInfo { +typedef struct MUST_USE_STRUCT LDKPeerHandleError { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNodeInfo *inner; + LDKnativePeerHandleError *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKNodeInfo; +} LDKPeerHandleError; /** - * The contents of CResult_NodeInfoDecodeErrorZ + * The contents of CResult_CVec_u8ZPeerHandleErrorZ */ -typedef union LDKCResult_NodeInfoDecodeErrorZPtr { +typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNodeInfo *result; + struct LDKCVec_u8Z *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_NodeInfoDecodeErrorZPtr; + struct LDKPeerHandleError *err; +} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; /** - * A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_CVec_u8ZPeerHandleErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_u8Z on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NodeInfoDecodeErrorZ { +typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { /** - * The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either + * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NodeInfoDecodeErrorZPtr contents; + union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; /** - * Whether this CResult_NodeInfoDecodeErrorZ represents a success state. + * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NodeInfoDecodeErrorZ; +} LDKCResult_CVec_u8ZPeerHandleErrorZ; /** - * The contents of CResult_NetworkGraphDecodeErrorZ + * The contents of CResult_NonePeerHandleErrorZ */ -typedef union LDKCResult_NetworkGraphDecodeErrorZPtr { +typedef union LDKCResult_NonePeerHandleErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKPeerHandleError *err; +} LDKCResult_NonePeerHandleErrorZPtr; + +/** + * A CResult_NonePeerHandleErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NonePeerHandleErrorZ { + /** + * The contents of this CResult_NonePeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NonePeerHandleErrorZPtr contents; + /** + * Whether this CResult_NonePeerHandleErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NonePeerHandleErrorZ; + +/** + * The contents of CResult_boolPeerHandleErrorZ + */ +typedef union LDKCResult_boolPeerHandleErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKNetworkGraph *result; + bool *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_NetworkGraphDecodeErrorZPtr; + struct LDKPeerHandleError *err; +} LDKCResult_boolPeerHandleErrorZPtr; /** - * A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::network_graph::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_boolPeerHandleErrorZ represents the result of a fallible operation, + * containing a bool on success and a crate::lightning::ln::peer_handler::PeerHandleError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NetworkGraphDecodeErrorZ { +typedef struct LDKCResult_boolPeerHandleErrorZ { /** - * The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either + * The contents of this CResult_boolPeerHandleErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NetworkGraphDecodeErrorZPtr contents; + union LDKCResult_boolPeerHandleErrorZPtr contents; /** - * Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. + * Whether this CResult_boolPeerHandleErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NetworkGraphDecodeErrorZ; +} LDKCResult_boolPeerHandleErrorZ; /** - * An enum which can either contain a crate::c_types::derived::CVec_NetAddressZ or not + * Errors that may occur when [sending an onion message]. + * + * [sending an onion message]: OnionMessenger::send_onion_message */ -typedef enum LDKCOption_CVec_NetAddressZZ_Tag { +typedef enum LDKSendError_Tag { /** - * When we're in this state, this COption_CVec_NetAddressZZ contains a crate::c_types::derived::CVec_NetAddressZ + * Errored computing onion message packet keys. */ - LDKCOption_CVec_NetAddressZZ_Some, + LDKSendError_Secp256k1, /** - * When we're in this state, this COption_CVec_NetAddressZZ contains nothing + * Because implementations such as Eclair will drop onion messages where the message packet + * exceeds 32834 bytes, we refuse to send messages where the packet exceeds this size. */ - LDKCOption_CVec_NetAddressZZ_None, + LDKSendError_TooBigPacket, + /** + * The provided [`Destination`] was an invalid [`BlindedRoute`], due to having fewer than two + * blinded hops. + */ + LDKSendError_TooFewBlindedHops, + /** + * Our next-hop peer was offline or does not support onion message forwarding. + */ + LDKSendError_InvalidFirstHop, + /** + * Our next-hop peer's buffer was full or our total outbound buffer was full. + */ + LDKSendError_BufferFull, /** * Must be last for serialization purposes */ - LDKCOption_CVec_NetAddressZZ_Sentinel, -} LDKCOption_CVec_NetAddressZZ_Tag; + LDKSendError_Sentinel, +} LDKSendError_Tag; -typedef struct LDKCOption_CVec_NetAddressZZ { - LDKCOption_CVec_NetAddressZZ_Tag tag; +typedef struct MUST_USE_STRUCT LDKSendError { + LDKSendError_Tag tag; union { struct { - struct LDKCVec_NetAddressZ some; + enum LDKSecp256k1Error secp256k1; }; }; -} LDKCOption_CVec_NetAddressZZ; +} LDKSendError; /** - * The contents of CResult_NetAddressDecodeErrorZ + * The contents of CResult_NoneSendErrorZ */ -typedef union LDKCResult_NetAddressDecodeErrorZPtr { +typedef union LDKCResult_NoneSendErrorZPtr { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKNetAddress *result; + void *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_NetAddressDecodeErrorZPtr; + struct LDKSendError *err; +} LDKCResult_NoneSendErrorZPtr; /** - * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_NoneSendErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NetAddressDecodeErrorZ { +typedef struct LDKCResult_NoneSendErrorZ { /** - * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either + * The contents of this CResult_NoneSendErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NetAddressDecodeErrorZPtr contents; + union LDKCResult_NoneSendErrorZPtr contents; /** - * Whether this CResult_NetAddressDecodeErrorZ represents a success state. + * Whether this CResult_NoneSendErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NetAddressDecodeErrorZ; - - +} LDKCResult_NoneSendErrorZ; /** - * An update_add_htlc message to be sent or received from a peer + * 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 + */ +typedef union LDKCResult_NetAddressDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKNetAddress *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_NetAddressDecodeErrorZPtr; + +/** + * A CResult_NetAddressDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::NetAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NetAddressDecodeErrorZ { + /** + * The contents of this CResult_NetAddressDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NetAddressDecodeErrorZPtr contents; + /** + * Whether this CResult_NetAddressDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NetAddressDecodeErrorZ; + + + +/** + * An update_add_htlc message to be sent or received from a peer */ typedef struct MUST_USE_STRUCT LDKUpdateAddHTLC { /** @@ -9535,37 +10516,37 @@ typedef struct LDKCResult_FundingSignedDecodeErrorZ { } LDKCResult_FundingSignedDecodeErrorZ; /** - * The contents of CResult_FundingLockedDecodeErrorZ + * The contents of CResult_ChannelReadyDecodeErrorZ */ -typedef union LDKCResult_FundingLockedDecodeErrorZPtr { +typedef union LDKCResult_ChannelReadyDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKFundingLocked *result; + struct LDKChannelReady *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKDecodeError *err; -} LDKCResult_FundingLockedDecodeErrorZPtr; +} LDKCResult_ChannelReadyDecodeErrorZPtr; /** - * A CResult_FundingLockedDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::msgs::FundingLocked on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_FundingLockedDecodeErrorZ { +typedef struct LDKCResult_ChannelReadyDecodeErrorZ { /** - * The contents of this CResult_FundingLockedDecodeErrorZ, accessible via either + * The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_FundingLockedDecodeErrorZPtr contents; + union LDKCResult_ChannelReadyDecodeErrorZPtr contents; /** - * Whether this CResult_FundingLockedDecodeErrorZ represents a success state. + * Whether this CResult_ChannelReadyDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_FundingLockedDecodeErrorZ; +} LDKCResult_ChannelReadyDecodeErrorZ; @@ -9906,6 +10887,59 @@ typedef struct LDKCResult_UpdateAddHTLCDecodeErrorZ { +/** + * An onion message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKOnionMessage { + /** + * 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. + */ + LDKnativeOnionMessage *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; +} LDKOnionMessage; + +/** + * The contents of CResult_OnionMessageDecodeErrorZ + */ +typedef union LDKCResult_OnionMessageDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOnionMessage *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_OnionMessageDecodeErrorZPtr; + +/** + * A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::msgs::OnionMessage 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_OnionMessageDecodeErrorZ { + /** + * The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OnionMessageDecodeErrorZPtr contents; + /** + * Whether this CResult_OnionMessageDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OnionMessageDecodeErrorZ; + + + /** * A ping message to be sent or received from a peer */ @@ -10281,6 +11315,26 @@ typedef struct LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ { bool result_ok; } LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ; + + +/** + * A node_announcement message to be sent or received from a peer + */ +typedef struct MUST_USE_STRUCT LDKNodeAnnouncement { + /** + * 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. + */ + LDKnativeNodeAnnouncement *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; +} LDKNodeAnnouncement; + /** * The contents of CResult_NodeAnnouncementDecodeErrorZ */ @@ -10586,7 +11640,7 @@ typedef struct LDKCResult_InvoiceSignOrCreationErrorZ { * * Used to convey to a [`Filter`] such an output with a given spending condition. Any transaction * spending the output must be given to [`ChannelMonitor::block_connected`] either directly or via - * the return value of [`Filter::register_output`]. + * [`Confirm::transactions_confirmed`]. * * If `block_hash` is `Some`, this indicates the output was created in the corresponding block and * may have been spent there. See [`Filter::register_output`] for details. @@ -10645,15 +11699,12 @@ typedef struct LDKFilter { /** * Registers interest in spends of a transaction output. * - * Optionally, when `output.block_hash` is set, should return any transaction spending the - * output that is found in the corresponding block along with its index. - * - * This return value is useful for Electrum clients in order to supply in-block descendant - * transactions which otherwise were not included. This is not necessary for other clients if - * such descendant transactions were already included (e.g., when a BIP 157 client provides the - * full block). + * Note that this method might be called during processing of a new block. You therefore need + * to ensure that also dependent output spents within an already connected block are correctly + * handled, e.g., by re-scanning the block in question whenever new outputs have been + * registered mid-processing. */ - struct LDKCOption_C2Tuple_usizeTransactionZZ (*register_output)(const void *this_arg, struct LDKWatchedOutput output); + void (*register_output)(const void *this_arg, struct LDKWatchedOutput output); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -10780,6 +11831,28 @@ typedef struct LDKMessageSendEventsProvider { void (*free)(void *this_arg); } LDKMessageSendEventsProvider; +/** + * 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 implemented for objects handling events from [`EventsProvider`]. */ @@ -10809,11 +11882,17 @@ typedef struct LDKEventHandler { * * # Requirements * - * See [`process_pending_events`] for requirements around event processing. - * * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending - * event since the last invocation. The handler must either act upon the event immediately - * or preserve it for later handling. + * 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 @@ -10837,9 +11916,7 @@ typedef struct LDKEventsProvider { /** * Processes any events generated since the last call using the given event handler. * - * Subsequent calls must only process new events. However, handlers must be capable of handling - * duplicate events across process restarts. This may occur if the provider was recovered from - * an old state (i.e., it hadn't been successfully persisted after processing pending events). + * See the trait-level documentation for requirements. */ void (*process_pending_events)(const void *this_arg, struct LDKEventHandler handler); /** @@ -10851,6 +11928,107 @@ typedef struct LDKEventsProvider { +/** + * Lightning TLV uses a custom variable-length integer called BigSize. It is similar to Bitcoin's + * variable-length integers except that it is serialized in big-endian instead of little-endian. + * + * Like Bitcoin's variable-length integer, it exhibits ambiguity in that certain values can be + * encoded in several different ways, which we must check for at deserialization-time. Thus, if + * you're looking for an example of a variable-length integer to use for your own project, move + * along, this is a rather poor design. + */ +typedef struct MUST_USE_STRUCT LDKBigSize { + /** + * 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. + */ + LDKnativeBigSize *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; +} LDKBigSize; + +/** + * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. + */ +typedef struct LDKPersister { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Persist the given ['ChannelManager'] to disk, returning an error if persistence failed. + */ + struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); + /** + * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. + */ + struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); + /** + * Persist the given [`WriteableScore`] to disk, returning an error if persistence failed. + */ + struct LDKCResult_NoneErrorZ (*persist_scorer)(const void *this_arg, const struct LDKWriteableScore *NONNULL_PTR scorer); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKPersister; + +/** + * A callback which is called when a [`Future`] completes. + * + * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be + * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`] + * instead. + * + * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule + * futures when they receive a wake, rather than immediately executing them. + */ +typedef struct LDKFutureCallback { + /** + * 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; + /** + * The method which is called. + */ + void (*call)(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); +} LDKFutureCallback; + + + +/** + * A simple future which can complete once, and calls some callback(s) when it does so. + */ +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; + + + /** * Configuration we set when applicable. * @@ -10952,6 +12130,10 @@ typedef struct MUST_USE_STRUCT LDKBestBlock { * sourcing chain data using a block-oriented API should prefer this interface over [`Confirm`]. * Such clients fetch the entire header chain whereas clients using [`Confirm`] only fetch headers * when needed. + * + * By using [`Listen::filtered_block_connected`] this interface supports clients fetching the + * entire header chain and only blocks with matching transaction data using BIP 157 filters or + * other similar filtering. */ typedef struct LDKListen { /** @@ -10959,6 +12141,11 @@ typedef struct LDKListen { * This has no meaning in the LDK, and can be NULL or any other value. */ void *this_arg; + /** + * Notifies the listener that a block was added at the given height, with the transaction data + * possibly filtered. + */ + void (*filtered_block_connected)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** * Notifies the listener that a block was added at the given height. */ @@ -11026,7 +12213,7 @@ typedef struct LDKConfirm { * in the event of a chain reorganization, it must not be called with a `header` that is no * longer in the chain as of the last call to [`best_block_updated`]. * - * [chain order]: Confirm#Order + * [chain order]: Confirm#order * [`best_block_updated`]: Self::best_block_updated */ void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); @@ -11034,8 +12221,8 @@ typedef struct LDKConfirm { * Processes a transaction that is no longer confirmed as result of a chain reorganization. * * Should be called for any transaction returned by [`get_relevant_txids`] if it has been - * reorganized out of the best chain. Once called, the given transaction should not be returned - * by [`get_relevant_txids`] unless it has been reconfirmed via [`transactions_confirmed`]. + * reorganized out of the best chain. Once called, the given transaction will not be returned + * by [`get_relevant_txids`], unless it has been reconfirmed via [`transactions_confirmed`]. * * [`get_relevant_txids`]: Self::get_relevant_txids * [`transactions_confirmed`]: Self::transactions_confirmed @@ -11051,9 +12238,9 @@ typedef struct LDKConfirm { /** * Returns transactions that should be monitored for reorganization out of the chain. * - * Should include any transactions passed to [`transactions_confirmed`] that have insufficient - * confirmations to be safe from a chain reorganization. Should not include any transactions - * passed to [`transaction_unconfirmed`] unless later reconfirmed. + * Will include any transactions passed to [`transactions_confirmed`] that have insufficient + * confirmations to be safe from a chain reorganization. Will not include any transactions + * passed to [`transaction_unconfirmed`], unless later reconfirmed. * * May be called to determine the subset of transactions that must still be monitored for * reorganization. Will be idempotent between calls but may change as a result of calls to the @@ -11299,16 +12486,6 @@ typedef struct MUST_USE_STRUCT LDKChainParameters { bool is_owned; } LDKChainParameters; -/** - * A 3-byte byte array. - */ -typedef struct LDKThreeBytes { - /** - * The three bytes - */ - uint8_t data[3]; -} LDKThreeBytes; - /** * A trait to describe an object which can receive channel messages. * @@ -11338,9 +12515,9 @@ typedef struct LDKChannelMessageHandler { */ void (*handle_funding_signed)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingSigned *NONNULL_PTR msg); /** - * Handle an incoming funding_locked message from the given peer. + * Handle an incoming channel_ready message from the given peer. */ - void (*handle_funding_locked)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKFundingLocked *NONNULL_PTR msg); + void (*handle_channel_ready)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelReady *NONNULL_PTR msg); /** * Handle an incoming shutdown message from the given peer. */ @@ -11404,6 +12581,20 @@ typedef struct LDKChannelMessageHandler { * Handle an incoming error message from the given peer. */ void (*handle_error)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKErrorMessage *NONNULL_PTR msg); + /** + * Gets the node feature flags which this handler itself supports. All available handlers are + * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] + * which are broadcasted in our [`NodeAnnouncement`] message. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * Note that this method is called before [`Self::peer_connected`]. + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); /** * Implementation of MessageSendEventsProvider for this object. */ @@ -11469,29 +12660,62 @@ typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { /** - * Proof that the sender knows the per-commitment secret of the previous commitment transaction. - * This is used to convince the recipient that the channel is at a certain commitment - * number even if they lost that data due to a local failure. Of course, the peer may lie - * and even later commitments may have been revoked. + * A set of keys that were HKDF-expanded from an initial call to + * [`KeysInterface::get_inbound_payment_key_material`]. + * + * [`KeysInterface::get_inbound_payment_key_material`]: crate::chain::keysinterface::KeysInterface::get_inbound_payment_key_material */ -typedef struct MUST_USE_STRUCT LDKDataLossProtect { +typedef struct MUST_USE_STRUCT LDKExpandedKey { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeDataLossProtect *inner; + LDKnativeExpandedKey *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKDataLossProtect; +} LDKExpandedKey; + + /** - * A trait to describe an object which can receive routing messages. - * + * Proof that the sender knows the per-commitment secret of the previous commitment transaction. + * This is used to convince the recipient that the channel is at a certain commitment + * number even if they lost that data due to a local failure. Of course, the peer may lie + * and even later commitments may have been revoked. + */ +typedef struct MUST_USE_STRUCT LDKDataLossProtect { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDataLossProtect *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKDataLossProtect; + +/** + * A 3-byte byte array. + */ +typedef struct LDKThreeBytes { + /** + * The three bytes + */ + uint8_t data[3]; +} LDKThreeBytes; + +/** + * A trait to describe an object which can receive routing messages. + * * # Implementor DoS Warnings * * For `gossip_queries` messages there are potential DoS vectors when handling @@ -11520,20 +12744,21 @@ typedef struct LDKRoutingMessageHandler { */ struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); /** - * Gets a subset of the channel announcements and updates required to dump our routing table - * to a remote node, starting at the short_channel_id indicated by starting_point and - * including the batch_amount entries immediately higher in numerical value than starting_point. + * Gets channel announcements and updates required to dump our routing table to a remote node, + * starting at the short_channel_id indicated by starting_point and including announcements + * for a single channel. */ - struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcements)(const void *this_arg, uint64_t starting_point, uint8_t batch_amount); + struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ (*get_next_channel_announcement)(const void *this_arg, uint64_t starting_point); /** - * Gets a subset of the node announcements required to dump our routing table to a remote node, - * starting at the node *after* the provided publickey and including batch_amount entries - * immediately higher (as defined by ::cmp) than starting_point. + * Gets a node announcement required to dump our routing table to a remote node, starting at + * the node *after* the provided pubkey and including up to one announcement immediately + * higher (as defined by ::cmp) than starting_point. * If None is provided for starting_point, we start at the first node. * * Note that starting_point (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCVec_NodeAnnouncementZ (*get_next_node_announcements)(const void *this_arg, struct LDKPublicKey starting_point, uint8_t batch_amount); + struct LDKNodeAnnouncement (*get_next_node_announcement)(const void *this_arg, struct LDKPublicKey starting_point); /** * Called when a connection is established with a peer. This can be used to * perform routing table synchronization using a strategy defined by the @@ -11563,6 +12788,20 @@ typedef struct LDKRoutingMessageHandler { * list of short_channel_ids. */ struct LDKCResult_NoneLightningErrorZ (*handle_query_short_channel_ids)(const void *this_arg, struct LDKPublicKey their_node_id, struct LDKQueryShortChannelIds msg); + /** + * Gets the node feature flags which this handler itself supports. All available handlers are + * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] + * which are broadcasted in our [`NodeAnnouncement`] message. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * Note that this method is called before [`Self::peer_connected`]. + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); /** * Implementation of MessageSendEventsProvider for this object. */ @@ -11574,6 +12813,54 @@ typedef struct LDKRoutingMessageHandler { void (*free)(void *this_arg); } LDKRoutingMessageHandler; +/** + * A trait to describe an object that can receive onion messages. + */ +typedef struct LDKOnionMessageHandler { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Handle an incoming onion_message message from the given peer. + */ + void (*handle_onion_message)(const void *this_arg, struct LDKPublicKey peer_node_id, const struct LDKOnionMessage *NONNULL_PTR msg); + /** + * Called when a connection is established with a peer. Can be used to track which peers + * advertise onion message support and are online. + */ + void (*peer_connected)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKInit *NONNULL_PTR init); + /** + * Indicates a connection to the peer failed/an existing connection was lost. Allows handlers to + * drop and refuse to forward onion messages to this peer. + */ + void (*peer_disconnected)(const void *this_arg, struct LDKPublicKey their_node_id, bool no_connection_possible); + /** + * Gets the node feature flags which this handler itself supports. All available handlers are + * queried similarly and their feature flags are OR'd together to form the [`NodeFeatures`] + * which are broadcasted in our [`NodeAnnouncement`] message. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Gets the init feature flags which should be sent to the given peer. All available handlers + * are queried similarly and their feature flags are OR'd together to form the [`InitFeatures`] + * which are sent in our [`Init`] message. + * + * Note that this method is called before [`Self::peer_connected`]. + */ + struct LDKInitFeatures (*provided_init_features)(const void *this_arg, struct LDKPublicKey their_node_id); + /** + * Implementation of OnionMessageProvider for this object. + */ + struct LDKOnionMessageProvider OnionMessageProvider; + /** + * 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); +} LDKOnionMessageHandler; + /** * Trait to be implemented by custom message (unrelated to the channel/gossip LN layers) * decoders. @@ -11823,6 +13110,13 @@ typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { bool is_owned; } LDKDirectedChannelTransactionParameters; +/** + * Integer in the range `0..=16` + */ +typedef struct LDKWitnessVersion { + uint8_t _0; +} LDKWitnessVersion; + /** @@ -11855,20 +13149,20 @@ typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the * [`NetworkGraph`]. */ -typedef struct MUST_USE_STRUCT LDKNetGraphMsgHandler { +typedef struct MUST_USE_STRUCT LDKP2PGossipSync { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeNetGraphMsgHandler *inner; + LDKnativeP2PGossipSync *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKNetGraphMsgHandler; +} LDKP2PGossipSync; @@ -11947,6 +13241,10 @@ typedef struct LDKEffectiveCapacity_LDKTotal_Body { * The funding amount denominated in millisatoshi. */ uint64_t capacity_msat; + /** + * The maximum HTLC amount denominated in millisatoshi. + */ + struct LDKCOption_u64Z htlc_maximum_msat; } LDKEffectiveCapacity_LDKTotal_Body; typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { @@ -11958,93 +13256,45 @@ typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { }; } LDKEffectiveCapacity; -/** - * An interface used to score payment channels for path finding. - * - *\tScoring is in terms of fees willing to be paid in order to avoid routing through a channel. - */ -typedef struct LDKScore { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Returns the fee in msats willing to be paid to avoid routing `send_amt_msat` through the - * given channel in the direction from `source` to `target`. - * - * The channel's capacity (less any other MPP parts that are also being considered for use in - * the same payment) is given by `capacity_msat`. It may be determined from various sources - * such as a chain data, network gossip, or invoice hints. For invoice hints, a capacity near - * [`u64::max_value`] is given to indicate sufficient capacity for the invoice's full amount. - * Thus, implementations should be overflow-safe. - */ - uint64_t (*channel_penalty_msat)(const void *this_arg, uint64_t short_channel_id, uint64_t send_amt_msat, uint64_t capacity_msat, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target); - /** - * Handles updating channel penalties after failing to route through a channel. - */ - void (*payment_path_failed)(void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); - /** - * Handles updating channel penalties after successfully routing along a path. - */ - void (*payment_path_successful)(void *this_arg, struct LDKCVec_RouteHopZ path); - /** - * Serialize the object into a byte array - */ - struct LDKCVec_u8Z (*write)(const void *this_arg); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKScore; + /** - * A scorer that is accessed under a lock. - * - * Needed so that calls to [`Score::channel_penalty_msat`] in [`find_route`] can be made while - * having shared ownership of a scorer but without requiring internal locking in [`Score`] - * implementations. Internal locking would be detrimental to route finding performance and could - * result in [`Score::channel_penalty_msat`] returning a different value for the same channel. - * - * [`find_route`]: crate::routing::router::find_route + * A concrete implementation of [`LockableScore`] which supports multi-threading. */ -typedef struct LDKLockableScore { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; +typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { /** - * Returns the locked scorer. + * 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 LDKScore (*lock)(const void *this_arg); + LDKnativeMultiThreadedLockableScore *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); -} LDKLockableScore; + bool is_owned; +} LDKMultiThreadedLockableScore; /** - * A concrete implementation of [`LockableScore`] which supports multi-threading. + * A locked `MultiThreadedLockableScore`. */ -typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { +typedef struct MUST_USE_STRUCT LDKMultiThreadedScoreLock { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeMultiThreadedLockableScore *inner; + LDKnativeMultiThreadedScoreLock *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKMultiThreadedLockableScore; +} LDKMultiThreadedScoreLock; @@ -12053,6 +13303,9 @@ typedef struct MUST_USE_STRUCT LDKMultiThreadedLockableScore { * * Used to configure base, liquidity, and amount penalties, the sum of which comprises the channel * penalty (i.e., the amount in msats willing to be paid to avoid routing through the channel). + * + * The penalty applied to any channel by the [`ProbabilisticScorer`] is the sum of each of the + * parameters here. */ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { /** @@ -12071,6 +13324,107 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { +/** + * A sender, receiver and forwarder of onion messages. In upcoming releases, this object will be + * used to retrieve invoices and fulfill invoice requests from [offers]. Currently, only sending + * and receiving empty onion messages is supported. + * + * # Example + * + * ``` + * # extern crate bitcoin; + * # use bitcoin::hashes::_export::_core::time::Duration; + * # use bitcoin::secp256k1::{PublicKey, Secp256k1, SecretKey}; + * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface}; + * # use lightning::onion_message::messenger::{Destination, OnionMessenger}; + * # use lightning::onion_message::blinded_route::BlindedRoute; + * # use lightning::util::logger::{Logger, Record}; + * # use std::sync::Arc; + * # struct FakeLogger {}; + * # impl Logger for FakeLogger { + * # fn log(&self, record: &Record) { unimplemented!() } + * # } + * # let seed = [42u8; 32]; + * # let time = Duration::from_secs(123456); + * # let keys_manager = KeysManager::new(&seed, time.as_secs(), time.subsec_nanos()); + * # let logger = Arc::new(FakeLogger {}); + * # let node_secret = SecretKey::from_slice(&hex::decode(\"0101010101010101010101010101010101010101010101010101010101010101\").unwrap()[..]).unwrap(); + * # let secp_ctx = Secp256k1::new(); + * # let hop_node_id1 = PublicKey::from_secret_key(&secp_ctx, &node_secret); + * # let (hop_node_id2, hop_node_id3, hop_node_id4) = (hop_node_id1, hop_node_id1, + * hop_node_id1); + * # let destination_node_id = hop_node_id1; + * # + * // Create the onion messenger. This must use the same `keys_manager` as is passed to your + * // ChannelManager. + * let onion_messenger = OnionMessenger::new(&keys_manager, logger); + * + * // Send an empty onion message to a node id. + * let intermediate_hops = [hop_node_id1, hop_node_id2]; + * let reply_path = None; + * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), reply_path); + * + * // Create a blinded route 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_route = BlindedRoute::new(&hops, &keys_manager, &secp_ctx).unwrap(); + * + * // Send an empty onion message to a blinded route. + * # let intermediate_hops = [hop_node_id1, hop_node_id2]; + * let reply_path = None; + * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), reply_path); + * ``` + * + * [offers]: + * [`OnionMessenger`]: crate::onion_message::OnionMessenger + */ +typedef struct MUST_USE_STRUCT LDKOnionMessenger { + /** + * 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. + */ + LDKnativeOnionMessenger *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; +} LDKOnionMessenger; + +/** + * The destination of an onion message. + */ +typedef enum LDKDestination_Tag { + /** + * We're sending this onion message to a node. + */ + LDKDestination_Node, + /** + * We're sending this onion message to a blinded route. + */ + LDKDestination_BlindedRoute, + /** + * Must be last for serialization purposes + */ + LDKDestination_Sentinel, +} LDKDestination_Tag; + +typedef struct MUST_USE_STRUCT LDKDestination { + LDKDestination_Tag tag; + union { + struct { + struct LDKPublicKey node; + }; + struct { + struct LDKBlindedRoute blinded_route; + }; + }; +} LDKDestination; + + + /** * FilesystemPersister persists channel data on disk, where each channel's * data is stored in a file named after its funding outpoint. @@ -12112,8 +13466,8 @@ typedef struct MUST_USE_STRUCT LDKFilesystemPersister { * [`ChannelManager`] persistence should be done in the background. * * Calling [`ChannelManager::timer_tick_occurred`] and [`PeerManager::timer_tick_occurred`] * at the appropriate intervals. - * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`NetGraphMsgHandler`] is provided to - * [`BackgroundProcessor::start`]). + * * Calling [`NetworkGraph::remove_stale_channels`] (if a [`GossipSync`] with a [`NetworkGraph`] + * is provided to [`BackgroundProcessor::start`]). * * It will also call [`PeerManager::process_events`] periodically though this shouldn't be relied * upon as doing so may result in high latency. @@ -12144,1549 +13498,2160 @@ typedef struct MUST_USE_STRUCT LDKBackgroundProcessor { bool is_owned; } LDKBackgroundProcessor; + + +/** + * Rapid Gossip Sync struct + * See [crate-level documentation] for usage. + * + * [crate-level documentation]: crate + */ +typedef struct MUST_USE_STRUCT LDKRapidGossipSync { + /** + * 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. + */ + LDKnativeRapidGossipSync *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; +} LDKRapidGossipSync; + +/** + * Either [`P2PGossipSync`] or [`RapidGossipSync`]. + */ +typedef enum LDKGossipSync_Tag { + /** + * Gossip sync via the lightning peer-to-peer network as defined by BOLT 7. + */ + LDKGossipSync_P2P, + /** + * Rapid gossip sync from a trusted server. + */ + LDKGossipSync_Rapid, + /** + * No gossip sync. + */ + LDKGossipSync_None, + /** + * Must be last for serialization purposes + */ + LDKGossipSync_Sentinel, +} LDKGossipSync_Tag; + +typedef struct MUST_USE_STRUCT LDKGossipSync { + LDKGossipSync_Tag tag; + union { + struct { + /** + * Note that this field is expected to be a reference. + */ + struct LDKP2PGossipSync p2p; + }; + struct { + /** + * Note that this field is expected to be a reference. + */ + struct LDKRapidGossipSync rapid; + }; + }; +} LDKGossipSync; + + + +/** + * Data of the `RawInvoice` that is encoded in the data part + */ +typedef struct MUST_USE_STRUCT LDKRawDataPart { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRawDataPart *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKRawDataPart; + + + +/** + * SHA-256 hash + */ +typedef struct MUST_USE_STRUCT LDKSha256 { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSha256 *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKSha256; + + + +/** + * Positive duration that defines when (relatively to the timestamp) in the future the invoice + * expires + */ +typedef struct MUST_USE_STRUCT LDKExpiryTime { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeExpiryTime *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKExpiryTime; + + + +/** + * `min_final_cltv_expiry` to use for the last HTLC in the route + */ +typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMinFinalCltvExpiry *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMinFinalCltvExpiry; + +/** + * A 20-byte byte array. + */ +typedef struct LDKTwentyBytes { + /** + * The twenty bytes + */ + uint8_t data[20]; +} LDKTwentyBytes; + +/** + * Fallback address in case no LN payment is possible + */ +typedef enum LDKFallback_Tag { + LDKFallback_SegWitProgram, + LDKFallback_PubKeyHash, + LDKFallback_ScriptHash, + /** + * Must be last for serialization purposes + */ + LDKFallback_Sentinel, +} LDKFallback_Tag; + +typedef struct LDKFallback_LDKSegWitProgram_Body { + struct LDKu5 version; + struct LDKCVec_u8Z program; +} LDKFallback_LDKSegWitProgram_Body; + +typedef struct MUST_USE_STRUCT LDKFallback { + LDKFallback_Tag tag; + union { + LDKFallback_LDKSegWitProgram_Body seg_wit_program; + struct { + struct LDKTwentyBytes pub_key_hash; + }; + struct { + struct LDKTwentyBytes script_hash; + }; + }; +} LDKFallback; + +/** + * A trait defining behavior of an [`Invoice`] payer. + */ +typedef struct LDKPayer { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns the payer's node id. + */ + struct LDKPublicKey (*node_id)(const void *this_arg); + /** + * Returns the payer's channels. + */ + struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg); + /** + * Sends a payment over the Lightning Network using the given [`Route`]. + * + * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); + /** + * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. + */ + struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); + /** + * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. + */ + struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); + /** + * Signals that no further retries for the given payment will occur. + */ + void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKPayer; + +/** + * A trait defining behavior for routing an [`Invoice`] payment. + */ +typedef struct LDKRouter { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); + /** + * Lets the router know that payment through a specific path has failed. + */ + void (*notify_payment_path_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + /** + * Lets the router know that payment through a specific path was successful. + */ + void (*notify_payment_path_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path); + /** + * Lets the router know that a payment probe was successful. + */ + void (*notify_payment_probe_successful)(const void *this_arg, struct LDKCVec_RouteHopZ path); + /** + * Lets the router know that a payment probe failed. + */ + void (*notify_payment_probe_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKRouter; + + + +/** + * A utility for paying [`Invoice`]s and sending spontaneous payments. + * + * See [module-level documentation] for details. + * + * [module-level documentation]: crate::payment + */ +typedef struct MUST_USE_STRUCT LDKInvoicePayer { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInvoicePayer *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKInvoicePayer; + +/** + * Strategies available to retry payment path failures for an [`Invoice`]. + * + */ +typedef enum LDKRetry_Tag { + /** + * Max number of attempts to retry payment. + * + * Note that this is the number of *path* failures, not full payment retries. For multi-path + * payments, if this is less than the total number of paths, we will never even retry all of the + * payment's paths. + */ + LDKRetry_Attempts, + /** + * Time elapsed before abandoning retries for a payment. + */ + LDKRetry_Timeout, + /** + * Must be last for serialization purposes + */ + LDKRetry_Sentinel, +} LDKRetry_Tag; + +typedef struct MUST_USE_STRUCT LDKRetry { + LDKRetry_Tag tag; + union { + struct { + uintptr_t attempts; + }; + struct { + uint64_t timeout; + }; + }; +} LDKRetry; + + + +/** + * A [`Router`] implemented using [`find_route`]. + */ +typedef struct MUST_USE_STRUCT LDKDefaultRouter { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDefaultRouter *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKDefaultRouter; + +extern const uintptr_t MAX_BUF_SIZE; + +extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; + +extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; + +extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; + +extern const uint32_t ANTI_REORG_DELAY; + +extern const uint16_t BREAKDOWN_TIMEOUT; + +extern const uint16_t MIN_CLTV_EXPIRY_DELTA; + +extern const uint32_t MIN_FINAL_CLTV_EXPIRY; + +extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; + +extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; + +extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA; + +extern const uint8_t DEFAULT_MAX_PATH_COUNT; + +extern const uint64_t MAX_TIMESTAMP; + +extern const uint64_t DEFAULT_EXPIRY_TIME; + +extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY; + +extern const uint8_t TAG_PAYMENT_HASH; + +extern const uint8_t TAG_DESCRIPTION; + +extern const uint8_t TAG_PAYEE_PUB_KEY; + +extern const uint8_t TAG_DESCRIPTION_HASH; + +extern const uint8_t TAG_EXPIRY_TIME; + +extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY; + +extern const uint8_t TAG_FALLBACK; + +extern const uint8_t TAG_PRIVATE_ROUTE; + +extern const uint8_t TAG_PAYMENT_SECRET; + +extern const uint8_t TAG_FEATURES; + +struct LDKStr _ldk_get_compiled_version(void); + +struct LDKStr _ldk_c_bindings_get_compiled_version(void); + +/** + * Creates a new Bech32Error which has the same data as `orig` + */ +struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); + +/** + * Releases any memory held by the given `Bech32Error` (which is currently none) + */ +void Bech32Error_free(struct LDKBech32Error o); + +/** + * Frees the data buffer, if data_is_owned is set and datalen > 0. + */ +void Transaction_free(struct LDKTransaction _res); + +/** + * Convenience function for constructing a new TxOut + */ +struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); + +/** + * Frees the data pointed to by script_pubkey. + */ +void TxOut_free(struct LDKTxOut _res); + +/** + * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + */ +struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); + +/** + * Frees the data buffer, if chars_is_owned is set and len > 0. + */ +void Str_free(struct LDKStr _res); + +#if defined(LDK_DEBUG_BUILD) +/** + * This function exists for memory safety testing purposes. It should never be used in production + * code + */ +const void *__unmangle_inner_ptr(const void *ptr); +#endif + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); + +/** + * Creates a new CResult_BlindedRouteNoneZ in the success state. + */ +struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_ok(struct LDKBlindedRoute o); + +/** + * Creates a new CResult_BlindedRouteNoneZ in the error state. + */ +struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedRouteNoneZ_is_ok(const struct LDKCResult_BlindedRouteNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedRouteNoneZ. + */ +void CResult_BlindedRouteNoneZ_free(struct LDKCResult_BlindedRouteNoneZ _res); + +/** + * Creates a new CResult_BlindedRouteDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_ok(struct LDKBlindedRoute o); + +/** + * Creates a new CResult_BlindedRouteDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedRouteDecodeErrorZ_is_ok(const struct LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedRouteDecodeErrorZ. + */ +void CResult_BlindedRouteDecodeErrorZ_free(struct LDKCResult_BlindedRouteDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); + +/** + * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_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); + +/** + * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. + */ +void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); + +/** + * Creates a new CResult_NoneNoneZ in the success state. + */ +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); + +/** + * Creates a new CResult_NoneNoneZ in the error state. + */ +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneNoneZ. + */ +void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); + +/** + * Creates a new CResult_NoneNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. + */ +void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); + +/** + * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SecretKeyErrorZ in the success state. + */ +struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o); + +/** + * Creates a new CResult_SecretKeyErrorZ in the error state. + */ +struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SecretKeyErrorZ. + */ +void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); + +/** + * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PublicKeyErrorZ in the success state. + */ +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); + +/** + * Creates a new CResult_PublicKeyErrorZ in the error state. + */ +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PublicKeyErrorZ. + */ +void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); + +/** + * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. + */ +void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); + +/** + * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); + /** - * Trait that handles persisting a [`ChannelManager`] and [`NetworkGraph`] to disk. + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. */ -typedef struct LDKPersister { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Persist the given [`ChannelManager`] to disk, returning an error if persistence failed - * (which will cause the [`BackgroundProcessor`] which called this method to exit). - */ - struct LDKCResult_NoneErrorZ (*persist_manager)(const void *this_arg, const struct LDKChannelManager *NONNULL_PTR channel_manager); - /** - * Persist the given [`NetworkGraph`] to disk, returning an error if persistence failed. - */ - struct LDKCResult_NoneErrorZ (*persist_graph)(const void *this_arg, const struct LDKNetworkGraph *NONNULL_PTR network_graph); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKPersister; - - +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); /** - * Data of the `RawInvoice` that is encoded in the data part + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKRawDataPart { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRawDataPart *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKRawDataPart; +bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. + */ +void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); +/** + * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); /** - * SHA-256 hash + * Creates a new CResult_TxCreationKeysErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKSha256 { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeSha256 *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKSha256; +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o); +/** + * Creates a new CResult_TxCreationKeysErrorZ in the error state. + */ +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o); /** - * Positive duration that defines when (relatively to the timestamp) in the future the invoice - * expires + * Frees any resources used by the CResult_TxCreationKeysErrorZ. */ -typedef struct MUST_USE_STRUCT LDKExpiryTime { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeExpiryTime *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKExpiryTime; +void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res); +/** + * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig); +/** + * Constructs a new COption_u32Z containing a u32 + */ +struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); /** - * `min_final_cltv_expiry` to use for the last HTLC in the route + * Constructs a new COption_u32Z containing nothing */ -typedef struct MUST_USE_STRUCT LDKMinFinalCltvExpiry { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMinFinalCltvExpiry *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKMinFinalCltvExpiry; +struct LDKCOption_u32Z COption_u32Z_none(void); /** - * A 20-byte byte array. + * Frees any resources associated with the u32, if we are in the Some state */ -typedef struct LDKTwentyBytes { - /** - * The twenty bytes - */ - uint8_t data[20]; -} LDKTwentyBytes; +void COption_u32Z_free(struct LDKCOption_u32Z _res); /** - * Fallback address in case no LN payment is possible + * Creates a new COption_u32Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -typedef enum LDKFallback_Tag { - LDKFallback_SegWitProgram, - LDKFallback_PubKeyHash, - LDKFallback_ScriptHash, - /** - * Must be last for serialization purposes - */ - LDKFallback_Sentinel, -} LDKFallback_Tag; +struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); -typedef struct LDKFallback_LDKSegWitProgram_Body { - struct LDKu5 version; - struct LDKCVec_u8Z program; -} LDKFallback_LDKSegWitProgram_Body; +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); -typedef struct MUST_USE_STRUCT LDKFallback { - LDKFallback_Tag tag; - union { - LDKFallback_LDKSegWitProgram_Body seg_wit_program; - struct { - struct LDKTwentyBytes pub_key_hash; - }; - struct { - struct LDKTwentyBytes script_hash; - }; - }; -} LDKFallback; +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); /** - * A trait defining behavior of an [`Invoice`] payer. + * Checks if the given object is currently in the success state */ -typedef struct LDKPayer { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Returns the payer's node id. - */ - struct LDKPublicKey (*node_id)(const void *this_arg); - /** - * Returns the payer's channels. - */ - struct LDKCVec_ChannelDetailsZ (*first_hops)(const void *this_arg); - /** - * Sends a payment over the Lightning Network using the given [`Route`]. - * - * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); - /** - * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. - */ - struct LDKCResult_PaymentIdPaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); - /** - * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. - */ - struct LDKCResult_NonePaymentSendFailureZ (*retry_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id); - /** - * Signals that no further retries for the given payment will occur. - */ - void (*abandon_payment)(const void *this_arg, struct LDKThirtyTwoBytes payment_id); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKPayer; +bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); /** - * A trait defining behavior for routing an [`Invoice`] payment. + * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. */ -typedef struct LDKRouter { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. - * - * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKCResult_RouteLightningErrorZ (*find_route)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, const uint8_t (*payment_hash)[32], struct LDKCVec_ChannelDetailsZ *first_hops, const struct LDKScore *NONNULL_PTR scorer); - /** - * Frees any resources associated with this object given its this_arg pointer. - * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. - */ - void (*free)(void *this_arg); -} LDKRouter; +void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); +/** + * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); +/** + * Constructs a new COption_NoneZ containing a + */ +enum LDKCOption_NoneZ COption_NoneZ_some(void); /** - * A utility for paying [`Invoice`]s and sending spontaneous payments. - * - * See [module-level documentation] for details. - * - * [module-level documentation]: crate::payment + * Constructs a new COption_NoneZ containing nothing */ -typedef struct MUST_USE_STRUCT LDKInvoicePayer { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInvoicePayer *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKInvoicePayer; +enum LDKCOption_NoneZ COption_NoneZ_none(void); + +/** + * Frees any resources associated with the , if we are in the Some state + */ +void COption_NoneZ_free(enum LDKCOption_NoneZ _res); +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + */ +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); /** - * Number of attempts to retry payment path failures for an [`Invoice`]. - * - * Note that this is the number of *path* failures, not full payment retries. For multi-path - * payments, if this is less than the total number of paths, we will never even retry all of the - * payment's paths. + * Checks if the given object is currently in the success state */ -typedef struct MUST_USE_STRUCT LDKRetryAttempts { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeRetryAttempts *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKRetryAttempts; +bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +/** + * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. + */ +void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); +/** + * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); /** - * A [`Router`] implemented using [`find_route`]. + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. */ -typedef struct MUST_USE_STRUCT LDKDefaultRouter { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeDefaultRouter *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKDefaultRouter; +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); -extern const uintptr_t MAX_BUF_SIZE; +/** + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); -extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; +/** + * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. + */ +void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); -extern const uint32_t ANTI_REORG_DELAY; +/** + * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); -extern const uint16_t BREAKDOWN_TIMEOUT; +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); -extern const uint16_t MIN_CLTV_EXPIRY_DELTA; +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); -extern const uint32_t MIN_FINAL_CLTV_EXPIRY; +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); -extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); -extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; +/** + * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + */ +void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); -extern const uint32_t DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA; +/** + * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); -extern const uint64_t MAX_TIMESTAMP; +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); -extern const uint64_t DEFAULT_EXPIRY_TIME; +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint64_t DEFAULT_MIN_FINAL_CLTV_EXPIRY; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_PAYMENT_HASH; +/** + * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + */ +void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); -extern const uint8_t TAG_DESCRIPTION; +/** + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); -extern const uint8_t TAG_PAYEE_PUB_KEY; +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); -extern const uint8_t TAG_DESCRIPTION_HASH; +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); -extern const uint8_t TAG_EXPIRY_TIME; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); -extern const uint8_t TAG_MIN_FINAL_CLTV_EXPIRY; +/** + * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + */ +void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); -extern const uint8_t TAG_FALLBACK; +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); -extern const uint8_t TAG_PRIVATE_ROUTE; +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); -extern const uint8_t TAG_PAYMENT_SECRET; +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); -extern const uint8_t TAG_FEATURES; +/** + * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + */ +void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); -struct LDKStr _ldk_get_compiled_version(void); +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); -struct LDKStr _ldk_c_bindings_get_compiled_version(void); +/** + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); /** - * Creates a new Bech32Error which has the same data as `orig` + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. */ -struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); /** - * Releases any memory held by the given `Bech32Error` (which is currently none) + * Checks if the given object is currently in the success state */ -void Bech32Error_free(struct LDKBech32Error o); +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); /** - * Frees the data buffer, if data_is_owned is set and datalen > 0. + * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. */ -void Transaction_free(struct LDKTransaction _res); +void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); /** - * Convenience function for constructing a new TxOut + * Creates a new CResult_CVec_SignatureZNoneZ in the success state. */ -struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); /** - * Frees the data pointed to by script_pubkey. + * Creates a new CResult_CVec_SignatureZNoneZ in the error state. */ -void TxOut_free(struct LDKTxOut _res); +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); /** - * Creates a new TxOut which has the same data as `orig` but with a new script buffer. + * Checks if the given object is currently in the success state */ -struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); +bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); /** - * Frees the data buffer, if chars_is_owned is set and len > 0. + * Frees any resources used by the CResult_CVec_SignatureZNoneZ. */ -void Str_free(struct LDKStr _res); +void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); -#if defined(LDK_DEBUG_BUILD) /** - * This function exists for memory safety testing purposes. It should never be used in production - * code + * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -const void *__unmangle_inner_ptr(const void *ptr); -#endif +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneNoneZ in the success state. + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_ok(void); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); /** - * Creates a new CResult_NoneNoneZ in the error state. + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_err(void); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneNoneZ_is_ok(const struct LDKCResult_NoneNoneZ *NONNULL_PTR o); +bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneNoneZ. + * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. */ -void CResult_NoneNoneZ_free(struct LDKCResult_NoneNoneZ _res); +void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); /** - * Creates a new CResult_NoneNoneZ which has the same data as `orig` + * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneNoneZ CResult_NoneNoneZ_clone(const struct LDKCResult_NoneNoneZ *NONNULL_PTR orig); +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(struct LDKCounterpartyCommitmentSecrets o); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + */ +void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); + +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore */ -bool CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); /** - * Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. + * Constructs a new COption_WriteableScoreZ containing nothing */ -void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ _res); +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); /** - * Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state */ -struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(const struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ *NONNULL_PTR orig); +void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); /** - * Creates a new CResult_SecretKeyErrorZ in the success state. + * Creates a new CResult_NoneErrorZ in the success state. */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_ok(struct LDKSecretKey o); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); /** - * Creates a new CResult_SecretKeyErrorZ in the error state. + * Creates a new CResult_NoneErrorZ in the error state. */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SecretKeyErrorZ_is_ok(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR o); +bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SecretKeyErrorZ. + * Frees any resources used by the CResult_NoneErrorZ. */ -void CResult_SecretKeyErrorZ_free(struct LDKCResult_SecretKeyErrorZ _res); +void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); /** - * Creates a new CResult_SecretKeyErrorZ which has the same data as `orig` + * Creates a new CResult_NoneErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SecretKeyErrorZ CResult_SecretKeyErrorZ_clone(const struct LDKCResult_SecretKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PublicKeyErrorZ in the success state. + * Creates a new CResult_RouteHopDecodeErrorZ in the success state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); /** - * Creates a new CResult_PublicKeyErrorZ in the error state. + * Creates a new CResult_RouteHopDecodeErrorZ in the error state. */ -struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); +bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PublicKeyErrorZ. + * Frees any resources used by the CResult_RouteHopDecodeErrorZ. */ -void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); +void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); /** - * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` + * Creates a new CResult_RouteHopDecodeErrorZ 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); +struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_ok(struct LDKTxCreationKeys o); +void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); + +/** + * Creates a new CResult_RouteDecodeErrorZ in the success state. + */ +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); + +/** + * Creates a new CResult_RouteDecodeErrorZ in the error state. + */ +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxCreationKeysDecodeErrorZ_is_ok(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR o); +bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. + * Frees any resources used by the CResult_RouteDecodeErrorZ. */ -void CResult_TxCreationKeysDecodeErrorZ_free(struct LDKCResult_TxCreationKeysDecodeErrorZ _res); +void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); /** - * Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxCreationKeysDecodeErrorZ CResult_TxCreationKeysDecodeErrorZ_clone(const struct LDKCResult_TxCreationKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. + * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_ok(struct LDKChannelPublicKeys o); +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. + * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelPublicKeysDecodeErrorZ_is_ok(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR o); +bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. + * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. */ -void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicKeysDecodeErrorZ _res); +void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); /** - * Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxCreationKeysErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o); +void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); /** - * Creates a new CResult_TxCreationKeysErrorZ in the error state. + * Constructs a new COption_u64Z containing a u64 */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_u64Z containing nothing */ -bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o); +struct LDKCOption_u64Z COption_u64Z_none(void); /** - * Frees any resources used by the CResult_TxCreationKeysErrorZ. + * Frees any resources associated with the u64, if we are in the Some state */ -void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res); +void COption_u64Z_free(struct LDKCOption_u64Z _res); /** - * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig` + * Creates a new COption_u64Z which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig); +struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); /** - * Constructs a new COption_u32Z containing a u32 + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_u32Z COption_u32Z_some(uint32_t o); +void CVec_u64Z_free(struct LDKCVec_u64Z _res); /** - * Constructs a new COption_u32Z containing nothing + * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. */ -struct LDKCOption_u32Z COption_u32Z_none(void); +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); /** - * Frees any resources associated with the u32, if we are in the Some state + * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. */ -void COption_u32Z_free(struct LDKCOption_u32Z _res); +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new COption_u32Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCOption_u32Z COption_u32Z_clone(const struct LDKCOption_u32Z *NONNULL_PTR orig); +bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. + * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(struct LDKHTLCOutputInCommitment o); +void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. + * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR o); +void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); /** - * Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. + * Creates a new CResult_RouteHintDecodeErrorZ in the success state. */ -void CResult_HTLCOutputInCommitmentDecodeErrorZ_free(struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ _res); +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); /** - * Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_RouteHintDecodeErrorZ in the error state. */ -struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(const struct LDKCResult_HTLCOutputInCommitmentDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_NoneZ containing a + * Checks if the given object is currently in the success state */ -enum LDKCOption_NoneZ COption_NoneZ_some(void); +bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_NoneZ containing nothing + * Frees any resources used by the CResult_RouteHintDecodeErrorZ. */ -enum LDKCOption_NoneZ COption_NoneZ_none(void); +void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); /** - * Frees any resources associated with the , if we are in the Some state + * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_NoneZ_free(enum LDKCOption_NoneZ _res); +struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. + * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(struct LDKCounterpartyChannelTransactionParameters o); +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. + * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. + * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. */ -void CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ _res); +void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); /** - * Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_ok(struct LDKChannelTransactionParameters o); +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. + * Creates a new CResult_RouteLightningErrorZ in the success state. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_RouteLightningErrorZ in the error state. */ -bool CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); /** - * Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_ChannelTransactionParametersDecodeErrorZ_free(struct LDKCResult_ChannelTransactionParametersDecodeErrorZ _res); +bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_RouteLightningErrorZ. */ -struct LDKCResult_ChannelTransactionParametersDecodeErrorZ CResult_ChannelTransactionParametersDecodeErrorZ_clone(const struct LDKCResult_ChannelTransactionParametersDecodeErrorZ *NONNULL_PTR orig); +void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_SignatureZ_free(struct LDKCVec_SignatureZ _res); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_ok(struct LDKHolderCommitmentTransaction o); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_ok(struct LDKPaymentPurpose o); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +bool CResult_PaymentPurposeDecodeErrorZ_is_ok(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. */ -void CResult_HolderCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ _res); +void CResult_PaymentPurposeDecodeErrorZ_free(struct LDKCResult_PaymentPurposeDecodeErrorZ _res); /** - * Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ CResult_HolderCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_HolderCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. - */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(struct LDKBuiltCommitmentTransaction o); +struct LDKCResult_PaymentPurposeDecodeErrorZ CResult_PaymentPurposeDecodeErrorZ_clone(const struct LDKCResult_PaymentPurposeDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. + * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_ClosureReasonZ containing nothing */ -bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); /** - * Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. + * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state */ -void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); +void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new COption_ClosureReasonZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); +bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. */ -void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); +void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + * 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_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); +struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + * Constructs a new COption_HTLCDestinationZ containing a crate::lightning::util::events::HTLCDestination */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_some(struct LDKHTLCDestination o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_HTLCDestinationZ containing nothing */ -bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_none(void); /** - * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + * Frees any resources associated with the crate::lightning::util::events::HTLCDestination, if we are in the Some state */ -void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); +void COption_HTLCDestinationZ_free(struct LDKCOption_HTLCDestinationZ _res); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new COption_HTLCDestinationZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_HTLCDestinationZ COption_HTLCDestinationZ_clone(const struct LDKCOption_HTLCDestinationZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_ok(struct LDKCOption_HTLCDestinationZ o); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + * Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); +bool CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + * Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. */ -void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); +void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + * 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_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); +struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_NetworkUpdateZ containing nothing */ -bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); /** - * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + * Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state */ -void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); +void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` + * Creates a new COption_NetworkUpdateZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); +struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_clone(const struct LDKCOption_NetworkUpdateZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); +void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_EventZ containing nothing */ -bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_EventZ COption_EventZ_none(void); /** - * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state */ -void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); +void COption_EventZ_free(struct LDKCOption_EventZ _res); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` + * Creates a new COption_EventZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); +bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. */ -void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * 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_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_NoneErrorZ in the success state. - */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); +struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_TxOutAccessErrorZ in the success state. */ -bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); /** - * Frees any resources used by the CResult_NoneErrorZ. + * Creates a new CResult_TxOutAccessErrorZ in the error state. */ -void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); /** - * Creates a new CResult_NoneErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); +bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the success state. + * Frees any resources used by the CResult_TxOutAccessErrorZ. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_ok(struct LDKRouteHop o); +void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); /** - * Creates a new CResult_RouteHopDecodeErrorZ in the error state. + * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_RouteHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_RouteHopDecodeErrorZ. + * Creates a new C2Tuple_usizeTransactionZ from the contained elements. */ -void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _res); +struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); /** - * Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_usizeTransactionZ. */ -struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); +void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); +void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_CVec_RouteHopZZ_free(struct LDKCVec_CVec_RouteHopZZ _res); +void CVec_TxidZ_free(struct LDKCVec_TxidZ _res); /** - * Creates a new CResult_RouteDecodeErrorZ in the success state. + * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_ok(struct LDKRoute o); +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); /** - * Creates a new CResult_RouteDecodeErrorZ in the error state. + * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); /** * Checks if the given object is currently in the success state */ -bool CResult_RouteDecodeErrorZ_is_ok(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR o); +bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RouteDecodeErrorZ. + * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ. */ -void CResult_RouteDecodeErrorZ_free(struct LDKCResult_RouteDecodeErrorZ _res); +void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res); /** - * Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteDecodeErrorZ CResult_RouteDecodeErrorZ_clone(const struct LDKCResult_RouteDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_ok(struct LDKRouteParameters o); +void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); /** - * Creates a new CResult_RouteParametersDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_clone(const struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ from the contained elements. */ -bool CResult_RouteParametersDecodeErrorZ_is_ok(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR o); +struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorEventZ b, struct LDKPublicKey c); /** - * Frees any resources used by the CResult_RouteParametersDecodeErrorZ. + * Frees any resources used by the C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ. */ -void CResult_RouteParametersDecodeErrorZ_free(struct LDKCResult_RouteParametersDecodeErrorZ _res); +void C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(struct LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ _res); /** - * Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeErrorZ_clone(const struct LDKCResult_RouteParametersDecodeErrorZ *NONNULL_PTR orig); +void CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. */ -void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); /** - * Constructs a new COption_u64Z containing a u64 + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_u64Z containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_u64Z COption_u64Z_none(void); +bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the u64, if we are in the Some state + * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); +void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); /** - * Creates a new COption_u64Z which has the same data as `orig` + * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ 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); +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_ok(struct LDKPaymentParameters o); +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_clone(const struct LDKC2Tuple_u64u64Z *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. + * Creates a new C2Tuple_u64u64Z from the contained elements. */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_u64u64Z C2Tuple_u64u64Z_new(uint64_t a, uint64_t b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_u64u64Z. */ -bool CResult_PaymentParametersDecodeErrorZ_is_ok(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR o); +void C2Tuple_u64u64Z_free(struct LDKC2Tuple_u64u64Z _res); /** - * Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. + * Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z */ -void CResult_PaymentParametersDecodeErrorZ_free(struct LDKCResult_PaymentParametersDecodeErrorZ _res); +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_some(struct LDKC2Tuple_u64u64Z o); /** - * Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_C2Tuple_u64u64ZZ containing nothing */ -struct LDKCResult_PaymentParametersDecodeErrorZ CResult_PaymentParametersDecodeErrorZ_clone(const struct LDKCResult_PaymentParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state */ -void CVec_RouteHintHopZ_free(struct LDKCVec_RouteHintHopZ _res); +void COption_C2Tuple_u64u64ZZ_free(struct LDKCOption_C2Tuple_u64u64ZZ _res); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the success state. + * Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_ok(struct LDKRouteHint o); +struct LDKCOption_C2Tuple_u64u64ZZ COption_C2Tuple_u64u64ZZ_clone(const struct LDKCOption_C2Tuple_u64u64ZZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteHintDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_NodeIdZ_free(struct LDKCVec_NodeIdZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. */ -bool CResult_RouteHintDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); /** - * Frees any resources used by the CResult_RouteHintDecodeErrorZ. + * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. */ -void CResult_RouteHintDecodeErrorZ_free(struct LDKCResult_RouteHintDecodeErrorZ _res); +struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_RouteHintDecodeErrorZ CResult_RouteHintDecodeErrorZ_clone(const struct LDKCResult_RouteHintDecodeErrorZ *NONNULL_PTR orig); +bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. + * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_ok(struct LDKRouteHintHop o); +void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. + * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. */ -bool CResult_RouteHintHopDecodeErrorZ_is_ok(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeErrorZ _res); +bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. */ -struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); +void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_RouteLightningErrorZ in the success state. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); /** - * Creates a new CResult_RouteLightningErrorZ in the error state. + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); +bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RouteLightningErrorZ. + * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. */ -void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); +void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TxOutAccessErrorZ in the success state. + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_ok(struct LDKTxOut o); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); /** - * Creates a new CResult_TxOutAccessErrorZ in the error state. + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_err(enum LDKAccessError e); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_TxOutAccessErrorZ_is_ok(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR o); +bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TxOutAccessErrorZ. + * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. */ -void CResult_TxOutAccessErrorZ_free(struct LDKCResult_TxOutAccessErrorZ _res); +void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_TxOutAccessErrorZ which has the same data as `orig` + * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_TxOutAccessErrorZ CResult_TxOutAccessErrorZ_clone(const struct LDKCResult_TxOutAccessErrorZ *NONNULL_PTR orig); +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_clone(const struct LDKC2Tuple_usizeTransactionZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); /** - * Creates a new C2Tuple_usizeTransactionZ from the contained elements. + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. */ -struct LDKC2Tuple_usizeTransactionZ C2Tuple_usizeTransactionZ_new(uintptr_t a, struct LDKTransaction b); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C2Tuple_usizeTransactionZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); +bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. */ -void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); +void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_TxidZ_free(struct LDKCVec_TxidZ _res); +struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the success state. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. */ -struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_ok(void); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); /** - * Creates a new CResult_NoneChannelMonitorUpdateErrZ in the error state. + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_err(enum LDKChannelMonitorUpdateErr e); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneChannelMonitorUpdateErrZ_is_ok(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR o); +bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneChannelMonitorUpdateErrZ. + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. */ -void CResult_NoneChannelMonitorUpdateErrZ_free(struct LDKCResult_NoneChannelMonitorUpdateErrZ _res); +void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_NoneChannelMonitorUpdateErrZ which has the same data as `orig` + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneChannelMonitorUpdateErrZ CResult_NoneChannelMonitorUpdateErrZ_clone(const struct LDKCResult_NoneChannelMonitorUpdateErrZ *NONNULL_PTR orig); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NodeIdDecodeErrorZ in the success state. */ -void CVec_MonitorEventZ_free(struct LDKCVec_MonitorEventZ _res); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); /** - * Constructs a new COption_C2Tuple_usizeTransactionZZ containing a crate::c_types::derived::C2Tuple_usizeTransactionZ + * Creates a new CResult_NodeIdDecodeErrorZ in the error state. */ -struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_some(struct LDKC2Tuple_usizeTransactionZ o); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_C2Tuple_usizeTransactionZZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_none(void); +bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::c_types::derived::C2Tuple_usizeTransactionZ, if we are in the Some state + * Frees any resources used by the CResult_NodeIdDecodeErrorZ. */ -void COption_C2Tuple_usizeTransactionZZ_free(struct LDKCOption_C2Tuple_usizeTransactionZZ _res); +void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); /** - * Creates a new COption_C2Tuple_usizeTransactionZZ which has the same data as `orig` + * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_C2Tuple_usizeTransactionZZ COption_C2Tuple_usizeTransactionZZ_clone(const struct LDKCOption_C2Tuple_usizeTransactionZZ *NONNULL_PTR orig); +struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_ClosureReasonZ containing a crate::lightning::util::events::ClosureReason + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_some(struct LDKClosureReason o); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); /** - * Constructs a new COption_ClosureReasonZ containing nothing + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_none(void); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources associated with the crate::lightning::util::events::ClosureReason, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_ClosureReasonZ_free(struct LDKCOption_ClosureReasonZ _res); +bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new COption_ClosureReasonZ which has the same data as `orig` + * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. + */ +void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); + +/** + * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_ClosureReasonZ COption_ClosureReasonZ_clone(const struct LDKCOption_ClosureReasonZ *NONNULL_PTR orig); +struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. + * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_ok(struct LDKCOption_ClosureReasonZ o); +struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. + * Constructs a new COption_AccessZ containing nothing */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_AccessZ COption_AccessZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state */ -bool CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR o); +void COption_AccessZ_free(struct LDKCOption_AccessZ _res); /** - * Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. + * Creates a new CResult_boolLightningErrorZ in the success state. */ -void CResult_COption_ClosureReasonZDecodeErrorZ_free(struct LDKCResult_COption_ClosureReasonZDecodeErrorZ _res); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); /** - * Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_boolLightningErrorZ in the error state. */ -struct LDKCResult_COption_ClosureReasonZDecodeErrorZ CResult_COption_ClosureReasonZDecodeErrorZ_clone(const struct LDKCResult_COption_ClosureReasonZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); /** - * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::network_graph::NetworkUpdate + * Checks if the given object is currently in the success state */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_some(struct LDKNetworkUpdate o); +bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); /** - * Constructs a new COption_NetworkUpdateZ containing nothing + * Frees any resources used by the CResult_boolLightningErrorZ. */ -struct LDKCOption_NetworkUpdateZ COption_NetworkUpdateZ_none(void); +void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); /** - * Frees any resources associated with the crate::lightning::routing::network_graph::NetworkUpdate, if we are in the Some state + * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void COption_NetworkUpdateZ_free(struct LDKCOption_NetworkUpdateZ _res); +struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new COption_NetworkUpdateZ which has the same data as `orig` + * Creates a new tuple 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); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. */ -void CVec_SpendableOutputDescriptorZ_free(struct LDKCVec_SpendableOutputDescriptorZ _res); +struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); /** - * Constructs a new COption_EventZ containing a crate::lightning::util::events::Event + * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. */ -struct LDKCOption_EventZ COption_EventZ_some(struct LDKEvent o); +void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); /** - * Constructs a new COption_EventZ containing nothing + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ */ -struct LDKCOption_EventZ COption_EventZ_none(void); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ o); /** - * Frees any resources associated with the crate::lightning::util::events::Event, if we are in the Some state + * Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing */ -void COption_EventZ_free(struct LDKCOption_EventZ _res); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none(void); /** - * Creates a new COption_EventZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state */ -struct LDKCOption_EventZ COption_EventZ_clone(const struct LDKCOption_EventZ *NONNULL_PTR orig); +void COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the success state. + * Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_ok(struct LDKCOption_EventZ o); +struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(const struct LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_EventZDecodeErrorZ in the error state. + * Creates a new CResult_NoneLightningErrorZ in the success state. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NoneLightningErrorZ in the error state. */ -bool CResult_COption_EventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); /** - * Frees any resources used by the CResult_COption_EventZDecodeErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_COption_EventZDecodeErrorZ_free(struct LDKCResult_COption_EventZDecodeErrorZ _res); +bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_NoneLightningErrorZ. */ -struct LDKCResult_COption_EventZDecodeErrorZ CResult_COption_EventZDecodeErrorZ_clone(const struct LDKCResult_COption_EventZDecodeErrorZ *NONNULL_PTR orig); +void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_MessageSendEventZ_free(struct LDKCVec_MessageSendEventZ _res); +struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_ok(struct LDKFixedPenaltyScorer o); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. + * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. */ -void CResult_FixedPenaltyScorerDecodeErrorZ_free(struct LDKCResult_FixedPenaltyScorerDecodeErrorZ _res); +void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); /** - * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ CResult_FixedPenaltyScorerDecodeErrorZ_clone(const struct LDKCResult_FixedPenaltyScorerDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ScoringParametersDecodeErrorZ in the success state. + * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. */ -struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_ok(struct LDKScoringParameters o); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); /** - * Creates a new CResult_ScoringParametersDecodeErrorZ in the error state. + * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. */ -struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ScoringParametersDecodeErrorZ_is_ok(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ScoringParametersDecodeErrorZ. + * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. */ -void CResult_ScoringParametersDecodeErrorZ_free(struct LDKCResult_ScoringParametersDecodeErrorZ _res); +void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); /** - * Creates a new CResult_ScoringParametersDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ScoringParametersDecodeErrorZ CResult_ScoringParametersDecodeErrorZ_clone(const struct LDKCResult_ScoringParametersDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ScorerDecodeErrorZ in the success state. + * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. */ -struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_ok(struct LDKScorer o); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); /** - * Creates a new CResult_ScorerDecodeErrorZ in the error state. + * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. */ -struct LDKCResult_ScorerDecodeErrorZ CResult_ScorerDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ScorerDecodeErrorZ_is_ok(const struct LDKCResult_ScorerDecodeErrorZ *NONNULL_PTR o); +bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ScorerDecodeErrorZ. + * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. */ -void CResult_ScorerDecodeErrorZ_free(struct LDKCResult_ScorerDecodeErrorZ _res); +void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. + * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_ok(struct LDKProbabilisticScorer o); +struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ CResult_ProbabilisticScorerDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. */ -bool CResult_ProbabilisticScorerDecodeErrorZ_is_ok(const struct LDKCResult_ProbabilisticScorerDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); /** - * Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. */ -void CResult_ProbabilisticScorerDecodeErrorZ_free(struct LDKCResult_ProbabilisticScorerDecodeErrorZ _res); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); +bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); +struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + * Creates a new CResult_NodeAliasDecodeErrorZ in the success state. */ -void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_ok(struct LDKNodeAlias o); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_NodeAliasDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_NodeAliasDecodeErrorZ_is_ok(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_NodeAliasDecodeErrorZ. */ -bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); +void CResult_NodeAliasDecodeErrorZ_free(struct LDKCResult_NodeAliasDecodeErrorZ _res); /** - * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + * Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); +struct LDKCResult_NodeAliasDecodeErrorZ CResult_NodeAliasDecodeErrorZ_clone(const struct LDKCResult_NodeAliasDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); /** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. */ -void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); +void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the success state. + * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_ok(struct LDKInvoiceFeatures o); +struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceFeaturesDecodeErrorZ in the error state. + * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceFeaturesDecodeErrorZ CResult_InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); + +/** + * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. + */ +struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. */ -void CResult_InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceFeaturesDecodeErrorZ _res); +void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. + * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. + * Constructs a new COption_CVec_NetAddressZZ containing nothing */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); /** - * Checks if the given object is currently in the success state + * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state */ -bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); +void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); /** - * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); +struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); /** * Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. @@ -13868,1764 +15833,1539 @@ struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSign /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ. - */ -void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res); - -/** - * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_SecretKeyNoneZ in the success state. - */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o); - -/** - * Creates a new CResult_SecretKeyNoneZ in the error state. - */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_SecretKeyNoneZ. - */ -void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res); - -/** - * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_SignDecodeErrorZ in the success state. - */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); - -/** - * Creates a new CResult_SignDecodeErrorZ in the error state. - */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_SignDecodeErrorZ. - */ -void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); - -/** - * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_u5Z_free(struct LDKCVec_u5Z _res); - -/** - * Creates a new CResult_RecoverableSignatureNoneZ in the success state. - */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); - -/** - * Creates a new CResult_RecoverableSignatureNoneZ in the error state. - */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_RecoverableSignatureNoneZ. - */ -void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); - -/** - * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_u8Z_free(struct LDKCVec_u8Z _res); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); - -/** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. - */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); - -/** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. - */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. - */ -void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); - -/** - * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. - */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); - -/** - * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. - */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. - */ -void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); - -/** - * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); - -/** - * Creates a new CResult_TransactionNoneZ in the success state. - */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); - -/** - * Creates a new CResult_TransactionNoneZ in the error state. - */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_TransactionNoneZ. - */ -void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); - -/** - * Creates a new CResult_TransactionNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. - */ -struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); - -/** - * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. - */ -void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); - -/** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. - */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); - -/** - * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. - */ -struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. - */ -void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); - -/** - * Constructs a new COption_u16Z containing a u16 - */ -struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); - -/** - * Constructs a new COption_u16Z containing nothing - */ -struct LDKCOption_u16Z COption_u16Z_none(void); +bool CResult_C2Tuple_SignatureSignatureZNoneZ_is_ok(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR o); /** - * Frees any resources associated with the u16, if we are in the Some state + * Frees any resources used by the CResult_C2Tuple_SignatureSignatureZNoneZ. */ -void COption_u16Z_free(struct LDKCOption_u16Z _res); +void CResult_C2Tuple_SignatureSignatureZNoneZ_free(struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ _res); /** - * Creates a new COption_u16Z which has the same data as `orig` + * Creates a new CResult_C2Tuple_SignatureSignatureZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ CResult_C2Tuple_SignatureSignatureZNoneZ_clone(const struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneAPIErrorZ in the success state. + * Creates a new CResult_SecretKeyNoneZ in the success state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); +struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_ok(struct LDKSecretKey o); /** - * Creates a new CResult_NoneAPIErrorZ in the error state. + * Creates a new CResult_SecretKeyNoneZ in the error state. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); +bool CResult_SecretKeyNoneZ_is_ok(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneAPIErrorZ. + * Frees any resources used by the CResult_SecretKeyNoneZ. */ -void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); +void CResult_SecretKeyNoneZ_free(struct LDKCResult_SecretKeyNoneZ _res); /** - * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` + * Creates a new CResult_SecretKeyNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_SecretKeyNoneZ CResult_SecretKeyNoneZ_clone(const struct LDKCResult_SecretKeyNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_ScalarZ containing a crate::c_types::BigEndianScalar */ -void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); +struct LDKCOption_ScalarZ COption_ScalarZ_some(struct LDKBigEndianScalar o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Constructs a new COption_ScalarZ containing nothing */ -void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); +struct LDKCOption_ScalarZ COption_ScalarZ_none(void); /** - * Creates a new CResult__u832APIErrorZ in the success state. + * Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); +void COption_ScalarZ_free(struct LDKCOption_ScalarZ _res); /** - * Creates a new CResult__u832APIErrorZ in the error state. + * Creates a new CResult_SharedSecretNoneZ in the success state. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_SharedSecretNoneZ in the error state. + */ +struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); +bool CResult_SharedSecretNoneZ_is_ok(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult__u832APIErrorZ. + * Frees any resources used by the CResult_SharedSecretNoneZ. */ -void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); +void CResult_SharedSecretNoneZ_free(struct LDKCResult_SharedSecretNoneZ _res); /** - * Creates a new CResult__u832APIErrorZ which has the same data as `orig` + * Creates a new CResult_SharedSecretNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); +struct LDKCResult_SharedSecretNoneZ CResult_SharedSecretNoneZ_clone(const struct LDKCResult_SharedSecretNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. + * Creates a new CResult_SignDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_ok(struct LDKSign o); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. + * Creates a new CResult_SignDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. + * Frees any resources used by the CResult_SignDecodeErrorZ. */ -void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res); +void CResult_SignDecodeErrorZ_free(struct LDKCResult_SignDecodeErrorZ _res); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_SignDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_SignDecodeErrorZ CResult_SignDecodeErrorZ_clone(const struct LDKCResult_SignDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePaymentSendFailureZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +void CVec_u5Z_free(struct LDKCVec_u5Z _res); /** - * Creates a new CResult_NonePaymentSendFailureZ in the error state. + * Creates a new CResult_RecoverableSignatureNoneZ in the success state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_ok(struct LDKRecoverableSignature o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_RecoverableSignatureNoneZ in the error state. */ -bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_err(void); /** - * Frees any resources used by the CResult_NonePaymentSendFailureZ. + * Checks if the given object is currently in the success state */ -void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); +bool CResult_RecoverableSignatureNoneZ_is_ok(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_RecoverableSignatureNoneZ. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); +void CResult_RecoverableSignatureNoneZ_free(struct LDKCResult_RecoverableSignatureNoneZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); +struct LDKCResult_RecoverableSignatureNoneZ CResult_RecoverableSignatureNoneZ_clone(const struct LDKCResult_RecoverableSignatureNoneZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +void CVec_u8Z_free(struct LDKCVec_u8Z _res); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); +void CVec_CVec_u8ZZ_free(struct LDKCVec_CVec_u8ZZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. + * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the success state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_ok(struct LDKCVec_CVec_u8ZZ o); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. + * Creates a new CResult_CVec_CVec_u8ZZNoneZ in the error state. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_CVec_CVec_u8ZZNoneZ_is_ok(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. + * Frees any resources used by the CResult_CVec_CVec_u8ZZNoneZ. */ -void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); +void CResult_CVec_CVec_u8ZZNoneZ_free(struct LDKCResult_CVec_CVec_u8ZZNoneZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_CVec_CVec_u8ZZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_CVec_CVec_u8ZZNoneZ CResult_CVec_CVec_u8ZZNoneZ_clone(const struct LDKCResult_CVec_CVec_u8ZZNoneZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. */ -void CVec_NetAddressZ_free(struct LDKCVec_NetAddressZ _res); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_ok(struct LDKInMemorySigner o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); +bool CResult_InMemorySignerDecodeErrorZ_is_ok(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. + * Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. */ -void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); +void CResult_InMemorySignerDecodeErrorZ_free(struct LDKCResult_InMemorySignerDecodeErrorZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. + * Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); +struct LDKCResult_InMemorySignerDecodeErrorZ CResult_InMemorySignerDecodeErrorZ_clone(const struct LDKCResult_InMemorySignerDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); +void CVec_TxOutZ_free(struct LDKCVec_TxOutZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_TransactionNoneZ in the success state. */ -bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_ok(struct LDKTransaction o); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. + * Creates a new CResult_TransactionNoneZ in the error state. */ -void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_err(void); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); +bool CResult_TransactionNoneZ_is_ok(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR o); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state. + * Frees any resources used by the CResult_TransactionNoneZ. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); +void CResult_TransactionNoneZ_free(struct LDKCResult_TransactionNoneZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state. + * Creates a new CResult_TransactionNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); +struct LDKCResult_TransactionNoneZ CResult_TransactionNoneZ_clone(const struct LDKCResult_TransactionNoneZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_BlockHashChannelMonitorZ from the contained elements. */ -bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_BlockHashChannelMonitorZ C2Tuple_BlockHashChannelMonitorZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelMonitor b); /** - * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ. + * Frees any resources used by the C2Tuple_BlockHashChannelMonitorZ. */ -void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); +void C2Tuple_BlockHashChannelMonitorZ_free(struct LDKC2Tuple_BlockHashChannelMonitorZ _res); /** - * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig); +void CVec_C2Tuple_BlockHashChannelMonitorZZ_free(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ _res); /** - * Creates a new CResult_PaymentSecretNoneZ in the success state. + * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the success state. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_ok(struct LDKCVec_C2Tuple_BlockHashChannelMonitorZZ o); /** - * Creates a new CResult_PaymentSecretNoneZ in the error state. + * Creates a new CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ in the error state. */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); +struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); +bool CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_is_ok(const struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentSecretNoneZ. + * Frees any resources used by the CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ. */ -void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); +void CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ _res); /** - * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_u16Z containing a u16 */ -struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); +struct LDKCOption_u16Z COption_u16Z_some(uint16_t o); /** - * Creates a new CResult_PaymentSecretAPIErrorZ in the success state. + * Constructs a new COption_u16Z containing nothing */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCOption_u16Z COption_u16Z_none(void); /** - * Creates a new CResult_PaymentSecretAPIErrorZ in the error state. + * Frees any resources associated with the u16, if we are in the Some state */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); +void COption_u16Z_free(struct LDKCOption_u16Z _res); /** - * Checks if the given object is currently in the success state + * Creates a new COption_u16Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o); +struct LDKCOption_u16Z COption_u16Z_clone(const struct LDKCOption_u16Z *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_PaymentSecretAPIErrorZ. + * Creates a new CResult_NoneAPIErrorZ in the success state. */ -void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); /** - * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NoneAPIErrorZ in the error state. */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); +bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. + * Frees any resources used by the CResult_NoneAPIErrorZ. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); +void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); /** - * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); +void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. + * Creates a new CResult__u832APIErrorZ in the success state. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. + * Creates a new CResult__u832APIErrorZ in the error state. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult__u832APIErrorZ_is_ok(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. + * Frees any resources used by the CResult__u832APIErrorZ. */ -void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); +void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); /** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult__u832APIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. + * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); +struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. + * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); +bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. + * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. */ -void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); +void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res); /** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. + * Creates a new CResult_NonePaymentSendFailureZ in the success state. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. + * Creates a new CResult_NonePaymentSendFailureZ in the error state. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); +bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. + * Frees any resources used by the CResult_NonePaymentSendFailureZ. */ -void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); +void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); /** - * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_clone(const struct LDKC2Tuple_PaymentHashPaymentIdZ *NONNULL_PTR orig); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. + * Creates a new C2Tuple_PaymentHashPaymentIdZ from the contained elements. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_PaymentHashPaymentIdZ C2Tuple_PaymentHashPaymentIdZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_PaymentHashPaymentIdZ. */ -bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); +void C2Tuple_PaymentHashPaymentIdZ_free(struct LDKC2Tuple_PaymentHashPaymentIdZ _res); /** - * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the success state. */ -void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_ok(struct LDKC2Tuple_PaymentHashPaymentIdZ o); /** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ in the error state. */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_err(struct LDKPaymentSendFailure 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_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); +bool CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ. */ -struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); +void CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ _res); /** - * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. + * Creates a new CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); +struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); +void CVec_ThirtyTwoBytesZ_free(struct LDKCVec_ThirtyTwoBytesZ _res); /** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_clone(const struct LDKC2Tuple_PaymentHashPaymentSecretZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new C2Tuple_PaymentHashPaymentSecretZ from the contained elements. */ -bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_PaymentHashPaymentSecretZ C2Tuple_PaymentHashPaymentSecretZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. + * Frees any resources used by the C2Tuple_PaymentHashPaymentSecretZ. */ -void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); +void C2Tuple_PaymentHashPaymentSecretZ_free(struct LDKC2Tuple_PaymentHashPaymentSecretZ _res); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the success state. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ in the error state. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_err(void); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ. */ -void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); +void CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ _res); /** - * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_OutPointDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the success state. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_ok(struct LDKC2Tuple_PaymentHashPaymentSecretZ o); /** - * Creates a new CResult_OutPointDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ in the error state. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); +bool CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_is_ok(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_OutPointDecodeErrorZ. + * Frees any resources used by the CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ. */ -void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); +void CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ _res); /** - * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); - -/** - * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type - */ -struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); - -/** - * Constructs a new COption_TypeZ containing nothing - */ -struct LDKCOption_TypeZ COption_TypeZ_none(void); +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_clone(const struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ *NONNULL_PTR orig); /** - * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state + * Creates a new CResult_PaymentSecretNoneZ in the success state. */ -void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + * Creates a new CResult_PaymentSecretNoneZ in the error state. */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_err(void); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_PaymentSecretNoneZ_is_ok(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_PaymentSecretNoneZ. */ -bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); +void CResult_PaymentSecretNoneZ_free(struct LDKCResult_PaymentSecretNoneZ _res); /** - * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + * Creates a new CResult_PaymentSecretNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); +struct LDKCResult_PaymentSecretNoneZ CResult_PaymentSecretNoneZ_clone(const struct LDKCResult_PaymentSecretNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. + * Creates a new CResult_PaymentSecretAPIErrorZ in the success state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + * Creates a new CResult_PaymentSecretAPIErrorZ in the error state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); +bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. + * Frees any resources used by the CResult_PaymentSecretAPIErrorZ. */ -void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); +void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res); /** - * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SiPrefixParseErrorZ in the success state. + * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_SiPrefixParseErrorZ in the error state. + * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); +bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SiPrefixParseErrorZ. + * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. */ -void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); +void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); /** - * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); +bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. + * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. */ -void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); +void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); +bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. + * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. */ -void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); +void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. */ -struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); /** - * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. */ -struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. + * Checks if the given object is currently in the success state */ -void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); +bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PayeePubKeyErrorZ in the success state. + * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); +void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ in the error state. + * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. + */ +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); + +/** + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. + */ +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); +bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PayeePubKeyErrorZ. + * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. */ -void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); +void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); /** - * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. + * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); +struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. + * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. */ -bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); /** - * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. */ -void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); +bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NoneSemanticErrorZ in the success state. + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); +void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); /** - * Creates a new CResult_NoneSemanticErrorZ in the error state. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); + +/** + * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); +bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneSemanticErrorZ. + * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. */ -void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); +void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); /** - * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the success state. + * Creates a new CResult_OutPointDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the error state. + * Creates a new CResult_OutPointDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceSemanticErrorZ. + * Frees any resources used by the CResult_OutPointDecodeErrorZ. */ -void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` + * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_DescriptionCreationErrorZ in the success state. - */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); - -/** - * Creates a new CResult_DescriptionCreationErrorZ in the error state. - */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type */ -bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); +struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); /** - * Frees any resources used by the CResult_DescriptionCreationErrorZ. + * Constructs a new COption_TypeZ containing nothing */ -void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); +struct LDKCOption_TypeZ COption_TypeZ_none(void); /** - * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); +void COption_TypeZ_free(struct LDKCOption_TypeZ _res); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. + * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. */ -void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); +void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); /** - * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_StringErrorZ in the success state. + * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); /** - * Creates a new CResult_StringErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +bool CResult_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. */ -bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); +void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); /** - * Frees any resources used by the CResult_StringErrorZ. + * Creates a new CResult_PaymentIdPaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. */ -void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); +void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); /** - * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_SiPrefixParseErrorZ in the success state. */ -struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); /** - * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent + * Creates a new CResult_SiPrefixParseErrorZ in the error state. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); /** - * Constructs a new COption_MonitorEventZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); +bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state + * Frees any resources used by the CResult_SiPrefixParseErrorZ. */ -void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); +void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); /** - * Creates a new COption_MonitorEventZ which has the same data as `orig` + * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); +bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. + * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. */ -void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); +void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); /** - * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); /** * Checks if the given object is currently in the success state */ -bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); +bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. + * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. */ -void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); +void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); /** - * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_OutPointScriptZ from the contained elements. + * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. */ -struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); /** - * Frees any resources used by the C2Tuple_OutPointScriptZ. + * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. */ -void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); +void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_PayeePubKeyErrorZ in the success state. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); /** - * Creates a new C2Tuple_u32ScriptZ from the contained elements. + * Creates a new CResult_PayeePubKeyErrorZ in the error state. */ -struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); /** - * Frees any resources used by the C2Tuple_u32ScriptZ. + * Checks if the given object is currently in the success state */ -void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); +bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the CResult_PayeePubKeyErrorZ. */ -void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); +void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); /** - * Creates a new tuple which has the same data as `orig` + * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); +void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. */ -void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. */ -void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + */ +void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); + +/** + * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NoneSemanticErrorZ in the success state. */ -void CVec_EventZ_free(struct LDKCVec_EventZ _res); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_NoneSemanticErrorZ in the error state. */ -void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); +bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); /** - * Creates a new C2Tuple_u32TxOutZ from the contained elements. + * Frees any resources used by the CResult_NoneSemanticErrorZ. */ -struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); +void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); /** - * Frees any resources used by the C2Tuple_u32TxOutZ. + * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InvoiceSemanticErrorZ in the success state. */ -void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); /** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_InvoiceSemanticErrorZ in the error state. */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); /** - * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. + * Checks if the given object is currently in the success state */ -struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); +bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. + * Frees any resources used by the CResult_InvoiceSemanticErrorZ. */ -void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); +void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); +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. + * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ -void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. + * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_DescriptionCreationErrorZ. */ -bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneLightningErrorZ in the success state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_ok(void); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); /** - * Creates a new CResult_NoneLightningErrorZ in the error state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneLightningErrorZ_is_ok(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR o); +bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneLightningErrorZ. + * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ -void CResult_NoneLightningErrorZ_free(struct LDKCResult_NoneLightningErrorZ _res); +void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); /** - * Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` + * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneLightningErrorZ CResult_NoneLightningErrorZ_clone(const struct LDKCResult_NoneLightningErrorZ *NONNULL_PTR orig); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. + * Creates a new CResult_StringErrorZ in the success state. */ -struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); /** - * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + * Creates a new CResult_StringErrorZ in the error state. */ -void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error 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_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); +bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_boolLightningErrorZ in the success state. + * Frees any resources used by the CResult_StringErrorZ. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_ok(bool o); +void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); /** - * Creates a new CResult_boolLightningErrorZ in the error state. + * Creates a new CResult_StringErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_err(struct LDKLightningError e); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. */ -bool CResult_boolLightningErrorZ_is_ok(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR o); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_ok(struct LDKChannelMonitorUpdate o); /** - * Frees any resources used by the CResult_boolLightningErrorZ. + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. */ -void CResult_boolLightningErrorZ_free(struct LDKCResult_boolLightningErrorZ _res); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_boolLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Checks if the given object is currently in the success state */ -struct LDKCResult_boolLightningErrorZ CResult_boolLightningErrorZ_clone(const struct LDKCResult_boolLightningErrorZ *NONNULL_PTR orig); +bool CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new tuple which has the same data as `orig` + * Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. + */ +void CResult_ChannelMonitorUpdateDecodeErrorZ_free(struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(const struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ *NONNULL_PTR orig); +struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ CResult_ChannelMonitorUpdateDecodeErrorZ_clone(const struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. + * Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent */ -struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(struct LDKChannelAnnouncement a, struct LDKChannelUpdate b, struct LDKChannelUpdate c); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_some(struct LDKMonitorEvent o); /** - * Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. + * Constructs a new COption_MonitorEventZ containing nothing */ -void C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(struct LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ _res); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_none(void); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state */ -void CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(struct LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ _res); +void COption_MonitorEventZ_free(struct LDKCOption_MonitorEventZ _res); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new COption_MonitorEventZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CVec_NodeAnnouncementZ_free(struct LDKCVec_NodeAnnouncementZ _res); +struct LDKCOption_MonitorEventZ COption_MonitorEventZ_clone(const struct LDKCOption_MonitorEventZ *NONNULL_PTR orig); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. */ -void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_ok(struct LDKCOption_MonitorEventZ o); /** - * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Constructs a new COption_NetAddressZ containing nothing + * Checks if the given object is currently in the success state */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); +bool CResult_COption_MonitorEventZDecodeErrorZ_is_ok(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state + * Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. */ -void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); +void CResult_COption_MonitorEventZDecodeErrorZ_free(struct LDKCResult_COption_MonitorEventZDecodeErrorZ _res); /** - * Creates a new COption_NetAddressZ which has the same data as `orig` + * Creates a new CResult_COption_MonitorEventZDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); +struct LDKCResult_COption_MonitorEventZDecodeErrorZ CResult_COption_MonitorEventZDecodeErrorZ_clone(const struct LDKCResult_COption_MonitorEventZDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_ok(struct LDKHTLCUpdate o); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + * Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); +bool CResult_HTLCUpdateDecodeErrorZ_is_ok(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + * Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. */ -void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); +void CResult_HTLCUpdateDecodeErrorZ_free(struct LDKCResult_HTLCUpdateDecodeErrorZ _res); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_HTLCUpdateDecodeErrorZ CResult_HTLCUpdateDecodeErrorZ_clone(const struct LDKCResult_HTLCUpdateDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ in the success state. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_clone(const struct LDKC2Tuple_OutPointScriptZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ in the error state. + * Creates a new C2Tuple_OutPointScriptZ from the contained elements. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKC2Tuple_OutPointScriptZ C2Tuple_OutPointScriptZ_new(struct LDKOutPoint a, struct LDKCVec_u8Z b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_OutPointScriptZ. */ -bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); +void C2Tuple_OutPointScriptZ_free(struct LDKC2Tuple_OutPointScriptZ _res); /** - * Frees any resources used by the CResult_NonePeerHandleErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_clone(const struct LDKC2Tuple_u32ScriptZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_u32ScriptZ from the contained elements. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32ScriptZ C2Tuple_u32ScriptZ_new(uint32_t a, struct LDKCVec_u8Z b); /** - * Creates a new CResult_boolPeerHandleErrorZ in the success state. + * Frees any resources used by the C2Tuple_u32ScriptZ. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); +void C2Tuple_u32ScriptZ_free(struct LDKC2Tuple_u32ScriptZ _res); /** - * Creates a new CResult_boolPeerHandleErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +void CVec_C2Tuple_u32ScriptZZ_free(struct LDKCVec_C2Tuple_u32ScriptZZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_boolPeerHandleErrorZ. + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. */ -void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32ScriptZZ b); /** - * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); +void C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ _res); /** - * Creates a new CResult_NodeIdDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_ok(struct LDKNodeId o); +void CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ _res); /** - * Creates a new CResult_NodeIdDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_EventZ_free(struct LDKCVec_EventZ _res); /** - * Checks if the given object is currently in the success state + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -bool CResult_NodeIdDecodeErrorZ_is_ok(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR o); +void CVec_TransactionZ_free(struct LDKCVec_TransactionZ _res); /** - * Frees any resources used by the CResult_NodeIdDecodeErrorZ. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_NodeIdDecodeErrorZ_free(struct LDKCResult_NodeIdDecodeErrorZ _res); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_clone(const struct LDKC2Tuple_u32TxOutZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new C2Tuple_u32TxOutZ from the contained elements. */ -struct LDKCResult_NodeIdDecodeErrorZ CResult_NodeIdDecodeErrorZ_clone(const struct LDKCResult_NodeIdDecodeErrorZ *NONNULL_PTR orig); +struct LDKC2Tuple_u32TxOutZ C2Tuple_u32TxOutZ_new(uint32_t a, struct LDKTxOut b); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. + * Frees any resources used by the C2Tuple_u32TxOutZ. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_ok(struct LDKCOption_NetworkUpdateZ o); +void C2Tuple_u32TxOutZ_free(struct LDKC2Tuple_u32TxOutZ _res); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_err(struct LDKDecodeError e); +void CVec_C2Tuple_u32TxOutZZ_free(struct LDKCVec_C2Tuple_u32TxOutZZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR o); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(const struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. + * Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. */ -void CResult_COption_NetworkUpdateZDecodeErrorZ_free(struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ _res); +struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(struct LDKThirtyTwoBytes a, struct LDKCVec_C2Tuple_u32TxOutZZ b); /** - * Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. */ -struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ CResult_COption_NetworkUpdateZDecodeErrorZ_clone(const struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ *NONNULL_PTR orig); +void C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ _res); /** - * Constructs a new COption_AccessZ containing a crate::lightning::chain::Access + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_AccessZ COption_AccessZ_some(struct LDKAccess o); +void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); /** - * Constructs a new COption_AccessZ containing nothing + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_AccessZ COption_AccessZ_none(void); +void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); /** - * Frees any resources associated with the crate::lightning::chain::Access, if we are in the Some state + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. */ -void COption_AccessZ_free(struct LDKCOption_AccessZ _res); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_ok(struct LDKChannelUpdateInfo o); +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. */ -bool CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR o); +void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); /** - * Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. + * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. */ -void CResult_ChannelUpdateInfoDecodeErrorZ_free(struct LDKCResult_ChannelUpdateInfoDecodeErrorZ _res); +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); /** - * Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the C2Tuple_PublicKeyTypeZ. */ -struct LDKCResult_ChannelUpdateInfoDecodeErrorZ CResult_ChannelUpdateInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelUpdateInfoDecodeErrorZ *NONNULL_PTR orig); +void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_ok(struct LDKChannelInfo o); +void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. + * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_NetAddressZ containing nothing */ -bool CResult_ChannelInfoDecodeErrorZ_is_ok(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); /** - * Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. + * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state */ -void CResult_ChannelInfoDecodeErrorZ_free(struct LDKCResult_ChannelInfoDecodeErrorZ _res); +void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); /** - * Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` + * Creates a new COption_NetAddressZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelInfoDecodeErrorZ CResult_ChannelInfoDecodeErrorZ_clone(const struct LDKCResult_ChannelInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_ok(struct LDKRoutingFees o); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** * Checks if the given object is currently in the success state */ -bool CResult_RoutingFeesDecodeErrorZ_is_ok(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR o); +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. + * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. */ -void CResult_RoutingFeesDecodeErrorZ_free(struct LDKCResult_RoutingFeesDecodeErrorZ _res); +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); /** - * Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_RoutingFeesDecodeErrorZ CResult_RoutingFeesDecodeErrorZ_clone(const struct LDKCResult_RoutingFeesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. + * Creates a new CResult_NonePeerHandleErrorZ in the success state. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_ok(struct LDKNodeAnnouncementInfo o); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. + * Creates a new CResult_NonePeerHandleErrorZ in the error state. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. + * Frees any resources used by the CResult_NonePeerHandleErrorZ. */ -void CResult_NodeAnnouncementInfoDecodeErrorZ_free(struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ _res); +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); /** - * Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ CResult_NodeAnnouncementInfoDecodeErrorZ_clone(const struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_u64Z_free(struct LDKCVec_u64Z _res); +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the success state. + * Creates a new CResult_boolPeerHandleErrorZ in the success state. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_ok(struct LDKNodeInfo o); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); /** - * Creates a new CResult_NodeInfoDecodeErrorZ in the error state. + * Creates a new CResult_boolPeerHandleErrorZ in the error state. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NodeInfoDecodeErrorZ_is_ok(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR o); +bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NodeInfoDecodeErrorZ. + * Frees any resources used by the CResult_boolPeerHandleErrorZ. */ -void CResult_NodeInfoDecodeErrorZ_free(struct LDKCResult_NodeInfoDecodeErrorZ _res); +void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); /** - * Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NodeInfoDecodeErrorZ CResult_NodeInfoDecodeErrorZ_clone(const struct LDKCResult_NodeInfoDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. + * Creates a new CResult_NoneSendErrorZ in the success state. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_ok(struct LDKNetworkGraph o); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. + * Creates a new CResult_NoneSendErrorZ in the error state. */ -struct LDKCResult_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NetworkGraphDecodeErrorZ_is_ok(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. - */ -void CResult_NetworkGraphDecodeErrorZ_free(struct LDKCResult_NetworkGraphDecodeErrorZ _res); +bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NetworkGraphDecodeErrorZ 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_NetworkGraphDecodeErrorZ CResult_NetworkGraphDecodeErrorZ_clone(const struct LDKCResult_NetworkGraphDecodeErrorZ *NONNULL_PTR orig); +void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); /** - * Constructs a new COption_CVec_NetAddressZZ containing a crate::c_types::derived::CVec_NetAddressZ + * Creates a new CResult_u32GraphSyncErrorZ in the success state. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_some(struct LDKCVec_NetAddressZ o); +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_ok(uint32_t o); /** - * Constructs a new COption_CVec_NetAddressZZ containing nothing + * Creates a new CResult_u32GraphSyncErrorZ in the error state. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_none(void); +struct LDKCResult_u32GraphSyncErrorZ CResult_u32GraphSyncErrorZ_err(struct LDKGraphSyncError e); /** - * Frees any resources associated with the crate::c_types::derived::CVec_NetAddressZ, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_CVec_NetAddressZZ_free(struct LDKCOption_CVec_NetAddressZZ _res); +bool CResult_u32GraphSyncErrorZ_is_ok(const struct LDKCResult_u32GraphSyncErrorZ *NONNULL_PTR o); /** - * Creates a new COption_CVec_NetAddressZZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_u32GraphSyncErrorZ. */ -struct LDKCOption_CVec_NetAddressZZ COption_CVec_NetAddressZZ_clone(const struct LDKCOption_CVec_NetAddressZZ *NONNULL_PTR orig); +void CResult_u32GraphSyncErrorZ_free(struct LDKCResult_u32GraphSyncErrorZ _res); /** * Creates a new CResult_NetAddressDecodeErrorZ in the success state. @@ -15882,30 +17622,30 @@ void CResult_FundingSignedDecodeErrorZ_free(struct LDKCResult_FundingSignedDecod struct LDKCResult_FundingSignedDecodeErrorZ CResult_FundingSignedDecodeErrorZ_clone(const struct LDKCResult_FundingSignedDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_FundingLockedDecodeErrorZ in the success state. + * Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. */ -struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_ok(struct LDKFundingLocked o); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_ok(struct LDKChannelReady o); /** - * Creates a new CResult_FundingLockedDecodeErrorZ in the error state. + * Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. */ -struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_FundingLockedDecodeErrorZ_is_ok(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelReadyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_FundingLockedDecodeErrorZ. + * Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. */ -void CResult_FundingLockedDecodeErrorZ_free(struct LDKCResult_FundingLockedDecodeErrorZ _res); +void CResult_ChannelReadyDecodeErrorZ_free(struct LDKCResult_ChannelReadyDecodeErrorZ _res); /** - * Creates a new CResult_FundingLockedDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_FundingLockedDecodeErrorZ CResult_FundingLockedDecodeErrorZ_clone(const struct LDKCResult_FundingLockedDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_ChannelReadyDecodeErrorZ CResult_ChannelReadyDecodeErrorZ_clone(const struct LDKCResult_ChannelReadyDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_InitDecodeErrorZ in the success state. @@ -16141,6 +17881,32 @@ void CResult_UpdateAddHTLCDecodeErrorZ_free(struct LDKCResult_UpdateAddHTLCDecod */ struct LDKCResult_UpdateAddHTLCDecodeErrorZ CResult_UpdateAddHTLCDecodeErrorZ_clone(const struct LDKCResult_UpdateAddHTLCDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_OnionMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_ok(struct LDKOnionMessage o); + +/** + * Creates a new CResult_OnionMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OnionMessageDecodeErrorZ_is_ok(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OnionMessageDecodeErrorZ. + */ +void CResult_OnionMessageDecodeErrorZ_free(struct LDKCResult_OnionMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OnionMessageDecodeErrorZ CResult_OnionMessageDecodeErrorZ_clone(const struct LDKCResult_OnionMessageDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_PingDecodeErrorZ in the success state. */ @@ -16622,6 +18388,16 @@ struct LDKPaymentPurpose PaymentPurpose_invoice_payment(struct LDKThirtyTwoBytes */ struct LDKPaymentPurpose PaymentPurpose_spontaneous_payment(struct LDKThirtyTwoBytes a); +/** + * Serialize the PaymentPurpose object into a byte array which can be read by PaymentPurpose_read + */ +struct LDKCVec_u8Z PaymentPurpose_write(const struct LDKPaymentPurpose *NONNULL_PTR obj); + +/** + * Read a PaymentPurpose from a byte array, created by PaymentPurpose_write + */ +struct LDKCResult_PaymentPurposeDecodeErrorZ PaymentPurpose_read(struct LDKu8slice ser); + /** * Frees any resources used by the ClosureReason */ @@ -16682,6 +18458,41 @@ struct LDKCVec_u8Z ClosureReason_write(const struct LDKClosureReason *NONNULL_PT */ struct LDKCResult_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(struct LDKu8slice ser); +/** + * Frees any resources used by the HTLCDestination + */ +void HTLCDestination_free(struct LDKHTLCDestination this_ptr); + +/** + * Creates a copy of the HTLCDestination + */ +struct LDKHTLCDestination HTLCDestination_clone(const struct LDKHTLCDestination *NONNULL_PTR orig); + +/** + * Utility method to constructs a new NextHopChannel-variant HTLCDestination + */ +struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey node_id, struct LDKThirtyTwoBytes channel_id); + +/** + * Utility method to constructs a new UnknownNextHop-variant HTLCDestination + */ +struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); + +/** + * Utility method to constructs a new FailedPayment-variant HTLCDestination + */ +struct LDKHTLCDestination HTLCDestination_failed_payment(struct LDKThirtyTwoBytes payment_hash); + +/** + * 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); + /** * Frees any resources used by the Event */ @@ -16695,27 +18506,47 @@ struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); /** * Utility method to constructs a new FundingGenerationReady-variant Event */ -struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, uint64_t user_channel_id); +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, uint64_t user_channel_id); /** * Utility method to constructs a new PaymentReceived-variant Event */ -struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amt, struct LDKPaymentPurpose purpose); +struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); + +/** + * Utility method to constructs a new PaymentClaimed-variant Event + */ +struct LDKEvent Event_payment_claimed(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); + +/** + * Utility method to constructs a new PaymentPathSuccessful-variant Event + */ +struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); + /** * Utility method to constructs a new PaymentPathFailed-variant Event */ -struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool rejected_by_dest, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry); +struct LDKEvent Event_payment_path_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, bool payment_failed_permanently, struct LDKCOption_NetworkUpdateZ network_update, bool all_paths_failed, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id, struct LDKRouteParameters retry); /** - * Utility method to constructs a new PaymentFailed-variant Event + * Utility method to constructs a new ProbeSuccessful-variant Event */ -struct LDKEvent Event_payment_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash); +struct LDKEvent Event_probe_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); + +/** + * Utility method to constructs a new ProbeFailed-variant Event + */ +struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path, struct LDKCOption_u64Z short_channel_id); /** * Utility method to constructs a new PendingHTLCsForwardable-variant Event @@ -16730,7 +18561,7 @@ struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptor /** * Utility method to constructs a new PaymentForwarded-variant Event */ -struct LDKEvent Event_payment_forwarded(struct LDKCOption_u64Z fee_earned_msat, bool claim_from_onchain_tx); +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); /** * Utility method to constructs a new ChannelClosed-variant Event @@ -16743,14 +18574,14 @@ struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64 struct LDKEvent Event_discard_funding(struct LDKThirtyTwoBytes channel_id, struct LDKTransaction transaction); /** - * Utility method to constructs a new PaymentPathSuccessful-variant Event + * Utility method to constructs a new OpenChannelRequest-variant Event */ -struct LDKEvent Event_payment_path_successful(struct LDKThirtyTwoBytes payment_id, struct LDKThirtyTwoBytes payment_hash, struct LDKCVec_RouteHopZ path); +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 OpenChannelRequest-variant Event + * Utility method to constructs a new HTLCHandlingFailed-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); +struct LDKEvent Event_htlchandling_failed(struct LDKThirtyTwoBytes prev_channel_id, struct LDKHTLCDestination failed_next_destination); /** * Serialize the Event object into a byte array which can be read by Event_read @@ -16793,9 +18624,9 @@ struct LDKMessageSendEvent MessageSendEvent_send_funding_created(struct LDKPubli struct LDKMessageSendEvent MessageSendEvent_send_funding_signed(struct LDKPublicKey node_id, struct LDKFundingSigned msg); /** - * Utility method to constructs a new SendFundingLocked-variant MessageSendEvent + * Utility method to constructs a new SendChannelReady-variant MessageSendEvent */ -struct LDKMessageSendEvent MessageSendEvent_send_funding_locked(struct LDKPublicKey node_id, struct LDKFundingLocked msg); +struct LDKMessageSendEvent MessageSendEvent_send_channel_ready(struct LDKPublicKey node_id, struct LDKChannelReady msg); /** * Utility method to constructs a new SendAnnouncementSignatures-variant MessageSendEvent @@ -16828,14 +18659,14 @@ struct LDKMessageSendEvent MessageSendEvent_send_shutdown(struct LDKPublicKey no struct LDKMessageSendEvent MessageSendEvent_send_channel_reestablish(struct LDKPublicKey node_id, struct LDKChannelReestablish msg); /** - * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent + * Utility method to constructs a new SendChannelAnnouncement-variant MessageSendEvent */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); +struct LDKMessageSendEvent MessageSendEvent_send_channel_announcement(struct LDKPublicKey node_id, struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** - * Utility method to constructs a new BroadcastNodeAnnouncement-variant MessageSendEvent + * Utility method to constructs a new BroadcastChannelAnnouncement-variant MessageSendEvent */ -struct LDKMessageSendEvent MessageSendEvent_broadcast_node_announcement(struct LDKNodeAnnouncement msg); +struct LDKMessageSendEvent MessageSendEvent_broadcast_channel_announcement(struct LDKChannelAnnouncement msg, struct LDKChannelUpdate update_msg); /** * Utility method to constructs a new BroadcastChannelUpdate-variant MessageSendEvent @@ -16877,6 +18708,11 @@ struct LDKMessageSendEvent MessageSendEvent_send_gossip_timestamp_filter(struct */ 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 */ @@ -16927,28 +18763,78 @@ struct LDKAPIError APIError_monitor_update_failed(void); */ struct LDKAPIError APIError_incompatible_shutdown_script(struct LDKShutdownScript script); +/** + * Frees any resources used by the BigSize, if is_owned is set and inner is non-NULL. + */ +void BigSize_free(struct LDKBigSize this_obj); + +uint64_t BigSize_get_a(const struct LDKBigSize *NONNULL_PTR this_ptr); + +void BigSize_set_a(struct LDKBigSize *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs a new BigSize given each field + */ +MUST_USE_RES struct LDKBigSize BigSize_new(uint64_t a_arg); + +/** + * Frees any resources used by the Hostname, if is_owned is set and inner is non-NULL. + */ +void Hostname_free(struct LDKHostname this_obj); + +/** + * Creates a copy of the Hostname + */ +struct LDKHostname Hostname_clone(const struct LDKHostname *NONNULL_PTR orig); + +/** + * Returns the length of the hostname. + */ +MUST_USE_RES uint8_t Hostname_len(const struct LDKHostname *NONNULL_PTR this_arg); + /** * Creates a digital signature of a message given a SecretKey, like the node's secret. * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller. * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted. */ -struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); +struct LDKCResult_StringErrorZ sign(struct LDKu8slice msg, const uint8_t (*sk)[32]); + +/** + * Recovers the PublicKey of the signer of the message given the message and the signature. + */ +struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); + +/** + * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, + * and the PublicKey. + */ +bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); + +/** + * Construct the invoice's HRP and signatureless data into a preimage to be hashed. + */ +struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature); + +/** + * Calls the free function if one is set + */ +void Persister_free(struct LDKPersister this_ptr); /** - * Recovers the PublicKey of the signer of the message given the message and the signature. + * Calls the free function if one is set */ -struct LDKCResult_PublicKeyErrorZ recover_pk(struct LDKu8slice msg, struct LDKStr sig); +void FutureCallback_free(struct LDKFutureCallback this_ptr); /** - * Verifies a message was signed by a PrivateKey that derives to a given PublicKey, given a message, a signature, - * and the PublicKey. + * Frees any resources used by the Future, if is_owned is set and inner is non-NULL. */ -bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); +void Future_free(struct LDKFuture this_obj); /** - * Construct the invoice's HRP and signatureless data into a preimage to be hashed. + * Registers a callback to be called upon completion of this future. If the future has already + * completed, the callback will be called immediately. */ -struct LDKCVec_u8Z construct_invoice_preimage(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z data_without_signature); +void Future_register_callback_fn(const struct LDKFuture *NONNULL_PTR this_arg, struct LDKFutureCallback callback); /** * Creates a copy of the Level @@ -17076,7 +18962,15 @@ void ChannelHandshakeConfig_free(struct LDKChannelHandshakeConfig this_obj); * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the * equivalent limit applied to outbound channels). * + * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * * Default value: 6. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); @@ -17085,7 +18979,15 @@ uint32_t ChannelHandshakeConfig_get_minimum_depth(const struct LDKChannelHandsha * Applied only for inbound channels (see ChannelHandshakeLimits::max_minimum_depth for the * equivalent limit applied to outbound channels). * + * A lower-bound of 1 is applied, requiring all channels to have a confirmed commitment + * transaction before operation. If you wish to accept channels with zero confirmations, see + * [`UserConfig::manually_accept_inbound_channels`] and + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]. + * * Default value: 6. + * + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`ChannelManager::accept_inbound_channel_from_trusted_peer_0conf`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel_from_trusted_peer_0conf */ void ChannelHandshakeConfig_set_minimum_depth(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_t val); @@ -17149,6 +19051,60 @@ uint64_t ChannelHandshakeConfig_get_our_htlc_minimum_msat(const struct LDKChanne */ void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint64_t val); +/** + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * * If configured to another value than the default value 10, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: 10. + * Minimum value: 1, any values less than 1 will be treated as 1 instead. + * Maximum value: 100, any values larger than 100 will be treated as 100 instead. + */ +uint8_t ChannelHandshakeConfig_get_max_inbound_htlc_value_in_flight_percent_of_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * Sets the percentage of the channel value we will cap the total value of outstanding inbound + * HTLCs to. + * + * This can be set to a value between 1-100, where the value corresponds to the percent of the + * channel value in whole percentages. + * + * Note that: + * * If configured to another value than the default value 10, any new channels created with + * the non default value will cause versions of LDK prior to 0.0.104 to refuse to read the + * `ChannelManager`. + * + * * This caps the total value for inbound HTLCs in-flight only, and there's currently + * no way to configure the cap for the total value of outbound HTLCs in-flight. + * + * * The requirements for your node being online to ensure the safety of HTLC-encumbered funds + * are different from the non-HTLC-encumbered funds. This makes this an important knob to + * restrict exposure to loss due to being offline for too long. + * See [`ChannelHandshakeConfig::our_to_self_delay`] and [`ChannelConfig::cltv_expiry_delta`] + * for more information. + * + * Default value: 10. + * Minimum value: 1, any values less than 1 will be treated as 1 instead. + * Maximum value: 100, any values larger than 100 will be treated as 100 instead. + */ +void ChannelHandshakeConfig_set_max_inbound_htlc_value_in_flight_percent_of_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint8_t val); + /** * If set, we attempt to negotiate the `scid_privacy` (referred to as `scid_alias` in the * BOLTs) option for outbound private channels. This provides better privacy by not including @@ -17157,20 +19113,20 @@ void ChannelHandshakeConfig_set_our_htlc_minimum_msat(struct LDKChannelHandshake * * If this option is set, channels may be created that will not be readable by LDK versions * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a - * [`DecodeError:InvalidValue`]. + * [`DecodeError::InvalidValue`]. * * Note that setting this to true does *not* prevent us from opening channels with * counterparties that do not support the `scid_alias` option; we will simply fall back to a * private channel without that option. * * Ignored if the channel is negotiated to be announced, see - * [`ChannelConfig::announced_channel`] and + * [`ChannelHandshakeConfig::announced_channel`] and * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. * * Default value: false. This value is likely to change to true in the future. * * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); @@ -17182,27 +19138,139 @@ bool ChannelHandshakeConfig_get_negotiate_scid_privacy(const struct LDKChannelHa * * If this option is set, channels may be created that will not be readable by LDK versions * prior to 0.0.106, causing [`ChannelManager`]'s read method to return a - * [`DecodeError:InvalidValue`]. + * [`DecodeError::InvalidValue`]. * * Note that setting this to true does *not* prevent us from opening channels with * counterparties that do not support the `scid_alias` option; we will simply fall back to a * private channel without that option. * * Ignored if the channel is negotiated to be announced, see - * [`ChannelConfig::announced_channel`] and + * [`ChannelHandshakeConfig::announced_channel`] and * [`ChannelHandshakeLimits::force_announced_channel_preference`] for more. * * Default value: false. This value is likely to change to true in the future. * * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - * [`DecodeError:InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue + * [`DecodeError::InvalidValue`]: crate::ln::msgs::DecodeError::InvalidValue */ void ChannelHandshakeConfig_set_negotiate_scid_privacy(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); +/** + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: false. + */ +bool ChannelHandshakeConfig_get_announced_channel(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * Set to announce the channel publicly and notify all nodes that they can route via this + * channel. + * + * This should only be set to true for nodes which expect to be online reliably. + * + * As the node which funds a channel picks this value this will only apply for new outbound + * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. + * + * Default value: false. + */ +void ChannelHandshakeConfig_set_announced_channel(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); + +/** + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * + * Default value: true. + * + * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + */ +bool ChannelHandshakeConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty + * supports it, they will then enforce the mutual-close output to us matches what we provided + * at intialization, preventing us from closing to an alternate pubkey. + * + * This is set to true by default to provide a slight increase in security, though ultimately + * any attacker who is able to take control of a channel can just as easily send the funds via + * lightning payments, so we never require that our counterparties support this option. + * + * The upfront key committed is provided from [`KeysInterface::get_shutdown_scriptpubkey`]. + * + * Default value: true. + * + * [`KeysInterface::get_shutdown_scriptpubkey`]: crate::chain::keysinterface::KeysInterface::get_shutdown_scriptpubkey + */ +void ChannelHandshakeConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, bool val); + +/** + * The Proportion of the channel value to configure as counterparty's channel reserve, + * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. + * + * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain + * on their side, at all times. + * This ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * Channel reserve values greater than 30% could be considered highly unreasonable, since that + * amount can never be used for payments. + * Also, if our selected channel reserve for counterparty and counterparty's selected + * channel reserve for us sum up to equal or greater than channel value, channel negotiations + * will fail. + * + * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve + * other than the default value. + * + * Default value: 1% of channel value, i.e., configured as 10,000 millionths. + * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated + * as 1000 sats instead, which is a safe implementation-specific lower bound. + * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%) + * instead, although channel negotiations will fail in that case. + */ +uint32_t ChannelHandshakeConfig_get_their_channel_reserve_proportional_millionths(const struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr); + +/** + * The Proportion of the channel value to configure as counterparty's channel reserve, + * i.e., `their_channel_reserve_satoshis` for both outbound and inbound channels. + * + * `their_channel_reserve_satoshis` is the minimum balance that the other node has to maintain + * on their side, at all times. + * This ensures that if our counterparty broadcasts a revoked state, we can punish them by + * claiming at least this value on chain. + * + * Channel reserve values greater than 30% could be considered highly unreasonable, since that + * amount can never be used for payments. + * Also, if our selected channel reserve for counterparty and counterparty's selected + * channel reserve for us sum up to equal or greater than channel value, channel negotiations + * will fail. + * + * Note: Versions of LDK earlier than v0.0.104 will fail to read channels with any channel reserve + * other than the default value. + * + * Default value: 1% of channel value, i.e., configured as 10,000 millionths. + * Minimum value: If the calculated proportional value is less than 1000 sats, it will be treated + * as 1000 sats instead, which is a safe implementation-specific lower bound. + * Maximum value: 1,000,000, any values larger than 1 Million will be treated as 1 Million (or 100%) + * instead, although channel negotiations will fail in that case. + */ +void ChannelHandshakeConfig_set_their_channel_reserve_proportional_millionths(struct LDKChannelHandshakeConfig *NONNULL_PTR this_ptr, uint32_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, bool negotiate_scid_privacy_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); /** * Creates a copy of the ChannelHandshakeConfig @@ -17220,7 +19288,7 @@ MUST_USE_RES struct LDKChannelHandshakeConfig ChannelHandshakeConfig_default(voi void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); /** - * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so + * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so * only applies to inbound channels. * * Default value: 0. @@ -17228,13 +19296,29 @@ void ChannelHandshakeLimits_free(struct LDKChannelHandshakeLimits this_obj); uint64_t ChannelHandshakeLimits_get_min_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); /** - * Minimum allowed satoshis when a channel is funded, this is supplied by the sender and so + * Minimum allowed satoshis when a channel is funded. This is supplied by the sender and so * only applies to inbound channels. * * Default value: 0. */ void ChannelHandshakeLimits_set_min_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); +/** + * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 2^24 - 1. + */ +uint64_t ChannelHandshakeLimits_get_max_funding_satoshis(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * Maximum allowed satoshis when a channel is funded. This is supplied by the sender and so + * only applies to inbound channels. + * + * Default value: 2^24 - 1. + */ +void ChannelHandshakeLimits_set_max_funding_satoshis(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint64_t val); + /** * The remote node sets a limit on the minimum size of HTLCs we can send to them. This allows * you to limit the maximum minimum-size they can require. @@ -17321,12 +19405,54 @@ uint32_t ChannelHandshakeLimits_get_max_minimum_depth(const struct LDKChannelHan */ void ChannelHandshakeLimits_set_max_minimum_depth(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, uint32_t val); +/** + * Whether we implicitly trust funding transactions generated by us for our own outbound + * channels to not be double-spent. + * + * If this is set, we assume that our own funding transactions are *never* double-spent, and + * thus we can trust them without any confirmations. This is generally a reasonable + * assumption, given we're the only ones who could ever double-spend it (assuming we have sole + * control of the signing keys). + * + * You may wish to un-set this if you allow the user to (or do in an automated fashion) + * double-spend the funding transaction to RBF with an alternative channel open. + * + * This only applies if our counterparty set their confirmations-required value to 0, and we + * always trust our own funding transaction at 1 confirmation irrespective of this value. + * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being + * `true` (0) and `false` (1). + * + * Default value: true + */ +bool ChannelHandshakeLimits_get_trust_own_funding_0conf(const struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr); + +/** + * Whether we implicitly trust funding transactions generated by us for our own outbound + * channels to not be double-spent. + * + * If this is set, we assume that our own funding transactions are *never* double-spent, and + * thus we can trust them without any confirmations. This is generally a reasonable + * assumption, given we're the only ones who could ever double-spend it (assuming we have sole + * control of the signing keys). + * + * You may wish to un-set this if you allow the user to (or do in an automated fashion) + * double-spend the funding transaction to RBF with an alternative channel open. + * + * This only applies if our counterparty set their confirmations-required value to 0, and we + * always trust our own funding transaction at 1 confirmation irrespective of this value. + * Thus, this effectively acts as a `min_minimum_depth`, with the only possible values being + * `true` (0) and `false` (1). + * + * Default value: true + */ +void ChannelHandshakeLimits_set_trust_own_funding_0conf(struct LDKChannelHandshakeLimits *NONNULL_PTR this_ptr, bool val); + /** * Set to force an incoming channel to match our announced channel preference in - * [`ChannelConfig::announced_channel`]. + * [`ChannelHandshakeConfig::announced_channel`]. * * For a node which is not online reliably, this should be set to true and - * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) * channels will ever be opened. * * Default value: true. @@ -17335,10 +19461,10 @@ bool ChannelHandshakeLimits_get_force_announced_channel_preference(const struct /** * Set to force an incoming channel to match our announced channel preference in - * [`ChannelConfig::announced_channel`]. + * [`ChannelHandshakeConfig::announced_channel`]. * * For a node which is not online reliably, this should be set to true and - * [`ChannelConfig::announced_channel`] set to false, ensuring that no announced (aka public) + * [`ChannelHandshakeConfig::announced_channel`] set to false, ensuring that no announced (aka public) * channels will ever be opened. * * Default value: true. @@ -17370,7 +19496,7 @@ void ChannelHandshakeLimits_set_their_to_self_delay(struct LDKChannelHandshakeLi /** * Constructs a new ChannelHandshakeLimits given each field */ -MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); +MUST_USE_RES struct LDKChannelHandshakeLimits ChannelHandshakeLimits_new(uint64_t min_funding_satoshis_arg, uint64_t max_funding_satoshis_arg, uint64_t max_htlc_minimum_msat_arg, uint64_t min_max_htlc_value_in_flight_msat_arg, uint64_t max_channel_reserve_satoshis_arg, uint16_t min_max_accepted_htlcs_arg, uint32_t max_minimum_depth_arg, bool trust_own_funding_0conf_arg, bool force_announced_channel_preference_arg, uint16_t their_to_self_delay_arg); /** * Creates a copy of the ChannelHandshakeLimits @@ -17485,66 +19611,6 @@ uint16_t ChannelConfig_get_cltv_expiry_delta(const struct LDKChannelConfig *NONN */ void ChannelConfig_set_cltv_expiry_delta(struct LDKChannelConfig *NONNULL_PTR this_ptr, uint16_t val); -/** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. - */ -bool ChannelConfig_get_announced_channel(const struct LDKChannelConfig *NONNULL_PTR this_ptr); - -/** - * Set to announce the channel publicly and notify all nodes that they can route via this - * channel. - * - * This should only be set to true for nodes which expect to be online reliably. - * - * As the node which funds a channel picks this value this will only apply for new outbound - * channels unless [`ChannelHandshakeLimits::force_announced_channel_preference`] is set. - * - * This cannot be changed after the initial channel handshake. - * - * Default value: false. - */ -void ChannelConfig_set_announced_channel(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); - -/** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. - */ -bool ChannelConfig_get_commit_upfront_shutdown_pubkey(const struct LDKChannelConfig *NONNULL_PTR this_ptr); - -/** - * When set, we commit to an upfront shutdown_pubkey at channel open. If our counterparty - * supports it, they will then enforce the mutual-close output to us matches what we provided - * at intialization, preventing us from closing to an alternate pubkey. - * - * This is set to true by default to provide a slight increase in security, though ultimately - * any attacker who is able to take control of a channel can just as easily send the funds via - * lightning payments, so we never require that our counterparties support this option. - * - * This cannot be changed after a channel has been initialized. - * - * Default value: true. - */ -void ChannelConfig_set_commit_upfront_shutdown_pubkey(struct LDKChannelConfig *NONNULL_PTR this_ptr, bool val); - /** * Limit our total exposure to in-flight HTLCs which are burned to fees as they are too * small to claim on-chain. @@ -17638,7 +19704,7 @@ void ChannelConfig_set_force_close_avoidance_max_fee_satoshis(struct LDKChannelC /** * Constructs a new ChannelConfig given each field */ -MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, bool announced_channel_arg, bool commit_upfront_shutdown_pubkey_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); +MUST_USE_RES struct LDKChannelConfig ChannelConfig_new(uint32_t forwarding_fee_proportional_millionths_arg, uint32_t forwarding_fee_base_msat_arg, uint16_t cltv_expiry_delta_arg, uint64_t max_dust_htlc_exposure_msat_arg, uint64_t force_close_avoidance_max_fee_satoshis_arg); /** * Creates a copy of the ChannelConfig @@ -17666,34 +19732,34 @@ struct LDKCResult_ChannelConfigDecodeErrorZ ChannelConfig_read(struct LDKu8slice void UserConfig_free(struct LDKUserConfig this_obj); /** - * Channel config that we propose to our counterparty. + * Channel handshake config that we propose to our counterparty. */ -struct LDKChannelHandshakeConfig UserConfig_get_own_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKChannelHandshakeConfig UserConfig_get_channel_handshake_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Channel config that we propose to our counterparty. + * Channel handshake config that we propose to our counterparty. */ -void UserConfig_set_own_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); +void UserConfig_set_channel_handshake_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeConfig val); /** - * Limits applied to our counterparty's proposed channel config settings. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -struct LDKChannelHandshakeLimits UserConfig_get_peer_channel_config_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKChannelHandshakeLimits UserConfig_get_channel_handshake_limits(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** - * Limits applied to our counterparty's proposed channel config settings. + * Limits applied to our counterparty's proposed channel handshake config settings. */ -void UserConfig_set_peer_channel_config_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); +void UserConfig_set_channel_handshake_limits(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelHandshakeLimits val); /** * Channel config which affects behavior during channel lifetime. */ -struct LDKChannelConfig UserConfig_get_channel_options(const struct LDKUserConfig *NONNULL_PTR this_ptr); +struct LDKChannelConfig UserConfig_get_channel_config(const struct LDKUserConfig *NONNULL_PTR this_ptr); /** * Channel config which affects behavior during channel lifetime. */ -void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); +void UserConfig_set_channel_config(struct LDKUserConfig *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** * If this is set to false, we will reject any HTLCs which were to be forwarded over private @@ -17701,7 +19767,7 @@ void UserConfig_set_channel_options(struct LDKUserConfig *NONNULL_PTR this_ptr, * node which is not online reliably. * * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelConfig::announced_channel`] and + * (using [`ChannelHandshakeConfig::announced_channel`] and * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to * ensure you are not exposed to any forwarding risk. * @@ -17721,7 +19787,7 @@ bool UserConfig_get_accept_forwards_to_priv_channels(const struct LDKUserConfig * node which is not online reliably. * * For nodes which are not online reliably, you should set all channels to *not* be announced - * (using [`ChannelConfig::announced_channel`] and + * (using [`ChannelHandshakeConfig::announced_channel`] and * [`ChannelHandshakeLimits::force_announced_channel_preference`]) and set this to false to * ensure you are not exposed to any forwarding risk. * @@ -17784,7 +19850,7 @@ void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNU /** * Constructs a new UserConfig given each field */ -MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig own_channel_config_arg, struct LDKChannelHandshakeLimits peer_channel_config_limits_arg, struct LDKChannelConfig channel_options_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg); +MUST_USE_RES struct LDKUserConfig UserConfig_new(struct LDKChannelHandshakeConfig channel_handshake_config_arg, struct LDKChannelHandshakeLimits channel_handshake_limits_arg, struct LDKChannelConfig channel_config_arg, bool accept_forwards_to_priv_channels_arg, bool accept_inbound_channels_arg, bool manually_accept_inbound_channels_arg); /** * Creates a copy of the UserConfig @@ -18227,9 +20293,19 @@ struct LDKBalance Balance_claimable_awaiting_confirmations(uint64_t claimable_am struct LDKBalance Balance_contentious_claimable(uint64_t claimable_amount_satoshis, uint32_t timeout_height); /** - * Utility method to constructs a new MaybeClaimableHTLCAwaitingTimeout-variant Balance + * Utility method to constructs a new MaybeTimeoutClaimableHTLC-variant Balance */ -struct LDKBalance Balance_maybe_claimable_htlcawaiting_timeout(uint64_t claimable_amount_satoshis, uint32_t claimable_height); +struct LDKBalance Balance_maybe_timeout_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t claimable_height); + +/** + * Utility method to constructs a new MaybePreimageClaimableHTLC-variant Balance + */ +struct LDKBalance Balance_maybe_preimage_claimable_htlc(uint64_t claimable_amount_satoshis, uint32_t expiry_height); + +/** + * Utility method to constructs a new CounterpartyRevokedOutputClaimable-variant Balance + */ +struct LDKBalance Balance_counterparty_revoked_output_claimable(uint64_t claimable_amount_satoshis); /** * Checks if two Balances contain equal inner contents. @@ -18253,7 +20329,7 @@ struct LDKCVec_u8Z ChannelMonitor_write(const struct LDKChannelMonitor *NONNULL_ * * panics if the given update is not the next update by update_id. */ -MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, const struct LDKFeeEstimator *NONNULL_PTR fee_estimator, const struct LDKLogger *NONNULL_PTR logger); +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKChannelMonitorUpdate *NONNULL_PTR updates, const struct LDKBroadcasterInterface *NONNULL_PTR broadcaster, struct LDKFeeEstimator fee_estimator, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this @@ -18295,6 +20371,16 @@ MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_m */ MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +/** + * Gets the `node_id` of the counterparty for this channel. + * + * Will be `None` for channels constructed on LDK versions prior to 0.0.110 and always `Some` + * otherwise. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPublicKey ChannelMonitor_get_counterparty_node_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); + /** * Used by ChannelManager deserialization to broadcast the latest holder state if its copy of * the Channel was out-of-date. You may use it to get a broadcastable holder toxic tx in case of @@ -18382,8 +20468,9 @@ MUST_USE_RES struct LDKBestBlock ChannelMonitor_current_best_block(const struct * balance, or until our counterparty has claimed the balance and accrued several * confirmations on the claim transaction. * - * Note that the balances available when you or your counterparty have broadcasted revoked - * state(s) may not be fully captured here. + * Note that for `ChannelMonitors` which track a channel which went on-chain with versions of + * LDK prior to 0.0.111, balances may not be fully captured if our counterparty broadcasted + * a revoked state. * * See [`Balance`] for additional details on the types of claimable balances which * may be returned here and their meanings. @@ -18494,6 +20581,13 @@ uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelaye */ void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); +/** + * The output which is referenced by the given outpoint + * + * Returns a copy of the field. + */ +struct LDKTxOut DelayedPaymentOutputDescriptor_get_output(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); + /** * The output which is referenced by the given outpoint */ @@ -18570,6 +20664,13 @@ struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKSt */ void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); +/** + * The output which is referenced by the given outpoint + * + * Returns a copy of the field. + */ +struct LDKTxOut StaticPaymentOutputDescriptor_get_output(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); + /** * The output which is referenced by the given outpoint */ @@ -19109,10 +21210,34 @@ struct LDKCounterpartyForwardingInfo ChannelCounterparty_get_forwarding_info(con */ void ChannelCounterparty_set_forwarding_info(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCounterpartyForwardingInfo val); +/** + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + */ +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_minimum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); + +/** + * The smallest value HTLC (in msat) the remote peer will accept, for this channel. This field + * is only `None` before we have received either the `OpenChannel` or `AcceptChannel` message + * from the remote peer, or for `ChannelCounterparty` objects serialized prior to LDK 0.0.107. + */ +void ChannelCounterparty_set_outbound_htlc_minimum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + */ +struct LDKCOption_u64Z ChannelCounterparty_get_outbound_htlc_maximum_msat(const struct LDKChannelCounterparty *NONNULL_PTR this_ptr); + +/** + * The largest value HTLC (in msat) the remote peer currently will accept, for this channel. + */ +void ChannelCounterparty_set_outbound_htlc_maximum_msat(struct LDKChannelCounterparty *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + /** * Constructs a new ChannelCounterparty given each field */ -MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg); +MUST_USE_RES struct LDKChannelCounterparty ChannelCounterparty_new(struct LDKPublicKey node_id_arg, struct LDKInitFeatures features_arg, uint64_t unspendable_punishment_reserve_arg, struct LDKCounterpartyForwardingInfo forwarding_info_arg, struct LDKCOption_u64Z outbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z outbound_htlc_maximum_msat_arg); /** * Creates a copy of the ChannelCounterparty @@ -19197,8 +21322,14 @@ void ChannelDetails_set_channel_type(struct LDKChannelDetails *NONNULL_PTR this_ * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound * payments instead of this. See [`get_inbound_payment_scid`]. * + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. + * * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required */ struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); @@ -19209,11 +21340,43 @@ struct LDKCOption_u64Z ChannelDetails_get_short_channel_id(const struct LDKChann * Note that if [`inbound_scid_alias`] is set, it must be used for invoices and inbound * payments instead of this. See [`get_inbound_payment_scid`]. * + * For channels with [`confirmations_required`] set to `Some(0)`, [`outbound_scid_alias`] may + * be used in place of this in outbound routes. See [`get_outbound_payment_scid`]. + * * [`inbound_scid_alias`]: Self::inbound_scid_alias + * [`outbound_scid_alias`]: Self::outbound_scid_alias * [`get_inbound_payment_scid`]: Self::get_inbound_payment_scid + * [`get_outbound_payment_scid`]: Self::get_outbound_payment_scid + * [`confirmations_required`]: Self::confirmations_required */ void ChannelDetails_set_short_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +/** + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). + * + * This will be `None` as long as the channel is not available for routing outbound payments. + * + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required + */ +struct LDKCOption_u64Z ChannelDetails_get_outbound_scid_alias(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * An optional [`short_channel_id`] alias for this channel, randomly generated by us and + * usable in place of [`short_channel_id`] to reference the channel in outbound routes when + * the channel has not yet been confirmed (as long as [`confirmations_required`] is + * `Some(0)`). + * + * This will be `None` as long as the channel is not available for routing outbound payments. + * + * [`short_channel_id`]: Self::short_channel_id + * [`confirmations_required`]: Self::confirmations_required + */ +void ChannelDetails_set_outbound_scid_alias(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + /** * An optional [`short_channel_id`] alias for this channel, randomly generated by our * counterparty and usable in place of [`short_channel_id`] in invoice route hints. Our @@ -19342,6 +21505,26 @@ uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetail */ void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +/** + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. + * + * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. + */ +uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The available outbound capacity for sending a single HTLC to the remote peer. This is + * similar to [`ChannelDetails::outbound_capacity_msat`] but it may be further restricted by + * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us + * to use a limit as close as possible to the HTLC limit we can currently send. + * + * See also [`ChannelDetails::balance_msat`] and [`ChannelDetails::outbound_capacity_msat`]. + */ +void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); + /** * The available inbound capacity for the remote peer to send HTLCs to us. This does not * include any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not @@ -19431,57 +21614,97 @@ bool ChannelDetails_get_is_outbound(const struct LDKChannelDetails *NONNULL_PTR void ChannelDetails_set_is_outbound(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * True if the channel is confirmed, funding_locked messages have been exchanged, and the - * channel is not currently being shut down. `funding_locked` message exchange implies the + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the * required confirmation count has been reached (and we were connected to the peer at some * point after the funding transaction received enough confirmations). The required * confirmation count is provided in [`confirmations_required`]. * * [`confirmations_required`]: ChannelDetails::confirmations_required */ -bool ChannelDetails_get_is_funding_locked(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool ChannelDetails_get_is_channel_ready(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * True if the channel is confirmed, funding_locked messages have been exchanged, and the - * channel is not currently being shut down. `funding_locked` message exchange implies the + * True if the channel is confirmed, channel_ready messages have been exchanged, and the + * channel is not currently being shut down. `channel_ready` message exchange implies the * required confirmation count has been reached (and we were connected to the peer at some * point after the funding transaction received enough confirmations). The required * confirmation count is provided in [`confirmations_required`]. * * [`confirmations_required`]: ChannelDetails::confirmations_required */ -void ChannelDetails_set_is_funding_locked(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelDetails_set_is_channel_ready(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** - * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) * the peer is connected, and (c) the channel is not currently negotiating a shutdown. * - * This is a strict superset of `is_funding_locked`. + * This is a strict superset of `is_channel_ready`. */ bool ChannelDetails_get_is_usable(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * True if the channel is (a) confirmed and funding_locked messages have been exchanged, (b) + * True if the channel is (a) confirmed and channel_ready messages have been exchanged, (b) * the peer is connected, and (c) the channel is not currently negotiating a shutdown. * - * This is a strict superset of `is_funding_locked`. + * This is a strict superset of `is_channel_ready`. */ void ChannelDetails_set_is_usable(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); /** * True if this channel is (or will be) publicly-announced. */ -bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +bool ChannelDetails_get_is_public(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * True if this channel is (or will be) publicly-announced. + */ +void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); + +/** + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + */ +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_minimum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The smallest value HTLC (in msat) we will accept, for this channel. This field + * is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.107 + */ +void ChannelDetails_set_inbound_htlc_minimum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * The largest value HTLC (in msat) we currently will accept, for this channel. + */ +struct LDKCOption_u64Z ChannelDetails_get_inbound_htlc_maximum_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The largest value HTLC (in msat) we currently will accept, for this channel. + */ +void ChannelDetails_set_inbound_htlc_maximum_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKChannelConfig ChannelDetails_get_config(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * True if this channel is (or will be) publicly-announced. + * Set of configurable parameters that affect channel operation. + * + * This field is only `None` for `ChannelDetails` objects serialized prior to LDK 0.0.109. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None */ -void ChannelDetails_set_is_public(struct LDKChannelDetails *NONNULL_PTR this_ptr, bool val); +void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKChannelConfig val); /** * 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 inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, uint64_t user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_funding_locked_arg, bool is_usable_arg, bool is_public_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, uint64_t 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_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 @@ -19498,6 +21721,16 @@ struct LDKChannelDetails ChannelDetails_clone(const struct LDKChannelDetails *NO */ MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_inbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); +/** + * Gets the current SCID which should be used to identify this channel for outbound payments. + * This should be used in [`Route`]s to describe the first hop or in other contexts where + * we're sending or forwarding a payment outbound over this channel. + * + * This is either the [`ChannelDetails::short_channel_id`], if set, or the + * [`ChannelDetails::outbound_scid_alias`]. See those for more information. + */ +MUST_USE_RES struct LDKCOption_u64Z ChannelDetails_get_outbound_payment_scid(const struct LDKChannelDetails *NONNULL_PTR this_arg); + /** * Frees any resources used by the PaymentSendFailure */ @@ -19583,8 +21816,6 @@ struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRoute * * Non-proportional fees are fixed according to our risk using the provided fee estimator. * - * panics if channel_value_satoshis is >= `MAX_FUNDING_SATOSHIS`! - * * 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`. @@ -19592,7 +21823,7 @@ struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRoute MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKLogger logger, struct LDKKeysInterface keys_manager, struct LDKUserConfig config, struct LDKChainParameters params); /** - * Gets the current configuration applied to all new channels, as + * Gets the current configuration applied to all new channels. */ MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configuration(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -19635,12 +21866,14 @@ MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(cons MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Gets the list of usable channels, in random order. Useful as an argument to - * get_route to ensure non-announced channels are used. + * Gets the list of usable channels, in random order. Useful as an argument to [`find_route`] + * to ensure non-announced channels are used. * * These are guaranteed to have their [`ChannelDetails::is_usable`] value set to true, see the * documentation for [`ChannelDetails::is_usable`] for more info on exactly what the criteria * are. + * + * [`find_route`]: crate::routing::router::find_route */ MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -19663,7 +21896,7 @@ MUST_USE_RES struct LDKCVec_ChannelDetailsZ ChannelManager_list_usable_channels( * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); +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); /** * Begins the process of closing a channel. After this call (plus some timeout), no new HTLCs @@ -19686,19 +21919,37 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_close_channel(const * [`Background`]: crate::chain::chaininterface::ConfirmationTarget::Background * [`Normal`]: crate::chain::chaininterface::ConfirmationTarget::Normal */ -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], uint32_t target_feerate_sats_per_1000_weight); +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); + +/** + * Force closes a channel, immediately broadcasting the latest local transaction(s) and + * rejecting new HTLCs on the given channel. Fails if `channel_id` is unknown to + * the manager, or if the `counterparty_node_id` isn't the counterparty of the corresponding + * channel. + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); /** - * Force closes a channel, immediately broadcasting the latest local commitment transaction to - * the chain and rejecting new HTLCs on the given channel. Fails if channel_id is unknown to the manager. + * Force closes a channel, rejecting new HTLCs on the given channel but skips broadcasting + * the latest local transaction(s). Fails if `channel_id` is unknown to the manager, or if the + * `counterparty_node_id` isn't the counterparty of the corresponding channel. + * + * You can always get the latest local transaction(s) to broadcast from + * [`ChannelMonitor::get_latest_holder_commitment_txn`]. */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32]); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_force_close_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*channel_id)[32], struct LDKPublicKey counterparty_node_id); /** * Force close all channels, immediately broadcasting the latest local commitment transaction * for each to the chain and rejecting new HTLCs on each. */ -void ChannelManager_force_close_all_channels(const struct LDKChannelManager *NONNULL_PTR this_arg); +void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Force close all channels rejecting new HTLCs on each but without broadcasting the latest + * local transaction(s). + */ +void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Sends a payment along a given route. @@ -19797,12 +22048,22 @@ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR */ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); +/** + * 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); + /** * Call this upon creation of a funding transaction for the given channel. * * Returns an [`APIError::APIMisuseError`] if the funding_transaction spent non-SegWit outputs * or if no output was found which matches the parameters in [`Event::FundingGenerationReady`]. * + * Returns [`APIError::APIMisuseError`] if the funding transaction is not final for propagation + * across the p2p network. + * * Returns [`APIError::ChannelUnavailable`] if a funding transaction has already been provided * for the channel or if the channel has been closed as indicated by [`Event::ChannelClosed`]. * @@ -19818,32 +22079,41 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ * not currently support replacing a funding transaction on an existing channel. Instead, * create a new channel with a conflicting funding transaction. * + * Note to keep the miner incentives aligned in moving the blockchain forward, we recommend + * the wallet software generating the funding transaction to apply anti-fee sniping as + * implemented by Bitcoin Core wallet. See + * for more details. + * * [`Event::FundingGenerationReady`]: crate::util::events::Event::FundingGenerationReady * [`Event::ChannelClosed`]: crate::util::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 LDKTransaction funding_transaction); +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); /** - * Regenerates channel_announcements and generates a signed node_announcement from the given - * arguments, providing them in corresponding events via - * [`get_and_clear_pending_msg_events`], if at least one public channel has been confirmed - * on-chain. This effectively re-broadcasts all channel announcements and sends our node - * announcement to ensure that the lightning P2P network is aware of the channels we have and - * our network addresses. + * Atomically updates the [`ChannelConfig`] for the given channels. * - * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this - * node to humans. They carry no in-protocol meaning. + * Once the updates are applied, each eligible channel (advertised with a known short channel + * ID and a change in [`forwarding_fee_proportional_millionths`], [`forwarding_fee_base_msat`], + * or [`cltv_expiry_delta`]) has a [`BroadcastChannelUpdate`] event message generated + * containing the new [`ChannelUpdate`] message which should be broadcast to the network. * - * `addresses` represent the set (possibly empty) of socket addresses on which this node - * accepts incoming connections. These will be included in the node_announcement, publicly - * tying these addresses together and to this node. If you wish to preserve user privacy, - * addresses should likely contain only Tor Onion addresses. + * Returns [`ChannelUnavailable`] when a channel is not found or an incorrect + * `counterparty_node_id` is provided. * - * Panics if `addresses` is absurdly large (more than 500). + * Returns [`APIMisuseError`] when a [`cltv_expiry_delta`] update is to be applied with a value + * below [`MIN_CLTV_EXPIRY_DELTA`]. * - * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events + * If an error is returned, none of the updates should be considered applied. + * + * [`forwarding_fee_proportional_millionths`]: ChannelConfig::forwarding_fee_proportional_millionths + * [`forwarding_fee_base_msat`]: ChannelConfig::forwarding_fee_base_msat + * [`cltv_expiry_delta`]: ChannelConfig::cltv_expiry_delta + * [`BroadcastChannelUpdate`]: events::MessageSendEvent::BroadcastChannelUpdate + * [`ChannelUpdate`]: msgs::ChannelUpdate + * [`ChannelUnavailable`]: APIError::ChannelUnavailable + * [`APIMisuseError`]: APIError::APIMisuseError */ -void ChannelManager_broadcast_node_announcement(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_update_channel_config(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey counterparty_node_id, struct LDKCVec_ThirtyTwoBytesZ channel_ids, const struct LDKChannelConfig *NONNULL_PTR config); /** * Processes HTLCs which are pending waiting on random forward delay. @@ -19861,6 +22131,8 @@ void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager * * 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`. * * Note that this may cause reentrancy through `chain::Watch::update_channel` calls or feerate * estimate fetches. @@ -19871,29 +22143,40 @@ void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_ * Indicates that the preimage for payment_hash is unknown or the received amount is incorrect * after a PaymentReceived event, failing the HTLC back to its origin and freeing resources * along the path (including in our own channel on which we received it). - * Returns false if no payment was found to fail backwards, true if the process of failing the - * HTLC backwards has been started. + * + * Note that in some cases around unclean shutdown, it is possible the payment may have + * already been claimed by you via [`ChannelManager::claim_funds`] prior to you seeing (a + * second copy of) the [`events::Event::PaymentReceived`] event. Alternatively, the payment + * may have already been failed automatically by LDK if it was nearing its expiration time. + * + * While LDK will never claim a payment automatically on your behalf (i.e. without you calling + * [`ChannelManager::claim_funds`]), you should still monitor for + * [`events::Event::PaymentClaimed`] events even for payments you intend to fail, especially on + * startup during which time claims that were in-progress at shutdown may be replayed. */ -MUST_USE_RES bool ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); +void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*payment_hash)[32]); /** * Provides a payment preimage in response to [`Event::PaymentReceived`], 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. + * * 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 `PaymentReceived` * 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. * - * Returns whether any HTLCs were claimed, and thus if any new [`MessageSendEvent`]s are now - * pending for processing via [`get_and_clear_pending_msg_events`]. - * * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived + * [`Event::PaymentClaimed`]: crate::util::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 * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events */ -MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); +void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); /** * Gets the node_id held by this ChannelManager @@ -19901,19 +22184,46 @@ MUST_USE_RES bool ChannelManager_claim_funds(const struct LDKChannelManager *NON MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Called to accept a request to open a channel after [`Event::OpenChannelRequest`] has been - * triggered. + * Accepts a request to open a channel after a [`Event::OpenChannelRequest`]. + * + * The `temporary_channel_id` parameter indicates which inbound channel should be accepted, + * and the `counterparty_node_id` parameter is the id of the peer which has requested to open + * the channel. * - * The `temporary_channel_id` parameter indicates which inbound channel should be accepted. + * The `user_channel_id` parameter will be provided back in + * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Note that this method will return an error and reject the channel, if it requires support + * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be + * used to accept such channels. + * + * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest + * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id); + +/** + * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating + * it as confirmed immediately. * - * For inbound channels, the `user_channel_id` parameter will be provided back in + * The `user_channel_id` parameter will be provided back in * [`Event::ChannelClosed::user_channel_id`] to allow tracking of which events correspond - * with which `accept_inbound_channel` call. + * with which `accept_inbound_channel`/`accept_inbound_channel_from_trusted_peer_0conf` call. + * + * Unlike [`ChannelManager::accept_inbound_channel`], this method accepts the incoming channel + * and (if the counterparty agrees), enables forwarding of payments immediately. + * + * This fully trusts that the counterparty has honestly and correctly constructed the funding + * transaction and blindly assumes that it will eventually confirm. + * + * If it does not confirm before we decide to close the channel, or if the funding transaction + * does not pay to the correct script the correct amount, *you will lose funds*. * * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ -MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], uint64_t user_channel_id); +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const uint8_t (*temporary_channel_id)[32], struct LDKPublicKey counterparty_node_id, uint64_t user_channel_id); /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing @@ -20082,6 +22392,13 @@ MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct L */ 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); + /** * Gets the latest best block which was connected either via the [`chain::Listen`] or * [`chain::Confirm`] interfaces. @@ -20240,6 +22557,44 @@ MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct */ struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(struct LDKu8slice ser, struct LDKChannelManagerReadArgs arg); +/** + * Frees any resources used by the ExpandedKey, if is_owned is set and inner is non-NULL. + */ +void ExpandedKey_free(struct LDKExpandedKey this_obj); + +/** + * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret. + * + * It is recommended to cache this value and not regenerate it for each new inbound payment. + */ +MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]); + +/** + * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no + * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without + * a `ChannelManager`. + * + * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then + * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not + * regenerate it for each new inbound payment. + * + * `current_time` is a Unix timestamp representing the current time. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + */ +struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKKeysInterface *NONNULL_PTR keys_manager, uint64_t current_time); + +/** + * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`], + * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments] + * without a `ChannelManager`. + * + * See [`create`] for information on the `keys` and `current_time` parameters. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + */ +struct LDKCResult_PaymentSecretNoneZ create_from_hash(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, uint64_t current_time); + /** * Frees any resources used by the DecodeError, if is_owned is set and inner is non-NULL. */ @@ -20918,51 +23273,51 @@ MUST_USE_RES struct LDKFundingSigned FundingSigned_new(struct LDKThirtyTwoBytes struct LDKFundingSigned FundingSigned_clone(const struct LDKFundingSigned *NONNULL_PTR orig); /** - * Frees any resources used by the FundingLocked, if is_owned is set and inner is non-NULL. + * Frees any resources used by the ChannelReady, if is_owned is set and inner is non-NULL. */ -void FundingLocked_free(struct LDKFundingLocked this_obj); +void ChannelReady_free(struct LDKChannelReady this_obj); /** * The channel ID */ -const uint8_t (*FundingLocked_get_channel_id(const struct LDKFundingLocked *NONNULL_PTR this_ptr))[32]; +const uint8_t (*ChannelReady_get_channel_id(const struct LDKChannelReady *NONNULL_PTR this_ptr))[32]; /** * The channel ID */ -void FundingLocked_set_channel_id(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void ChannelReady_set_channel_id(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * The per-commitment point of the second commitment transaction */ -struct LDKPublicKey FundingLocked_get_next_per_commitment_point(const struct LDKFundingLocked *NONNULL_PTR this_ptr); +struct LDKPublicKey ChannelReady_get_next_per_commitment_point(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** * The per-commitment point of the second commitment transaction */ -void FundingLocked_set_next_per_commitment_point(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void ChannelReady_set_next_per_commitment_point(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * If set, provides a short_channel_id alias for this channel. The sender will accept payments * to be forwarded over this SCID and forward them to this messages' recipient. */ -struct LDKCOption_u64Z FundingLocked_get_short_channel_id_alias(const struct LDKFundingLocked *NONNULL_PTR this_ptr); +struct LDKCOption_u64Z ChannelReady_get_short_channel_id_alias(const struct LDKChannelReady *NONNULL_PTR this_ptr); /** * If set, provides a short_channel_id alias for this channel. The sender will accept payments * to be forwarded over this SCID and forward them to this messages' recipient. */ -void FundingLocked_set_short_channel_id_alias(struct LDKFundingLocked *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ChannelReady_set_short_channel_id_alias(struct LDKChannelReady *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * Constructs a new FundingLocked given each field + * Constructs a new ChannelReady given each field */ -MUST_USE_RES struct LDKFundingLocked FundingLocked_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); +MUST_USE_RES struct LDKChannelReady ChannelReady_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKPublicKey next_per_commitment_point_arg, struct LDKCOption_u64Z short_channel_id_alias_arg); /** - * Creates a copy of the FundingLocked + * Creates a copy of the ChannelReady */ -struct LDKFundingLocked FundingLocked_clone(const struct LDKFundingLocked *NONNULL_PTR orig); +struct LDKChannelReady ChannelReady_clone(const struct LDKChannelReady *NONNULL_PTR orig); /** * Frees any resources used by the Shutdown, if is_owned is set and inner is non-NULL. @@ -21161,6 +23516,26 @@ void UpdateAddHTLC_set_cltv_expiry(struct LDKUpdateAddHTLC *NONNULL_PTR this_ptr */ struct LDKUpdateAddHTLC UpdateAddHTLC_clone(const struct LDKUpdateAddHTLC *NONNULL_PTR orig); +/** + * Frees any resources used by the OnionMessage, if is_owned is set and inner is non-NULL. + */ +void OnionMessage_free(struct LDKOnionMessage this_obj); + +/** + * Used in decrypting the onion packet's payload. + */ +struct LDKPublicKey OnionMessage_get_blinding_point(const struct LDKOnionMessage *NONNULL_PTR this_ptr); + +/** + * Used in decrypting the onion packet's payload. + */ +void OnionMessage_set_blinding_point(struct LDKOnionMessage *NONNULL_PTR this_ptr, struct LDKPublicKey val); + +/** + * Creates a copy of the OnionMessage + */ +struct LDKOnionMessage OnionMessage_clone(const struct LDKOnionMessage *NONNULL_PTR orig); + /** * Frees any resources used by the UpdateFulfillHTLC, if is_owned is set and inner is non-NULL. */ @@ -21301,6 +23676,13 @@ struct LDKSignature CommitmentSigned_get_signature(const struct LDKCommitmentSig */ void CommitmentSigned_set_signature(struct LDKCommitmentSigned *NONNULL_PTR this_ptr, struct LDKSignature val); +/** + * Signatures on the HTLC transactions + * + * Returns a copy of the field. + */ +struct LDKCVec_SignatureZ CommitmentSigned_get_htlc_signatures(const struct LDKCommitmentSigned *NONNULL_PTR this_ptr); + /** * Signatures on the HTLC transactions */ @@ -21558,6 +23940,11 @@ struct LDKNetAddress NetAddress_onion_v2(struct LDKTwelveBytes a); */ struct LDKNetAddress NetAddress_onion_v3(struct LDKThirtyTwoBytes ed25519_pubkey, uint16_t checksum, uint8_t version, uint16_t port); +/** + * Utility method to constructs a new Hostname-variant NetAddress + */ +struct LDKNetAddress NetAddress_hostname(struct LDKHostname hostname, uint16_t port); + /** * Serialize the NetAddress object into a byte array which can be read by NetAddress_read */ @@ -21627,6 +24014,13 @@ const uint8_t (*UnsignedNodeAnnouncement_get_alias(const struct LDKUnsignedNodeA */ void UnsignedNodeAnnouncement_set_alias(struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +/** + * List of addresses on which this node is reachable + * + * Returns a copy of the field. + */ +struct LDKCVec_NetAddressZ UnsignedNodeAnnouncement_get_addresses(const struct LDKUnsignedNodeAnnouncement *NONNULL_PTR this_ptr); + /** * List of addresses on which this node is reachable */ @@ -21896,6 +24290,16 @@ uint64_t UnsignedChannelUpdate_get_htlc_minimum_msat(const struct LDKUnsignedCha */ void UnsignedChannelUpdate_set_htlc_minimum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); +/** + * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + */ +uint64_t UnsignedChannelUpdate_get_htlc_maximum_msat(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); + +/** + * The maximum HTLC value incoming to sender, in milli-satoshi. Used to be optional. + */ +void UnsignedChannelUpdate_set_htlc_maximum_msat(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint64_t val); + /** * The base HTLC fee charged by sender, in milli-satoshi */ @@ -21916,6 +24320,27 @@ uint32_t UnsignedChannelUpdate_get_fee_proportional_millionths(const struct LDKU */ void UnsignedChannelUpdate_set_fee_proportional_millionths(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, uint32_t val); +/** + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. This is stored to ensure forward-compatibility as new fields are added to the + * lightning gossip + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z UnsignedChannelUpdate_get_excess_data(const struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr); + +/** + * Excess data which was signed as a part of the message which we do not (yet) understand how + * to decode. This is stored to ensure forward-compatibility as new fields are added to the + * lightning gossip + */ +void UnsignedChannelUpdate_set_excess_data(struct LDKUnsignedChannelUpdate *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Constructs a new UnsignedChannelUpdate given each field + */ +MUST_USE_RES struct LDKUnsignedChannelUpdate UnsignedChannelUpdate_new(struct LDKThirtyTwoBytes chain_hash_arg, uint64_t short_channel_id_arg, uint32_t timestamp_arg, uint8_t flags_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, uint32_t fee_base_msat_arg, uint32_t fee_proportional_millionths_arg, struct LDKCVec_u8Z excess_data_arg); + /** * Creates a copy of the UnsignedChannelUpdate */ @@ -22046,6 +24471,13 @@ bool ReplyChannelRange_get_sync_complete(const struct LDKReplyChannelRange *NONN */ void ReplyChannelRange_set_sync_complete(struct LDKReplyChannelRange *NONNULL_PTR this_ptr, bool val); +/** + * The short_channel_ids in the channel range + * + * Returns a copy of the field. + */ +struct LDKCVec_u64Z ReplyChannelRange_get_short_channel_ids(const struct LDKReplyChannelRange *NONNULL_PTR this_ptr); + /** * The short_channel_ids in the channel range */ @@ -22076,6 +24508,13 @@ const uint8_t (*QueryShortChannelIds_get_chain_hash(const struct LDKQueryShortCh */ void QueryShortChannelIds_set_chain_hash(struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +/** + * The short_channel_ids that are being queried + * + * Returns a copy of the field. + */ +struct LDKCVec_u64Z QueryShortChannelIds_get_short_channel_ids(const struct LDKQueryShortChannelIds *NONNULL_PTR this_ptr); + /** * The short_channel_ids that are being queried */ @@ -22337,6 +24776,11 @@ void ChannelMessageHandler_free(struct LDKChannelMessageHandler this_ptr); */ void RoutingMessageHandler_free(struct LDKRoutingMessageHandler this_ptr); +/** + * Calls the free function if one is set + */ +void OnionMessageHandler_free(struct LDKOnionMessageHandler this_ptr); + /** * Serialize the AcceptChannel object into a byte array which can be read by AcceptChannel_read */ @@ -22418,14 +24862,14 @@ struct LDKCVec_u8Z FundingSigned_write(const struct LDKFundingSigned *NONNULL_PT struct LDKCResult_FundingSignedDecodeErrorZ FundingSigned_read(struct LDKu8slice ser); /** - * Serialize the FundingLocked object into a byte array which can be read by FundingLocked_read + * Serialize the ChannelReady object into a byte array which can be read by ChannelReady_read */ -struct LDKCVec_u8Z FundingLocked_write(const struct LDKFundingLocked *NONNULL_PTR obj); +struct LDKCVec_u8Z ChannelReady_write(const struct LDKChannelReady *NONNULL_PTR obj); /** - * Read a FundingLocked from a byte array, created by FundingLocked_write + * Read a ChannelReady from a byte array, created by ChannelReady_write */ -struct LDKCResult_FundingLockedDecodeErrorZ FundingLocked_read(struct LDKu8slice ser); +struct LDKCResult_ChannelReadyDecodeErrorZ ChannelReady_read(struct LDKu8slice ser); /** * Serialize the Init object into a byte array which can be read by Init_read @@ -22517,6 +24961,16 @@ struct LDKCVec_u8Z UpdateAddHTLC_write(const struct LDKUpdateAddHTLC *NONNULL_PT */ struct LDKCResult_UpdateAddHTLCDecodeErrorZ UpdateAddHTLC_read(struct LDKu8slice ser); +/** + * Read a OnionMessage from a byte array, created by OnionMessage_write + */ +struct LDKCResult_OnionMessageDecodeErrorZ OnionMessage_read(struct LDKu8slice ser); + +/** + * Serialize the OnionMessage object into a byte array which can be read by OnionMessage_read + */ +struct LDKCVec_u8Z OnionMessage_write(const struct LDKOnionMessage *NONNULL_PTR obj); + /** * Serialize the Ping object into a byte array which can be read by Ping_read */ @@ -22699,6 +25153,18 @@ struct LDKMessageSendEventsProvider IgnoringMessageHandler_as_MessageSendEventsP */ struct LDKRoutingMessageHandler IgnoringMessageHandler_as_RoutingMessageHandler(const struct LDKIgnoringMessageHandler *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 IgnoringMessageHandler_as_OnionMessageProvider(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); + +/** + * 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 IgnoringMessageHandler_as_OnionMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); + /** * Constructs a new CustomMessageReader which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned CustomMessageReader must be freed before this_arg is @@ -22756,26 +25222,36 @@ void MessageHandler_set_chan_handler(struct LDKMessageHandler *NONNULL_PTR this_ /** * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`NetGraphMsgHandler`] object or an - * [`IgnoringMessageHandler`]. + * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. * - * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler + * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ const struct LDKRoutingMessageHandler *MessageHandler_get_route_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); /** * A message handler which handles messages updating our knowledge of the network channel - * graph. Usually this is just a [`NetGraphMsgHandler`] object or an - * [`IgnoringMessageHandler`]. + * graph. Usually this is just a [`P2PGossipSync`] object or an [`IgnoringMessageHandler`]. * - * [`NetGraphMsgHandler`]: crate::routing::network_graph::NetGraphMsgHandler + * [`P2PGossipSync`]: crate::routing::gossip::P2PGossipSync */ void MessageHandler_set_route_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKRoutingMessageHandler val); +/** + * A message handler which handles onion messages. For now, this can only be an + * [`IgnoringMessageHandler`]. + */ +const struct LDKOnionMessageHandler *MessageHandler_get_onion_message_handler(const struct LDKMessageHandler *NONNULL_PTR this_ptr); + +/** + * A message handler which handles onion messages. For now, this can only be an + * [`IgnoringMessageHandler`]. + */ +void MessageHandler_set_onion_message_handler(struct LDKMessageHandler *NONNULL_PTR this_ptr, struct LDKOnionMessageHandler val); + /** * Constructs a new MessageHandler given each field */ -MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg); +MUST_USE_RES struct LDKMessageHandler MessageHandler_new(struct LDKChannelMessageHandler chan_handler_arg, struct LDKRoutingMessageHandler route_handler_arg, struct LDKOnionMessageHandler onion_message_handler_arg); /** * Creates a copy of a SocketDescriptor @@ -22793,14 +25269,24 @@ void SocketDescriptor_free(struct LDKSocketDescriptor this_ptr); void PeerHandleError_free(struct LDKPeerHandleError this_obj); /** - * Used to indicate that we probably can't make any future connections to this peer, implying - * we should go ahead and force-close any channels we have with it. + * Used to indicate that we probably can't make any future connections to this peer (e.g. + * because we required features that our peer was missing, or vice versa). + * + * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close + * any channels with this peer or check for new versions of LDK. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ bool PeerHandleError_get_no_connection_possible(const struct LDKPeerHandleError *NONNULL_PTR this_ptr); /** - * Used to indicate that we probably can't make any future connections to this peer, implying - * we should go ahead and force-close any channels we have with it. + * Used to indicate that we probably can't make any future connections to this peer (e.g. + * because we required features that our peer was missing, or vice versa). + * + * While LDK's [`ChannelManager`] will not do it automatically, you likely wish to force-close + * any channels with this peer or check for new versions of LDK. + * + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ void PeerHandleError_set_no_connection_possible(struct LDKPeerHandleError *NONNULL_PTR this_ptr, bool val); @@ -22823,8 +25309,13 @@ 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 * cryptographically secure random bytes. + * + * `current_time` is used as an always-increasing counter that survives across restarts and is + * incremented irregularly internally. In general it is best to simply use the current UNIX + * timestamp, however if it is not available a persistent counter that increases once per + * minute should suffice. */ -MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler); +MUST_USE_RES struct LDKPeerManager PeerManager_new(struct LDKMessageHandler message_handler, struct LDKSecretKey our_node_secret, uint64_t current_time, const uint8_t (*ephemeral_random_data)[32], struct LDKLogger logger, struct LDKCustomMessageHandler custom_message_handler); /** * Get the list of node ids for peers which have completed the initial handshake. @@ -22843,8 +25334,7 @@ MUST_USE_RES struct LDKCVec_PublicKeyZ PeerManager_get_peer_node_ids(const struc * peer using the init message. * The user should pass the remote network address of the host they are connected to. * - * Note that if an Err is returned here you MUST NOT call socket_disconnected for the new - * descriptor but must disconnect the connection immediately. + * If an `Err` is returned here you must disconnect the connection immediately. * * Returns a small number of bytes to send to the remote node (currently always 50). * @@ -22864,9 +25354,8 @@ MUST_USE_RES struct LDKCResult_CVec_u8ZPeerHandleErrorZ PeerManager_new_outbound * The user should pass the remote network address of the host they are connected to. * * May refuse the connection by returning an Err, but will never write bytes to the remote end - * (outbound connector always speaks first). Note that if an Err is returned here you MUST NOT - * call socket_disconnected for the new descriptor but must disconnect the connection - * immediately. + * (outbound connector always speaks first). If an `Err` is returned here you must disconnect + * the connection immediately. * * Panics if descriptor is duplicative with some other descriptor which has not yet been * [`socket_disconnected()`]. @@ -22920,6 +25409,10 @@ MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const * You don't have to call this function explicitly if you are using [`lightning-net-tokio`] * or one of the other clients provided in our language bindings. * + * Note that if there are any other calls to this function waiting on lock(s) this may return + * without doing any work. All available events that need handling will be handled before the + * other calls return. + * * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards * [`send_data`]: SocketDescriptor::send_data @@ -22966,6 +25459,25 @@ void PeerManager_disconnect_all_peers(const struct LDKPeerManager *NONNULL_PTR t */ void PeerManager_timer_tick_occurred(const struct LDKPeerManager *NONNULL_PTR this_arg); +/** + * Generates a signed node_announcement from the given arguments, sending it to all connected + * peers. Note that peers will likely ignore this message unless we have at least one public + * channel which has at least six confirmations on-chain. + * + * `rgb` is a node \"color\" and `alias` is a printable human-readable string to describe this + * node to humans. They carry no in-protocol meaning. + * + * `addresses` represent the set (possibly empty) of socket addresses on which this node + * accepts incoming connections. These will be included in the node_announcement, publicly + * tying these addresses together and to this node. If you wish to preserve user privacy, + * addresses should likely contain only Tor Onion addresses. + * + * Panics if `addresses` is absurdly large (more than 100). + * + * [`get_and_clear_pending_msg_events`]: MessageSendEventsProvider::get_and_clear_pending_msg_events + */ +void PeerManager_broadcast_node_announcement(const struct LDKPeerManager *NONNULL_PTR this_arg, struct LDKThreeBytes rgb, struct LDKThirtyTwoBytes alias, struct LDKCVec_NetAddressZ addresses); + /** * Gets the weight for an HTLC-Success transaction. */ @@ -23606,6 +26118,13 @@ struct LDKSignature HolderCommitmentTransaction_get_counterparty_sig(const struc */ void HolderCommitmentTransaction_set_counterparty_sig(struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr, struct LDKSignature val); +/** + * All non-dust counterparty HTLC signatures, in the order they appear in the transaction + * + * Returns a copy of the field. + */ +struct LDKCVec_SignatureZ HolderCommitmentTransaction_get_counterparty_htlc_sigs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR this_ptr); + /** * All non-dust counterparty HTLC signatures, in the order they appear in the transaction */ @@ -23870,7 +26389,7 @@ MUST_USE_RES bool TrustedCommitmentTransaction_opt_anchors(const struct LDKTrust * * The returned Vec has one entry for each HTLC, and in the same order. * - * This function is only valid in the holder commitment context, it always uses SigHashType::All. + * 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); @@ -23969,6 +26488,17 @@ void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); */ void ChannelTypeFeatures_free(struct LDKChannelTypeFeatures this_obj); +/** + * Returns the set of known init features that are related to channels. At least some of + * these features are likely required for peers to talk to us. + */ +MUST_USE_RES struct LDKInitFeatures InitFeatures_known_channel_features(void); + +/** + * Returns the set of known node features that are related to channels. + */ +MUST_USE_RES struct LDKNodeFeatures NodeFeatures_known_channel_features(void); + /** * Create a blank Features with no features set */ @@ -24417,102 +26947,182 @@ MUST_USE_RES bool InvoiceFeatures_requires_payment_secret(const struct LDKInvoic /** * Set this feature as optional. */ -void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void InitFeatures_set_basic_mpp_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void InitFeatures_set_wumbo_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_wumbo_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_wumbo_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Set this feature as required. */ -void InitFeatures_set_basic_mpp_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void NodeFeatures_set_wumbo_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is supported. */ -MUST_USE_RES bool InitFeatures_supports_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_wumbo(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_wumbo(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Set this feature as optional. */ -void NodeFeatures_set_basic_mpp_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Set this feature as required. */ -void NodeFeatures_set_basic_mpp_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is supported. */ -MUST_USE_RES bool NodeFeatures_supports_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Set this feature as optional. */ -void InvoiceFeatures_set_basic_mpp_optional(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Set this feature as required. */ -void InvoiceFeatures_set_basic_mpp_required(struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is supported. */ -MUST_USE_RES bool InvoiceFeatures_supports_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); - -/** - * Checks if this feature is required. - */ -MUST_USE_RES bool InitFeatures_requires_basic_mpp(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is required. */ -MUST_USE_RES bool NodeFeatures_requires_basic_mpp(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is required. */ -MUST_USE_RES bool InvoiceFeatures_requires_basic_mpp(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Set this feature as optional. */ -void InitFeatures_set_shutdown_any_segwit_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); +void InitFeatures_set_onion_messages_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Set this feature as required. */ -void InitFeatures_set_shutdown_any_segwit_required(struct LDKInitFeatures *NONNULL_PTR this_arg); +void InitFeatures_set_onion_messages_required(struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is supported. */ -MUST_USE_RES bool InitFeatures_supports_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_supports_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Set this feature as optional. */ -void NodeFeatures_set_shutdown_any_segwit_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NodeFeatures_set_onion_messages_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Set this feature as required. */ -void NodeFeatures_set_shutdown_any_segwit_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); +void NodeFeatures_set_onion_messages_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is supported. */ -MUST_USE_RES bool NodeFeatures_supports_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_supports_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is required. */ -MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool InitFeatures_requires_onion_messages(const struct LDKInitFeatures *NONNULL_PTR this_arg); /** * Checks if this feature is required. */ -MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +MUST_USE_RES bool NodeFeatures_requires_onion_messages(const struct LDKNodeFeatures *NONNULL_PTR this_arg); /** * Set this feature as optional. @@ -24614,6 +27224,66 @@ MUST_USE_RES bool NodeFeatures_requires_scid_privacy(const struct LDKNodeFeature */ MUST_USE_RES bool ChannelTypeFeatures_requires_scid_privacy(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void InitFeatures_set_zero_conf_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_zero_conf_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_zero_conf_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_zero_conf_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void ChannelTypeFeatures_set_zero_conf_optional(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void ChannelTypeFeatures_set_zero_conf_required(struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool ChannelTypeFeatures_supports_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_zero_conf(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_zero_conf(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool ChannelTypeFeatures_requires_zero_conf(const struct LDKChannelTypeFeatures *NONNULL_PTR this_arg); + /** * Set this feature as optional. */ @@ -24652,14 +27322,14 @@ void InvalidShutdownScript_free(struct LDKInvalidShutdownScript this_obj); /** * The script that did not meet the requirements from [BOLT #2]. * - * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ struct LDKu8slice InvalidShutdownScript_get_script(const struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr); /** * The script that did not meet the requirements from [BOLT #2]. * - * [BOLT #2]: https://github.com/lightningnetwork/lightning-rfc/blob/master/02-peer-protocol.md + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md */ void InvalidShutdownScript_set_script(struct LDKInvalidShutdownScript *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); @@ -24703,7 +27373,7 @@ MUST_USE_RES struct LDKShutdownScript ShutdownScript_new_p2wsh(const uint8_t (*s * * This function may return an error if `program` is invalid for the segwit `version`. */ -MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(uint8_t version, struct LDKu8slice program); +MUST_USE_RES struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ ShutdownScript_new_witness_program(struct LDKWitnessVersion version, struct LDKu8slice program); /** * Converts the shutdown script into the underlying [`Script`]. @@ -24774,11 +27444,6 @@ struct LDKCResult_NodeIdDecodeErrorZ NodeId_read(struct LDKu8slice ser); */ void NetworkGraph_free(struct LDKNetworkGraph this_obj); -/** - * Creates a copy of the NetworkGraph - */ -struct LDKNetworkGraph NetworkGraph_clone(const struct LDKNetworkGraph *NONNULL_PTR orig); - /** * Frees any resources used by the ReadOnlyNetworkGraph, if is_owned is set and inner is non-NULL. */ @@ -24800,9 +27465,9 @@ struct LDKNetworkUpdate NetworkUpdate_clone(const struct LDKNetworkUpdate *NONNU struct LDKNetworkUpdate NetworkUpdate_channel_update_message(struct LDKChannelUpdate msg); /** - * Utility method to constructs a new ChannelClosed-variant NetworkUpdate + * Utility method to constructs a new ChannelFailure-variant NetworkUpdate */ -struct LDKNetworkUpdate NetworkUpdate_channel_closed(uint64_t short_channel_id, bool is_permanent); +struct LDKNetworkUpdate NetworkUpdate_channel_failure(uint64_t short_channel_id, bool is_permanent); /** * Utility method to constructs a new NodeFailure-variant NetworkUpdate @@ -24820,15 +27485,9 @@ struct LDKCVec_u8Z NetworkUpdate_write(const struct LDKNetworkUpdate *NONNULL_PT struct LDKCResult_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(struct LDKu8slice ser); /** - * Constructs a new EventHandler which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is - */ -struct LDKEventHandler NetGraphMsgHandler_as_EventHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); - -/** - * Frees any resources used by the NetGraphMsgHandler, if is_owned is set and inner is non-NULL. + * Frees any resources used by the P2PGossipSync, if is_owned is set and inner is non-NULL. */ -void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj); +void P2PGossipSync_free(struct LDKP2PGossipSync this_obj); /** * Creates a new tracker of the actual state of the network of channels and nodes, @@ -24837,26 +27496,32 @@ void NetGraphMsgHandler_free(struct LDKNetGraphMsgHandler this_obj); * channel data is correct, and that the announcement is signed with * channel owners' keys. */ -MUST_USE_RES struct LDKNetGraphMsgHandler NetGraphMsgHandler_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); +MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCOption_AccessZ chain_access, struct LDKLogger logger); /** * Adds a provider used to check new announcements. Does not affect * existing announcements unless they are updated. * Add, update or remove the provider would replace the current one. */ -void NetGraphMsgHandler_add_chain_access(struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); +void P2PGossipSync_add_chain_access(struct LDKP2PGossipSync *NONNULL_PTR this_arg, struct LDKCOption_AccessZ chain_access); + +/** + * Constructs a new EventHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned EventHandler must be freed before this_arg is + */ +struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg); /** * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned RoutingMessageHandler must be freed before this_arg is */ -struct LDKRoutingMessageHandler NetGraphMsgHandler_as_RoutingMessageHandler(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); +struct LDKRoutingMessageHandler P2PGossipSync_as_RoutingMessageHandler(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned MessageSendEventsProvider must be freed before this_arg is */ -struct LDKMessageSendEventsProvider NetGraphMsgHandler_as_MessageSendEventsProvider(const struct LDKNetGraphMsgHandler *NONNULL_PTR this_arg); +struct LDKMessageSendEventsProvider P2PGossipSync_as_MessageSendEventsProvider(const struct LDKP2PGossipSync *NONNULL_PTR this_arg); /** * Frees any resources used by the ChannelUpdateInfo, if is_owned is set and inner is non-NULL. @@ -24908,12 +27573,12 @@ void ChannelUpdateInfo_set_htlc_minimum_msat(struct LDKChannelUpdateInfo *NONNUL /** * The maximum value which may be relayed to the next hop via the channel. */ -struct LDKCOption_u64Z ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); +uint64_t ChannelUpdateInfo_get_htlc_maximum_msat(const struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr); /** * The maximum value which may be relayed to the next hop via the channel. */ -void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); +void ChannelUpdateInfo_set_htlc_maximum_msat(struct LDKChannelUpdateInfo *NONNULL_PTR this_ptr, uint64_t val); /** * Fees charged when the channel is used for routing @@ -24948,7 +27613,7 @@ void ChannelUpdateInfo_set_last_update_message(struct LDKChannelUpdateInfo *NONN /** * Constructs a new ChannelUpdateInfo given each field */ -MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, struct LDKCOption_u64Z htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); +MUST_USE_RES struct LDKChannelUpdateInfo ChannelUpdateInfo_new(uint32_t last_update_arg, bool enabled_arg, uint16_t cltv_expiry_delta_arg, uint64_t htlc_minimum_msat_arg, uint64_t htlc_maximum_msat_arg, struct LDKRoutingFees fees_arg, struct LDKChannelUpdate last_update_message_arg); /** * Creates a copy of the ChannelUpdateInfo @@ -25063,6 +27728,13 @@ void ChannelInfo_set_announcement_message(struct LDKChannelInfo *NONNULL_PTR thi */ struct LDKChannelInfo ChannelInfo_clone(const struct LDKChannelInfo *NONNULL_PTR orig); +/** + * Returns a [`ChannelUpdateInfo`] based on the direction implied by the channel_flag. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKChannelUpdateInfo ChannelInfo_get_directional_info(const struct LDKChannelInfo *NONNULL_PTR this_arg, uint8_t channel_flags); + /** * Serialize the ChannelInfo object into a byte array which can be read by ChannelInfo_read */ @@ -25095,12 +27767,17 @@ MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKD */ MUST_USE_RES struct LDKChannelUpdateInfo DirectedChannelInfo_direction(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); +/** + * Returns the maximum HTLC amount allowed over the channel in the direction. + */ +MUST_USE_RES uint64_t DirectedChannelInfo_htlc_maximum_msat(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); + /** * Returns the [`EffectiveCapacity`] of the channel in the direction. * * This is either the total capacity from the funding transaction, if known, or the * `htlc_maximum_msat` for the direction as advertised by the gossip network, if known, - * whichever is smaller. + * otherwise. */ MUST_USE_RES struct LDKEffectiveCapacity DirectedChannelInfo_effective_capacity(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); @@ -25127,7 +27804,7 @@ struct LDKEffectiveCapacity EffectiveCapacity_maximum_htlc(uint64_t amount_msat) /** * Utility method to constructs a new Total-variant EffectiveCapacity */ -struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat); +struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, struct LDKCOption_u64Z htlc_maximum_msat); /** * Utility method to constructs a new Infinite-variant EffectiveCapacity @@ -25245,14 +27922,21 @@ void NodeAnnouncementInfo_set_rgb(struct LDKNodeAnnouncementInfo *NONNULL_PTR th * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -const uint8_t (*NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr))[32]; +struct LDKNodeAlias NodeAnnouncementInfo_get_alias(const struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr); /** * Moniker assigned to the node. * May be invalid or malicious (eg control chars), * should not be exposed to the user. */ -void NodeAnnouncementInfo_set_alias(struct LDKNodeAnnouncementInfo *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +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 @@ -25282,7 +27966,7 @@ void NodeAnnouncementInfo_set_announcement_message(struct LDKNodeAnnouncementInf /** * 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 LDKThirtyTwoBytes 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 LDKCVec_NetAddressZ addresses_arg, struct LDKNodeAnnouncement announcement_message_arg); /** * Creates a copy of the NodeAnnouncementInfo @@ -25299,11 +27983,47 @@ struct LDKCVec_u8Z NodeAnnouncementInfo_write(const struct LDKNodeAnnouncementIn */ struct LDKCResult_NodeAnnouncementInfoDecodeErrorZ NodeAnnouncementInfo_read(struct LDKu8slice ser); +/** + * Frees any resources used by the NodeAlias, if is_owned is set and inner is non-NULL. + */ +void NodeAlias_free(struct LDKNodeAlias this_obj); + +const uint8_t (*NodeAlias_get_a(const struct LDKNodeAlias *NONNULL_PTR this_ptr))[32]; + +void NodeAlias_set_a(struct LDKNodeAlias *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); + +/** + * Constructs a new NodeAlias given each field + */ +MUST_USE_RES struct LDKNodeAlias NodeAlias_new(struct LDKThirtyTwoBytes a_arg); + +/** + * Creates a copy of the NodeAlias + */ +struct LDKNodeAlias NodeAlias_clone(const struct LDKNodeAlias *NONNULL_PTR orig); + +/** + * Serialize the NodeAlias object into a byte array which can be read by NodeAlias_read + */ +struct LDKCVec_u8Z NodeAlias_write(const struct LDKNodeAlias *NONNULL_PTR obj); + +/** + * Read a NodeAlias from a byte array, created by NodeAlias_write + */ +struct LDKCResult_NodeAliasDecodeErrorZ NodeAlias_read(struct LDKu8slice ser); + /** * Frees any resources used by the NodeInfo, if is_owned is set and inner is non-NULL. */ void NodeInfo_free(struct LDKNodeInfo this_obj); +/** + * All valid channels a node has announced + * + * Returns a copy of the field. + */ +struct LDKCVec_u64Z NodeInfo_get_channels(const struct LDKNodeInfo *NONNULL_PTR this_ptr); + /** * All valid channels a node has announced */ @@ -25373,23 +28093,35 @@ struct LDKCVec_u8Z NetworkGraph_write(const struct LDKNetworkGraph *NONNULL_PTR /** * Read a NetworkGraph from a byte array, created by NetworkGraph_write */ -struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser); +struct LDKCResult_NetworkGraphDecodeErrorZ NetworkGraph_read(struct LDKu8slice ser, struct LDKLogger arg); /** * Creates a new, empty, network graph. */ -MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash); +MUST_USE_RES struct LDKNetworkGraph NetworkGraph_new(struct LDKThirtyTwoBytes genesis_hash, struct LDKLogger logger); /** * Returns a read-only view of the network graph. */ MUST_USE_RES struct LDKReadOnlyNetworkGraph NetworkGraph_read_only(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +/** + * The unix timestamp provided by the most recent rapid gossip sync. + * It will be set by the rapid sync process after every sync completion. + */ +MUST_USE_RES struct LDKCOption_u32Z NetworkGraph_get_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg); + +/** + * Update the unix timestamp provided by the most recent rapid gossip sync. + * This should be done automatically by the rapid sync process after every sync completion. + */ +void NetworkGraph_set_last_rapid_gossip_sync_timestamp(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint32_t last_rapid_gossip_sync_timestamp); + /** * For an already known node (from channel announcements), update its stored properties from a * given node announcement. * - * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's + * You probably don't want to call this directly, instead relying on a P2PGossipSync's * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. */ @@ -25406,7 +28138,7 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_node_from /** * Store or update channel info from a channel announcement. * - * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's + * You probably don't want to call this directly, instead relying on a P2PGossipSync's * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. * @@ -25426,17 +28158,27 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_f MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_from_unsigned_announcement(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg, struct LDKCOption_AccessZ chain_access); /** - * Close a channel if a corresponding HTLC fail was sent. + * Update channel from partial announcement data received via rapid gossip sync + * + * `timestamp: u64`: Timestamp emulating the backdated original announcement receipt (by the + * rapid gossip sync server) + * + * All other parameters as used in [`msgs::UnsignedChannelAnnouncement`] fields. + */ +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. */ -void NetworkGraph_close_channel_from_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); +void NetworkGraph_channel_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id, bool is_permanent); /** * Marks a node in the graph as failed. */ -void NetworkGraph_fail_node(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); +void NetworkGraph_node_failed(const struct LDKNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey _node_id, bool is_permanent); /** * Removes information about channels that we haven't heard any updates about in some time. @@ -25473,7 +28215,7 @@ void NetworkGraph_remove_stale_channels_with_time(const struct LDKNetworkGraph * * For an already known (from announcement) channel, update info about one of the directions * of the channel. * - * You probably don't want to call this directly, instead relying on a NetGraphMsgHandler's + * You probably don't want to call this directly, instead relying on a P2PGossipSync's * RoutingMessageHandler implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. * @@ -25492,6 +28234,30 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(c */ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); +/** + * Returns information on a channel with the given id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKChannelInfo ReadOnlyNetworkGraph_channel(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, uint64_t short_channel_id); + +/** + * Returns the list of channels in the graph + */ +MUST_USE_RES struct LDKCVec_u64Z ReadOnlyNetworkGraph_list_channels(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); + +/** + * Returns information on a node with the given id. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKNodeInfo ReadOnlyNetworkGraph_node(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + +/** + * Returns the list of nodes in the graph + */ +MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg); + /** * Get network addresses by node id. * Returns None if the requested node is completely unknown, @@ -25613,21 +28379,19 @@ 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 to less than 20 should currently - * ensure it is viable. + * 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. */ struct LDKCVec_CVec_RouteHopZZ 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 to less than 20 should currently - * ensure it is viable. + * 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. */ void Route_set_paths(struct LDKRoute *NONNULL_PTR this_ptr, struct LDKCVec_CVec_RouteHopZZ val); @@ -25814,18 +28578,82 @@ void PaymentParameters_set_expiry_time(struct LDKPaymentParameters *NONNULL_PTR /** * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ uint32_t PaymentParameters_get_max_total_cltv_expiry_delta(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); /** * The maximum total CLTV delta we accept for the route. + * Defaults to [`DEFAULT_MAX_TOTAL_CLTV_EXPIRY_DELTA`]. */ void PaymentParameters_set_max_total_cltv_expiry_delta(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint32_t val); +/** + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + */ +uint8_t PaymentParameters_get_max_path_count(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + +/** + * The maximum number of paths that may be used by (MPP) payments. + * Defaults to [`DEFAULT_MAX_PATH_COUNT`]. + */ +void PaymentParameters_set_max_path_count(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); + +/** + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 + */ +uint8_t PaymentParameters_get_max_channel_saturation_power_of_half(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + +/** + * Selects the maximum share of a channel's total capacity which will be sent over a channel, + * as a power of 1/2. A higher value prefers to send the payment using more MPP parts whereas + * a lower value prefers to send larger MPP parts, potentially saturating channels and + * increasing failure probability for those paths. + * + * Note that this restriction will be relaxed during pathfinding after paths which meet this + * restriction have been found. While paths which meet this criteria will be searched for, it + * is ultimately up to the scorer to select them over other paths. + * + * A value of 0 will allow payments up to and including a channel's total announced usable + * capacity, a value of one will only use up to half its capacity, two 1/4, etc. + * + * Default value: 2 + */ +void PaymentParameters_set_max_channel_saturation_power_of_half(struct LDKPaymentParameters *NONNULL_PTR this_ptr, uint8_t val); + +/** + * A list of SCIDs which this payment was previously attempted over and which caused the + * payment to fail. Future attempts for the same payment shouldn't be relayed through any of + * these SCIDs. + * + * Returns a copy of the field. + */ +struct LDKCVec_u64Z PaymentParameters_get_previously_failed_channels(const struct LDKPaymentParameters *NONNULL_PTR this_ptr); + +/** + * A list of SCIDs which this payment was previously attempted over and which caused the + * payment to fail. Future attempts for the same payment shouldn't be relayed through any of + * these SCIDs. + */ +void PaymentParameters_set_previously_failed_channels(struct LDKPaymentParameters *NONNULL_PTR this_ptr, struct LDKCVec_u64Z val); + /** * 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); +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); /** * Creates a copy of the PaymentParameters @@ -26011,8 +28839,8 @@ struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice s * Private routing paths between a public node and the target may be included in `params.payee`. * * If some channels aren't announced, it may be useful to fill in `first_hops` with the results - * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of our local - * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used. + * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels + * from `network_graph` will be ignored, and only those in `first_hops` will be used. * * The fees on channels from us to the next hop are ignored as they are assumed to all be equal. * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` / @@ -26031,236 +28859,144 @@ struct LDKCResult_RouteHintHopDecodeErrorZ RouteHintHop_read(struct LDKu8slice s * * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels * [`Event::PaymentPathFailed`]: crate::util::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_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]); +struct LDKCResult_RouteLightningErrorZ find_route(struct LDKPublicKey our_node_pubkey, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKLogger logger, const struct LDKScore *NONNULL_PTR scorer, const uint8_t (*random_seed_bytes)[32]); /** - * Calls the free function if one is set + * Construct a route from us (payer) to the target node (payee) via the given hops (which should + * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path. + * + * Re-uses logic from `find_route`, so the restrictions described there also apply here. */ -void Score_free(struct LDKScore this_ptr); +struct LDKCResult_RouteLightningErrorZ build_route_from_hops(struct LDKPublicKey our_node_pubkey, struct LDKCVec_PublicKeyZ hops, const struct LDKRouteParameters *NONNULL_PTR route_params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, const uint8_t (*random_seed_bytes)[32]); /** * Calls the free function if one is set */ -void LockableScore_free(struct LDKLockableScore this_ptr); - -/** - * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. - */ -void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); +void Score_free(struct LDKScore this_ptr); /** - * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. + * Calls the free function if one is set */ -MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); +void LockableScore_free(struct LDKLockableScore this_ptr); /** - * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. + * Calls the free function if one is set */ -void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); +void WriteableScore_free(struct LDKWriteableScore this_ptr); /** - * Creates a copy of the FixedPenaltyScorer + * Frees any resources used by the MultiThreadedLockableScore, if is_owned is set and inner is non-NULL. */ -struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); +void MultiThreadedLockableScore_free(struct LDKMultiThreadedLockableScore this_obj); /** - * Creates a new scorer using `penalty_msat`. + * Frees any resources used by the MultiThreadedScoreLock, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); +void MultiThreadedScoreLock_free(struct LDKMultiThreadedScoreLock this_obj); /** * Constructs a new Score which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is */ -struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); - -/** - * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read - */ -struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); - -/** - * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write - */ -struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); - -/** - * Frees any resources used by the Scorer, if is_owned is set and inner is non-NULL. - */ -void Scorer_free(struct LDKScorer this_obj); - -/** - * Frees any resources used by the ScoringParameters, if is_owned is set and inner is non-NULL. - */ -void ScoringParameters_free(struct LDKScoringParameters this_obj); - -/** - * A fixed penalty in msats to apply to each channel. - * - * Default value: 500 msat - */ -uint64_t ScoringParameters_get_base_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr); - -/** - * A fixed penalty in msats to apply to each channel. - * - * Default value: 500 msat - */ -void ScoringParameters_set_base_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKScore MultiThreadedScoreLock_as_Score(const struct LDKMultiThreadedScoreLock *NONNULL_PTR this_arg); /** - * A penalty in msats to apply to a channel upon failing to relay a payment. - * - * This accumulates for each failure but may be reduced over time based on - * [`failure_penalty_half_life`] or when successfully routing through a channel. - * - * Default value: 1,024,000 msat - * - * [`failure_penalty_half_life`]: Self::failure_penalty_half_life + * Serialize the MultiThreadedScoreLock object into a byte array which can be read by MultiThreadedScoreLock_read */ -uint64_t ScoringParameters_get_failure_penalty_msat(const struct LDKScoringParameters *NONNULL_PTR this_ptr); +struct LDKCVec_u8Z MultiThreadedScoreLock_write(const struct LDKMultiThreadedScoreLock *NONNULL_PTR obj); /** - * A penalty in msats to apply to a channel upon failing to relay a payment. - * - * This accumulates for each failure but may be reduced over time based on - * [`failure_penalty_half_life`] or when successfully routing through a channel. - * - * Default value: 1,024,000 msat - * - * [`failure_penalty_half_life`]: Self::failure_penalty_half_life + * Constructs a new LockableScore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned LockableScore must be freed before this_arg is */ -void ScoringParameters_set_failure_penalty_msat(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +struct LDKLockableScore MultiThreadedLockableScore_as_LockableScore(const struct LDKMultiThreadedLockableScore *NONNULL_PTR this_arg); /** - * When the amount being sent over a channel is this many 1024ths of the total channel - * capacity, we begin applying [`overuse_penalty_msat_per_1024th`]. - * - * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel) - * - * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th + * Creates a new [`MultiThreadedLockableScore`] given an underlying [`Score`]. */ -uint16_t ScoringParameters_get_overuse_penalty_start_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); +MUST_USE_RES struct LDKMultiThreadedLockableScore MultiThreadedLockableScore_new(struct LDKScore score); /** - * When the amount being sent over a channel is this many 1024ths of the total channel - * capacity, we begin applying [`overuse_penalty_msat_per_1024th`]. - * - * Default value: 128 1024ths (i.e. begin penalizing when an HTLC uses 1/8th of a channel) - * - * [`overuse_penalty_msat_per_1024th`]: Self::overuse_penalty_msat_per_1024th + * Frees any resources used by the ChannelUsage, if is_owned is set and inner is non-NULL. */ -void ScoringParameters_set_overuse_penalty_start_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint16_t val); +void ChannelUsage_free(struct LDKChannelUsage this_obj); /** - * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent - * over the channel exceeds [`overuse_penalty_start_1024th`] by. - * - * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty - * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel) - * - * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th + * The amount to send through the channel, denominated in millisatoshis. */ -uint64_t ScoringParameters_get_overuse_penalty_msat_per_1024th(const struct LDKScoringParameters *NONNULL_PTR this_ptr); +uint64_t ChannelUsage_get_amount_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * A penalty applied, per whole 1024ths of the channel capacity which the amount being sent - * over the channel exceeds [`overuse_penalty_start_1024th`] by. - * - * Default value: 20 msat (i.e. 2560 msat penalty to use 1/4th of a channel, 7680 msat penalty - * to use half a channel, and 12,560 msat penalty to use 3/4ths of a channel) - * - * [`overuse_penalty_start_1024th`]: Self::overuse_penalty_start_1024th + * The amount to send through the channel, denominated in millisatoshis. */ -void ScoringParameters_set_overuse_penalty_msat_per_1024th(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +void ChannelUsage_set_amount_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are - * cut in half. - * - * Successfully routing through a channel will immediately cut the penalty in half as well. - * - * Default value: 1 hour - * - * # Note - * - * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will - * never decay. - * - * [`failure_penalty_msat`]: Self::failure_penalty_msat + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -uint64_t ScoringParameters_get_failure_penalty_half_life(const struct LDKScoringParameters *NONNULL_PTR this_ptr); +uint64_t ChannelUsage_get_inflight_htlc_msat(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * The time required to elapse before any accumulated [`failure_penalty_msat`] penalties are - * cut in half. - * - * Successfully routing through a channel will immediately cut the penalty in half as well. - * - * Default value: 1 hour - * - * # Note - * - * When built with the `no-std` feature, time will never elapse. Therefore, this penalty will - * never decay. - * - * [`failure_penalty_msat`]: Self::failure_penalty_msat + * Total amount, denominated in millisatoshis, already allocated to send through the channel + * as part of a multi-path payment. */ -void ScoringParameters_set_failure_penalty_half_life(struct LDKScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +void ChannelUsage_set_inflight_htlc_msat(struct LDKChannelUsage *NONNULL_PTR this_ptr, uint64_t val); /** - * Constructs a new ScoringParameters given each field + * The effective capacity of the channel. */ -MUST_USE_RES struct LDKScoringParameters ScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t failure_penalty_msat_arg, uint16_t overuse_penalty_start_1024th_arg, uint64_t overuse_penalty_msat_per_1024th_arg, uint64_t failure_penalty_half_life_arg); +struct LDKEffectiveCapacity ChannelUsage_get_effective_capacity(const struct LDKChannelUsage *NONNULL_PTR this_ptr); /** - * Creates a copy of the ScoringParameters + * The effective capacity of the channel. */ -struct LDKScoringParameters ScoringParameters_clone(const struct LDKScoringParameters *NONNULL_PTR orig); +void ChannelUsage_set_effective_capacity(struct LDKChannelUsage *NONNULL_PTR this_ptr, struct LDKEffectiveCapacity val); /** - * Serialize the ScoringParameters object into a byte array which can be read by ScoringParameters_read + * Constructs a new ChannelUsage given each field */ -struct LDKCVec_u8Z ScoringParameters_write(const struct LDKScoringParameters *NONNULL_PTR obj); +MUST_USE_RES struct LDKChannelUsage ChannelUsage_new(uint64_t amount_msat_arg, uint64_t inflight_htlc_msat_arg, struct LDKEffectiveCapacity effective_capacity_arg); /** - * Read a ScoringParameters from a byte array, created by ScoringParameters_write + * Creates a copy of the ChannelUsage */ -struct LDKCResult_ScoringParametersDecodeErrorZ ScoringParameters_read(struct LDKu8slice ser); +struct LDKChannelUsage ChannelUsage_clone(const struct LDKChannelUsage *NONNULL_PTR orig); /** - * Creates a new scorer using the given scoring parameters. + * Frees any resources used by the FixedPenaltyScorer, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKScorer Scorer_new(struct LDKScoringParameters params); +void FixedPenaltyScorer_free(struct LDKFixedPenaltyScorer this_obj); /** - * Creates a "default" Scorer. See struct and individual field documentaiton for details on which values are used. + * Creates a copy of the FixedPenaltyScorer */ -MUST_USE_RES struct LDKScorer Scorer_default(void); +struct LDKFixedPenaltyScorer FixedPenaltyScorer_clone(const struct LDKFixedPenaltyScorer *NONNULL_PTR orig); /** - * Creates a "default" ScoringParameters. See struct and individual field documentaiton for details on which values are used. + * Creates a new scorer using `penalty_msat`. */ -MUST_USE_RES struct LDKScoringParameters ScoringParameters_default(void); +MUST_USE_RES struct LDKFixedPenaltyScorer FixedPenaltyScorer_with_penalty(uint64_t penalty_msat); /** * Constructs a new Score which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned Score must be freed before this_arg is */ -struct LDKScore Scorer_as_Score(const struct LDKScorer *NONNULL_PTR this_arg); +struct LDKScore FixedPenaltyScorer_as_Score(const struct LDKFixedPenaltyScorer *NONNULL_PTR this_arg); /** - * Serialize the Scorer object into a byte array which can be read by Scorer_read + * Serialize the FixedPenaltyScorer object into a byte array which can be read by FixedPenaltyScorer_read */ -struct LDKCVec_u8Z Scorer_write(const struct LDKScorer *NONNULL_PTR obj); +struct LDKCVec_u8Z FixedPenaltyScorer_write(const struct LDKFixedPenaltyScorer *NONNULL_PTR obj); /** - * Read a Scorer from a byte array, created by Scorer_write + * Read a FixedPenaltyScorer from a byte array, created by FixedPenaltyScorer_write */ -struct LDKCResult_ScorerDecodeErrorZ Scorer_read(struct LDKu8slice ser); +struct LDKCResult_FixedPenaltyScorerDecodeErrorZ FixedPenaltyScorer_read(struct LDKu8slice ser, uint64_t arg); /** * Frees any resources used by the ProbabilisticScorer, if is_owned is set and inner is non-NULL. @@ -26286,6 +29022,38 @@ uint64_t ProbabilisticScoringParameters_get_base_penalty_msat(const struct LDKPr */ void ProbabilisticScoringParameters_set_base_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +/** + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the payment amount. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat + */ +uint64_t ProbabilisticScoringParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + +/** + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. + * + * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., + * fees plus penalty) for large payments. The penalty is computed as the product of this + * multiplier and `2^30`ths of the payment amount. + * + * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` + * + * Default value: 8,192 msat + * + * [`base_penalty_msat`]: Self::base_penalty_msat + */ +void ProbabilisticScoringParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + /** * A multiplier used in conjunction with the negative `log10` of the channel's success * probability for a payment to determine the liquidity penalty. @@ -26363,7 +29131,7 @@ void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKPro * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the * success probability. * - * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of * the amount will result in a penalty of the multiplier. And, as the success probability @@ -26373,7 +29141,7 @@ void ProbabilisticScoringParameters_set_liquidity_offset_half_life(struct LDKPro * * Default value: 256 msat */ -uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); +uint64_t ProbabilisticScoringParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** * A multiplier used in conjunction with a payment amount and the negative `log10` of the @@ -26384,7 +29152,7 @@ uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the * success probability. * - * `-log10(success_probability) * amount_penalty_multiplier_msat * amount_msat / 2^20` + * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * * In practice, this means for 0.1 success probability (`-log10(0.1) == 1`) each `2^20`th of * the amount will result in a penalty of the multiplier. And, as the success probability @@ -26394,12 +29162,69 @@ uint64_t ProbabilisticScoringParameters_get_amount_penalty_multiplier_msat(const * * Default value: 256 msat */ -void ProbabilisticScoringParameters_set_amount_penalty_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); +void ProbabilisticScoringParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the + * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We + * treat such nodes preferentially as this makes balance discovery attacks harder to execute, + * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. + * + * Default value: 250 msat + */ +uint64_t ProbabilisticScoringParameters_get_anti_probing_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); + +/** + * This penalty is applied when `htlc_maximum_msat` is equal to or larger than half of the + * channel's capacity, which makes us prefer nodes with a smaller `htlc_maximum_msat`. We + * treat such nodes preferentially as this makes balance discovery attacks harder to execute, + * thereby creating an incentive to restrict `htlc_maximum_msat` and improve privacy. + * + * Default value: 250 msat + */ +void ProbabilisticScoringParameters_set_anti_probing_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); + +/** + * This penalty is applied when the amount we're attempting to send over a channel exceeds our + * current estimate of the channel's available liquidity. + * + * Note that in this case all other penalties, including the + * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. + * + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. + * + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat + */ +uint64_t ProbabilisticScoringParameters_get_considered_impossible_penalty_msat(const struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr); /** - * Constructs a new ProbabilisticScoringParameters given each field + * This penalty is applied when the amount we're attempting to send over a channel exceeds our + * current estimate of the channel's available liquidity. + * + * Note that in this case all other penalties, including the + * [`liquidity_penalty_multiplier_msat`] and [`liquidity_penalty_amount_multiplier_msat`]-based + * penalties, as well as the [`base_penalty_msat`] and the [`anti_probing_penalty_msat`], if + * applicable, are still included in the overall penalty. + * + * If you wish to avoid creating paths with such channels entirely, setting this to a value of + * `u64::max_value()` will guarantee that. + * + * Default value: 1_0000_0000_000 msat (1 Bitcoin) + * + * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat + * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat + * [`base_penalty_msat`]: Self::base_penalty_msat + * [`anti_probing_penalty_msat`]: Self::anti_probing_penalty_msat */ -MUST_USE_RES struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_new(uint64_t base_penalty_msat_arg, uint64_t liquidity_penalty_multiplier_msat_arg, uint64_t liquidity_offset_half_life_arg, uint64_t amount_penalty_multiplier_msat_arg); +void ProbabilisticScoringParameters_set_considered_impossible_penalty_msat(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_ptr, uint64_t val); /** * Creates a copy of the ProbabilisticScoringParameters @@ -26410,7 +29235,53 @@ struct LDKProbabilisticScoringParameters ProbabilisticScoringParameters_clone(co * Creates a new scorer using the given scoring parameters for sending payments from a node * through a network graph. */ -MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph); +MUST_USE_RES struct LDKProbabilisticScorer ProbabilisticScorer_new(struct LDKProbabilisticScoringParameters params, const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger); + +/** + * Dump the contents of this scorer into the configured logger. + * + * Note that this writes roughly one line per channel for which we have a liquidity estimate, + * which may be a substantial amount of log output. + */ +void ProbabilisticScorer_debug_log_liquidity_stats(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg); + +/** + * Query the estimated minimum and maximum liquidity available for sending a payment over the + * channel with `scid` towards the given `target` node. + */ +MUST_USE_RES struct LDKCOption_C2Tuple_u64u64ZZ ProbabilisticScorer_estimated_channel_liquidity_range(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target); + +/** + * Marks the node with the given `node_id` as banned, i.e., + * it will be avoided during path finding. + */ +void ProbabilisticScorer_add_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + +/** + * Removes the node with the given `node_id` from the list of nodes to avoid. + */ +void ProbabilisticScorer_remove_banned(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + +/** + * Sets a manual penalty for the given node. + */ +void ProbabilisticScorer_set_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id, uint64_t penalty); + +/** + * Removes the node with the given `node_id` from the list of manual penalties. + */ +void ProbabilisticScorer_remove_manual_penalty(struct LDKProbabilisticScorer *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR node_id); + +/** + * Clears the list of manual penalties that are applied during path finding. + */ +void ProbabilisticScorer_clear_manual_penalties(struct LDKProbabilisticScorer *NONNULL_PTR this_arg); + +/** + * Marks all nodes in the given list as banned, i.e., + * they will be avoided during path finding. + */ +void ProbabilisticScoringParameters_add_banned_from_list(struct LDKProbabilisticScoringParameters *NONNULL_PTR this_arg, struct LDKCVec_NodeIdZ node_ids); /** * Creates a "default" ProbabilisticScoringParameters. See struct and individual field documentaiton for details on which values are used. @@ -26431,7 +29302,126 @@ struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer /** * Read a ProbabilisticScorer from a byte array, created by ProbabilisticScorer_write */ -struct LDKCResult_ProbabilisticScorerDecodeErrorZ ProbabilisticScorer_read(struct LDKu8slice ser, struct LDKProbabilisticScoringParameters arg_a, const struct LDKNetworkGraph *NONNULL_PTR arg_b); +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 BlindedRoute, if is_owned is set and inner is non-NULL. + */ +void BlindedRoute_free(struct LDKBlindedRoute this_obj); + +/** + * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. + */ +void BlindedHop_free(struct LDKBlindedHop this_obj); + +/** + * Create a blinded route 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_BlindedRouteNoneZ BlindedRoute_new(struct LDKCVec_PublicKeyZ node_pks, const struct LDKKeysInterface *NONNULL_PTR keys_manager); + +/** + * Serialize the BlindedRoute object into a byte array which can be read by BlindedRoute_read + */ +struct LDKCVec_u8Z BlindedRoute_write(const struct LDKBlindedRoute *NONNULL_PTR obj); + +/** + * Read a BlindedRoute from a byte array, created by BlindedRoute_write + */ +struct LDKCResult_BlindedRouteDecodeErrorZ BlindedRoute_read(struct LDKu8slice ser); + +/** + * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read + */ +struct LDKCVec_u8Z BlindedHop_write(const struct LDKBlindedHop *NONNULL_PTR obj); + +/** + * Read a BlindedHop from a byte array, created by BlindedHop_write + */ +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. + */ +void OnionMessenger_free(struct LDKOnionMessenger this_obj); + +/** + * Frees any resources used by the Destination + */ +void Destination_free(struct LDKDestination this_ptr); + +/** + * Utility method to constructs a new Node-variant Destination + */ +struct LDKDestination Destination_node(struct LDKPublicKey a); + +/** + * Utility method to constructs a new BlindedRoute-variant Destination + */ +struct LDKDestination Destination_blinded_route(struct LDKBlindedRoute 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 BufferFull-variant SendError + */ +struct LDKSendError SendError_buffer_full(void); + +/** + * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to + * their respective handlers. + */ +MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface keys_manager, struct LDKLogger logger); + +/** + * Send an empty onion 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 LDKBlindedRoute 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 FilesystemPersister, if is_owned is set and inner is non-NULL. @@ -26450,37 +29440,34 @@ MUST_USE_RES struct LDKFilesystemPersister FilesystemPersister_new(struct LDKStr MUST_USE_RES struct LDKStr FilesystemPersister_get_data_dir(const struct LDKFilesystemPersister *NONNULL_PTR this_arg); /** - * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister` - * initialization, within a file called \"manager\". + * Read `ChannelMonitor`s from disk. */ -MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_manager(struct LDKStr data_dir, const struct LDKChannelManager *NONNULL_PTR manager); +MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager); /** - * Write the provided `NetworkGraph` to the path provided at `FilesystemPersister` - * initialization, within a file called \"network_graph\" + * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. */ -MUST_USE_RES struct LDKCResult_NoneErrorZ FilesystemPersister_persist_network_graph(struct LDKStr data_dir, const struct LDKNetworkGraph *NONNULL_PTR network_graph); +void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj); /** - * Read `ChannelMonitor`s from disk. + * Frees any resources used by the GossipSync */ -MUST_USE_RES struct LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ FilesystemPersister_read_channelmonitors(const struct LDKFilesystemPersister *NONNULL_PTR this_arg, struct LDKKeysInterface keys_manager); +void GossipSync_free(struct LDKGossipSync this_ptr); /** - * Constructs a new Persist which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Persist must be freed before this_arg is + * Utility method to constructs a new P2P-variant GossipSync */ -struct LDKPersist FilesystemPersister_as_Persist(const struct LDKFilesystemPersister *NONNULL_PTR this_arg); +struct LDKGossipSync GossipSync_p2_p(const struct LDKP2PGossipSync *NONNULL_PTR a); /** - * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. + * Utility method to constructs a new Rapid-variant GossipSync */ -void BackgroundProcessor_free(struct LDKBackgroundProcessor this_obj); +struct LDKGossipSync GossipSync_rapid(const struct LDKRapidGossipSync *NONNULL_PTR a); /** - * Calls the free function if one is set + * Utility method to constructs a new None-variant GossipSync */ -void Persister_free(struct LDKPersister this_ptr); +struct LDKGossipSync GossipSync_none(void); /** * Start a background thread that takes care of responsibilities enumerated in the [top-level @@ -26494,12 +29481,12 @@ void Persister_free(struct LDKPersister this_ptr); * * [`Persister::persist_manager`] is responsible for writing out the [`ChannelManager`] to disk, and/or * uploading to one or more backup services. See [`ChannelManager::write`] for writing out a - * [`ChannelManager`]. See [`FilesystemPersister::persist_manager`] for Rust-Lightning's + * [`ChannelManager`]. See the `lightning-persister` crate for LDK's * provided implementation. * - * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk. See - * [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. See [`FilesystemPersister::persist_network_graph`] - * for Rust-Lightning's provided implementation. + * [`Persister::persist_graph`] is responsible for writing out the [`NetworkGraph`] to disk, if + * [`GossipSync`] is supplied. See [`NetworkGraph::write`] for writing out a [`NetworkGraph`]. + * See the `lightning-persister` crate for LDK's provided implementation. * * Typically, users should either implement [`Persister::persist_manager`] to never return an * error or call [`join`] and handle any error that may arise. For the latter case, @@ -26510,21 +29497,25 @@ void Persister_free(struct LDKPersister this_ptr); * `event_handler` is responsible for handling events that users should be notified of (e.g., * payment failed). [`BackgroundProcessor`] may decorate the given [`EventHandler`] with common * functionality implemented by other handlers. - * * [`NetGraphMsgHandler`] if given will update the [`NetworkGraph`] based on payment failures. + * * [`P2PGossipSync`] if given will update the [`NetworkGraph`] based on payment failures. + * + * # Rapid Gossip Sync + * + * If rapid gossip sync is meant to run at startup, pass [`RapidGossipSync`] via `gossip_sync` + * to indicate that the [`BackgroundProcessor`] should not prune the [`NetworkGraph`] instance + * until the [`RapidGossipSync`] instance completes its first sync. * * [top-level documentation]: BackgroundProcessor * [`join`]: Self::join * [`stop`]: Self::stop * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager * [`ChannelManager::write`]: lightning::ln::channelmanager::ChannelManager#impl-Writeable - * [`FilesystemPersister::persist_manager`]: lightning_persister::FilesystemPersister::persist_manager - * [`FilesystemPersister::persist_network_graph`]: lightning_persister::FilesystemPersister::persist_network_graph - * [`NetworkGraph`]: lightning::routing::network_graph::NetworkGraph - * [`NetworkGraph::write`]: lightning::routing::network_graph::NetworkGraph#impl-Writeable - * - * Note that net_graph_msg_handler (or a relevant inner pointer) may be NULL or all-0s to represent None + * [`Persister::persist_manager`]: lightning::util::persist::Persister::persist_manager + * [`Persister::persist_graph`]: lightning::util::persist::Persister::persist_graph + * [`NetworkGraph`]: lightning::routing::gossip::NetworkGraph + * [`NetworkGraph::write`]: lightning::routing::gossip::NetworkGraph#impl-Writeable */ -MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKNetGraphMsgHandler net_graph_msg_handler, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger); +MUST_USE_RES struct LDKBackgroundProcessor BackgroundProcessor_start(struct LDKPersister persister, struct LDKEventHandler event_handler, const struct LDKChainMonitor *NONNULL_PTR chain_monitor, const struct LDKChannelManager *NONNULL_PTR channel_manager, struct LDKGossipSync gossip_sync, const struct LDKPeerManager *NONNULL_PTR peer_manager, struct LDKLogger logger, struct LDKCOption_WriteableScoreZ scorer); /** * Join `BackgroundProcessor`'s thread, returning any error that occurred while persisting @@ -26689,6 +29680,11 @@ bool Invoice_eq(const struct LDKInvoice *NONNULL_PTR a, const struct LDKInvoice */ struct LDKInvoice Invoice_clone(const struct LDKInvoice *NONNULL_PTR orig); +/** + * Checks if two Invoices contain equal inner contents. + */ +uint64_t Invoice_hash(const struct LDKInvoice *NONNULL_PTR o); + /** * Frees any resources used by the SignedRawInvoice, if is_owned is set and inner is non-NULL. */ @@ -26706,6 +29702,11 @@ bool SignedRawInvoice_eq(const struct LDKSignedRawInvoice *NONNULL_PTR a, const */ struct LDKSignedRawInvoice SignedRawInvoice_clone(const struct LDKSignedRawInvoice *NONNULL_PTR orig); +/** + * Checks if two SignedRawInvoices contain equal inner contents. + */ +uint64_t SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR o); + /** * Frees any resources used by the RawInvoice, if is_owned is set and inner is non-NULL. */ @@ -26733,6 +29734,11 @@ bool RawInvoice_eq(const struct LDKRawInvoice *NONNULL_PTR a, const struct LDKRa */ struct LDKRawInvoice RawInvoice_clone(const struct LDKRawInvoice *NONNULL_PTR orig); +/** + * Checks if two RawInvoices contain equal inner contents. + */ +uint64_t RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR o); + /** * Frees any resources used by the RawDataPart, if is_owned is set and inner is non-NULL. */ @@ -26760,6 +29766,11 @@ bool RawDataPart_eq(const struct LDKRawDataPart *NONNULL_PTR a, const struct LDK */ struct LDKRawDataPart RawDataPart_clone(const struct LDKRawDataPart *NONNULL_PTR orig); +/** + * Checks if two RawDataParts contain equal inner contents. + */ +uint64_t RawDataPart_hash(const struct LDKRawDataPart *NONNULL_PTR o); + /** * Frees any resources used by the PositiveTimestamp, if is_owned is set and inner is non-NULL. */ @@ -26777,6 +29788,11 @@ bool PositiveTimestamp_eq(const struct LDKPositiveTimestamp *NONNULL_PTR a, cons */ struct LDKPositiveTimestamp PositiveTimestamp_clone(const struct LDKPositiveTimestamp *NONNULL_PTR orig); +/** + * Checks if two PositiveTimestamps contain equal inner contents. + */ +uint64_t PositiveTimestamp_hash(const struct LDKPositiveTimestamp *NONNULL_PTR o); + /** * Creates a copy of the SiPrefix */ @@ -26808,6 +29824,11 @@ enum LDKSiPrefix SiPrefix_pico(void); */ bool SiPrefix_eq(const enum LDKSiPrefix *NONNULL_PTR a, const enum LDKSiPrefix *NONNULL_PTR b); +/** + * Checks if two SiPrefixs contain equal inner contents. + */ +uint64_t SiPrefix_hash(const enum LDKSiPrefix *NONNULL_PTR o); + /** * Returns the multiplier to go from a BTC value to picoBTC implied by this SiPrefix. * This is effectively 10^12 * the prefix multiplier @@ -27029,6 +30050,11 @@ void InvoiceSignature_free(struct LDKInvoiceSignature this_obj); */ struct LDKInvoiceSignature InvoiceSignature_clone(const struct LDKInvoiceSignature *NONNULL_PTR orig); +/** + * Checks if two InvoiceSignatures contain equal inner contents. + */ +uint64_t InvoiceSignature_hash(const struct LDKInvoiceSignature *NONNULL_PTR o); + /** * Checks if two InvoiceSignatures contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -27074,7 +30100,7 @@ MUST_USE_RES struct LDKRawInvoice SignedRawInvoice_raw_invoice(const struct LDKS /** * The hash of the `RawInvoice` that was signed. */ -MUST_USE_RES const uint8_t (*SignedRawInvoice_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32]; +MUST_USE_RES const uint8_t (*SignedRawInvoice_signable_hash(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg))[32]; /** * InvoiceSignature for the invoice. @@ -27093,9 +30119,9 @@ MUST_USE_RES struct LDKCResult_PayeePubKeyErrorZ SignedRawInvoice_recover_payee_ MUST_USE_RES bool SignedRawInvoice_check_signature(const struct LDKSignedRawInvoice *NONNULL_PTR this_arg); /** - * Calculate the hash of the encoded `RawInvoice` + * Calculate the hash of the encoded `RawInvoice` which should be signed. */ -MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKThirtyTwoBytes RawInvoice_signable_hash(const struct LDKRawInvoice *NONNULL_PTR this_arg); /** * @@ -27501,35 +30527,35 @@ void Payer_free(struct LDKPayer this_ptr); void Router_free(struct LDKRouter this_ptr); /** - * Frees any resources used by the RetryAttempts, if is_owned is set and inner is non-NULL. + * Frees any resources used by the Retry */ -void RetryAttempts_free(struct LDKRetryAttempts this_obj); +void Retry_free(struct LDKRetry this_ptr); -uintptr_t RetryAttempts_get_a(const struct LDKRetryAttempts *NONNULL_PTR this_ptr); - -void RetryAttempts_set_a(struct LDKRetryAttempts *NONNULL_PTR this_ptr, uintptr_t val); +/** + * Creates a copy of the Retry + */ +struct LDKRetry Retry_clone(const struct LDKRetry *NONNULL_PTR orig); /** - * Constructs a new RetryAttempts given each field + * Utility method to constructs a new Attempts-variant Retry */ -MUST_USE_RES struct LDKRetryAttempts RetryAttempts_new(uintptr_t a_arg); +struct LDKRetry Retry_attempts(uintptr_t a); /** - * Creates a copy of the RetryAttempts + * Utility method to constructs a new Timeout-variant Retry */ -struct LDKRetryAttempts RetryAttempts_clone(const struct LDKRetryAttempts *NONNULL_PTR orig); +struct LDKRetry Retry_timeout(uint64_t a); /** - * Checks if two RetryAttemptss contain equal inner contents. + * Checks if two Retrys 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 RetryAttempts_eq(const struct LDKRetryAttempts *NONNULL_PTR a, const struct LDKRetryAttempts *NONNULL_PTR b); +bool Retry_eq(const struct LDKRetry *NONNULL_PTR a, const struct LDKRetry *NONNULL_PTR b); /** - * Checks if two RetryAttemptss contain equal inner contents. + * Checks if two Retrys contain equal inner contents. */ -uint64_t RetryAttempts_hash(const struct LDKRetryAttempts *NONNULL_PTR o); +uint64_t Retry_hash(const struct LDKRetry *NONNULL_PTR o); /** * Frees any resources used by the PaymentError @@ -27560,9 +30586,9 @@ struct LDKPaymentError PaymentError_sending(struct LDKPaymentSendFailure a); * Creates an invoice payer that retries failed payment paths. * * Will forward any [`Event::PaymentPathFailed`] events to the decorated `event_handler` once - * `retry_attempts` has been exceeded for a given [`Invoice`]. + * `retry` has been exceeded for a given [`Invoice`]. */ -MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, const struct LDKMultiThreadedLockableScore *NONNULL_PTR scorer, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetryAttempts retry_attempts); +MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, struct LDKRouter router, struct LDKLogger logger, struct LDKEventHandler event_handler, struct LDKRetry retry); /** * Pays the given [`Invoice`], caching it for later use in case a retry is needed. @@ -27606,6 +30632,27 @@ void InvoicePayer_remove_cached_payment(const struct LDKInvoicePayer *NONNULL_PT */ struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer *NONNULL_PTR this_arg); +/** + * Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. + */ +void InFlightHtlcs_free(struct LDKInFlightHtlcs this_obj); + +/** + * Returns liquidity in msat given the public key of the HTLC source, target, and short channel + * id. + */ +MUST_USE_RES struct LDKCOption_u64Z InFlightHtlcs_used_liquidity_msat(const struct LDKInFlightHtlcs *NONNULL_PTR this_arg, const struct LDKNodeId *NONNULL_PTR source, const struct LDKNodeId *NONNULL_PTR target, uint64_t channel_scid); + +/** + * Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read + */ +struct LDKCVec_u8Z InFlightHtlcs_write(const struct LDKInFlightHtlcs *NONNULL_PTR obj); + +/** + * Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ InFlightHtlcs_read(struct LDKu8slice ser); + /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" * See [`PhantomKeysManager`] for more information on phantom node payments. @@ -27620,9 +30667,12 @@ struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared * down * - * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or - * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any - * participating node. + * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference + * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). + * If `None` is provided for `payment_hash`, then one will be created. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. * * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this @@ -27630,9 +30680,13 @@ struct LDKEventHandler InvoicePayer_as_EventHandler(const struct LDKInvoicePayer * * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels + * + * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKStr description, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network); /** * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\" @@ -27650,9 +30704,12 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKC * * `description_hash` is a SHA-256 hash of the description text * - * `payment_hash` and `payment_secret` come from [`ChannelManager::create_inbound_payment`] or - * [`ChannelManager::create_inbound_payment_for_hash`]. These values can be retrieved from any - * participating node. + * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference + * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]). + * If `None` is provided for `payment_hash`, then one will be created. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. * * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this @@ -27660,9 +30717,13 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKC * * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints + * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment + * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels + * + * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKThirtyTwoBytes payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKKeysInterface keys_manager, enum LDKCurrency network); /** * Utility to construct an invoice. Generally, unless you want to do something like a custom @@ -27670,8 +30731,11 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_descri * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify * that the payment secret is valid when the invoice is paid. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs); /** * Utility to construct an invoice. Generally, unless you want to do something like a custom @@ -27680,22 +30744,25 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify * that the payment secret is valid when the invoice is paid. * Use this variant if you want to pass the `description_hash` to the invoice. + * + * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for + * in excess of the current time. */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs); /** * See [`create_invoice_from_channelmanager_with_description_hash`] * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs); /** * See [`create_invoice_from_channelmanager`] * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not * available and the current time is supplied by the caller. */ -struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs); /** * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. @@ -27706,7 +30773,7 @@ void DefaultRouter_free(struct LDKDefaultRouter this_obj); * Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source * `random_seed_bytes`. */ -MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes); +MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph, struct LDKLogger logger, struct LDKThirtyTwoBytes random_seed_bytes, struct LDKLockableScore scorer); /** * Constructs a new Router which calls the relevant methods on this_arg. @@ -27765,6 +30832,62 @@ struct LDKStr Currency_to_str(const enum LDKCurrency *NONNULL_PTR o); */ struct LDKStr SiPrefix_to_str(const enum LDKSiPrefix *NONNULL_PTR o); +/** + * Frees any resources used by the RapidGossipSync, if is_owned is set and inner is non-NULL. + */ +void RapidGossipSync_free(struct LDKRapidGossipSync this_obj); + +/** + * Instantiate a new [`RapidGossipSync`] instance + */ +MUST_USE_RES struct LDKRapidGossipSync RapidGossipSync_new(const struct LDKNetworkGraph *NONNULL_PTR network_graph); + +/** + * Sync gossip data from a file + * Returns the last sync timestamp to be used the next time rapid sync data is queried. + * + * `network_graph`: The network graph to apply the updates to + * + * `sync_path`: Path to the file where the gossip update data is located + * + */ +MUST_USE_RES struct LDKCResult_u32GraphSyncErrorZ RapidGossipSync_sync_network_graph_with_file_path(const struct LDKRapidGossipSync *NONNULL_PTR this_arg, struct LDKStr sync_path); + +/** + * Returns whether a rapid gossip sync has completed at least once + */ +MUST_USE_RES bool RapidGossipSync_is_initial_sync_complete(const struct LDKRapidGossipSync *NONNULL_PTR this_arg); + +/** + * Frees any resources used by the GraphSyncError + */ +void GraphSyncError_free(struct LDKGraphSyncError this_ptr); + +/** + * Creates a copy of the GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_clone(const struct LDKGraphSyncError *NONNULL_PTR orig); + +/** + * Utility method to constructs a new DecodeError-variant GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_decode_error(struct LDKDecodeError a); + +/** + * Utility method to constructs a new LightningError-variant GraphSyncError + */ +struct LDKGraphSyncError GraphSyncError_lightning_error(struct LDKLightningError a); + +/** + * Update network graph from binary data. + * Returns the last sync timestamp to be used the next time rapid sync data is queried. + * + * `network_graph`: network graph to be updated + * + * `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); + #endif /* LDK_C_BINDINGS_H */ #include "ldk_ver.h"