From: Matt Corallo Date: Fri, 23 Dec 2022 20:25:40 +0000 (+0000) Subject: Update auto-generated bindings to 0.0.113 X-Git-Tag: v0.0.113.0^2~3 X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=2f70a371708dbfde3fa6abfcc0315736d2795a01;p=ldk-c-bindings Update auto-generated bindings to 0.0.113 --- diff --git a/lightning-c-bindings/include/ldk_rust_types.h b/lightning-c-bindings/include/ldk_rust_types.h index 3faff3d..7432c15 100644 --- a/lightning-c-bindings/include/ldk_rust_types.h +++ b/lightning-c-bindings/include/ldk_rust_types.h @@ -10,10 +10,6 @@ #else #define NONNULL_PTR #endif -struct nativeBlindedRouteOpaque; -typedef struct nativeBlindedRouteOpaque LDKnativeBlindedRoute; -struct nativeBlindedHopOpaque; -typedef struct nativeBlindedHopOpaque LDKnativeBlindedHop; struct nativeCounterpartyCommitmentSecretsOpaque; typedef struct nativeCounterpartyCommitmentSecretsOpaque LDKnativeCounterpartyCommitmentSecrets; struct nativeTxCreationKeysOpaque; @@ -44,8 +40,18 @@ struct nativeShutdownScriptOpaque; typedef struct nativeShutdownScriptOpaque LDKnativeShutdownScript; struct nativeInvalidShutdownScriptOpaque; typedef struct nativeInvalidShutdownScriptOpaque LDKnativeInvalidShutdownScript; +struct nativeBlindedPathOpaque; +typedef struct nativeBlindedPathOpaque LDKnativeBlindedPath; +struct nativeBlindedHopOpaque; +typedef struct nativeBlindedHopOpaque LDKnativeBlindedHop; struct nativeBackgroundProcessorOpaque; typedef struct nativeBackgroundProcessorOpaque LDKnativeBackgroundProcessor; +struct nativeDefaultRouterOpaque; +typedef struct nativeDefaultRouterOpaque LDKnativeDefaultRouter; +struct nativeScorerAccountingForInFlightHtlcsOpaque; +typedef struct nativeScorerAccountingForInFlightHtlcsOpaque LDKnativeScorerAccountingForInFlightHtlcs; +struct nativeInFlightHtlcsOpaque; +typedef struct nativeInFlightHtlcsOpaque LDKnativeInFlightHtlcs; struct nativeRouteHopOpaque; typedef struct nativeRouteHopOpaque LDKnativeRouteHop; struct nativeRouteOpaque; @@ -82,6 +88,10 @@ struct nativeChannelFeaturesOpaque; typedef struct nativeChannelFeaturesOpaque LDKnativeChannelFeatures; struct nativeInvoiceFeaturesOpaque; typedef struct nativeInvoiceFeaturesOpaque LDKnativeInvoiceFeatures; +struct nativeOfferFeaturesOpaque; +typedef struct nativeOfferFeaturesOpaque LDKnativeOfferFeatures; +struct nativeInvoiceRequestFeaturesOpaque; +typedef struct nativeInvoiceRequestFeaturesOpaque LDKnativeInvoiceRequestFeatures; struct nativeChannelTypeFeaturesOpaque; typedef struct nativeChannelTypeFeaturesOpaque LDKnativeChannelTypeFeatures; struct nativeNodeIdOpaque; @@ -145,12 +155,32 @@ struct nativeBigSizeOpaque; typedef struct nativeBigSizeOpaque LDKnativeBigSize; struct nativeHostnameOpaque; typedef struct nativeHostnameOpaque LDKnativeHostname; +struct nativePrintableStringOpaque; +typedef struct nativePrintableStringOpaque LDKnativePrintableString; struct nativeOutPointOpaque; typedef struct nativeOutPointOpaque LDKnativeOutPoint; struct nativeInvoicePayerOpaque; typedef struct nativeInvoicePayerOpaque LDKnativeInvoicePayer; -struct nativeInFlightHtlcsOpaque; -typedef struct nativeInFlightHtlcsOpaque LDKnativeInFlightHtlcs; +struct nativeChannelMonitorUpdateOpaque; +typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate; +struct nativeHTLCUpdateOpaque; +typedef struct nativeHTLCUpdateOpaque LDKnativeHTLCUpdate; +struct nativeChannelMonitorOpaque; +typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor; +struct nativeExpandedKeyOpaque; +typedef struct nativeExpandedKeyOpaque LDKnativeExpandedKey; +struct nativeIgnoringMessageHandlerOpaque; +typedef struct nativeIgnoringMessageHandlerOpaque LDKnativeIgnoringMessageHandler; +struct nativeErroringMessageHandlerOpaque; +typedef struct nativeErroringMessageHandlerOpaque LDKnativeErroringMessageHandler; +struct nativeMessageHandlerOpaque; +typedef struct nativeMessageHandlerOpaque LDKnativeMessageHandler; +struct nativePeerHandleErrorOpaque; +typedef struct nativePeerHandleErrorOpaque LDKnativePeerHandleError; +struct nativePeerManagerOpaque; +typedef struct nativePeerManagerOpaque LDKnativePeerManager; +struct nativeOnionMessengerOpaque; +typedef struct nativeOnionMessengerOpaque LDKnativeOnionMessenger; struct nativeInvoiceOpaque; typedef struct nativeInvoiceOpaque LDKnativeInvoice; struct nativeSignedRawInvoiceOpaque; @@ -175,26 +205,6 @@ struct nativeInvoiceSignatureOpaque; typedef struct nativeInvoiceSignatureOpaque LDKnativeInvoiceSignature; struct nativePrivateRouteOpaque; typedef struct nativePrivateRouteOpaque LDKnativePrivateRoute; -struct nativeChannelMonitorUpdateOpaque; -typedef struct nativeChannelMonitorUpdateOpaque LDKnativeChannelMonitorUpdate; -struct nativeHTLCUpdateOpaque; -typedef struct nativeHTLCUpdateOpaque LDKnativeHTLCUpdate; -struct nativeChannelMonitorOpaque; -typedef struct nativeChannelMonitorOpaque LDKnativeChannelMonitor; -struct nativeExpandedKeyOpaque; -typedef struct nativeExpandedKeyOpaque LDKnativeExpandedKey; -struct nativeIgnoringMessageHandlerOpaque; -typedef struct nativeIgnoringMessageHandlerOpaque LDKnativeIgnoringMessageHandler; -struct nativeErroringMessageHandlerOpaque; -typedef struct nativeErroringMessageHandlerOpaque LDKnativeErroringMessageHandler; -struct nativeMessageHandlerOpaque; -typedef struct nativeMessageHandlerOpaque LDKnativeMessageHandler; -struct nativePeerHandleErrorOpaque; -typedef struct nativePeerHandleErrorOpaque LDKnativePeerHandleError; -struct nativePeerManagerOpaque; -typedef struct nativePeerManagerOpaque LDKnativePeerManager; -struct nativeOnionMessengerOpaque; -typedef struct nativeOnionMessengerOpaque LDKnativeOnionMessenger; struct nativeRapidGossipSyncOpaque; typedef struct nativeRapidGossipSyncOpaque LDKnativeRapidGossipSync; struct nativeInitOpaque; @@ -271,8 +281,6 @@ struct nativeLightningErrorOpaque; typedef struct nativeLightningErrorOpaque LDKnativeLightningError; struct nativeCommitmentUpdateOpaque; typedef struct nativeCommitmentUpdateOpaque LDKnativeCommitmentUpdate; -struct nativeDefaultRouterOpaque; -typedef struct nativeDefaultRouterOpaque LDKnativeDefaultRouter; struct nativeRecordOpaque; typedef struct nativeRecordOpaque LDKnativeRecord; struct nativeFutureOpaque; diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 8b6468c..af9b134 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -221,6 +221,36 @@ typedef enum LDKCurrency { LDKCurrency_Sentinel, } LDKCurrency; +/** + * Describes the type of HTLC claim as determined by analyzing the witness. + */ +typedef enum LDKHTLCClaim { + /** + * Claims an offered output on a commitment transaction through the timeout path. + */ + LDKHTLCClaim_OfferedTimeout, + /** + * Claims an offered output on a commitment transaction through the success path. + */ + LDKHTLCClaim_OfferedPreimage, + /** + * Claims an accepted output on a commitment transaction through the timeout path. + */ + LDKHTLCClaim_AcceptedTimeout, + /** + * Claims an accepted output on a commitment transaction through the success path. + */ + LDKHTLCClaim_AcceptedPreimage, + /** + * Claims an offered/accepted output on a commitment transaction through the revocation path. + */ + LDKHTLCClaim_Revocation, + /** + * Must be last for serialization purposes + */ + LDKHTLCClaim_Sentinel, +} LDKHTLCClaim; + /** * Represents an IO Error. Note that some information is lost in the conversion from Rust. */ @@ -310,8 +340,10 @@ typedef enum LDKNetwork { } LDKNetwork; /** - * Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node - * secret key should be used to sign the invoice. + * Specifies the recipient of an invoice. + * + * This indicates to [`KeysInterface::sign_invoice`] what node secret key should be used to sign + * the invoice. */ typedef enum LDKRecipient { /** @@ -482,6 +514,29 @@ typedef struct LDKStr { bool chars_is_owned; } LDKStr; +/** + * A 16-byte byte array. + */ +typedef struct LDKSixteenBytes { + /** + * The sixteen bytes + */ + uint8_t data[16]; +} LDKSixteenBytes; + +/** + * Unsigned, 128-bit integer. + * + * Because LLVM implements an incorrect ABI for 128-bit integers, a wrapper type is defined here. + * See https://github.com/rust-lang/rust/issues/54341 for more details. + */ +typedef struct LDKU128 { + /** + * The 128-bit integer, as 16 little-endian bytes + */ + uint8_t le_bytes[16]; +} LDKU128; + /** * Represents a scalar value between zero and the secp256k1 curve order, in big endian. */ @@ -585,6 +640,26 @@ typedef struct LDKTransaction { bool data_is_owned; } LDKTransaction; +/** + * A serialized witness. + */ +typedef struct LDKWitness { + /** + * The serialized transaction data. + * + * This is non-const for your convenience, an object passed to Rust is never written to. + */ + uint8_t *data; + /** + * The length of the serialized transaction + */ + uintptr_t datalen; + /** + * Whether the data pointed to by `data` should be freed or not. + */ + bool data_is_owned; +} LDKWitness; + /** * A dynamically-allocated array of u8s of arbitrary size. * This corresponds to std::vector in C++ @@ -617,83 +692,86 @@ typedef struct LDKTxOut { } LDKTxOut; /** - * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. + * An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not */ -typedef struct LDKPublicKey { +typedef enum LDKCOption_HTLCClaimZ_Tag { /** - * The bytes of the public key + * When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim */ - 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 { + LDKCOption_HTLCClaimZ_Some, /** - * 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_HTLCClaimZ contains nothing */ - struct LDKPublicKey *data; + LDKCOption_HTLCClaimZ_None, /** - * The number of elements pointed to by `data`. + * Must be last for serialization purposes */ - uintptr_t datalen; -} LDKCVec_PublicKeyZ; - + LDKCOption_HTLCClaimZ_Sentinel, +} LDKCOption_HTLCClaimZ_Tag; +typedef struct LDKCOption_HTLCClaimZ { + LDKCOption_HTLCClaimZ_Tag tag; + union { + struct { + enum LDKHTLCClaim some; + }; + }; +} LDKCOption_HTLCClaimZ; /** - * Onion messages can be sent and received to blinded routes, which serve to hide the identity of - * the recipient. + * The contents of CResult_NoneNoneZ */ -typedef struct MUST_USE_STRUCT LDKBlindedRoute { +typedef union LDKCResult_NoneNoneZPtr { /** - * 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 */ - LDKnativeBlindedRoute *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. + * Note that this value is always NULL, as there are no contents in the Err variant */ - bool is_owned; -} LDKBlindedRoute; + void *err; +} LDKCResult_NoneNoneZPtr; /** - * The contents of CResult_BlindedRouteNoneZ + * A CResult_NoneNoneZ represents the result of a fallible operation, + * containing a () on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef union LDKCResult_BlindedRouteNoneZPtr { +typedef struct LDKCResult_NoneNoneZ { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The contents of this CResult_NoneNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - struct LDKBlindedRoute *result; + union LDKCResult_NoneNoneZPtr contents; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Whether this CResult_NoneNoneZ represents a success state. */ - void *err; -} LDKCResult_BlindedRouteNoneZPtr; + bool result_ok; +} LDKCResult_NoneNoneZ; + + /** - * 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`. + * Implements the per-commitment secret storage scheme from + * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). + * + * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes + * or so. */ -typedef struct LDKCResult_BlindedRouteNoneZ { +typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { /** - * The contents of this CResult_BlindedRouteNoneZ, 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_BlindedRouteNoneZPtr contents; + LDKnativeCounterpartyCommitmentSecrets *inner; /** - * Whether this CResult_BlindedRouteNoneZ 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_BlindedRouteNoneZ; + bool is_owned; +} LDKCounterpartyCommitmentSecrets; /** * An error in decoding a message or struct. @@ -746,417 +824,166 @@ typedef struct MUST_USE_STRUCT LDKDecodeError { } LDKDecodeError; /** - * The contents of CResult_BlindedRouteDecodeErrorZ + * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ */ -typedef union LDKCResult_BlindedRouteDecodeErrorZPtr { +typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBlindedRoute *result; + struct LDKCounterpartyCommitmentSecrets *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; +} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr; /** - * 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. + * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets 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 { +typedef struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ { /** - * The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either + * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_BlindedRouteDecodeErrorZPtr contents; + union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents; /** - * Whether this CResult_BlindedRouteDecodeErrorZ represents a success state. + * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_BlindedRouteDecodeErrorZ; +} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ; /** - * 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. + * The set of public keys which are used in the creation of one commitment transaction. + * These are derived from the channel base keys and per-commitment data. + * + * A broadcaster key is provided from potential broadcaster of the computed transaction. + * A countersignatory key is coming from a protocol participant unable to broadcast the + * transaction. + * + * These keys are assumed to be good, either because the code derived them from + * channel basepoints via the new function, or they were obtained via + * CommitmentTransaction.trust().keys() because we trusted the source of the + * pre-calculated keys. */ -typedef struct MUST_USE_STRUCT LDKBlindedHop { +typedef struct MUST_USE_STRUCT LDKTxCreationKeys { /** * 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; + LDKnativeTxCreationKeys *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; +} LDKTxCreationKeys; /** - * The contents of CResult_BlindedHopDecodeErrorZ + * The contents of CResult_TxCreationKeysDecodeErrorZ */ -typedef union LDKCResult_BlindedHopDecodeErrorZPtr { +typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKBlindedHop *result; + struct LDKTxCreationKeys *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 - */ -typedef union LDKCResult_NoneNoneZPtr { - /** - * Note that this value is always NULL, as there are no contents in the OK variant - */ - void *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_NoneNoneZPtr; +} LDKCResult_TxCreationKeysDecodeErrorZPtr; /** - * A CResult_NoneNoneZ represents the result of a fallible operation, - * containing a () on success and a () on failure. + * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::TxCreationKeys 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_NoneNoneZ { +typedef struct LDKCResult_TxCreationKeysDecodeErrorZ { /** - * The contents of this CResult_NoneNoneZ, accessible via either + * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneNoneZPtr contents; + union LDKCResult_TxCreationKeysDecodeErrorZPtr contents; /** - * Whether this CResult_NoneNoneZ represents a success state. + * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneNoneZ; +} LDKCResult_TxCreationKeysDecodeErrorZ; /** - * Implements the per-commitment secret storage scheme from - * [BOLT 3](https://github.com/lightning/bolts/blob/dcbf8583976df087c79c3ce0b535311212e6812d/03-transactions.md#efficient-per-commitment-secret-storage). - * - * Allows us to keep track of all of the revocation secrets of our counterparty in just 50*32 bytes - * or so. + * One counterparty's public keys which do not change over the life of a channel. */ -typedef struct MUST_USE_STRUCT LDKCounterpartyCommitmentSecrets { +typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeCounterpartyCommitmentSecrets *inner; + LDKnativeChannelPublicKeys *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKCounterpartyCommitmentSecrets; +} LDKChannelPublicKeys; /** - * The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ + * The contents of CResult_ChannelPublicKeysDecodeErrorZ */ -typedef union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { +typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCounterpartyCommitmentSecrets *result; + struct LDKChannelPublicKeys *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_CounterpartyCommitmentSecretsDecodeErrorZPtr; +} LDKCResult_ChannelPublicKeysDecodeErrorZPtr; /** - * A CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys 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_CounterpartyCommitmentSecretsDecodeErrorZ { +typedef struct LDKCResult_ChannelPublicKeysDecodeErrorZ { /** - * The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either + * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZPtr contents; + union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents; /** - * Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. + * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ; +} LDKCResult_ChannelPublicKeysDecodeErrorZ; /** - * Represents a valid secp256k1 secret key serialized as a 32 byte array. + * An enum which can either contain a u32 or not */ -typedef struct LDKSecretKey { +typedef enum LDKCOption_u32Z_Tag { /** - * The bytes of the secret key + * When we're in this state, this COption_u32Z contains a u32 */ - uint8_t bytes[32]; -} LDKSecretKey; - -/** - * The contents of CResult_SecretKeyErrorZ - */ -typedef union LDKCResult_SecretKeyErrorZPtr { + LDKCOption_u32Z_Some, /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * When we're in this state, this COption_u32Z contains nothing */ - struct LDKSecretKey *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKSecp256k1Error *err; -} LDKCResult_SecretKeyErrorZPtr; - -/** - * A CResult_SecretKeyErrorZ represents the result of a fallible operation, - * containing a crate::c_types::SecretKey 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_SecretKeyErrorZ { - /** - * The contents of this CResult_SecretKeyErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_SecretKeyErrorZPtr contents; - /** - * Whether this CResult_SecretKeyErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_SecretKeyErrorZ; - -/** - * The contents of CResult_PublicKeyErrorZ - */ -typedef union LDKCResult_PublicKeyErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKPublicKey *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKSecp256k1Error *err; -} LDKCResult_PublicKeyErrorZPtr; - -/** - * A CResult_PublicKeyErrorZ represents the result of a fallible operation, - * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_PublicKeyErrorZ { - /** - * The contents of this CResult_PublicKeyErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_PublicKeyErrorZPtr contents; - /** - * Whether this CResult_PublicKeyErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_PublicKeyErrorZ; - - - -/** - * The set of public keys which are used in the creation of one commitment transaction. - * These are derived from the channel base keys and per-commitment data. - * - * A broadcaster key is provided from potential broadcaster of the computed transaction. - * A countersignatory key is coming from a protocol participant unable to broadcast the - * transaction. - * - * These keys are assumed to be good, either because the code derived them from - * channel basepoints via the new function, or they were obtained via - * CommitmentTransaction.trust().keys() because we trusted the source of the - * pre-calculated keys. - */ -typedef struct MUST_USE_STRUCT LDKTxCreationKeys { - /** - * 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. - */ - LDKnativeTxCreationKeys *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; -} LDKTxCreationKeys; - -/** - * The contents of CResult_TxCreationKeysDecodeErrorZ - */ -typedef union LDKCResult_TxCreationKeysDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTxCreationKeys *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_TxCreationKeysDecodeErrorZPtr; - -/** - * A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::chan_utils::TxCreationKeys 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_TxCreationKeysDecodeErrorZ { - /** - * The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_TxCreationKeysDecodeErrorZPtr contents; - /** - * Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_TxCreationKeysDecodeErrorZ; - - - -/** - * One counterparty's public keys which do not change over the life of a channel. - */ -typedef struct MUST_USE_STRUCT LDKChannelPublicKeys { - /** - * 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. - */ - LDKnativeChannelPublicKeys *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; -} LDKChannelPublicKeys; - -/** - * The contents of CResult_ChannelPublicKeysDecodeErrorZ - */ -typedef union LDKCResult_ChannelPublicKeysDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKChannelPublicKeys *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_ChannelPublicKeysDecodeErrorZPtr; - -/** - * A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::chan_utils::ChannelPublicKeys 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_ChannelPublicKeysDecodeErrorZ { - /** - * The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_ChannelPublicKeysDecodeErrorZPtr contents; - /** - * Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_ChannelPublicKeysDecodeErrorZ; - -/** - * The contents of CResult_TxCreationKeysErrorZ - */ -typedef union LDKCResult_TxCreationKeysErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKTxCreationKeys *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKSecp256k1Error *err; -} LDKCResult_TxCreationKeysErrorZPtr; - -/** - * A CResult_TxCreationKeysErrorZ represents the result of a fallible operation, - * containing a crate::lightning::ln::chan_utils::TxCreationKeys 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_TxCreationKeysErrorZ { - /** - * The contents of this CResult_TxCreationKeysErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_TxCreationKeysErrorZPtr contents; - /** - * Whether this CResult_TxCreationKeysErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_TxCreationKeysErrorZ; - -/** - * An enum which can either contain a u32 or not - */ -typedef enum LDKCOption_u32Z_Tag { - /** - * When we're in this state, this COption_u32Z contains a u32 - */ - LDKCOption_u32Z_Some, - /** - * When we're in this state, this COption_u32Z contains nothing - */ - LDKCOption_u32Z_None, + LDKCOption_u32Z_None, /** * Must be last for serialization purposes */ @@ -1781,80 +1608,246 @@ typedef struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ { bool result_ok; } LDKCResult_ShutdownScriptInvalidShutdownScriptZ; - - /** - * Represents the compressed public key of a node + * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. */ -typedef struct MUST_USE_STRUCT LDKNodeId { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNodeId *inner; +typedef struct LDKPublicKey { /** - * 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 bytes of the public key */ - bool is_owned; -} LDKNodeId; - - + uint8_t compressed_form[33]; +} LDKPublicKey; /** - * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. + * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKChannelUsage { +typedef struct LDKCVec_PublicKeyZ { /** - * 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(). */ - LDKnativeChannelUsage *inner; + struct LDKPublicKey *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; -} LDKChannelUsage; + uintptr_t datalen; +} LDKCVec_PublicKeyZ; /** - * A hop in a route + * Onion messages can be sent and received to blinded paths, which serve to hide the identity of + * the recipient. */ -typedef struct MUST_USE_STRUCT LDKRouteHop { +typedef struct MUST_USE_STRUCT LDKBlindedPath { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeRouteHop *inner; + LDKnativeBlindedPath *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKRouteHop; +} LDKBlindedPath; /** - * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_BlindedPathNoneZ */ -typedef struct LDKCVec_RouteHopZ { +typedef union LDKCResult_BlindedPathNoneZPtr { /** - * 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 LDKRouteHop *data; + struct LDKBlindedPath *result; /** - * The number of elements pointed to by `data`. + * Note that this value is always NULL, as there are no contents in the Err variant */ - uintptr_t datalen; + void *err; +} LDKCResult_BlindedPathNoneZPtr; + +/** + * A CResult_BlindedPathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedPathNoneZ { + /** + * The contents of this CResult_BlindedPathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedPathNoneZPtr contents; + /** + * Whether this CResult_BlindedPathNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedPathNoneZ; + +/** + * The contents of CResult_BlindedPathDecodeErrorZ + */ +typedef union LDKCResult_BlindedPathDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedPath *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_BlindedPathDecodeErrorZPtr; + +/** + * A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedPathDecodeErrorZ { + /** + * The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedPathDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedPathDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedPathDecodeErrorZ; + + + +/** + * Used to construct the blinded hops portion of a blinded path. These hops cannot be identified + * by outside observers and thus can be used to hide the identity of the recipient. + */ +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_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedHopDecodeErrorZ { + /** + * The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedHopDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedHopDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedHopDecodeErrorZ; + + + +/** + * Represents the compressed public key of a node + */ +typedef struct MUST_USE_STRUCT LDKNodeId { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeNodeId *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKNodeId; + + + +/** + * Proposed use of a channel passed as a parameter to [`Score::channel_penalty_msat`]. + */ +typedef struct MUST_USE_STRUCT LDKChannelUsage { + /** + * 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. + */ + LDKnativeChannelUsage *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; +} LDKChannelUsage; + + + +/** + * A hop in a route + */ +typedef struct MUST_USE_STRUCT LDKRouteHop { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeRouteHop *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKRouteHop; + +/** + * A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_RouteHopZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKRouteHop *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; } LDKCVec_RouteHopZ; /** @@ -2019,54 +2012,41 @@ typedef struct LDKCResult_NoneErrorZ { 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`. + * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels */ -typedef struct LDKCResult_RouteHopDecodeErrorZ { +typedef struct MUST_USE_STRUCT LDKChannelDetails { /** - * The contents of this CResult_RouteHopDecodeErrorZ, 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_RouteHopDecodeErrorZPtr contents; + LDKnativeChannelDetails *inner; /** - * Whether this CResult_RouteHopDecodeErrorZ 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_RouteHopDecodeErrorZ; + bool is_owned; +} LDKChannelDetails; /** - * A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size. + * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_CVec_RouteHopZZ { +typedef struct LDKCVec_ChannelDetailsZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKCVec_RouteHopZ *data; + struct LDKChannelDetails *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_CVec_RouteHopZZ; +} LDKCVec_ChannelDetailsZ; @@ -2089,10 +2069,30 @@ typedef struct MUST_USE_STRUCT LDKRoute { bool is_owned; } LDKRoute; + + /** - * The contents of CResult_RouteDecodeErrorZ + * An Err type for failure to process messages. */ -typedef union LDKCResult_RouteDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKLightningError { + /** + * 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. + */ + LDKnativeLightningError *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; +} LDKLightningError; + +/** + * The contents of CResult_RouteLightningErrorZ + */ +typedef union LDKCResult_RouteLightningErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -2102,35 +2102,198 @@ typedef union LDKCResult_RouteDecodeErrorZPtr { * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKDecodeError *err; -} LDKCResult_RouteDecodeErrorZPtr; + struct LDKLightningError *err; +} LDKCResult_RouteLightningErrorZPtr; /** - * A CResult_RouteDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::DecodeError on failure. + * A CResult_RouteLightningErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::Route 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_RouteDecodeErrorZ { +typedef struct LDKCResult_RouteLightningErrorZ { /** - * The contents of this CResult_RouteDecodeErrorZ, accessible via either + * The contents of this CResult_RouteLightningErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_RouteDecodeErrorZPtr contents; + union LDKCResult_RouteLightningErrorZPtr contents; /** - * Whether this CResult_RouteDecodeErrorZ represents a success state. + * Whether this CResult_RouteLightningErrorZ represents a success state. */ bool result_ok; -} LDKCResult_RouteDecodeErrorZ; - - +} LDKCResult_RouteLightningErrorZ; /** - * Parameters needed to find a [`Route`]. - * - * 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 + * An enum which can either contain a u64 or not + */ +typedef enum LDKCOption_u64Z_Tag { + /** + * When we're in this state, this COption_u64Z contains a u64 + */ + LDKCOption_u64Z_Some, + /** + * When we're in this state, this COption_u64Z contains nothing + */ + LDKCOption_u64Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u64Z_Sentinel, +} LDKCOption_u64Z_Tag; + +typedef struct LDKCOption_u64Z { + LDKCOption_u64Z_Tag tag; + union { + struct { + uint64_t some; + }; + }; +} LDKCOption_u64Z; + + + +/** + * A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for + * in-use channel liquidity. + */ +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 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_InFlightHtlcsDecodeErrorZPtr; + +/** + * A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::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_InFlightHtlcsDecodeErrorZ { + /** + * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents; + /** + * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InFlightHtlcsDecodeErrorZ; + +/** + * 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 { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKCVec_RouteHopZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_CVec_RouteHopZZ; + +/** + * The contents of CResult_RouteDecodeErrorZ + */ +typedef union LDKCResult_RouteDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKRoute *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_RouteDecodeErrorZPtr; + +/** + * A CResult_RouteDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::routing::router::Route 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_RouteDecodeErrorZ { + /** + * The contents of this CResult_RouteDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_RouteDecodeErrorZPtr contents; + /** + * Whether this CResult_RouteDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_RouteDecodeErrorZ; + + + +/** + * Parameters needed to find a [`Route`]. + * + * 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 */ typedef struct MUST_USE_STRUCT LDKRouteParameters { /** @@ -2216,33 +2379,6 @@ typedef struct LDKCVec_RouteHintZ { uintptr_t datalen; } LDKCVec_RouteHintZ; -/** - * An enum which can either contain a u64 or not - */ -typedef enum LDKCOption_u64Z_Tag { - /** - * When we're in this state, this COption_u64Z contains a u64 - */ - LDKCOption_u64Z_Some, - /** - * When we're in this state, this COption_u64Z contains nothing - */ - LDKCOption_u64Z_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_u64Z_Sentinel, -} LDKCOption_u64Z_Tag; - -typedef struct LDKCOption_u64Z { - LDKCOption_u64Z_Tag tag; - union { - struct { - uint64_t some; - }; - }; -} LDKCOption_u64Z; - /** * A dynamically-allocated array of u64s of arbitrary size. * This corresponds to std::vector in C++ @@ -2414,127 +2550,38 @@ typedef struct LDKCResult_RouteHintHopDecodeErrorZ { bool result_ok; } LDKCResult_RouteHintHopDecodeErrorZ; - - /** - * Details of a channel, as returned by ChannelManager::list_channels and ChannelManager::list_usable_channels + * 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 MUST_USE_STRUCT LDKChannelDetails { - /** - * 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. - */ - LDKnativeChannelDetails *inner; +typedef enum LDKPaymentPurpose_Tag { /** - * 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. + * Information for receiving a payment that we generated an invoice for. */ - bool is_owned; -} LDKChannelDetails; - -/** - * A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_ChannelDetailsZ { + LDKPaymentPurpose_InvoicePayment, /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Because this is a spontaneous payment, the payer generated their own preimage rather than us + * (the payee) providing a preimage. */ - struct LDKChannelDetails *data; + LDKPaymentPurpose_SpontaneousPayment, /** - * The number of elements pointed to by `data`. + * Must be last for serialization purposes */ - uintptr_t datalen; -} LDKCVec_ChannelDetailsZ; - - + LDKPaymentPurpose_Sentinel, +} LDKPaymentPurpose_Tag; -/** - * An Err type for failure to process messages. - */ -typedef struct MUST_USE_STRUCT LDKLightningError { +typedef struct LDKPaymentPurpose_LDKInvoicePayment_Body { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * The 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 */ - LDKnativeLightningError *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; -} LDKLightningError; - -/** - * The contents of CResult_RouteLightningErrorZ - */ -typedef union LDKCResult_RouteLightningErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKRoute *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_RouteLightningErrorZPtr; - -/** - * A CResult_RouteLightningErrorZ represents the result of a fallible operation, - * containing a crate::lightning::routing::router::Route 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_RouteLightningErrorZ { - /** - * The contents of this CResult_RouteLightningErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_RouteLightningErrorZPtr contents; - /** - * Whether this CResult_RouteLightningErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_RouteLightningErrorZ; - -/** - * 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; + struct LDKThirtyTwoBytes payment_preimage; /** * The \"payment secret\". This authenticates the sender to the recipient, preventing a * number of deanonymization attacks during the routing process. @@ -2755,6 +2802,11 @@ typedef enum LDKHTLCDestination_Tag { * Scenario where we are unsure of the next node to forward the HTLC to. */ LDKHTLCDestination_UnknownNextHop, + /** + * We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate + * intercept HTLC. + */ + LDKHTLCDestination_InvalidForward, /** * Failure scenario where an HTLC may have been forwarded to be intended for us, * but is invalid for some reason, so we reject it. @@ -2793,6 +2845,13 @@ typedef struct LDKHTLCDestination_LDKUnknownNextHop_Body { uint64_t requested_forward_scid; } LDKHTLCDestination_LDKUnknownNextHop_Body; +typedef struct LDKHTLCDestination_LDKInvalidForward_Body { + /** + * Short channel id we are requesting to forward an HTLC to. + */ + uint64_t requested_forward_scid; +} LDKHTLCDestination_LDKInvalidForward_Body; + typedef struct LDKHTLCDestination_LDKFailedPayment_Body { /** * The payment hash of the payment we attempted to process. @@ -2805,6 +2864,7 @@ typedef struct MUST_USE_STRUCT LDKHTLCDestination { union { LDKHTLCDestination_LDKNextHopChannel_Body next_hop_channel; LDKHTLCDestination_LDKUnknownNextHop_Body unknown_next_hop; + LDKHTLCDestination_LDKInvalidForward_Body invalid_forward; LDKHTLCDestination_LDKFailedPayment_Body failed_payment; }; } LDKHTLCDestination; @@ -2869,6 +2929,33 @@ typedef struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ { bool result_ok; } LDKCResult_COption_HTLCDestinationZDecodeErrorZ; +/** + * An enum which can either contain a crate::c_types::U128 or not + */ +typedef enum LDKCOption_u128Z_Tag { + /** + * When we're in this state, this COption_u128Z contains a crate::c_types::U128 + */ + LDKCOption_u128Z_Some, + /** + * When we're in this state, this COption_u128Z contains nothing + */ + LDKCOption_u128Z_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_u128Z_Sentinel, +} LDKCOption_u128Z_Tag; + +typedef struct LDKCOption_u128Z { + LDKCOption_u128Z_Tag tag; + union { + struct { + struct LDKU128 some; + }; + }; +} LDKCOption_u128Z; + /** @@ -3010,8 +3097,9 @@ typedef struct MUST_USE_STRUCT LDKOutPoint { /** - * Information about a spendable output to a P2WSH script. See - * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this. + * Information about a spendable output to a P2WSH script. + * + * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this. */ typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { /** @@ -3031,8 +3119,9 @@ typedef struct MUST_USE_STRUCT LDKDelayedPaymentOutputDescriptor { /** - * Information about a spendable output to our \"payment key\". See - * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this. + * Information about a spendable output to our \"payment key\". + * + * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this. */ typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { /** @@ -3050,57 +3139,76 @@ typedef struct MUST_USE_STRUCT LDKStaticPaymentOutputDescriptor { } LDKStaticPaymentOutputDescriptor; /** - * When on-chain outputs are created by rust-lightning (which our counterparty is not able to - * claim at any point in the future) an event is generated which you must track and be able to - * spend on-chain. The information needed to do this is provided in this enum, including the - * outpoint describing which txid and output index is available, the full output which exists at - * that txid/index, and any keys or other information required to sign. + * Describes the necessary information to spend a spendable output. + * + * When on-chain outputs are created by LDK (which our counterparty is not able to claim at any + * point in the future) a [`SpendableOutputs`] event is generated which you must track and be able + * to spend on-chain. The information needed to do this is provided in this enum, including the + * outpoint describing which `txid` and output `index` is available, the full output which exists + * at that `txid`/`index`, and any keys or other information required to sign. + * + * [`SpendableOutputs`]: crate::util::events::Event::SpendableOutputs */ typedef enum LDKSpendableOutputDescriptor_Tag { /** - * An output to a script which was provided via KeysInterface directly, either from - * `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know - * how to spend it. No secret keys are provided as rust-lightning was never given any key. + * An output to a script which was provided via [`KeysInterface`] directly, either from + * [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already + * know how to spend it. No secret keys are provided as LDK was never given any key. * These may include outputs from a transaction punishing our counterparty or claiming an HTLC * on-chain using the payment preimage or after it has timed out. + * + * [`get_shutdown_scriptpubkey`]: KeysInterface::get_shutdown_scriptpubkey + * [`get_destination_script`]: KeysInterface::get_shutdown_scriptpubkey */ LDKSpendableOutputDescriptor_StaticOutput, /** - * An output to a P2WSH script which can be spent with a single signature after a CSV delay. + * An output to a P2WSH script which can be spent with a single signature after an `OP_CSV` + * delay. * * The witness in the spending input should be: + * ```bitcoin * (MINIMALIF standard rule) + * ``` * - * Note that the nSequence field in the spending input must be set to to_self_delay - * (which means the transaction is not broadcastable until at least to_self_delay - * blocks after the outpoint confirms). + * Note that the `nSequence` field in the spending input must be set to + * [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not + * broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after + * the outpoint confirms, see [BIP + * 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK + * won't generate a [`SpendableOutputDescriptor`] until the corresponding block height + * is reached. * * These are generally the result of a \"revocable\" output to us, spendable only by us unless * it is an output from an old state which we broadcast (which should never happen). * - * To derive the delayed_payment key which is used to sign for this input, you must pass the - * holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in - * Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to - * chan_utils::derive_private_key. The public key can be generated without the secret key - * using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in - * Sign::pubkeys(). + * To derive the delayed payment key which is used to sign this input, you must pass the + * holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the + * [`ChannelPublicKeys::delayed_payment_basepoint`] in [`BaseSign::pubkeys`]) and the provided + * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be + * generated without the secret key using [`chan_utils::derive_public_key`] and only the + * [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`BaseSign::pubkeys`]. * - * To derive the revocation_pubkey provided here (which is used in the witness - * script generation), you must pass the counterparty revocation_basepoint (which appears in the - * call to Sign::ready_channel) and the provided per_commitment point - * to chan_utils::derive_public_revocation_key. + * To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is + * used in the witness script generation), you must pass the counterparty + * [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to + * [`BaseSign::provide_channel_parameters`]) and the provided + * [`DelayedPaymentOutputDescriptor::per_commitment_point`] to + * [`chan_utils::derive_public_revocation_key`]. * - * The witness script which is hashed and included in the output script_pubkey may be - * regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey - * (derived as above), and the to_self_delay contained here to - * chan_utils::get_revokeable_redeemscript. + * The witness script which is hashed and included in the output `script_pubkey` may be + * regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived + * as explained above), our delayed payment pubkey (derived as explained above), and the + * [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to + * [`chan_utils::get_revokeable_redeemscript`]. */ LDKSpendableOutputDescriptor_DelayedPaymentOutput, /** - * An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which - * corresponds to the public key in Sign::pubkeys().payment_point). - * The witness in the spending input, is, thus, simply: + * An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key + * which corresponds to the `payment_point` in [`BaseSign::pubkeys`]). The witness + * in the spending input is, thus, simply: + * ```bitcoin * + * ``` * * These are generally the result of our counterparty having broadcast the current state, * allowing us to claim the non-HTLC-encumbered outputs immediately. @@ -3114,7 +3222,7 @@ typedef enum LDKSpendableOutputDescriptor_Tag { typedef struct LDKSpendableOutputDescriptor_LDKStaticOutput_Body { /** - * The outpoint which is spendable + * The outpoint which is spendable. */ struct LDKOutPoint outpoint; /** @@ -3201,8 +3309,8 @@ typedef enum LDKEvent_Tag { */ LDKEvent_FundingGenerationReady, /** - * 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.... + * Indicates that we've been offered a payment and it needs to be claimed via calling + * [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`]. * * Note that if the preimage is not known, you should call * [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid @@ -3213,24 +3321,27 @@ typedef enum LDKEvent_Tag { * * # Note * LDK will not stop an inbound payment from being paid multiple times, so multiple - * `PaymentReceived` events may be generated for the same payment. + * `PaymentClaimable` events may be generated for the same payment. + * + * # Note + * This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds * [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards */ - LDKEvent_PaymentReceived, + LDKEvent_PaymentClaimable, /** * 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 + * to an [`Event::PaymentClaimable`]. However, if we previously crashed during a * [`ChannelManager::claim_funds`] call you may see this event without a corresponding - * [`Event::PaymentReceived`] event. + * [`Event::PaymentClaimable`] 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 + * `PaymentClaimable` events may be generated for the same payment. If you then call + * [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get * multiple `PaymentClaimed` events. * * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds @@ -3249,8 +3360,8 @@ typedef enum LDKEvent_Tag { * 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. + * payment is no longer retryable due to [`ChannelManager::abandon_payment`] having been + * called for the corresponding payment. * * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment */ @@ -3266,9 +3377,14 @@ typedef enum LDKEvent_Tag { * Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped * something. You may wish to retry with a different route. * + * If you have given up retrying this payment and wish to fail it, you MUST call + * [`ChannelManager::abandon_payment`] at least once for a given [`PaymentId`] or memory + * related to payment tracking will leak. + * * Note that this does *not* indicate that all paths for an MPP payment have failed, see * [`Event::PaymentFailed`] and [`all_paths_failed`]. * + * [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment * [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed */ LDKEvent_PaymentPathFailed, @@ -3287,6 +3403,21 @@ typedef enum LDKEvent_Tag { * [`ChannelManager::process_pending_htlc_forwards`]: crate::ln::channelmanager::ChannelManager::process_pending_htlc_forwards */ LDKEvent_PendingHTLCsForwardable, + /** + * Used to indicate that we've intercepted an HTLC forward. This event will only be generated if + * you've encoded an intercept scid in the receiver's invoice route hints using + * [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`]. + * + * [`ChannelManager::forward_intercepted_htlc`] or + * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See + * their docs for more information. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + * [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + * [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc + */ + LDKEvent_HTLCIntercepted, /** * Used to indicate that an output which you should know how to spend was confirmed on chain * and is now spendable. @@ -3300,6 +3431,13 @@ typedef enum LDKEvent_Tag { * forwarding fee earned. */ LDKEvent_PaymentForwarded, + /** + * Used to indicate that a channel with the given `channel_id` is ready to + * be used. This event is emitted either when the funding transaction has been confirmed + * on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel + * establishment. + */ + LDKEvent_ChannelReady, /** * Used to indicate that a previously opened channel with the given `channel_id` is in the * process of closure. @@ -3369,15 +3507,27 @@ typedef struct LDKEvent_LDKFundingGenerationReady_Body { */ struct LDKCVec_u8Z output_script; /** - * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for - * an inbound channel. + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a + * random value for an inbound channel. This may be zero for objects serialized with LDK + * versions prior to 0.0.113. * * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel */ - uint64_t user_channel_id; + struct LDKU128 user_channel_id; } LDKEvent_LDKFundingGenerationReady_Body; -typedef struct LDKEvent_LDKPaymentReceived_Body { +typedef struct LDKEvent_LDKPaymentClaimable_Body { + /** + * The node that will receive the payment after it has been claimed. + * This is useful to identify payments received via [phantom nodes]. + * This field will always be filled in when the event was generated by LDK versions + * 0.0.113 and above. + * + * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey receiver_node_id; /** * The hash for which the preimage should be handed to the ChannelManager. Note that LDK will * not stop you from registering duplicate payment hashes for inbound payments. @@ -3392,9 +3542,30 @@ typedef struct LDKEvent_LDKPaymentReceived_Body { * payment is to pay an invoice or to send a spontaneous payment. */ struct LDKPaymentPurpose purpose; -} LDKEvent_LDKPaymentReceived_Body; + /** + * The `channel_id` indicating over which channel we received the payment. + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes via_channel_id; + /** + * The `user_channel_id` indicating over which channel we received the payment. + */ + struct LDKCOption_u128Z via_user_channel_id; +} LDKEvent_LDKPaymentClaimable_Body; typedef struct LDKEvent_LDKPaymentClaimed_Body { + /** + * The node that received the payment. + * This is useful to identify payments which were received via [phantom nodes]. + * This field will always be filled in when the event was generated by LDK versions + * 0.0.113 and above. + * + * [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey receiver_node_id; /** * The payment hash of the claimed payment. Note that LDK will not stop you from * registering duplicate payment hashes for inbound payments. @@ -3405,7 +3576,7 @@ typedef struct LDKEvent_LDKPaymentClaimed_Body { */ uint64_t amount_msat; /** - * The purpose of this claimed payment, i.e. whether the payment was for an invoice or a + * The purpose of the claimed payment, i.e. whether the payment was for an invoice or a * spontaneous payment. */ struct LDKPaymentPurpose purpose; @@ -3629,6 +3800,37 @@ typedef struct LDKEvent_LDKPendingHTLCsForwardable_Body { uint64_t time_forwardable; } LDKEvent_LDKPendingHTLCsForwardable_Body; +typedef struct LDKEvent_LDKHTLCIntercepted_Body { + /** + * An id to help LDK identify which HTLC is being forwarded or failed. + */ + struct LDKThirtyTwoBytes intercept_id; + /** + * The fake scid that was programmed as the next hop's scid, generated using + * [`ChannelManager::get_intercept_scid`]. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + */ + uint64_t requested_next_hop_scid; + /** + * The payment hash used for this HTLC. + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * How many msats were received on the inbound edge of this HTLC. + */ + uint64_t inbound_amount_msat; + /** + * How many msats the payer intended to route to the next node. Depending on the reason you are + * intercepting this payment, you might take a fee by forwarding less than this amount. + * + * Note that LDK will NOT check that expected fees were factored into this value. You MUST + * check that whatever fee you want has been included here or subtract it as required. Further, + * LDK will not stop you from forwarding more than you received. + */ + uint64_t expected_outbound_amount_msat; +} LDKEvent_LDKHTLCIntercepted_Body; + typedef struct LDKEvent_LDKSpendableOutputs_Body { /** * The outputs which you should store as spendable by you. @@ -3674,6 +3876,32 @@ typedef struct LDKEvent_LDKPaymentForwarded_Body { bool claim_from_onchain_tx; } LDKEvent_LDKPaymentForwarded_Body; +typedef struct LDKEvent_LDKChannelReady_Body { + /** + * The channel_id of the channel that is ready. + */ + struct LDKThirtyTwoBytes channel_id; + /** + * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + * `user_channel_id` will be randomized for an inbound channel. + * + * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + */ + struct LDKU128 user_channel_id; + /** + * The node_id of the channel counterparty. + */ + struct LDKPublicKey counterparty_node_id; + /** + * The features that this channel will operate with. + */ + struct LDKChannelTypeFeatures channel_type; +} LDKEvent_LDKChannelReady_Body; + typedef struct LDKEvent_LDKChannelClosed_Body { /** * The channel_id of the channel which has been closed. Note that on-chain transactions @@ -3684,14 +3912,15 @@ typedef struct LDKEvent_LDKChannelClosed_Body { * The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound * channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - * `user_channel_id` will be 0 for an inbound channel. - * This will always be zero for objects serialized with LDK versions prior to 0.0.102. + * `user_channel_id` will be randomized for inbound channels. + * This may be zero for inbound channels serialized prior to 0.0.113 and will always be + * zero for objects serialized with LDK versions prior to 0.0.102. * * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels */ - uint64_t user_channel_id; + struct LDKU128 user_channel_id; /** * The reason the channel was closed. */ @@ -3776,7 +4005,7 @@ typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_Tag tag; union { LDKEvent_LDKFundingGenerationReady_Body funding_generation_ready; - LDKEvent_LDKPaymentReceived_Body payment_received; + LDKEvent_LDKPaymentClaimable_Body payment_claimable; LDKEvent_LDKPaymentClaimed_Body payment_claimed; LDKEvent_LDKPaymentSent_Body payment_sent; LDKEvent_LDKPaymentFailed_Body payment_failed; @@ -3785,8 +4014,10 @@ typedef struct MUST_USE_STRUCT LDKEvent { LDKEvent_LDKProbeSuccessful_Body probe_successful; LDKEvent_LDKProbeFailed_Body probe_failed; LDKEvent_LDKPendingHTLCsForwardable_Body pending_htl_cs_forwardable; + LDKEvent_LDKHTLCIntercepted_Body htlc_intercepted; LDKEvent_LDKSpendableOutputs_Body spendable_outputs; LDKEvent_LDKPaymentForwarded_Body payment_forwarded; + LDKEvent_LDKChannelReady_Body channel_ready; LDKEvent_LDKChannelClosed_Body channel_closed; LDKEvent_LDKDiscardFunding_Body discard_funding; LDKEvent_LDKOpenChannelRequest_Body open_channel_request; @@ -4747,20 +4978,34 @@ typedef struct LDKCVec_C2Tuple_usizeTransactionZZ { } LDKCVec_C2Tuple_usizeTransactionZZ; /** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_TxidBlockHashZ { + /** + * The element at position 0 + */ + struct LDKThirtyTwoBytes a; + /** + * The element at position 1 + */ + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_TxidBlockHashZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_TxidZ { +typedef struct LDKCVec_C2Tuple_TxidBlockHashZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKThirtyTwoBytes *data; + struct LDKC2Tuple_TxidBlockHashZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_TxidZ; +} LDKCVec_C2Tuple_TxidBlockHashZZ; @@ -5401,6 +5646,112 @@ typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { bool result_ok; } LDKCResult_ChannelTypeFeaturesDecodeErrorZ; + + +/** + * Features used within an `offer`. + */ +typedef struct MUST_USE_STRUCT LDKOfferFeatures { + /** + * 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. + */ + LDKnativeOfferFeatures *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; +} LDKOfferFeatures; + +/** + * The contents of CResult_OfferFeaturesDecodeErrorZ + */ +typedef union LDKCResult_OfferFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOfferFeatures *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_OfferFeaturesDecodeErrorZPtr; + +/** + * A CResult_OfferFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::OfferFeatures 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_OfferFeaturesDecodeErrorZ { + /** + * The contents of this CResult_OfferFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OfferFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_OfferFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_OfferFeaturesDecodeErrorZ; + + + +/** + * Features used within an `invoice_request`. + */ +typedef struct MUST_USE_STRUCT LDKInvoiceRequestFeatures { + /** + * 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. + */ + LDKnativeInvoiceRequestFeatures *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; +} LDKInvoiceRequestFeatures; + +/** + * The contents of CResult_InvoiceRequestFeaturesDecodeErrorZ + */ +typedef union LDKCResult_InvoiceRequestFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceRequestFeatures *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_InvoiceRequestFeaturesDecodeErrorZPtr; + +/** + * A CResult_InvoiceRequestFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::ln::features::InvoiceRequestFeatures 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_InvoiceRequestFeaturesDecodeErrorZ { + /** + * The contents of this CResult_InvoiceRequestFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestFeaturesDecodeErrorZ; + /** * The contents of CResult_NodeIdDecodeErrorZ */ @@ -5799,16 +6150,6 @@ typedef struct LDKFourBytes { uint8_t data[4]; } LDKFourBytes; -/** - * A 16-byte byte array. - */ -typedef struct LDKSixteenBytes { - /** - * The sixteen bytes - */ - uint8_t data[16]; -} LDKSixteenBytes; - /** * A 12-byte byte array. */ @@ -6421,7 +6762,17 @@ typedef struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ { } LDKCResult_C2Tuple_SignatureSignatureZNoneZ; /** - * The contents of CResult_SecretKeyNoneZ + * Represents a valid secp256k1 secret key serialized as a 32 byte array. + */ +typedef struct LDKSecretKey { + /** + * The bytes of the secret key + */ + uint8_t bytes[32]; +} LDKSecretKey; + +/** + * The contents of CResult_SecretKeyNoneZ */ typedef union LDKCResult_SecretKeyNoneZPtr { /** @@ -6588,23 +6939,13 @@ typedef struct MUST_USE_STRUCT LDKUnsignedChannelAnnouncement { } LDKUnsignedChannelAnnouncement; /** - * 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 trait to sign Lightning channel transactions as described in + * [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). * - * 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. + * Signing services could be implemented on a hardware wallet and should implement signing + * policies in order to be secure. Please refer to the [VLS Policy + * Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) + * for an example of such policies. */ typedef struct LDKBaseSign { /** @@ -6615,7 +6956,7 @@ typedef struct LDKBaseSign { /** * Gets the per-commitment point for a specific commitment number * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. */ struct LDKPublicKey (*get_per_commitment_point)(const void *this_arg, uint64_t idx); /** @@ -6626,7 +6967,7 @@ typedef struct LDKBaseSign { * * May be called more than once for the same index. * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. */ struct LDKThirtyTwoBytes (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** @@ -6641,12 +6982,12 @@ typedef struct LDKBaseSign { * 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 + * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages); /** - * Gets the holder's channel public keys and basepoints + * Returns the holder's channel public keys and basepoints. */ struct LDKChannelPublicKeys pubkeys; /** @@ -6656,9 +6997,9 @@ typedef struct LDKBaseSign { */ void (*set_pubkeys)(const struct LDKBaseSign*NONNULL_PTR ); /** - * 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. + * Returns 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 + * [`BaseSign`] object uniquely and lookup or re-derive its keys. */ struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); /** @@ -6673,7 +7014,7 @@ typedef struct LDKBaseSign { * 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 + * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages); @@ -6685,17 +7026,21 @@ typedef struct LDKBaseSign { */ struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); /** - * 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. + * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * + * This will be called + * - with a non-revoked `commitment_tx`. + * - with the latest `commitment_tx` when we initiate a force-close. + * - with the previous `commitment_tx`, just to get claiming HTLC + * signatures, if we are reacting to a [`ChannelMonitor`] + * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * that decided to broadcast before it had been updated to the latest `commitment_tx`. + * * 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. + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ struct LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ (*sign_holder_commitment_and_htlcs)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** @@ -6709,9 +7054,9 @@ typedef struct LDKBaseSign { * * 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 + * `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 + * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do * so). */ 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]); @@ -6724,14 +7069,15 @@ typedef struct LDKBaseSign { * 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. + * `amount` is the 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 + * `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 + * `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); @@ -6744,12 +7090,12 @@ typedef struct LDKBaseSign { * 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 + * `witness_script` is either an 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. + * `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 + * `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. @@ -6781,17 +7127,13 @@ typedef struct LDKBaseSign { struct LDKCResult_C2Tuple_SignatureSignatureZNoneZ (*sign_channel_announcement)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** * 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. + * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. Since these + * are static channel data, they MUST NOT be allowed to change to different values once set, + * as LDK may call this method more than once. * * 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. */ - void (*ready_channel)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + void (*provide_channel_parameters)(void *this_arg, const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); /** * 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. @@ -6800,11 +7142,13 @@ typedef struct LDKBaseSign { } LDKBaseSign; /** - * A cloneable signer. + * A writeable signer. + * + * There will always be two instances of a signer per channel, one occupied by the + * [`ChannelManager`] and another by the channel's [`ChannelMonitor`]. * - * 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. + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ typedef struct LDKSign { /** @@ -6820,12 +7164,6 @@ typedef struct LDKSign { * Serialize the object into a byte array */ struct LDKCVec_u8Z (*write)(const void *this_arg); - /** - * 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. - */ - void (*cloned)(struct LDKSign *NONNULL_PTR new_Sign); /** * 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. @@ -6869,25 +7207,25 @@ typedef struct LDKCResult_SignDecodeErrorZ { /** * Integer in the range `0..32` */ -typedef struct LDKu5 { +typedef struct LDKU5 { uint8_t _0; -} LDKu5; +} LDKU5; /** - * A dynamically-allocated array of crate::c_types::u5s 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_u5Z { +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; + struct LDKU5 *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_u5Z; +} LDKCVec_U5Z; /** * Represents a secp256k1 signature serialized as two 32-byte numbers as well as a tag which @@ -6984,7 +7322,7 @@ typedef struct LDKCResult_CVec_CVec_u8ZZNoneZ { /** - * A simple implementation of Sign that just keeps the private keys in memory. + * 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. @@ -7230,7 +7568,7 @@ typedef enum LDKAPIError_Tag { * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, * too-many-hops, etc). */ - LDKAPIError_RouteError, + LDKAPIError_InvalidRoute, /** * 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 @@ -7283,12 +7621,12 @@ typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { uint32_t feerate; } LDKAPIError_LDKFeeRateTooHigh_Body; -typedef struct LDKAPIError_LDKRouteError_Body { +typedef struct LDKAPIError_LDKInvalidRoute_Body { /** * A human-readable error message */ struct LDKStr err; -} LDKAPIError_LDKRouteError_Body; +} LDKAPIError_LDKInvalidRoute_Body; typedef struct LDKAPIError_LDKChannelUnavailable_Body { /** @@ -7309,7 +7647,7 @@ typedef struct MUST_USE_STRUCT LDKAPIError { union { LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKRouteError_Body route_error; + LDKAPIError_LDKInvalidRoute_Body invalid_route; LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; }; @@ -7420,26 +7758,47 @@ typedef struct LDKCResult__u832APIErrorZ { typedef enum LDKPaymentSendFailure_Tag { /** * A parameter which was passed to send_payment was invalid, preventing us from attempting to - * send the payment at all. No channel state has been changed or messages sent to peers, and - * once you've changed the parameter at error, you can freely retry the payment in full. + * send the payment at all. + * + * You can freely resend the payment in full (with the parameter error fixed). + * + * Because the payment failed outright, no payment tracking is done, you do not need to call + * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work + * for this payment. */ LDKPaymentSendFailure_ParameterError, /** * A parameter in a single path which was passed to send_payment was invalid, preventing us - * from attempting to send the payment at all. No channel state has been changed or messages - * sent to peers, and once you've changed the parameter at error, you can freely retry the - * payment in full. + * from attempting to send the payment at all. + * + * You can freely resend the payment in full (with the parameter error fixed). * * The results here are ordered the same as the paths in the route object which was passed to * send_payment. + * + * Because the payment failed outright, no payment tracking is done, you do not need to call + * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work + * for this payment. */ LDKPaymentSendFailure_PathParameterError, /** * All paths which were attempted failed to send, with no channel state change taking place. - * You can freely retry the payment in full (though you probably want to do so over different + * You can freely resend the payment in full (though you probably want to do so over different * paths than the ones selected). + * + * Because the payment failed outright, no payment tracking is done, you do not need to call + * [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work + * for this payment. + */ + LDKPaymentSendFailure_AllFailedResendSafe, + /** + * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not + * yet completed (i.e. generated an [`Event::PaymentSent`]) or been abandoned (via + * [`ChannelManager::abandon_payment`]). + * + * [`Event::PaymentSent`]: events::Event::PaymentSent */ - LDKPaymentSendFailure_AllFailedRetrySafe, + LDKPaymentSendFailure_DuplicatePayment, /** * 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 @@ -7490,76 +7849,76 @@ typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; }; struct { - struct LDKCVec_APIErrorZ all_failed_retry_safe; + struct LDKCVec_APIErrorZ all_failed_resend_safe; }; LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; }; } LDKPaymentSendFailure; /** - * The contents of CResult_PaymentIdPaymentSendFailureZ + * The contents of CResult_NonePaymentSendFailureZ */ -typedef union LDKCResult_PaymentIdPaymentSendFailureZPtr { +typedef union LDKCResult_NonePaymentSendFailureZPtr { /** - * 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 LDKThirtyTwoBytes *result; + void *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_PaymentIdPaymentSendFailureZPtr; +} LDKCResult_NonePaymentSendFailureZPtr; /** - * 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. + * 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_PaymentIdPaymentSendFailureZ { +typedef struct LDKCResult_NonePaymentSendFailureZ { /** - * The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either + * The contents of this CResult_NonePaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_PaymentIdPaymentSendFailureZPtr contents; + union LDKCResult_NonePaymentSendFailureZPtr contents; /** - * Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state. + * Whether this CResult_NonePaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_PaymentIdPaymentSendFailureZ; +} LDKCResult_NonePaymentSendFailureZ; /** - * The contents of CResult_NonePaymentSendFailureZ + * The contents of CResult_PaymentHashPaymentSendFailureZ */ -typedef union LDKCResult_NonePaymentSendFailureZPtr { +typedef union LDKCResult_PaymentHashPaymentSendFailureZPtr { /** - * 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 LDKThirtyTwoBytes *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ struct LDKPaymentSendFailure *err; -} LDKCResult_NonePaymentSendFailureZPtr; +} LDKCResult_PaymentHashPaymentSendFailureZPtr; /** - * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::channelmanager::PaymentSendFailure on failure. + * A CResult_PaymentHashPaymentSendFailureZ 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_NonePaymentSendFailureZ { +typedef struct LDKCResult_PaymentHashPaymentSendFailureZ { /** - * The contents of this CResult_NonePaymentSendFailureZ, accessible via either + * The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePaymentSendFailureZPtr contents; + union LDKCResult_PaymentHashPaymentSendFailureZPtr contents; /** - * Whether this CResult_NonePaymentSendFailureZ represents a success state. + * Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_NonePaymentSendFailureZ; +} LDKCResult_PaymentHashPaymentSendFailureZ; /** * A tuple of 2 elements. See the individual fields for the types contained. @@ -8155,24 +8514,24 @@ typedef struct LDKKeysInterface { /** * Get node secret key based on the provided [`Recipient`]. * - * The node_id/network_key is the public key that corresponds to this secret key. + * 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` + * This method must return the same value each time it is called with a given [`Recipient`] * parameter. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. */ struct LDKCResult_SecretKeyNoneZ (*get_node_secret)(const void *this_arg, enum LDKRecipient recipient); /** * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in * [`get_node_secret`]. * - * This method must return the same value each time it is called with a given `Recipient` + * This method must return the same value each time it is called with a given [`Recipient`] * parameter. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. * - * [`get_node_secret`]: KeysInterface::get_node_secret + * [`get_node_secret`]: Self::get_node_secret */ struct LDKCResult_PublicKeyNoneZ (*get_node_id)(const void *this_arg, enum LDKRecipient recipient); /** @@ -8180,7 +8539,7 @@ typedef struct LDKKeysInterface { * one is provided. Note that this tweak can be applied to `other_key` instead of our node * secret, though this is less efficient. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. * * [`node secret`]: Self::get_node_secret */ @@ -8200,12 +8559,21 @@ typedef struct LDKKeysInterface { */ struct LDKShutdownScript (*get_shutdown_scriptpubkey)(const void *this_arg); /** - * Get a new set of Sign for per-channel secrets. These MUST be unique even if you + * Get a new set of [`Sign`] for per-channel secrets. These MUST be unique even if you * restarted with some stale data! * * This method must return a different value each time it is called. */ - struct LDKSign (*get_channel_signer)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis); + struct LDKThirtyTwoBytes (*generate_channel_keys_id)(const void *this_arg, bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id); + /** + * Derives the private key material backing a `Signer`. + * + * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through + * [`KeysInterface::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + * re-derived from its `channel_keys_id`, which can be obtained through its trait method + * [`BaseSign::channel_keys_id`]. + */ + struct LDKSign (*derive_channel_signer)(const void *this_arg, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** * 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 @@ -8215,12 +8583,19 @@ typedef struct LDKKeysInterface { */ struct LDKThirtyTwoBytes (*get_secure_random_bytes)(const void *this_arg); /** - * Reads a `Signer` for this `KeysInterface` from the given input stream. + * 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). + * [`Sign`]-implementing objects (i.e., [`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. + * + * This method is slowly being phased out -- it will only be called when reading objects + * written by LDK versions prior to 0.0.113. + * + * [`Signer`]: Self::Signer + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ struct LDKCResult_SignDecodeErrorZ (*read_chan_signer)(const void *this_arg, struct LDKu8slice reader); /** @@ -8228,13 +8603,13 @@ typedef struct LDKKeysInterface { * 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 `hrp` is ASCII bytes, while the invoice data is base32-encoded. * * The secret key used to sign the invoice is dependent on the [`Recipient`]. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. */ - struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient); + 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. * @@ -8634,1383 +9009,1395 @@ typedef struct LDKCResult_PaymentIdPaymentErrorZ { bool result_ok; } LDKCResult_PaymentIdPaymentErrorZ; - +/** + * The contents of CResult_NonePaymentErrorZ + */ +typedef union LDKCResult_NonePaymentErrorZPtr { + /** + * 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 LDKPaymentError *err; +} LDKCResult_NonePaymentErrorZPtr; /** - * 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. + * A CResult_NonePaymentErrorZ represents the result of a fallible operation, + * containing a () 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 MUST_USE_STRUCT LDKInFlightHtlcs { +typedef struct LDKCResult_NonePaymentErrorZ { /** - * 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_NonePaymentErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKnativeInFlightHtlcs *inner; + union LDKCResult_NonePaymentErrorZPtr 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_NonePaymentErrorZ represents a success state. */ - bool is_owned; -} LDKInFlightHtlcs; + bool result_ok; +} LDKCResult_NonePaymentErrorZ; /** - * The contents of CResult_InFlightHtlcsDecodeErrorZ + * The contents of CResult_StringErrorZ */ -typedef union LDKCResult_InFlightHtlcsDecodeErrorZPtr { +typedef union LDKCResult_StringErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInFlightHtlcs *result; + struct LDKStr *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_InFlightHtlcsDecodeErrorZPtr; + enum LDKSecp256k1Error *err; +} LDKCResult_StringErrorZPtr; /** - * 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. + * 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_InFlightHtlcsDecodeErrorZ { +typedef struct LDKCResult_StringErrorZ { /** - * The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either + * The contents of this CResult_StringErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InFlightHtlcsDecodeErrorZPtr contents; + union LDKCResult_StringErrorZPtr contents; /** - * Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. + * Whether this CResult_StringErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InFlightHtlcsDecodeErrorZ; +} LDKCResult_StringErrorZ; /** - * Sub-errors which don't have specific information in them use this type. + * The contents of CResult_PublicKeyErrorZ */ -typedef struct LDKError { +typedef union LDKCResult_PublicKeyErrorZPtr { /** - * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - uint8_t _dummy; -} LDKError; + struct LDKPublicKey *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKSecp256k1Error *err; +} LDKCResult_PublicKeyErrorZPtr; /** - * 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. + * A CResult_PublicKeyErrorZ represents the result of a fallible operation, + * containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef 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 struct LDKCResult_PublicKeyErrorZ { /** - * Not an error, but used internally to signal that a part of the invoice should be ignored - * according to BOLT11 + * The contents of this CResult_PublicKeyErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKParseError_Skip, + union LDKCResult_PublicKeyErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_PublicKeyErrorZ represents a success state. */ - 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; + bool result_ok; +} LDKCResult_PublicKeyErrorZ; /** - * The contents of CResult_SiPrefixParseErrorZ + * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ */ -typedef union LDKCResult_SiPrefixParseErrorZPtr { +typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - enum LDKSiPrefix *result; + struct LDKChannelMonitorUpdate *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_ChannelMonitorUpdateDecodeErrorZPtr; /** - * 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_ChannelMonitorUpdateDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::chain::channelmonitor::ChannelMonitorUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_SiPrefixParseErrorZ { +typedef struct LDKCResult_ChannelMonitorUpdateDecodeErrorZ { /** - * The contents of this CResult_SiPrefixParseErrorZ, accessible via either + * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SiPrefixParseErrorZPtr contents; + union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; /** - * Whether this CResult_SiPrefixParseErrorZ represents a success state. + * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SiPrefixParseErrorZ; - - +} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; /** - * 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)` + * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not */ -typedef struct MUST_USE_STRUCT LDKInvoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInvoice *inner; +typedef enum LDKCOption_MonitorEventZ_Tag { /** - * 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_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent */ - 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 { + LDKCOption_MonitorEventZ_Some, /** - * The invoice couldn't be decoded + * When we're in this state, this COption_MonitorEventZ contains nothing */ - LDKParseOrSemanticError_ParseError, + LDKCOption_MonitorEventZ_None, /** - * The invoice could be decoded but violates the BOLT11 standard + * Must be last for serialization purposes */ - LDKParseOrSemanticError_SemanticError, - /** - * Must be last for serialization purposes - */ - LDKParseOrSemanticError_Sentinel, -} LDKParseOrSemanticError_Tag; + LDKCOption_MonitorEventZ_Sentinel, +} LDKCOption_MonitorEventZ_Tag; -typedef struct MUST_USE_STRUCT LDKParseOrSemanticError { - LDKParseOrSemanticError_Tag tag; +typedef struct LDKCOption_MonitorEventZ { + LDKCOption_MonitorEventZ_Tag tag; union { struct { - struct LDKParseError parse_error; - }; - struct { - enum LDKSemanticError semantic_error; + struct LDKMonitorEvent some; }; }; -} LDKParseOrSemanticError; +} LDKCOption_MonitorEventZ; /** - * The contents of CResult_InvoiceParseOrSemanticErrorZ + * The contents of CResult_COption_MonitorEventZDecodeErrorZ */ -typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr { +typedef union LDKCResult_COption_MonitorEventZDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoice *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 LDKParseOrSemanticError *err; -} LDKCResult_InvoiceParseOrSemanticErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_COption_MonitorEventZDecodeErrorZPtr; /** - * 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_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_InvoiceParseOrSemanticErrorZ { +typedef struct LDKCResult_COption_MonitorEventZDecodeErrorZ { /** - * The contents of this CResult_InvoiceParseOrSemanticErrorZ, 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_InvoiceParseOrSemanticErrorZPtr contents; + union LDKCResult_COption_MonitorEventZDecodeErrorZPtr contents; /** - * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. + * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceParseOrSemanticErrorZ; - - - -/** - * Represents a signed `RawInvoice` with cached hash. The signature is not checked and may be - * invalid. - * - * # Invariants - * The hash has to be either from the deserialized invoice or from the serialized `raw_invoice`. - */ -typedef struct MUST_USE_STRUCT LDKSignedRawInvoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeSignedRawInvoice *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKSignedRawInvoice; +} LDKCResult_COption_MonitorEventZDecodeErrorZ; /** - * The contents of CResult_SignedRawInvoiceParseErrorZ + * The contents of CResult_HTLCUpdateDecodeErrorZ */ -typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr { +typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKSignedRawInvoice *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 LDKParseError *err; -} LDKCResult_SignedRawInvoiceParseErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_HTLCUpdateDecodeErrorZPtr; /** - * 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. + * 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_SignedRawInvoiceParseErrorZ { +typedef struct LDKCResult_HTLCUpdateDecodeErrorZ { /** - * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either + * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_SignedRawInvoiceParseErrorZPtr contents; + union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; /** - * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. + * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_SignedRawInvoiceParseErrorZ; - - +} LDKCResult_HTLCUpdateDecodeErrorZ; /** - * 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`. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKRawInvoice { +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 */ - LDKnativeRawInvoice *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; -} LDKRawInvoice; - + struct LDKCVec_u8Z b; +} LDKC2Tuple_OutPointScriptZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_u32ScriptZ { + /** + * The element at position 0 + */ + uint32_t a; + /** + * The element at position 1 + */ + struct LDKCVec_u8Z b; +} LDKC2Tuple_u32ScriptZ; /** - * Recoverable signature + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKInvoiceSignature { +typedef struct LDKCVec_C2Tuple_u32ScriptZZ { /** - * 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(). */ - LDKnativeInvoiceSignature *inner; + struct LDKC2Tuple_u32ScriptZ *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; -} LDKInvoiceSignature; + uintptr_t datalen; +} LDKCVec_C2Tuple_u32ScriptZZ; /** - * A tuple of 3 elements. See the individual fields for the types contained. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { /** * The element at position 0 */ - struct LDKRawInvoice a; + struct LDKThirtyTwoBytes a; /** * The element at position 1 */ - struct LDKThirtyTwoBytes b; - /** - * The element at position 2 - */ - struct LDKInvoiceSignature c; -} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; - - + struct LDKCVec_C2Tuple_u32ScriptZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; /** - * Payee public key + * 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 MUST_USE_STRUCT LDKPayeePubKey { +typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { /** - * 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(). */ - LDKnativePayeePubKey *inner; + struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *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; -} LDKPayeePubKey; + uintptr_t datalen; +} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; /** - * The contents of CResult_PayeePubKeyErrorZ + * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_PayeePubKeyErrorZPtr { +typedef struct LDKCVec_EventZ { /** - * 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 LDKPayeePubKey *result; + struct LDKEvent *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`. */ - enum LDKSecp256k1Error *err; -} LDKCResult_PayeePubKeyErrorZPtr; + uintptr_t datalen; +} LDKCVec_EventZ; /** - * 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`. + * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_PayeePubKeyErrorZ { +typedef struct LDKCVec_TransactionZ { /** - * The contents of this CResult_PayeePubKeyErrorZ, 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_PayeePubKeyErrorZPtr contents; + struct LDKTransaction *data; /** - * Whether this CResult_PayeePubKeyErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_PayeePubKeyErrorZ; - - + uintptr_t datalen; +} LDKCVec_TransactionZ; /** - * Private routing information - * - * # Invariants - * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) - * + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKPrivateRoute { +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 */ - LDKnativePrivateRoute *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; -} LDKPrivateRoute; + struct LDKTxOut b; +} LDKC2Tuple_u32TxOutZ; /** - * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_PrivateRouteZ { +typedef struct LDKCVec_C2Tuple_u32TxOutZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKPrivateRoute *data; + struct LDKC2Tuple_u32TxOutZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_PrivateRouteZ; - - +} LDKCVec_C2Tuple_u32TxOutZZ; /** - * 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`]. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct MUST_USE_STRUCT LDKPositiveTimestamp { +typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { /** - * 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 */ - LDKnativePositiveTimestamp *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; -} LDKPositiveTimestamp; + struct LDKCVec_C2Tuple_u32TxOutZZ b; +} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; /** - * The contents of CResult_PositiveTimestampCreationErrorZ + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef union LDKCResult_PositiveTimestampCreationErrorZPtr { +typedef struct LDKCVec_TransactionOutputsZ { /** - * 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 LDKPositiveTimestamp *result; + struct LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ *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`. */ - enum LDKCreationError *err; -} LDKCResult_PositiveTimestampCreationErrorZPtr; + uintptr_t datalen; +} LDKCVec_TransactionOutputsZ; /** - * 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`. + * 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 struct LDKCResult_PositiveTimestampCreationErrorZ { +typedef enum LDKBalance_Tag { /** - * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * 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. */ - union LDKCResult_PositiveTimestampCreationErrorZPtr contents; + LDKBalance_ClaimableOnChannelClose, /** - * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. + * The channel has been closed, and the given balance is ours but awaiting confirmations until + * we consider it spendable. */ - bool result_ok; -} LDKCResult_PositiveTimestampCreationErrorZ; + LDKBalance_ClaimableAwaitingConfirmations, + /** + * The channel has been closed, and the given balance should be ours but awaiting spending + * transaction confirmation. If the spending transaction does not confirm in time, it is + * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. + * + * Once the spending transaction confirms, before it has reached enough confirmations to be + * considered safe from chain reorganizations, the balance will instead be provided via + * [`Balance::ClaimableAwaitingConfirmations`]. + */ + LDKBalance_ContentiousClaimable, + /** + * HTLCs which we sent to our counterparty which are claimable after a timeout (less on-chain + * fees) if the counterparty does not know the preimage for the HTLCs. These are somewhat + * likely to be claimed by our counterparty before we do. + */ + LDKBalance_MaybeTimeoutClaimableHTLC, + /** + * 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. + */ + LDKBalance_MaybePreimageClaimableHTLC, + /** + * 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. + */ + LDKBalance_CounterpartyRevokedOutputClaimable, + /** + * Must be last for serialization purposes + */ + LDKBalance_Sentinel, +} LDKBalance_Tag; -/** - * The contents of CResult_NoneSemanticErrorZ - */ -typedef union LDKCResult_NoneSemanticErrorZPtr { +typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { /** - * Note that this value is always NULL, as there are no contents in the OK variant + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - void *result; + uint64_t claimable_amount_satoshis; +} LDKBalance_LDKClaimableOnChannelClose_Body; + +typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_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, possibly excluding the on-chain fees which + * were spent in broadcasting the transaction. */ - enum LDKSemanticError *err; -} LDKCResult_NoneSemanticErrorZPtr; + uint64_t claimable_amount_satoshis; + /** + * The height at which an [`Event::SpendableOutputs`] event will be generated for this + * amount. + */ + uint32_t confirmation_height; +} LDKBalance_LDKClaimableAwaitingConfirmations_Body; -/** - * A CResult_NoneSemanticErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning_invoice::SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NoneSemanticErrorZ { +typedef struct LDKBalance_LDKContentiousClaimable_Body { /** - * The contents of this CResult_NoneSemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The amount available to claim, in satoshis, excluding the on-chain fees which will be + * required to do so. */ - union LDKCResult_NoneSemanticErrorZPtr contents; + uint64_t claimable_amount_satoshis; /** - * Whether this CResult_NoneSemanticErrorZ represents a success state. + * The height at which the counterparty may be able to claim the balance if we have not + * done so. */ - bool result_ok; -} LDKCResult_NoneSemanticErrorZ; + uint32_t timeout_height; +} LDKBalance_LDKContentiousClaimable_Body; -/** - * The contents of CResult_InvoiceSemanticErrorZ - */ -typedef union LDKCResult_InvoiceSemanticErrorZPtr { +typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The amount potentially available to claim, in satoshis, excluding the on-chain fees + * which will be required to do so. */ - struct LDKInvoice *result; + uint64_t claimable_amount_satoshis; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The height at which we will be able to claim the balance if our counterparty has not + * done so. */ - enum LDKSemanticError *err; -} LDKCResult_InvoiceSemanticErrorZPtr; + uint32_t claimable_height; +} LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body; -/** - * A CResult_InvoiceSemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceSemanticErrorZ { +typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body { /** - * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The amount potentially available to claim, in satoshis, excluding the on-chain fees + * which will be required to do so. */ - union LDKCResult_InvoiceSemanticErrorZPtr contents; + uint64_t claimable_amount_satoshis; /** - * Whether this CResult_InvoiceSemanticErrorZ represents a success state. + * 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. */ - bool result_ok; -} LDKCResult_InvoiceSemanticErrorZ; + 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; /** - * Description string - * - * # Invariants - * The description can be at most 639 __bytes__ long + * 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 LDKDescription { +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(). */ - LDKnativeDescription *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; -} LDKDescription; + uintptr_t datalen; +} LDKCVec_BalanceZ; /** - * The contents of CResult_DescriptionCreationErrorZ + * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ */ -typedef union LDKCResult_DescriptionCreationErrorZPtr { +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 LDKDescription *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. */ - enum LDKCreationError *err; -} LDKCResult_DescriptionCreationErrorZPtr; + struct LDKDecodeError *err; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr; /** - * 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_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_DescriptionCreationErrorZ { +typedef struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { /** - * The contents of this CResult_DescriptionCreationErrorZ, 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_DescriptionCreationErrorZPtr contents; + union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; /** - * Whether this CResult_DescriptionCreationErrorZ represents a success state. + * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_DescriptionCreationErrorZ; +} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; /** - * The contents of CResult_PrivateRouteCreationErrorZ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_PrivateRouteCreationErrorZPtr { +typedef struct LDKC2Tuple_PublicKeyTypeZ { /** - * 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 LDKPrivateRoute *result; + struct LDKPublicKey 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 */ - enum LDKCreationError *err; -} LDKCResult_PrivateRouteCreationErrorZPtr; + struct LDKType b; +} LDKC2Tuple_PublicKeyTypeZ; /** - * 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`. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_PrivateRouteCreationErrorZ { +typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { /** - * The contents of this CResult_PrivateRouteCreationErrorZ, 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_PrivateRouteCreationErrorZPtr contents; + struct LDKC2Tuple_PublicKeyTypeZ *data; /** - * Whether this CResult_PrivateRouteCreationErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_PrivateRouteCreationErrorZ; + uintptr_t datalen; +} LDKCVec_C2Tuple_PublicKeyTypeZZ; /** - * The contents of CResult_StringErrorZ + * The contents of a custom onion message. */ -typedef union LDKCResult_StringErrorZPtr { +typedef struct LDKCustomOnionMessageContents { /** - * 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 TLV type identifying the message contents. MUST be >= 64. */ - enum LDKSecp256k1Error *err; -} LDKCResult_StringErrorZPtr; + uint64_t (*tlv_type)(const void *this_arg); + /** + * Serialize the object into a byte array + */ + struct LDKCVec_u8Z (*write)(const void *this_arg); + /** + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKCustomOnionMessageContents; /** - * 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`. + * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not */ -typedef struct LDKCResult_StringErrorZ { +typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag { /** - * The contents of this CResult_StringErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents */ - union LDKCResult_StringErrorZPtr contents; + LDKCOption_CustomOnionMessageContentsZ_Some, /** - * Whether this CResult_StringErrorZ represents a success state. + * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing */ - bool result_ok; -} LDKCResult_StringErrorZ; + LDKCOption_CustomOnionMessageContentsZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_CustomOnionMessageContentsZ_Sentinel, +} LDKCOption_CustomOnionMessageContentsZ_Tag; + +typedef struct LDKCOption_CustomOnionMessageContentsZ { + LDKCOption_CustomOnionMessageContentsZ_Tag tag; + union { + struct { + struct LDKCustomOnionMessageContents some; + }; + }; +} LDKCOption_CustomOnionMessageContentsZ; /** - * The contents of CResult_ChannelMonitorUpdateDecodeErrorZ + * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ */ -typedef union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr { +typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { /** * 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_CustomOnionMessageContentsZ *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_CustomOnionMessageContentsZDecodeErrorZPtr; /** - * 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_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ 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_CustomOnionMessageContentsZDecodeErrorZ { /** - * The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either + * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ChannelMonitorUpdateDecodeErrorZPtr contents; + union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents; /** - * Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ChannelMonitorUpdateDecodeErrorZ; +} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ; /** - * An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not + * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not */ -typedef enum LDKCOption_MonitorEventZ_Tag { +typedef enum LDKCOption_NetAddressZ_Tag { /** - * When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + * When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress */ - LDKCOption_MonitorEventZ_Some, + LDKCOption_NetAddressZ_Some, /** - * When we're in this state, this COption_MonitorEventZ contains nothing + * When we're in this state, this COption_NetAddressZ contains nothing */ - LDKCOption_MonitorEventZ_None, + LDKCOption_NetAddressZ_None, /** * Must be last for serialization purposes */ - LDKCOption_MonitorEventZ_Sentinel, -} LDKCOption_MonitorEventZ_Tag; + LDKCOption_NetAddressZ_Sentinel, +} LDKCOption_NetAddressZ_Tag; -typedef struct LDKCOption_MonitorEventZ { - LDKCOption_MonitorEventZ_Tag tag; +typedef struct LDKCOption_NetAddressZ { + LDKCOption_NetAddressZ_Tag tag; union { struct { - struct LDKMonitorEvent some; + struct LDKNetAddress some; }; }; -} LDKCOption_MonitorEventZ; +} LDKCOption_NetAddressZ; + + /** - * The contents of CResult_COption_MonitorEventZDecodeErrorZ + * 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 union LDKCResult_COption_MonitorEventZDecodeErrorZPtr { +typedef struct MUST_USE_STRUCT LDKPeerHandleError { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativePeerHandleError *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKPeerHandleError; + +/** + * The contents of CResult_CVec_u8ZPeerHandleErrorZ + */ +typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_MonitorEventZ *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_COption_MonitorEventZDecodeErrorZPtr; + struct LDKPeerHandleError *err; +} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; /** - * 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_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_COption_MonitorEventZDecodeErrorZ { +typedef struct LDKCResult_CVec_u8ZPeerHandleErrorZ { /** - * The contents of this CResult_COption_MonitorEventZDecodeErrorZ, 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_COption_MonitorEventZDecodeErrorZPtr contents; + union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; /** - * Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. + * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_MonitorEventZDecodeErrorZ; +} LDKCResult_CVec_u8ZPeerHandleErrorZ; /** - * The contents of CResult_HTLCUpdateDecodeErrorZ + * The contents of CResult_NonePeerHandleErrorZ */ -typedef union LDKCResult_HTLCUpdateDecodeErrorZPtr { +typedef union LDKCResult_NonePeerHandleErrorZPtr { /** - * 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 LDKHTLCUpdate *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_HTLCUpdateDecodeErrorZPtr; + struct LDKPeerHandleError *err; +} LDKCResult_NonePeerHandleErrorZPtr; /** - * 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_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_HTLCUpdateDecodeErrorZ { +typedef struct LDKCResult_NonePeerHandleErrorZ { /** - * The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either + * The contents of this CResult_NonePeerHandleErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_HTLCUpdateDecodeErrorZPtr contents; + union LDKCResult_NonePeerHandleErrorZPtr contents; /** - * Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + * Whether this CResult_NonePeerHandleErrorZ represents a success state. */ bool result_ok; -} LDKCResult_HTLCUpdateDecodeErrorZ; +} LDKCResult_NonePeerHandleErrorZ; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * The contents of CResult_boolPeerHandleErrorZ */ -typedef struct LDKC2Tuple_OutPointScriptZ { +typedef union LDKCResult_boolPeerHandleErrorZPtr { /** - * 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 LDKOutPoint a; + bool *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_u8Z b; -} LDKC2Tuple_OutPointScriptZ; + struct LDKPeerHandleError *err; +} LDKCResult_boolPeerHandleErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * 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 LDKC2Tuple_u32ScriptZ { +typedef struct LDKCResult_boolPeerHandleErrorZ { /** - * The element at position 0 + * The contents of this CResult_boolPeerHandleErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint32_t a; + union LDKCResult_boolPeerHandleErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_boolPeerHandleErrorZ represents a success state. */ - struct LDKCVec_u8Z b; -} LDKC2Tuple_u32ScriptZ; + bool result_ok; +} LDKCResult_boolPeerHandleErrorZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. - * This corresponds to std::vector in C++ + * Errors that may occur when [sending an onion message]. + * + * [sending an onion message]: OnionMessenger::send_onion_message */ -typedef struct LDKCVec_C2Tuple_u32ScriptZZ { +typedef enum LDKSendError_Tag { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Errored computing onion message packet keys. */ - struct LDKC2Tuple_u32ScriptZ *data; + LDKSendError_Secp256k1, /** - * The number of elements pointed to by `data`. + * 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. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_u32ScriptZZ; - -/** - * A tuple of 2 elements. See the individual fields for the types contained. - */ -typedef struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { + LDKSendError_TooBigPacket, /** - * The element at position 0 + * The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two + * blinded hops. */ - struct LDKThirtyTwoBytes a; + LDKSendError_TooFewBlindedHops, /** - * The element at position 1 + * Our next-hop peer was offline or does not support onion message forwarding. */ - struct LDKCVec_C2Tuple_u32ScriptZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { + LDKSendError_InvalidFirstHop, /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Onion message contents must have a TLV type >= 64. */ - struct LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ *data; + LDKSendError_InvalidMessage, /** - * The number of elements pointed to by `data`. + * Our next-hop peer's buffer was full or our total outbound buffer was full. */ - uintptr_t datalen; -} LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; - -/** - * A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_EventZ { + LDKSendError_BufferFull, /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Failed to retrieve our node id from the provided [`KeysInterface`]. + * + * [`KeysInterface`]: crate::chain::keysinterface::KeysInterface */ - struct LDKEvent *data; + LDKSendError_GetNodeIdFailed, /** - * The number of elements pointed to by `data`. + * We attempted to send to a blinded path where we are the introduction node, and failed to + * advance the blinded path to make the second hop the new introduction node. Either + * [`KeysInterface::ecdh`] failed, we failed to tweak the current blinding point to get the + * new blinding point, or we were attempting to send to ourselves. */ - uintptr_t datalen; -} LDKCVec_EventZ; + LDKSendError_BlindedPathAdvanceFailed, + /** + * Must be last for serialization purposes + */ + LDKSendError_Sentinel, +} LDKSendError_Tag; + +typedef struct MUST_USE_STRUCT LDKSendError { + LDKSendError_Tag tag; + union { + struct { + enum LDKSecp256k1Error secp256k1; + }; + }; +} LDKSendError; /** - * A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_NoneSendErrorZ */ -typedef struct LDKCVec_TransactionZ { +typedef union LDKCResult_NoneSendErrorZPtr { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * Note that this value is always NULL, as there are no contents in the OK variant */ - struct LDKTransaction *data; + void *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 LDKSendError *err; +} LDKCResult_NoneSendErrorZPtr; /** - * A tuple of 2 elements. See the individual fields for the types contained. + * 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 LDKC2Tuple_u32TxOutZ { +typedef struct LDKCResult_NoneSendErrorZ { /** - * The element at position 0 + * The contents of this CResult_NoneSendErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint32_t a; + union LDKCResult_NoneSendErrorZPtr contents; /** - * The element at position 1 + * Whether this CResult_NoneSendErrorZ represents a success state. */ - struct LDKTxOut b; -} LDKC2Tuple_u32TxOutZ; + bool result_ok; +} LDKCResult_NoneSendErrorZ; /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. - * This corresponds to std::vector in C++ + * Sub-errors which don't have specific information in them use this type. */ -typedef struct LDKCVec_C2Tuple_u32TxOutZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC2Tuple_u32TxOutZ *data; +typedef struct LDKError { /** - * The number of elements pointed to by `data`. + * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here */ - uintptr_t datalen; -} LDKCVec_C2Tuple_u32TxOutZZ; + 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_TxidCVec_C2Tuple_u32TxOutZZZ { +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 */ - struct LDKThirtyTwoBytes a; + LDKParseError_Skip, /** - * The element at position 1 + * Must be last for serialization purposes */ - struct LDKCVec_C2Tuple_u32TxOutZZ b; -} LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; + 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_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. - * This corresponds to std::vector in C++ + * The contents of CResult_SiPrefixParseErrorZ */ -typedef struct LDKCVec_TransactionOutputsZ { +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_TxidCVec_C2Tuple_u32TxOutZZZ *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_TransactionOutputsZ; + struct LDKParseError *err; +} LDKCResult_SiPrefixParseErrorZPtr; /** - * 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. + * 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 enum LDKBalance_Tag { - /** - * The channel is not yet closed (or the commitment or closing transaction has not yet - * appeared in a block). The given balance is claimable (less on-chain fees) if the channel is - * force-closed now. - */ - LDKBalance_ClaimableOnChannelClose, - /** - * The channel has been closed, and the given balance is ours but awaiting confirmations until - * we consider it spendable. - */ - LDKBalance_ClaimableAwaitingConfirmations, - /** - * The channel has been closed, and the given balance should be ours but awaiting spending - * transaction confirmation. If the spending transaction does not confirm in time, it is - * possible our counterparty can take the funds by broadcasting an HTLC timeout on-chain. - * - * Once the spending transaction confirms, before it has reached enough confirmations to be - * considered safe from chain reorganizations, the balance will instead be provided via - * [`Balance::ClaimableAwaitingConfirmations`]. - */ - LDKBalance_ContentiousClaimable, +typedef struct LDKCResult_SiPrefixParseErrorZ { /** - * 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. + * The contents of this CResult_SiPrefixParseErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKBalance_MaybeTimeoutClaimableHTLC, + union LDKCResult_SiPrefixParseErrorZPtr contents; /** - * 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. + * Whether this CResult_SiPrefixParseErrorZ represents a success state. */ - LDKBalance_MaybePreimageClaimableHTLC, + bool result_ok; +} LDKCResult_SiPrefixParseErrorZ; + + + +/** + * Represents a syntactically and semantically correct lightning BOLT11 invoice. + * + * There are three ways to construct an `Invoice`: + * 1. using `InvoiceBuilder` + * 2. using `Invoice::from_signed(SignedRawInvoice)` + * 3. using `str::parse::(&str)` + */ +typedef struct MUST_USE_STRUCT LDKInvoice { /** - * 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. + * 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_CounterpartyRevokedOutputClaimable, + LDKnativeInvoice *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; +} LDKInvoice; -typedef struct LDKBalance_LDKClaimableOnChannelClose_Body { +/** + * 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 amount available to claim, in satoshis, excluding the on-chain fees which will be - * required to do so. + * The invoice couldn't be decoded */ - uint64_t claimable_amount_satoshis; -} LDKBalance_LDKClaimableOnChannelClose_Body; - -typedef struct LDKBalance_LDKClaimableAwaitingConfirmations_Body { + LDKParseOrSemanticError_ParseError, /** - * The amount available to claim, in satoshis, possibly excluding the on-chain fees which - * were spent in broadcasting the transaction. + * The invoice could be decoded but violates the BOLT11 standard */ - uint64_t claimable_amount_satoshis; + LDKParseOrSemanticError_SemanticError, /** - * The height at which an [`Event::SpendableOutputs`] event will be generated for this - * amount. + * Must be last for serialization purposes */ - uint32_t confirmation_height; -} LDKBalance_LDKClaimableAwaitingConfirmations_Body; + LDKParseOrSemanticError_Sentinel, +} LDKParseOrSemanticError_Tag; -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 MUST_USE_STRUCT LDKParseOrSemanticError { + LDKParseOrSemanticError_Tag tag; + union { + struct { + struct LDKParseError parse_error; + }; + struct { + enum LDKSemanticError semantic_error; + }; + }; +} LDKParseOrSemanticError; -typedef struct LDKBalance_LDKMaybeTimeoutClaimableHTLC_Body { +/** + * The contents of CResult_InvoiceParseOrSemanticErrorZ + */ +typedef union LDKCResult_InvoiceParseOrSemanticErrorZPtr { /** - * The amount potentially 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 LDKInvoice *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_LDKMaybeTimeoutClaimableHTLC_Body; + struct LDKParseOrSemanticError *err; +} LDKCResult_InvoiceParseOrSemanticErrorZPtr; -typedef struct LDKBalance_LDKMaybePreimageClaimableHTLC_Body { +/** + * A CResult_InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::ParseOrSemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InvoiceParseOrSemanticErrorZ { /** - * The amount potentially available to claim, in satoshis, excluding the on-chain fees - * which will be required to do so. + * The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - uint64_t claimable_amount_satoshis; + union LDKCResult_InvoiceParseOrSemanticErrorZPtr contents; /** - * 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. + * Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. */ - uint32_t expiry_height; -} LDKBalance_LDKMaybePreimageClaimableHTLC_Body; + bool result_ok; +} LDKCResult_InvoiceParseOrSemanticErrorZ; -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; /** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances 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_BalanceZ { +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 LDKBalance *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_BalanceZ; + bool is_owned; +} LDKSignedRawInvoice; /** - * The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ + * The contents of CResult_SignedRawInvoiceParseErrorZ */ -typedef union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +typedef union LDKCResult_SignedRawInvoiceParseErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKC2Tuple_BlockHashChannelMonitorZ *result; + struct LDKSignedRawInvoice *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; + struct LDKParseError *err; +} LDKCResult_SignedRawInvoiceParseErrorZPtr; /** - * 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_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_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +typedef struct LDKCResult_SignedRawInvoiceParseErrorZ { /** - * The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either + * The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr contents; + union LDKCResult_SignedRawInvoiceParseErrorZPtr contents; /** - * Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + * Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +} LDKCResult_SignedRawInvoiceParseErrorZ; + + /** - * A tuple of 2 elements. See the individual fields for the types contained. + * Represents an syntactically correct Invoice for a payment on the lightning network, + * but without the signature information. + * De- and encoding should not lead to information loss but may lead to different hashes. + * + * For methods without docs see the corresponding methods in `Invoice`. */ -typedef struct LDKC2Tuple_PublicKeyTypeZ { +typedef struct MUST_USE_STRUCT LDKRawInvoice { /** - * 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 LDKPublicKey a; + LDKnativeRawInvoice *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 LDKType b; -} LDKC2Tuple_PublicKeyTypeZ; + bool is_owned; +} LDKRawInvoice; + + /** - * A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. - * This corresponds to std::vector in C++ + * Recoverable signature */ -typedef struct LDKCVec_C2Tuple_PublicKeyTypeZZ { +typedef struct MUST_USE_STRUCT LDKInvoiceSignature { /** - * 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_PublicKeyTypeZ *data; + LDKnativeInvoiceSignature *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_PublicKeyTypeZZ; + bool is_owned; +} LDKInvoiceSignature; /** - * The contents of a custom onion message. + * A tuple of 3 elements. See the individual fields for the types contained. */ -typedef struct LDKCustomOnionMessageContents { - /** - * 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 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ { /** - * Returns the TLV type identifying the message contents. MUST be >= 64. + * The element at position 0 */ - uint64_t (*tlv_type)(const void *this_arg); + struct LDKRawInvoice a; /** - * Serialize the object into a byte array + * The element at position 1 */ - struct LDKCVec_u8Z (*write)(const void *this_arg); + struct LDKThirtyTwoBytes b; /** - * 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 element at position 2 */ - void (*free)(void *this_arg); -} LDKCustomOnionMessageContents; + struct LDKInvoiceSignature c; +} LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ; + + /** - * An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not + * Payee public key */ -typedef enum LDKCOption_CustomOnionMessageContentsZ_Tag { - /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents - */ - LDKCOption_CustomOnionMessageContentsZ_Some, +typedef struct MUST_USE_STRUCT LDKPayeePubKey { /** - * When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCOption_CustomOnionMessageContentsZ_None, + LDKnativePayeePubKey *inner; /** - * Must be last for serialization purposes + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKCOption_CustomOnionMessageContentsZ_Sentinel, -} LDKCOption_CustomOnionMessageContentsZ_Tag; - -typedef struct LDKCOption_CustomOnionMessageContentsZ { - LDKCOption_CustomOnionMessageContentsZ_Tag tag; - union { - struct { - struct LDKCustomOnionMessageContents some; - }; - }; -} LDKCOption_CustomOnionMessageContentsZ; + bool is_owned; +} LDKPayeePubKey; /** - * The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ + * The contents of CResult_PayeePubKeyErrorZ */ -typedef union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { +typedef union LDKCResult_PayeePubKeyErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKCOption_CustomOnionMessageContentsZ *result; + struct LDKPayeePubKey *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_CustomOnionMessageContentsZDecodeErrorZPtr; + enum LDKSecp256k1Error *err; +} LDKCResult_PayeePubKeyErrorZPtr; /** - * A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, - * containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. + * 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_COption_CustomOnionMessageContentsZDecodeErrorZ { +typedef struct LDKCResult_PayeePubKeyErrorZ { /** - * The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either + * The contents of this CResult_PayeePubKeyErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr contents; + union LDKCResult_PayeePubKeyErrorZPtr contents; /** - * Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state. + * Whether this CResult_PayeePubKeyErrorZ represents a success state. */ bool result_ok; -} LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ; +} LDKCResult_PayeePubKeyErrorZ; + + /** - * An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not + * Private routing information + * + * # Invariants + * The encoded route has to be <1024 5bit characters long (<=639 bytes or <=12 hops) + * */ -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 struct MUST_USE_STRUCT LDKPrivateRoute { /** - * When we're in this state, this COption_NetAddressZ contains nothing + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKCOption_NetAddressZ_None, + LDKnativePrivateRoute *inner; /** - * Must be last for serialization purposes + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. */ - LDKCOption_NetAddressZ_Sentinel, -} LDKCOption_NetAddressZ_Tag; + bool is_owned; +} LDKPrivateRoute; -typedef struct LDKCOption_NetAddressZ { - LDKCOption_NetAddressZ_Tag tag; - union { - struct { - struct LDKNetAddress some; - }; - }; -} LDKCOption_NetAddressZ; +/** + * A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PrivateRouteZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPrivateRoute *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PrivateRouteZ; /** - * 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 timestamp that refers to a date after 1 January 1970. + * + * # Invariants + * + * The Unix timestamp representing the stored time has to be positive and no greater than + * [`MAX_TIMESTAMP`]. */ -typedef struct MUST_USE_STRUCT LDKPeerHandleError { +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. */ - LDKnativePeerHandleError *inner; + 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; -} LDKPeerHandleError; +} LDKPositiveTimestamp; /** - * The contents of CResult_CVec_u8ZPeerHandleErrorZ + * The contents of CResult_PositiveTimestampCreationErrorZ */ -typedef union LDKCResult_CVec_u8ZPeerHandleErrorZPtr { +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 LDKCVec_u8Z *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 LDKPeerHandleError *err; -} LDKCResult_CVec_u8ZPeerHandleErrorZPtr; + enum LDKCreationError *err; +} LDKCResult_PositiveTimestampCreationErrorZPtr; /** - * 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. + * 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_CVec_u8ZPeerHandleErrorZ { +typedef struct LDKCResult_PositiveTimestampCreationErrorZ { /** - * The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either + * The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_CVec_u8ZPeerHandleErrorZPtr contents; + union LDKCResult_PositiveTimestampCreationErrorZPtr contents; /** - * Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. + * Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_CVec_u8ZPeerHandleErrorZ; +} LDKCResult_PositiveTimestampCreationErrorZ; /** - * The contents of CResult_NonePeerHandleErrorZ + * The contents of CResult_NoneSemanticErrorZ */ -typedef union LDKCResult_NonePeerHandleErrorZPtr { +typedef union LDKCResult_NoneSemanticErrorZPtr { /** * Note that this value is always NULL, as there are no contents in the OK variant */ @@ -10019,137 +10406,147 @@ typedef union LDKCResult_NonePeerHandleErrorZPtr { * 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; + enum LDKSemanticError *err; +} LDKCResult_NoneSemanticErrorZPtr; /** - * 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_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_NonePeerHandleErrorZ { +typedef struct LDKCResult_NoneSemanticErrorZ { /** - * The contents of this CResult_NonePeerHandleErrorZ, accessible via either + * The contents of this CResult_NoneSemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePeerHandleErrorZPtr contents; + union LDKCResult_NoneSemanticErrorZPtr contents; /** - * Whether this CResult_NonePeerHandleErrorZ represents a success state. + * Whether this CResult_NoneSemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NonePeerHandleErrorZ; +} LDKCResult_NoneSemanticErrorZ; /** - * The contents of CResult_boolPeerHandleErrorZ + * The contents of CResult_InvoiceSemanticErrorZ */ -typedef union LDKCResult_boolPeerHandleErrorZPtr { +typedef union LDKCResult_InvoiceSemanticErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - bool *result; + struct LDKInvoice *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; + enum LDKSemanticError *err; +} LDKCResult_InvoiceSemanticErrorZPtr; /** - * 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_InvoiceSemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Invoice on success and a crate::lightning_invoice::SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_boolPeerHandleErrorZ { +typedef struct LDKCResult_InvoiceSemanticErrorZ { /** - * The contents of this CResult_boolPeerHandleErrorZ, accessible via either + * The contents of this CResult_InvoiceSemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_boolPeerHandleErrorZPtr contents; + union LDKCResult_InvoiceSemanticErrorZPtr contents; /** - * Whether this CResult_boolPeerHandleErrorZ represents a success state. + * Whether this CResult_InvoiceSemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_boolPeerHandleErrorZ; +} LDKCResult_InvoiceSemanticErrorZ; + + /** - * Errors that may occur when [sending an onion message]. + * Description string * - * [sending an onion message]: OnionMessenger::send_custom_onion_message + * # Invariants + * The description can be at most 639 __bytes__ long */ -typedef enum LDKSendError_Tag { - /** - * Errored computing onion message packet keys. - */ - LDKSendError_Secp256k1, +typedef struct MUST_USE_STRUCT LDKDescription { /** - * 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. + * 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. */ - LDKSendError_TooBigPacket, + LDKnativeDescription *inner; /** - * The provided [`Destination`] was an invalid [`BlindedRoute`], due to having fewer than two - * blinded hops. + * 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. */ - LDKSendError_TooFewBlindedHops, + bool is_owned; +} LDKDescription; + +/** + * The contents of CResult_DescriptionCreationErrorZ + */ +typedef union LDKCResult_DescriptionCreationErrorZPtr { /** - * Our next-hop peer was offline or does not support onion message forwarding. + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. */ - LDKSendError_InvalidFirstHop, + struct LDKDescription *result; /** - * Onion message contents must have a TLV type >= 64. + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. */ - LDKSendError_InvalidMessage, + enum LDKCreationError *err; +} LDKCResult_DescriptionCreationErrorZPtr; + +/** + * A CResult_DescriptionCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Description on success and a crate::lightning_invoice::CreationError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_DescriptionCreationErrorZ { /** - * Our next-hop peer's buffer was full or our total outbound buffer was full. + * The contents of this CResult_DescriptionCreationErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. */ - LDKSendError_BufferFull, + union LDKCResult_DescriptionCreationErrorZPtr contents; /** - * Must be last for serialization purposes + * Whether this CResult_DescriptionCreationErrorZ represents a success state. */ - LDKSendError_Sentinel, -} LDKSendError_Tag; - -typedef struct MUST_USE_STRUCT LDKSendError { - LDKSendError_Tag tag; - union { - struct { - enum LDKSecp256k1Error secp256k1; - }; - }; -} LDKSendError; + bool result_ok; +} LDKCResult_DescriptionCreationErrorZ; /** - * The contents of CResult_NoneSendErrorZ + * The contents of CResult_PrivateRouteCreationErrorZ */ -typedef union LDKCResult_NoneSendErrorZPtr { +typedef union LDKCResult_PrivateRouteCreationErrorZPtr { /** - * 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 LDKPrivateRoute *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKSendError *err; -} LDKCResult_NoneSendErrorZPtr; + enum LDKCreationError *err; +} LDKCResult_PrivateRouteCreationErrorZPtr; /** - * A CResult_NoneSendErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure. + * A CResult_PrivateRouteCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NoneSendErrorZ { +typedef struct LDKCResult_PrivateRouteCreationErrorZ { /** - * The contents of this CResult_NoneSendErrorZ, accessible via either + * The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NoneSendErrorZPtr contents; + union LDKCResult_PrivateRouteCreationErrorZPtr contents; /** - * Whether this CResult_NoneSendErrorZ represents a success state. + * Whether this CResult_PrivateRouteCreationErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NoneSendErrorZ; +} LDKCResult_PrivateRouteCreationErrorZ; /** * All-encompassing standard error type that processing can return @@ -11956,43 +12353,109 @@ typedef union LDKCResult_LockedChannelMonitorNoneZPtr { */ struct LDKLockedChannelMonitor *result; /** - * Note that this value is always NULL, as there are no contents in the Err variant + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_LockedChannelMonitorNoneZPtr; + +/** + * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation, + * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_LockedChannelMonitorNoneZ { + /** + * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_LockedChannelMonitorNoneZPtr contents; + /** + * Whether this CResult_LockedChannelMonitorNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_LockedChannelMonitorNoneZ; + +/** + * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_OutPointZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKOutPoint *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_OutPointZ; + + + +/** + * An opaque identifier describing a specific [`Persist`] method call. + */ +typedef struct MUST_USE_STRUCT LDKMonitorUpdateId { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMonitorUpdateId *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKMonitorUpdateId; + +/** + * A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_MonitorUpdateIdZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKMonitorUpdateId *data; + /** + * The number of elements pointed to by `data`. */ - void *err; -} LDKCResult_LockedChannelMonitorNoneZPtr; + uintptr_t datalen; +} LDKCVec_MonitorUpdateIdZ; /** - * A CResult_LockedChannelMonitorNoneZ represents the result of a fallible operation, - * containing a crate::lightning::chain::chainmonitor::LockedChannelMonitor on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCResult_LockedChannelMonitorNoneZ { +typedef struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ { /** - * The contents of this CResult_LockedChannelMonitorNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The element at position 0 */ - union LDKCResult_LockedChannelMonitorNoneZPtr contents; + struct LDKOutPoint a; /** - * Whether this CResult_LockedChannelMonitorNoneZ represents a success state. + * The element at position 1 */ - bool result_ok; -} LDKCResult_LockedChannelMonitorNoneZ; + struct LDKCVec_MonitorUpdateIdZ b; +} LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ; /** - * A dynamically-allocated array of crate::lightning::chain::transaction::OutPoints of arbitrary size. + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size. * This corresponds to std::vector in C++ */ -typedef struct LDKCVec_OutPointZ { +typedef struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { /** * The elements in the array. * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). */ - struct LDKOutPoint *data; + struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *data; /** * The number of elements pointed to by `data`. */ uintptr_t datalen; -} LDKCVec_OutPointZ; +} LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; /** * A trait indicating an object may generate message send events @@ -12039,6 +12502,10 @@ typedef struct LDKOnionMessageProvider { /** * A trait implemented for objects handling events from [`EventsProvider`]. + * + * An async variation also exists for implementations of [`EventsProvider`] that support async + * event handling. The async event handler should satisfy the generic bounds: `F: + * core::future::Future, H: Fn(Event) -> F`. */ typedef struct LDKEventHandler { /** @@ -12051,7 +12518,7 @@ typedef struct LDKEventHandler { * * See [`EventsProvider`] for details that must be considered when implementing this method. */ - void (*handle_event)(const void *this_arg, const struct LDKEvent *NONNULL_PTR event); + void (*handle_event)(const void *this_arg, struct LDKEvent event); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -12064,6 +12531,10 @@ typedef struct LDKEventHandler { * * Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. * + * Implementations of this trait may also feature an async version of event handling, as shown with + * [`ChannelManager::process_pending_events_async`] and + * [`ChainMonitor::process_pending_events_async`]. + * * # Requirements * * When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending @@ -12090,6 +12561,8 @@ typedef struct LDKEventHandler { * [`handle_event`]: EventHandler::handle_event * [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events * [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events + * [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async + * [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async */ typedef struct LDKEventsProvider { /** @@ -12164,6 +12637,27 @@ typedef struct LDKPersister { void (*free)(void *this_arg); } LDKPersister; + + +/** + * A string that displays only printable characters, replacing control characters with + * [`core::char::REPLACEMENT_CHARACTER`]. + */ +typedef struct MUST_USE_STRUCT LDKPrintableString { + /** + * 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. + */ + LDKnativePrintableString *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; +} LDKPrintableString; + /** * A callback which is called when a [`Future`] completes. * @@ -12346,31 +12840,35 @@ typedef struct LDKListen { } LDKListen; /** - * The `Confirm` trait is used to notify when transactions have been confirmed on chain or - * unconfirmed during a chain reorganization. + * The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on + * chain or unconfirmed during a chain reorganization. * * Clients sourcing chain data using a transaction-oriented API should prefer this interface over - * [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity - * related to registered transactions and outputs. Upon notification, it would pass along the - * matching transactions using this interface. + * [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement + * [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for + * on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes + * with reference to the confirmation status of the monitored objects. * * # Use - * * The intended use is as follows: - * - Call [`transactions_confirmed`] to process any on-chain activity of interest. - * - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`] - * that has been reorganized out of the chain. - * - Call [`best_block_updated`] whenever a new chain tip becomes available. + * - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or + * outputs are, respectively, confirmed or spent on chain. + * - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by + * [`get_relevant_txids`] is no longer confirmed in the block with the given block hash. + * - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available. * * # Order * * Clients must call these methods in chain order. Specifically: - * - Transactions confirmed in a block must be given before transactions confirmed in a later - * block. + * - Transactions which are confirmed in a particular block must be given before transactions + * confirmed in a later block. * - Dependent transactions within the same block must be given in topological order, possibly in * separate calls. - * - Unconfirmed transactions must be given after the original confirmations and before any - * reconfirmation. + * - All unconfirmed transactions must be given after the original confirmations and before *any* + * reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should + * never be interleaved, but always conduced *en bloc*. + * - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed + * in regard to the new block. * * See individual method documentation for further details. * @@ -12386,9 +12884,9 @@ typedef struct LDKConfirm { */ void *this_arg; /** - * Processes transactions confirmed in a block with a given header and height. + * Notifies LDK of transactions confirmed in a block with a given header and height. * - * Should be called for any transactions registered by [`Filter::register_tx`] or any + * Must be called for any transactions registered by [`Filter::register_tx`] or any * transactions spending an output registered by [`Filter::register_output`]. Such transactions * appearing in the same block do not need to be included in the same call; instead, multiple * calls with additional transactions may be made so long as they are made in [chain order]. @@ -12402,10 +12900,11 @@ typedef struct LDKConfirm { */ void (*transactions_confirmed)(const void *this_arg, const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** - * Processes a transaction that is no longer confirmed as result of a chain reorganization. + * Notifies LDK of 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 will not be returned + * Must be called for any transaction returned by [`get_relevant_txids`] if it has been + * reorganized out of the best chain or if it is no longer confirmed in the block with the + * given block hash. 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 @@ -12413,28 +12912,33 @@ typedef struct LDKConfirm { */ void (*transaction_unconfirmed)(const void *this_arg, const uint8_t (*txid)[32]); /** - * Processes an update to the best header connected at the given height. + * Notifies LDK of an update to the best header connected at the given height. * - * Should be called when a new header is available but may be skipped for intermediary blocks - * if they become available at the same time. + * Must be called whenever a new chain tip becomes available. May be skipped for intermediary + * blocks. */ void (*best_block_updated)(const void *this_arg, const uint8_t (*header)[80], uint32_t height); /** - * Returns transactions that should be monitored for reorganization out of the chain. + * Returns transactions that must be monitored for reorganization out of the chain along + * with the hash of the block as part of which it had been previously confirmed. * * 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 + * Must be called to determine the subset of transactions that must be monitored for * reorganization. Will be idempotent between calls but may change as a result of calls to the - * other interface methods. Thus, this is useful to determine which transactions may need to be + * other interface methods. Thus, this is useful to determine which transactions must be * given to [`transaction_unconfirmed`]. * + * If any of the returned transactions are confirmed in a block other than the one with the + * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and + * [`transactions_confirmed`], respectively. + * * [`transactions_confirmed`]: Self::transactions_confirmed * [`transaction_unconfirmed`]: Self::transaction_unconfirmed */ - struct LDKCVec_TxidZ (*get_relevant_txids)(const void *this_arg); + struct LDKCVec_C2Tuple_TxidBlockHashZZ (*get_relevant_txids)(const void *this_arg); /** * Frees any resources associated with this object given its this_arg pointer. * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. @@ -12442,26 +12946,6 @@ typedef struct LDKConfirm { void (*free)(void *this_arg); } LDKConfirm; - - -/** - * An opaque identifier describing a specific [`Persist`] method call. - */ -typedef struct MUST_USE_STRUCT LDKMonitorUpdateId { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMonitorUpdateId *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKMonitorUpdateId; - /** * `Persist` defines behavior for persisting channel monitors: this could mean * writing once to disk, and/or uploading to one or more backup services. @@ -12584,12 +13068,12 @@ typedef struct MUST_USE_STRUCT LDKChainMonitor { /** - * Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key - * and derives keys from that. + * Simple [`KeysInterface`] implementation that takes a 32-byte seed for use as a BIP 32 extended + * key and derives keys from that. * - * Your node_id is seed/0' - * ChannelMonitor closes may use seed/1' - * Cooperative closes may use seed/2' + * Your `node_id` is seed/0'. + * Unilateral closes may use seed/1'. + * Cooperative closes may use seed/2'. * The two close keys may be needed to claim on-chain funds! * * This struct cannot be used for nodes that wish to support receiving phantom payments; @@ -13382,9 +13866,6 @@ typedef struct MUST_USE_STRUCT LDKReadOnlyNetworkGraph { * This network graph is then used for routing payments. * Provides interface to help with initial routing sync by * serving historical announcements. - * - * Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the - * [`NetworkGraph`]. */ typedef struct MUST_USE_STRUCT LDKP2PGossipSync { /** @@ -13481,7 +13962,7 @@ typedef struct LDKEffectiveCapacity_LDKTotal_Body { /** * The maximum HTLC amount denominated in millisatoshi. */ - struct LDKCOption_u64Z htlc_maximum_msat; + uint64_t htlc_maximum_msat; } LDKEffectiveCapacity_LDKTotal_Body; typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { @@ -13495,6 +13976,96 @@ typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { +/** + * 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; + +/** + * A trait defining behavior for routing a 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, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); + /** + * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes + * `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment. + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCResult_RouteLightningErrorZ (*find_route_with_id)(const void *this_arg, struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); + /** + * 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; + + + +/** + * [`Score`] implementation that factors in in-flight HTLC liquidity. + * + * Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling + * [`find_route`]. + * + * [`Score`]: crate::routing::scoring::Score + */ +typedef struct MUST_USE_STRUCT LDKScorerAccountingForInFlightHtlcs { + /** + * 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. + */ + LDKnativeScorerAccountingForInFlightHtlcs *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; +} LDKScorerAccountingForInFlightHtlcs; + + + /** * A concrete implementation of [`LockableScore`] which supports multi-threading. */ @@ -13575,9 +14146,8 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { * # use lightning::chain::keysinterface::{InMemorySigner, KeysManager, KeysInterface}; * # use lightning::ln::msgs::DecodeError; * # use lightning::ln::peer_handler::IgnoringMessageHandler; - * # use lightning::onion_message::messenger::{Destination, OnionMessenger}; - * # use lightning::onion_message::packet::CustomOnionMessageContents; - * # use lightning::onion_message::blinded_route::BlindedRoute; + * # use lightning::onion_message::blinded_path::BlindedPath; + * # use lightning::onion_message::messenger::{CustomOnionMessageContents, Destination, OnionMessageContents, OnionMessenger}; * # use lightning::util::logger::{Logger, Record}; * # use lightning::util::ser::{Writeable, Writer}; * # use lightning::io; @@ -13617,18 +14187,20 @@ typedef struct MUST_USE_STRUCT LDKProbabilisticScoringParameters { * let intermediate_hops = [hop_node_id1, hop_node_id2]; * let reply_path = None; * # let your_custom_message = YourCustomMessage {}; - * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::Node(destination_node_id), your_custom_message, reply_path); + * let message = OnionMessageContents::Custom(your_custom_message); + * onion_messenger.send_onion_message(&intermediate_hops, Destination::Node(destination_node_id), message, reply_path); * - * // Create a blinded route to yourself, for someone to send an onion message to. + * // Create a blinded path to yourself, for someone to send an onion message to. * # let your_node_id = hop_node_id1; * let hops = [hop_node_id3, hop_node_id4, your_node_id]; - * let blinded_route = BlindedRoute::new(&hops, &keys_manager, &secp_ctx).unwrap(); + * let blinded_path = BlindedPath::new(&hops, &keys_manager, &secp_ctx).unwrap(); * - * // Send a custom onion message to a blinded route. + * // Send a custom onion message to a blinded path. * # let intermediate_hops = [hop_node_id1, hop_node_id2]; * let reply_path = None; * # let your_custom_message = YourCustomMessage {}; - * onion_messenger.send_custom_onion_message(&intermediate_hops, Destination::BlindedRoute(blinded_route), your_custom_message, reply_path); + * let message = OnionMessageContents::Custom(your_custom_message); + * onion_messenger.send_onion_message(&intermediate_hops, Destination::BlindedPath(blinded_path), message, reply_path); * ``` * * [offers]: @@ -13658,9 +14230,9 @@ typedef enum LDKDestination_Tag { */ LDKDestination_Node, /** - * We're sending this onion message to a blinded route. + * We're sending this onion message to a blinded path. */ - LDKDestination_BlindedRoute, + LDKDestination_BlindedPath, /** * Must be last for serialization purposes */ @@ -13674,11 +14246,35 @@ typedef struct MUST_USE_STRUCT LDKDestination { struct LDKPublicKey node; }; struct { - struct LDKBlindedRoute blinded_route; + struct LDKBlindedPath blinded_path; }; }; } LDKDestination; +/** + * The contents of an onion message. In the context of offers, this would be the invoice, invoice + * request, or invoice error. + */ +typedef enum LDKOnionMessageContents_Tag { + /** + * A custom onion message specified by the user. + */ + LDKOnionMessageContents_Custom, + /** + * Must be last for serialization purposes + */ + LDKOnionMessageContents_Sentinel, +} LDKOnionMessageContents_Tag; + +typedef struct MUST_USE_STRUCT LDKOnionMessageContents { + LDKOnionMessageContents_Tag tag; + union { + struct { + struct LDKCustomOnionMessageContents custom; + }; + }; +} LDKOnionMessageContents; + /** @@ -13923,7 +14519,7 @@ typedef enum LDKFallback_Tag { } LDKFallback_Tag; typedef struct LDKFallback_LDKSegWitProgram_Body { - struct LDKu5 version; + struct LDKU5 version; struct LDKCVec_u8Z program; } LDKFallback_LDKSegWitProgram_Body; @@ -13942,6 +14538,18 @@ typedef struct MUST_USE_STRUCT LDKFallback { /** * A trait defining behavior of an [`Invoice`] payer. + * + * While the behavior of [`InvoicePayer`] provides idempotency of duplicate `send_*payment` calls + * with the same [`PaymentHash`], it is up to the `Payer` to provide idempotency across restarts. + * + * [`ChannelManager`] provides idempotency for duplicate payments with the same [`PaymentId`]. + * + * In order to trivially ensure idempotency for payments, the default `Payer` implementation + * reuses the [`PaymentHash`] bytes as the [`PaymentId`]. Custom implementations wishing to + * provide payment idempotency with a different idempotency key (i.e. [`PaymentId`]) should map + * the [`Invoice`] or spontaneous payment target pubkey to their own idempotency key. + * + * [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager */ typedef struct LDKPayer { /** @@ -13962,11 +14570,11 @@ typedef struct LDKPayer { * * 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); + struct LDKCResult_NonePaymentSendFailureZ (*send_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id); /** * 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); + struct LDKCResult_NonePaymentSendFailureZ (*send_spontaneous_payment)(const void *this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id); /** * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. */ @@ -13976,49 +14584,16 @@ typedef struct LDKPayer { */ 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. + * Construct an [`InFlightHtlcs`] containing information about currently used up liquidity + * across payments. */ - void (*notify_payment_probe_failed)(const void *this_arg, struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + struct LDKInFlightHtlcs (*inflight_htlcs)(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); -} LDKRouter; +} LDKPayer; @@ -14079,26 +14654,6 @@ typedef struct MUST_USE_STRUCT LDKRetry { }; } 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; @@ -14115,6 +14670,14 @@ extern const uint16_t MIN_CLTV_EXPIRY_DELTA; extern const uint32_t MIN_FINAL_CLTV_EXPIRY; +extern const uint16_t MAX_HTLCS; + +extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT; + +extern const uintptr_t OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS; + +extern const uintptr_t MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT; + extern const uintptr_t REVOKEABLE_REDEEMSCRIPT_MAX_LENGTH; extern const uint64_t UNKNOWN_CHANNEL_CAPACITY_MSAT; @@ -14151,120 +14714,85 @@ extern const uint8_t TAG_FEATURES; struct LDKStr _ldk_get_compiled_version(void); -struct LDKStr _ldk_c_bindings_get_compiled_version(void); - -/** - * Convenience function for constructing a new BigEndianScalar - */ -struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes); - -/** - * 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); +struct LDKStr _ldk_c_bindings_get_compiled_version(void); /** - * Frees the data buffer, if chars_is_owned is set and len > 0. + * Gets the 128-bit integer, as 16 little-endian bytes */ -void Str_free(struct LDKStr _res); +struct LDKSixteenBytes U128_le_bytes(struct LDKU128 val); -#if defined(LDK_DEBUG_BUILD) /** - * This function exists for memory safety testing purposes. It should never be used in production - * code + * Constructs a new U128 from 16 little-endian bytes */ -const void *__unmangle_inner_ptr(const void *ptr); -#endif +struct LDKU128 U128_new(struct LDKSixteenBytes le_bytes); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Convenience function for constructing a new BigEndianScalar */ -void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); +struct LDKBigEndianScalar BigEndianScalar_new(struct LDKThirtyTwoBytes big_endian_bytes); /** - * Creates a new CResult_BlindedRouteNoneZ in the success state. + * Creates a new Bech32Error which has the same data as `orig` */ -struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_ok(struct LDKBlindedRoute o); +struct LDKBech32Error Bech32Error_clone(const struct LDKBech32Error *NONNULL_PTR orig); /** - * Creates a new CResult_BlindedRouteNoneZ in the error state. + * Releases any memory held by the given `Bech32Error` (which is currently none) */ -struct LDKCResult_BlindedRouteNoneZ CResult_BlindedRouteNoneZ_err(void); +void Bech32Error_free(struct LDKBech32Error o); /** - * Checks if the given object is currently in the success state + * Frees the data buffer, if data_is_owned is set and datalen > 0. */ -bool CResult_BlindedRouteNoneZ_is_ok(const struct LDKCResult_BlindedRouteNoneZ *NONNULL_PTR o); +void Transaction_free(struct LDKTransaction _res); /** - * Frees any resources used by the CResult_BlindedRouteNoneZ. + * Frees the data pointed to by data */ -void CResult_BlindedRouteNoneZ_free(struct LDKCResult_BlindedRouteNoneZ _res); +void Witness_free(struct LDKWitness _res); /** - * Creates a new CResult_BlindedRouteDecodeErrorZ in the success state. + * Convenience function for constructing a new TxOut */ -struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_ok(struct LDKBlindedRoute o); +struct LDKTxOut TxOut_new(struct LDKCVec_u8Z script_pubkey, uint64_t value); /** - * Creates a new CResult_BlindedRouteDecodeErrorZ in the error state. + * Frees the data pointed to by script_pubkey. */ -struct LDKCResult_BlindedRouteDecodeErrorZ CResult_BlindedRouteDecodeErrorZ_err(struct LDKDecodeError e); +void TxOut_free(struct LDKTxOut _res); /** - * Checks if the given object is currently in the success state + * Creates a new TxOut which has the same data as `orig` but with a new script buffer. */ -bool CResult_BlindedRouteDecodeErrorZ_is_ok(const struct LDKCResult_BlindedRouteDecodeErrorZ *NONNULL_PTR o); +struct LDKTxOut TxOut_clone(const struct LDKTxOut *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_BlindedRouteDecodeErrorZ. + * Frees the data buffer, if chars_is_owned is set and len > 0. */ -void CResult_BlindedRouteDecodeErrorZ_free(struct LDKCResult_BlindedRouteDecodeErrorZ _res); +void Str_free(struct LDKStr _res); +#if defined(LDK_DEBUG_BUILD) /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. + * This function exists for memory safety testing purposes. It should never be used in production + * code */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); +const void *__unmangle_inner_ptr(const void *ptr); +#endif /** - * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. + * Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim */ -struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_some(enum LDKHTLCClaim o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_HTLCClaimZ containing nothing */ -bool CResult_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); +struct LDKCOption_HTLCClaimZ COption_HTLCClaimZ_none(void); /** - * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. + * Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state */ -void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); +void COption_HTLCClaimZ_free(struct LDKCOption_HTLCClaimZ _res); /** * Creates a new CResult_NoneNoneZ in the success state. @@ -14318,58 +14846,6 @@ void CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(struct LDKCResult_Co */ 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. */ @@ -14422,32 +14898,6 @@ void CResult_ChannelPublicKeysDecodeErrorZ_free(struct LDKCResult_ChannelPublicK */ struct LDKCResult_ChannelPublicKeysDecodeErrorZ CResult_ChannelPublicKeysDecodeErrorZ_clone(const struct LDKCResult_ChannelPublicKeysDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new CResult_TxCreationKeysErrorZ in the success state. - */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_ok(struct LDKTxCreationKeys o); - -/** - * Creates a new CResult_TxCreationKeysErrorZ in the error state. - */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_err(enum LDKSecp256k1Error e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_TxCreationKeysErrorZ_is_ok(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_TxCreationKeysErrorZ. - */ -void CResult_TxCreationKeysErrorZ_free(struct LDKCResult_TxCreationKeysErrorZ _res); - -/** - * Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_TxCreationKeysErrorZ CResult_TxCreationKeysErrorZ_clone(const struct LDKCResult_TxCreationKeysErrorZ *NONNULL_PTR orig); - /** * Constructs a new COption_u32Z containing a u32 */ @@ -14614,195 +15064,361 @@ bool CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResul void CResult_BuiltCommitmentTransactionDecodeErrorZ_free(struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ _res); /** - * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); + +/** + * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + */ +void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); + +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); + +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + */ +void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); + +/** + * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + */ +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); + +/** + * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + */ +struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_TrustedCommitmentTransactionNoneZ_is_ok(const struct LDKCResult_TrustedCommitmentTransactionNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + */ +void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); + +/** + * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + */ +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_ok(struct LDKCVec_SignatureZ o); + +/** + * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + */ +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + */ +void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); + +/** + * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + */ +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); + +/** + * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + */ +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + */ +void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); + +/** + * Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); + +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + */ +void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); + +/** + * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_clone(const struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); + +/** + * Creates a new CResult_BlindedPathNoneZ in the success state. */ -struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_BuiltCommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_ok(struct LDKBlindedPath o); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. + * Creates a new CResult_BlindedPathNoneZ in the error state. */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_ok(struct LDKTrustedClosingTransaction o); +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_err(void); /** - * Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_TrustedClosingTransactionNoneZ CResult_TrustedClosingTransactionNoneZ_err(void); +bool CResult_BlindedPathNoneZ_is_ok(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_BlindedPathNoneZ. */ -bool CResult_TrustedClosingTransactionNoneZ_is_ok(const struct LDKCResult_TrustedClosingTransactionNoneZ *NONNULL_PTR o); +void CResult_BlindedPathNoneZ_free(struct LDKCResult_BlindedPathNoneZ _res); /** - * Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. + * Creates a new CResult_BlindedPathNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_TrustedClosingTransactionNoneZ_free(struct LDKCResult_TrustedClosingTransactionNoneZ _res); +struct LDKCResult_BlindedPathNoneZ CResult_BlindedPathNoneZ_clone(const struct LDKCResult_BlindedPathNoneZ *NONNULL_PTR orig); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. + * Creates a new CResult_BlindedPathDecodeErrorZ in the success state. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_ok(struct LDKCommitmentTransaction o); +struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_ok(struct LDKBlindedPath o); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. + * Creates a new CResult_BlindedPathDecodeErrorZ in the error state. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_CommitmentTransactionDecodeErrorZ_is_ok(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR o); +bool CResult_BlindedPathDecodeErrorZ_is_ok(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. + * Frees any resources used by the CResult_BlindedPathDecodeErrorZ. */ -void CResult_CommitmentTransactionDecodeErrorZ_free(struct LDKCResult_CommitmentTransactionDecodeErrorZ _res); +void CResult_BlindedPathDecodeErrorZ_free(struct LDKCResult_BlindedPathDecodeErrorZ _res); /** - * Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_CommitmentTransactionDecodeErrorZ CResult_CommitmentTransactionDecodeErrorZ_clone(const struct LDKCResult_CommitmentTransactionDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_BlindedPathDecodeErrorZ CResult_BlindedPathDecodeErrorZ_clone(const struct LDKCResult_BlindedPathDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. + * Creates a new CResult_BlindedHopDecodeErrorZ in the success state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_ok(struct LDKTrustedCommitmentTransaction o); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_ok(struct LDKBlindedHop o); /** - * Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. + * Creates a new CResult_BlindedHopDecodeErrorZ in the error state. */ -struct LDKCResult_TrustedCommitmentTransactionNoneZ CResult_TrustedCommitmentTransactionNoneZ_err(void); +struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_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_BlindedHopDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. + * Frees any resources used by the CResult_BlindedHopDecodeErrorZ. */ -void CResult_TrustedCommitmentTransactionNoneZ_free(struct LDKCResult_TrustedCommitmentTransactionNoneZ _res); +void CResult_BlindedHopDecodeErrorZ_free(struct LDKCResult_BlindedHopDecodeErrorZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the success state. + * Creates a new CResult_BlindedHopDecodeErrorZ 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_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(const struct LDKCResult_BlindedHopDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_SignatureZNoneZ in the error state. + * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_err(void); +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); /** - * Checks if the given object is currently in the success state + * Constructs a new COption_WriteableScoreZ containing nothing */ -bool CResult_CVec_SignatureZNoneZ_is_ok(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR o); +struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); /** - * Frees any resources used by the CResult_CVec_SignatureZNoneZ. + * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state */ -void CResult_CVec_SignatureZNoneZ_free(struct LDKCResult_CVec_SignatureZNoneZ _res); +void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); /** - * Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_NoneErrorZ in the success state. */ -struct LDKCResult_CVec_SignatureZNoneZ CResult_CVec_SignatureZNoneZ_clone(const struct LDKCResult_CVec_SignatureZNoneZ *NONNULL_PTR orig); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. + * Creates a new CResult_NoneErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_ok(struct LDKShutdownScript o); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_NoneErrorZ. */ -bool CResult_ShutdownScriptDecodeErrorZ_is_ok(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR o); +void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); /** - * Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. + * Creates a new CResult_NoneErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_ShutdownScriptDecodeErrorZ_free(struct LDKCResult_ShutdownScriptDecodeErrorZ _res); +struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_ShutdownScriptDecodeErrorZ 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_ShutdownScriptDecodeErrorZ CResult_ShutdownScriptDecodeErrorZ_clone(const struct LDKCResult_ShutdownScriptDecodeErrorZ *NONNULL_PTR orig); +void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. + * Creates a new CResult_RouteLightningErrorZ in the success state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_ok(struct LDKShutdownScript o); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. + * Creates a new CResult_RouteLightningErrorZ in the error state. */ -struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ CResult_ShutdownScriptInvalidShutdownScriptZ_err(struct LDKInvalidShutdownScript e); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError 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_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. + * Frees any resources used by the CResult_RouteLightningErrorZ. */ -void CResult_ShutdownScriptInvalidShutdownScriptZ_free(struct LDKCResult_ShutdownScriptInvalidShutdownScriptZ _res); +void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); /** - * Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` + * Creates a new CResult_RouteLightningErrorZ 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); +struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); /** - * Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_some(struct LDKWriteableScore o); +void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); /** - * Constructs a new COption_WriteableScoreZ containing nothing + * Constructs a new COption_u64Z containing a u64 */ -struct LDKCOption_WriteableScoreZ COption_WriteableScoreZ_none(void); +struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); /** - * Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state + * Constructs a new COption_u64Z containing nothing */ -void COption_WriteableScoreZ_free(struct LDKCOption_WriteableScoreZ _res); +struct LDKCOption_u64Z COption_u64Z_none(void); /** - * Creates a new CResult_NoneErrorZ in the success state. + * Frees any resources associated with the u64, if we are in the Some state */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_ok(void); +void COption_u64Z_free(struct LDKCOption_u64Z _res); /** - * Creates a new CResult_NoneErrorZ in the error state. + * Creates a new COption_u64Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_err(enum LDKIOError e); +struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); + +/** + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); + +/** + * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + */ +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneErrorZ_is_ok(const struct LDKCResult_NoneErrorZ *NONNULL_PTR o); +bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneErrorZ. + * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. */ -void CResult_NoneErrorZ_free(struct LDKCResult_NoneErrorZ _res); +void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); /** - * Creates a new CResult_NoneErrorZ which has the same data as `orig` + * Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NoneErrorZ CResult_NoneErrorZ_clone(const struct LDKCResult_NoneErrorZ *NONNULL_PTR orig); +struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_clone(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_RouteHopDecodeErrorZ in the success state. @@ -14830,11 +15446,6 @@ void CResult_RouteHopDecodeErrorZ_free(struct LDKCResult_RouteHopDecodeErrorZ _r */ struct LDKCResult_RouteHopDecodeErrorZ CResult_RouteHopDecodeErrorZ_clone(const struct LDKCResult_RouteHopDecodeErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_RouteHopZ_free(struct LDKCVec_RouteHopZ _res); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -14897,27 +15508,6 @@ struct LDKCResult_RouteParametersDecodeErrorZ CResult_RouteParametersDecodeError */ void CVec_RouteHintZ_free(struct LDKCVec_RouteHintZ _res); -/** - * Constructs a new COption_u64Z containing a u64 - */ -struct LDKCOption_u64Z COption_u64Z_some(uint64_t o); - -/** - * Constructs a new COption_u64Z containing nothing - */ -struct LDKCOption_u64Z COption_u64Z_none(void); - -/** - * Frees any resources associated with the u64, if we are in the Some state - */ -void COption_u64Z_free(struct LDKCOption_u64Z _res); - -/** - * Creates a new COption_u64Z which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCOption_u64Z COption_u64Z_clone(const struct LDKCOption_u64Z *NONNULL_PTR orig); - /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -15006,37 +15596,6 @@ void CResult_RouteHintHopDecodeErrorZ_free(struct LDKCResult_RouteHintHopDecodeE */ struct LDKCResult_RouteHintHopDecodeErrorZ CResult_RouteHintHopDecodeErrorZ_clone(const struct LDKCResult_RouteHintHopDecodeErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_ChannelDetailsZ_free(struct LDKCVec_ChannelDetailsZ _res); - -/** - * Creates a new CResult_RouteLightningErrorZ in the success state. - */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_ok(struct LDKRoute o); - -/** - * Creates a new CResult_RouteLightningErrorZ in the error state. - */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_err(struct LDKLightningError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_RouteLightningErrorZ_is_ok(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_RouteLightningErrorZ. - */ -void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _res); - -/** - * Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); - /** * Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. */ @@ -15157,6 +15716,27 @@ void CResult_COption_HTLCDestinationZDecodeErrorZ_free(struct LDKCResult_COption */ struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ CResult_COption_HTLCDestinationZDecodeErrorZ_clone(const struct LDKCResult_COption_HTLCDestinationZDecodeErrorZ *NONNULL_PTR orig); +/** + * Constructs a new COption_u128Z containing a crate::c_types::U128 + */ +struct LDKCOption_u128Z COption_u128Z_some(struct LDKU128 o); + +/** + * Constructs a new COption_u128Z containing nothing + */ +struct LDKCOption_u128Z COption_u128Z_none(void); + +/** + * Frees any resources associated with the crate::c_types::U128, if we are in the Some state + */ +void COption_u128Z_free(struct LDKCOption_u128Z _res); + +/** + * Creates a new COption_u128Z which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_u128Z COption_u128Z_clone(const struct LDKCOption_u128Z *NONNULL_PTR orig); + /** * Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate */ @@ -15282,10 +15862,26 @@ void C2Tuple_usizeTransactionZ_free(struct LDKC2Tuple_usizeTransactionZ _res); */ void CVec_C2Tuple_usizeTransactionZZ_free(struct LDKCVec_C2Tuple_usizeTransactionZZ _res); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_clone(const struct LDKC2Tuple_TxidBlockHashZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_TxidBlockHashZ from the contained elements. + */ +struct LDKC2Tuple_TxidBlockHashZ C2Tuple_TxidBlockHashZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); + +/** + * Frees any resources used by the C2Tuple_TxidBlockHashZ. + */ +void C2Tuple_TxidBlockHashZ_free(struct LDKC2Tuple_TxidBlockHashZ _res); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -void CVec_TxidZ_free(struct LDKCVec_TxidZ _res); +void CVec_C2Tuple_TxidBlockHashZZ_free(struct LDKCVec_C2Tuple_TxidBlockHashZZ _res); /** * Frees the buffer pointed to by `data` if `datalen` is non-0. @@ -15513,23 +16109,75 @@ struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDec /** * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + */ +void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OfferFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_ok(struct LDKOfferFeatures o); + +/** + * Creates a new CResult_OfferFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OfferFeaturesDecodeErrorZ. + */ +void CResult_OfferFeaturesDecodeErrorZ_free(struct LDKCResult_OfferFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_OfferFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferFeaturesDecodeErrorZ CResult_OfferFeaturesDecodeErrorZ_clone(const struct LDKCResult_OfferFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(struct LDKInvoiceRequestFeatures o); + +/** + * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); +bool CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + * Frees any resources used by the CResult_InvoiceRequestFeaturesDecodeErrorZ. */ -void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); +void CResult_InvoiceRequestFeaturesDecodeErrorZ_free(struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ _res); /** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_NodeIdDecodeErrorZ in the success state. @@ -16195,16 +16843,10 @@ bool CResult_SignDecodeErrorZ_is_ok(const struct LDKCResult_SignDecodeErrorZ *NO */ 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); +void CVec_U5Z_free(struct LDKCVec_U5Z _res); /** * Creates a new CResult_RecoverableSignatureNoneZ in the success state. @@ -16444,56 +17086,56 @@ void CResult__u832APIErrorZ_free(struct LDKCResult__u832APIErrorZ _res); struct LDKCResult__u832APIErrorZ CResult__u832APIErrorZ_clone(const struct LDKCResult__u832APIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. + * Creates a new CResult_NonePaymentSendFailureZ in the success state. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. + * Creates a new CResult_NonePaymentSendFailureZ in the error state. */ -struct LDKCResult_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_PaymentIdPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR o); +bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. + * Frees any resources used by the CResult_NonePaymentSendFailureZ. */ -void CResult_PaymentIdPaymentSendFailureZ_free(struct LDKCResult_PaymentIdPaymentSendFailureZ _res); +void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); /** - * Creates a new CResult_PaymentIdPaymentSendFailureZ 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_PaymentIdPaymentSendFailureZ CResult_PaymentIdPaymentSendFailureZ_clone(const struct LDKCResult_PaymentIdPaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePaymentSendFailureZ in the success state. + * Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_NonePaymentSendFailureZ in the error state. + * Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); /** * Checks if the given object is currently in the success state */ -bool CResult_NonePaymentSendFailureZ_is_ok(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR o); +bool CResult_PaymentHashPaymentSendFailureZ_is_ok(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePaymentSendFailureZ. + * Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. */ -void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); +void CResult_PaymentHashPaymentSendFailureZ_free(struct LDKCResult_PaymentHashPaymentSendFailureZ _res); /** - * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_clone(const struct LDKCResult_NonePaymentSendFailureZ *NONNULL_PTR orig); +struct LDKCResult_PaymentHashPaymentSendFailureZ CResult_PaymentHashPaymentSendFailureZ_clone(const struct LDKCResult_PaymentHashPaymentSendFailureZ *NONNULL_PTR orig); /** * Creates a new tuple which has the same data as `orig` @@ -16657,589 +17299,366 @@ bool CResult_PaymentSecretAPIErrorZ_is_ok(const struct LDKCResult_PaymentSecretA void CResult_PaymentSecretAPIErrorZ_free(struct LDKCResult_PaymentSecretAPIErrorZ _res); /** - * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the success state. - */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); - -/** - * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. - */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. - */ -void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); - -/** - * Creates a new CResult_PaymentPreimageAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. - */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); - -/** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. - */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. - */ -void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); - -/** - * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); - -/** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. - */ -void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); - -/** - * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. - */ -void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelDetailsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. - */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); - -/** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. - */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. - */ -void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); - -/** - * Creates a new CResult_PhantomRouteHintsDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); - -/** - * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. - */ -struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); - -/** - * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. - */ -void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); - -/** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. - */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); - -/** - * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. - */ -struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. - */ -void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); - -/** - * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. - */ -void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_OutPointDecodeErrorZ in the success state. - */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); - -/** - * Creates a new CResult_OutPointDecodeErrorZ in the error state. - */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_OutPointDecodeErrorZ. - */ -void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); - -/** - * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); - -/** - * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type - */ -struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); - -/** - * Constructs a new COption_TypeZ containing nothing + * Creates a new CResult_PaymentSecretAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCOption_TypeZ COption_TypeZ_none(void); +struct LDKCResult_PaymentSecretAPIErrorZ CResult_PaymentSecretAPIErrorZ_clone(const struct LDKCResult_PaymentSecretAPIErrorZ *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_PaymentPreimageAPIErrorZ in the success state. */ -void COption_TypeZ_free(struct LDKCOption_TypeZ _res); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. + * Creates a new CResult_PaymentPreimageAPIErrorZ in the error state. */ -struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); +struct LDKCResult_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_err(struct LDKAPIError e); /** - * 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_PaymentPreimageAPIErrorZ_is_ok(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_PaymentPreimageAPIErrorZ. */ -bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); +void CResult_PaymentPreimageAPIErrorZ_free(struct LDKCResult_PaymentPreimageAPIErrorZ _res); /** - * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. + * Creates a new CResult_PaymentPreimageAPIErrorZ 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_PaymentPreimageAPIErrorZ CResult_PaymentPreimageAPIErrorZ_clone(const struct LDKCResult_PaymentPreimageAPIErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(struct LDKCounterpartyForwardingInfo o); /** - * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. + * Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. */ -struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError e); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_err(struct LDKDecodeError 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_CounterpartyForwardingInfoDecodeErrorZ_is_ok(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. + * Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. */ -void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); +void CResult_CounterpartyForwardingInfoDecodeErrorZ_free(struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ _res); /** - * Creates a new CResult_PaymentIdPaymentErrorZ 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_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); +struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(const struct LDKCResult_CounterpartyForwardingInfoDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_ok(struct LDKInFlightHtlcs o); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_ok(struct LDKChannelCounterparty o); /** - * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. */ -struct LDKCResult_InFlightHtlcsDecodeErrorZ CResult_InFlightHtlcsDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InFlightHtlcsDecodeErrorZ_is_ok(const struct LDKCResult_InFlightHtlcsDecodeErrorZ *NONNULL_PTR o); +bool CResult_ChannelCounterpartyDecodeErrorZ_is_ok(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. + * Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. */ -void CResult_InFlightHtlcsDecodeErrorZ_free(struct LDKCResult_InFlightHtlcsDecodeErrorZ _res); +void CResult_ChannelCounterpartyDecodeErrorZ_free(struct LDKCResult_ChannelCounterpartyDecodeErrorZ _res); /** - * Creates a new CResult_SiPrefixParseErrorZ in the success state. + * Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); +struct LDKCResult_ChannelCounterpartyDecodeErrorZ CResult_ChannelCounterpartyDecodeErrorZ_clone(const struct LDKCResult_ChannelCounterpartyDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SiPrefixParseErrorZ in the error state. + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. */ -struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_ok(struct LDKChannelDetails o); + +/** + * Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_err(struct LDKDecodeError e); /** * Checks if the given object is currently in the success state */ -bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); +bool CResult_ChannelDetailsDecodeErrorZ_is_ok(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_SiPrefixParseErrorZ. + * Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. */ -void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); +void CResult_ChannelDetailsDecodeErrorZ_free(struct LDKCResult_ChannelDetailsDecodeErrorZ _res); /** - * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` + * Creates a new CResult_ChannelDetailsDecodeErrorZ 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_ChannelDetailsDecodeErrorZ CResult_ChannelDetailsDecodeErrorZ_clone(const struct LDKCResult_ChannelDetailsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the success state. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_ok(struct LDKPhantomRouteHints o); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. + * Creates a new CResult_PhantomRouteHintsDecodeErrorZ in the error state. */ -struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_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_PhantomRouteHintsDecodeErrorZ_is_ok(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. + * Frees any resources used by the CResult_PhantomRouteHintsDecodeErrorZ. */ -void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); +void CResult_PhantomRouteHintsDecodeErrorZ_free(struct LDKCResult_PhantomRouteHintsDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceParseOrSemanticErrorZ 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_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_PhantomRouteHintsDecodeErrorZ CResult_PhantomRouteHintsDecodeErrorZ_clone(const struct LDKCResult_PhantomRouteHintsDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. + * Frees the buffer pointed to by `data` if `datalen` is non-0. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); +void CVec_ChannelMonitorZ_free(struct LDKCVec_ChannelMonitorZ _res); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. + * Creates a new C2Tuple_BlockHashChannelManagerZ from the contained elements. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); +struct LDKC2Tuple_BlockHashChannelManagerZ C2Tuple_BlockHashChannelManagerZ_new(struct LDKThirtyTwoBytes a, struct LDKChannelManager b); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the C2Tuple_BlockHashChannelManagerZ. */ -bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); +void C2Tuple_BlockHashChannelManagerZ_free(struct LDKC2Tuple_BlockHashChannelManagerZ _res); /** - * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the success state. */ -void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelManagerZ o); /** - * Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ in the error state. */ -struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); +struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_err(struct LDKDecodeError 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 LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); +bool CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ. */ -struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); +void CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ _res); /** - * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the success state. */ -void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_ok(struct LDKChannelConfig o); /** - * Creates a new CResult_PayeePubKeyErrorZ in the success state. + * Creates a new CResult_ChannelConfigDecodeErrorZ in the error state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_PayeePubKeyErrorZ in the error state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); +bool CResult_ChannelConfigDecodeErrorZ_is_ok(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_ChannelConfigDecodeErrorZ. */ -bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); +void CResult_ChannelConfigDecodeErrorZ_free(struct LDKCResult_ChannelConfigDecodeErrorZ _res); /** - * Frees any resources used by the CResult_PayeePubKeyErrorZ. + * Creates a new CResult_ChannelConfigDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); +struct LDKCResult_ChannelConfigDecodeErrorZ CResult_ChannelConfigDecodeErrorZ_clone(const struct LDKCResult_ChannelConfigDecodeErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_OutPointDecodeErrorZ in the success state. */ -struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR orig); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_ok(struct LDKOutPoint o); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Creates a new CResult_OutPointDecodeErrorZ in the error state. */ -void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_err(struct LDKDecodeError e); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. + * Checks if the given object is currently in the success state */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); +bool CResult_OutPointDecodeErrorZ_is_ok(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. + * Frees any resources used by the CResult_OutPointDecodeErrorZ. */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError e); +void CResult_OutPointDecodeErrorZ_free(struct LDKCResult_OutPointDecodeErrorZ _res); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -bool CResult_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR o); +struct LDKCResult_OutPointDecodeErrorZ CResult_OutPointDecodeErrorZ_clone(const struct LDKCResult_OutPointDecodeErrorZ *NONNULL_PTR orig); /** - * Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. + * Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type */ -void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); +struct LDKCOption_TypeZ COption_TypeZ_some(struct LDKType o); /** - * Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Constructs a new COption_TypeZ containing nothing */ -struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); +struct LDKCOption_TypeZ COption_TypeZ_none(void); /** - * Creates a new CResult_NoneSemanticErrorZ in the success state. + * Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); +void COption_TypeZ_free(struct LDKCOption_TypeZ _res); /** - * Creates a new CResult_NoneSemanticErrorZ in the error state. + * Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError e); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_ok(struct LDKCOption_TypeZ o); /** - * Checks if the given object is currently in the success state + * Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. */ -bool CResult_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); +struct LDKCResult_COption_TypeZDecodeErrorZ CResult_COption_TypeZDecodeErrorZ_err(struct LDKDecodeError e); /** - * Frees any resources used by the CResult_NoneSemanticErrorZ. + * Checks if the given object is currently in the success state */ -void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); +bool CResult_COption_TypeZDecodeErrorZ_is_ok(const struct LDKCResult_COption_TypeZDecodeErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. */ -struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); +void CResult_COption_TypeZDecodeErrorZ_free(struct LDKCResult_COption_TypeZDecodeErrorZ _res); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the success state. + * Creates a new CResult_PaymentIdPaymentErrorZ in the success state. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_ok(struct LDKThirtyTwoBytes o); /** - * Creates a new CResult_InvoiceSemanticErrorZ in the error state. + * Creates a new CResult_PaymentIdPaymentErrorZ in the error state. */ -struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_err(struct LDKPaymentError 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_PaymentIdPaymentErrorZ_is_ok(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceSemanticErrorZ. + * Frees any resources used by the CResult_PaymentIdPaymentErrorZ. */ -void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); +void CResult_PaymentIdPaymentErrorZ_free(struct LDKCResult_PaymentIdPaymentErrorZ _res); /** - * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` + * Creates a new CResult_PaymentIdPaymentErrorZ 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); +struct LDKCResult_PaymentIdPaymentErrorZ CResult_PaymentIdPaymentErrorZ_clone(const struct LDKCResult_PaymentIdPaymentErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_DescriptionCreationErrorZ in the success state. + * Creates a new CResult_NonePaymentErrorZ in the success state. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_ok(void); /** - * Creates a new CResult_DescriptionCreationErrorZ in the error state. + * Creates a new CResult_NonePaymentErrorZ in the error state. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_err(struct LDKPaymentError e); /** * Checks if the given object is currently in the success state */ -bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); +bool CResult_NonePaymentErrorZ_is_ok(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_DescriptionCreationErrorZ. + * Frees any resources used by the CResult_NonePaymentErrorZ. */ -void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); +void CResult_NonePaymentErrorZ_free(struct LDKCResult_NonePaymentErrorZ _res); /** - * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` + * Creates a new CResult_NonePaymentErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_NonePaymentErrorZ CResult_NonePaymentErrorZ_clone(const struct LDKCResult_NonePaymentErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. + * Creates a new CResult_StringErrorZ in the success state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); /** - * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. + * Creates a new CResult_StringErrorZ in the error state. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error 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_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. + * Frees any resources used by the CResult_StringErrorZ. */ -void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); +void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); /** - * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` + * Creates a new CResult_StringErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); +struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_StringErrorZ in the success state. + * Creates a new CResult_PublicKeyErrorZ in the success state. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_ok(struct LDKStr o); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_ok(struct LDKPublicKey o); /** - * Creates a new CResult_StringErrorZ in the error state. + * Creates a new CResult_PublicKeyErrorZ in the error state. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_err(enum LDKSecp256k1Error e); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_err(enum LDKSecp256k1Error e); /** * Checks if the given object is currently in the success state */ -bool CResult_StringErrorZ_is_ok(const struct LDKCResult_StringErrorZ *NONNULL_PTR o); +bool CResult_PublicKeyErrorZ_is_ok(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_StringErrorZ. + * Frees any resources used by the CResult_PublicKeyErrorZ. */ -void CResult_StringErrorZ_free(struct LDKCResult_StringErrorZ _res); +void CResult_PublicKeyErrorZ_free(struct LDKCResult_PublicKeyErrorZ _res); /** - * Creates a new CResult_StringErrorZ which has the same data as `orig` + * Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_StringErrorZ CResult_StringErrorZ_clone(const struct LDKCResult_StringErrorZ *NONNULL_PTR orig); +struct LDKCResult_PublicKeyErrorZ CResult_PublicKeyErrorZ_clone(const struct LDKCResult_PublicKeyErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. @@ -17461,188 +17880,443 @@ void CVec_BalanceZ_free(struct LDKCVec_BalanceZ _res); struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(struct LDKC2Tuple_BlockHashChannelMonitorZ o); /** - * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + * Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. + */ +struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + */ +void CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ _res); + +/** + * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. + */ +struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); + +/** + * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + */ +void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); + +/** + * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents + */ +struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); + +/** + * Constructs a new COption_CustomOnionMessageContentsZ containing nothing + */ +struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state + */ +void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); + +/** + * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. + */ +struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); + +/** + * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. + */ +struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. + */ +void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); + +/** + * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + */ +struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); + +/** + * Constructs a new COption_NetAddressZ containing nothing + */ +struct LDKCOption_NetAddressZ COption_NetAddressZ_none(void); + +/** + * Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state + */ +void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); + +/** + * Creates a new COption_NetAddressZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_NetAddressZ COption_NetAddressZ_clone(const struct LDKCOption_NetAddressZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + */ +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); + +/** + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + */ +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_u8ZPeerHandleErrorZ_is_ok(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + */ +void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); + +/** + * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_clone(const struct LDKCResult_CVec_u8ZPeerHandleErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NonePeerHandleErrorZ in the success state. + */ +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); + +/** + * Creates a new CResult_NonePeerHandleErrorZ in the error state. + */ +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NonePeerHandleErrorZ. + */ +void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); + +/** + * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_boolPeerHandleErrorZ in the success state. + */ +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); + +/** + * Creates a new CResult_boolPeerHandleErrorZ in the error state. + */ +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_boolPeerHandleErrorZ. + */ +void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); + +/** + * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NoneSendErrorZ in the success state. + */ +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); + +/** + * Creates a new CResult_NoneSendErrorZ in the error state. + */ +struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneSendErrorZ. + */ +void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); + +/** + * Creates a new CResult_SiPrefixParseErrorZ in the success state. + */ +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_ok(enum LDKSiPrefix o); + +/** + * Creates a new CResult_SiPrefixParseErrorZ in the error state. + */ +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_err(struct LDKParseError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_SiPrefixParseErrorZ_is_ok(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_SiPrefixParseErrorZ. + */ +void CResult_SiPrefixParseErrorZ_free(struct LDKCResult_SiPrefixParseErrorZ _res); + +/** + * Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_SiPrefixParseErrorZ CResult_SiPrefixParseErrorZ_clone(const struct LDKCResult_SiPrefixParseErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. + */ +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_ok(struct LDKInvoice o); + +/** + * Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. + */ +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_err(struct LDKParseOrSemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceParseOrSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. + */ +void CResult_InvoiceParseOrSemanticErrorZ_free(struct LDKCResult_InvoiceParseOrSemanticErrorZ _res); + +/** + * Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InvoiceParseOrSemanticErrorZ CResult_InvoiceParseOrSemanticErrorZ_clone(const struct LDKCResult_InvoiceParseOrSemanticErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. + */ +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_ok(struct LDKSignedRawInvoice o); + +/** + * Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. + */ +struct LDKCResult_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_err(struct LDKParseError e); + +/** + * Checks if the given object is currently in the success state */ -struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(struct LDKDecodeError e); +bool CResult_SignedRawInvoiceParseErrorZ_is_ok(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR o); /** - * Checks if the given object is currently in the success state + * Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. */ -bool CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(const struct LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ *NONNULL_PTR o); +void CResult_SignedRawInvoiceParseErrorZ_free(struct LDKCResult_SignedRawInvoiceParseErrorZ _res); /** - * Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. + * Creates a new CResult_SignedRawInvoiceParseErrorZ 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_SignedRawInvoiceParseErrorZ CResult_SignedRawInvoiceParseErrorZ_clone(const struct LDKCResult_SignedRawInvoiceParseErrorZ *NONNULL_PTR orig); /** - * Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKC2Tuple_PublicKeyTypeZ C2Tuple_PublicKeyTypeZ_new(struct LDKPublicKey a, struct LDKType b); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(const struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ *NONNULL_PTR orig); /** - * Frees any resources used by the C2Tuple_PublicKeyTypeZ. + * Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. */ -void C2Tuple_PublicKeyTypeZ_free(struct LDKC2Tuple_PublicKeyTypeZ _res); +struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(struct LDKRawInvoice a, struct LDKThirtyTwoBytes b, struct LDKInvoiceSignature c); /** - * Frees the buffer pointed to by `data` if `datalen` is non-0. + * Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. */ -void CVec_C2Tuple_PublicKeyTypeZZ_free(struct LDKCVec_C2Tuple_PublicKeyTypeZZ _res); +void C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(struct LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ _res); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents + * Creates a new CResult_PayeePubKeyErrorZ in the success state. */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_some(struct LDKCustomOnionMessageContents o); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_ok(struct LDKPayeePubKey o); /** - * Constructs a new COption_CustomOnionMessageContentsZ containing nothing + * Creates a new CResult_PayeePubKeyErrorZ in the error state. */ -struct LDKCOption_CustomOnionMessageContentsZ COption_CustomOnionMessageContentsZ_none(void); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_err(enum LDKSecp256k1Error e); /** - * Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state + * Checks if the given object is currently in the success state */ -void COption_CustomOnionMessageContentsZ_free(struct LDKCOption_CustomOnionMessageContentsZ _res); +bool CResult_PayeePubKeyErrorZ_is_ok(const struct LDKCResult_PayeePubKeyErrorZ *NONNULL_PTR o); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. + * Frees any resources used by the CResult_PayeePubKeyErrorZ. */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(struct LDKCOption_CustomOnionMessageContentsZ o); +void CResult_PayeePubKeyErrorZ_free(struct LDKCResult_PayeePubKeyErrorZ _res); /** - * Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. + * Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(struct LDKDecodeError e); +struct LDKCResult_PayeePubKeyErrorZ CResult_PayeePubKeyErrorZ_clone(const struct LDKCResult_PayeePubKeyErrorZ *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_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(const struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ *NONNULL_PTR o); +void CVec_PrivateRouteZ_free(struct LDKCVec_PrivateRouteZ _res); /** - * Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. + * Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. */ -void CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(struct LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ _res); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_ok(struct LDKPositiveTimestamp o); /** - * Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress + * Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. */ -struct LDKCOption_NetAddressZ COption_NetAddressZ_some(struct LDKNetAddress o); +struct LDKCResult_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_err(enum LDKCreationError 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_PositiveTimestampCreationErrorZ_is_ok(const struct LDKCResult_PositiveTimestampCreationErrorZ *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_PositiveTimestampCreationErrorZ. */ -void COption_NetAddressZ_free(struct LDKCOption_NetAddressZ _res); +void CResult_PositiveTimestampCreationErrorZ_free(struct LDKCResult_PositiveTimestampCreationErrorZ _res); /** - * Creates a new COption_NetAddressZ which has the same data as `orig` + * Creates a new CResult_PositiveTimestampCreationErrorZ 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_PositiveTimestampCreationErrorZ CResult_PositiveTimestampCreationErrorZ_clone(const struct LDKCResult_PositiveTimestampCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. + * Creates a new CResult_NoneSemanticErrorZ in the success state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_ok(struct LDKCVec_u8Z o); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_ok(void); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. + * Creates a new CResult_NoneSemanticErrorZ in the error state. */ -struct LDKCResult_CVec_u8ZPeerHandleErrorZ CResult_CVec_u8ZPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_err(enum LDKSemanticError 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_NoneSemanticErrorZ_is_ok(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. + * Frees any resources used by the CResult_NoneSemanticErrorZ. */ -void CResult_CVec_u8ZPeerHandleErrorZ_free(struct LDKCResult_CVec_u8ZPeerHandleErrorZ _res); +void CResult_NoneSemanticErrorZ_free(struct LDKCResult_NoneSemanticErrorZ _res); /** - * Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_NoneSemanticErrorZ 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_NoneSemanticErrorZ CResult_NoneSemanticErrorZ_clone(const struct LDKCResult_NoneSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NonePeerHandleErrorZ in the success state. + * Creates a new CResult_InvoiceSemanticErrorZ in the success state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_ok(void); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_ok(struct LDKInvoice o); /** - * Creates a new CResult_NonePeerHandleErrorZ in the error state. + * Creates a new CResult_InvoiceSemanticErrorZ in the error state. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_err(enum LDKSemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NonePeerHandleErrorZ_is_ok(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR o); +bool CResult_InvoiceSemanticErrorZ_is_ok(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePeerHandleErrorZ. + * Frees any resources used by the CResult_InvoiceSemanticErrorZ. */ -void CResult_NonePeerHandleErrorZ_free(struct LDKCResult_NonePeerHandleErrorZ _res); +void CResult_InvoiceSemanticErrorZ_free(struct LDKCResult_InvoiceSemanticErrorZ _res); /** - * Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_NonePeerHandleErrorZ CResult_NonePeerHandleErrorZ_clone(const struct LDKCResult_NonePeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_InvoiceSemanticErrorZ CResult_InvoiceSemanticErrorZ_clone(const struct LDKCResult_InvoiceSemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_boolPeerHandleErrorZ in the success state. + * Creates a new CResult_DescriptionCreationErrorZ in the success state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_ok(bool o); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_ok(struct LDKDescription o); /** - * Creates a new CResult_boolPeerHandleErrorZ in the error state. + * Creates a new CResult_DescriptionCreationErrorZ in the error state. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_err(struct LDKPeerHandleError e); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_err(enum LDKCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_boolPeerHandleErrorZ_is_ok(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR o); +bool CResult_DescriptionCreationErrorZ_is_ok(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_boolPeerHandleErrorZ. + * Frees any resources used by the CResult_DescriptionCreationErrorZ. */ -void CResult_boolPeerHandleErrorZ_free(struct LDKCResult_boolPeerHandleErrorZ _res); +void CResult_DescriptionCreationErrorZ_free(struct LDKCResult_DescriptionCreationErrorZ _res); /** - * Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` + * Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. */ -struct LDKCResult_boolPeerHandleErrorZ CResult_boolPeerHandleErrorZ_clone(const struct LDKCResult_boolPeerHandleErrorZ *NONNULL_PTR orig); +struct LDKCResult_DescriptionCreationErrorZ CResult_DescriptionCreationErrorZ_clone(const struct LDKCResult_DescriptionCreationErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_NoneSendErrorZ in the success state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the success state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_ok(void); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_ok(struct LDKPrivateRoute o); /** - * Creates a new CResult_NoneSendErrorZ in the error state. + * Creates a new CResult_PrivateRouteCreationErrorZ in the error state. */ -struct LDKCResult_NoneSendErrorZ CResult_NoneSendErrorZ_err(struct LDKSendError e); +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_err(enum LDKCreationError e); /** * Checks if the given object is currently in the success state */ -bool CResult_NoneSendErrorZ_is_ok(const struct LDKCResult_NoneSendErrorZ *NONNULL_PTR o); +bool CResult_PrivateRouteCreationErrorZ_is_ok(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NoneSendErrorZ. + * Frees any resources used by the CResult_PrivateRouteCreationErrorZ. */ -void CResult_NoneSendErrorZ_free(struct LDKCResult_NoneSendErrorZ _res); +void CResult_PrivateRouteCreationErrorZ_free(struct LDKCResult_PrivateRouteCreationErrorZ _res); + +/** + * Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_PrivateRouteCreationErrorZ CResult_PrivateRouteCreationErrorZ_clone(const struct LDKCResult_PrivateRouteCreationErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_u32GraphSyncErrorZ in the success state. @@ -18665,6 +19339,32 @@ void CResult_LockedChannelMonitorNoneZ_free(struct LDKCResult_LockedChannelMonit */ void CVec_OutPointZ_free(struct LDKCVec_OutPointZ _res); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_MonitorUpdateIdZ_free(struct LDKCVec_MonitorUpdateIdZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(const struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements. + */ +struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(struct LDKOutPoint a, struct LDKCVec_MonitorUpdateIdZ b); + +/** + * Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ. + */ +void C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(struct LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ _res); + /** * Frees any resources used by the PaymentPurpose */ @@ -18781,6 +19481,11 @@ struct LDKHTLCDestination HTLCDestination_next_hop_channel(struct LDKPublicKey n */ struct LDKHTLCDestination HTLCDestination_unknown_next_hop(uint64_t requested_forward_scid); +/** + * Utility method to constructs a new InvalidForward-variant HTLCDestination + */ +struct LDKHTLCDestination HTLCDestination_invalid_forward(uint64_t requested_forward_scid); + /** * Utility method to constructs a new FailedPayment-variant HTLCDestination */ @@ -18815,17 +19520,17 @@ struct LDKEvent Event_clone(const struct LDKEvent *NONNULL_PTR orig); /** * Utility method to constructs a new FundingGenerationReady-variant Event */ -struct LDKEvent Event_funding_generation_ready(struct LDKThirtyTwoBytes temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t channel_value_satoshis, struct LDKCVec_u8Z output_script, 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, struct LDKU128 user_channel_id); /** - * Utility method to constructs a new PaymentReceived-variant Event + * Utility method to constructs a new PaymentClaimable-variant Event */ -struct LDKEvent Event_payment_received(struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); +struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKThirtyTwoBytes via_channel_id, struct LDKCOption_u128Z via_user_channel_id); /** * 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); +struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose); /** * Utility method to constructs a new PaymentSent-variant Event @@ -18862,6 +19567,11 @@ struct LDKEvent Event_probe_failed(struct LDKThirtyTwoBytes payment_id, struct L */ struct LDKEvent Event_pending_htlcs_forwardable(uint64_t time_forwardable); +/** + * Utility method to constructs a new HTLCIntercepted-variant Event + */ +struct LDKEvent Event_htlcintercepted(struct LDKThirtyTwoBytes intercept_id, uint64_t requested_next_hop_scid, struct LDKThirtyTwoBytes payment_hash, uint64_t inbound_amount_msat, uint64_t expected_outbound_amount_msat); + /** * Utility method to constructs a new SpendableOutputs-variant Event */ @@ -18872,10 +19582,15 @@ struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptor */ 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 ChannelReady-variant Event + */ +struct LDKEvent Event_channel_ready(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKChannelTypeFeatures channel_type); + /** * Utility method to constructs a new ChannelClosed-variant Event */ -struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, uint64_t user_channel_id, struct LDKClosureReason reason); +struct LDKEvent Event_channel_closed(struct LDKThirtyTwoBytes channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason); /** * Utility method to constructs a new DiscardFunding-variant Event @@ -19053,9 +19768,9 @@ struct LDKAPIError APIError_apimisuse_error(struct LDKStr err); struct LDKAPIError APIError_fee_rate_too_high(struct LDKStr err, uint32_t feerate); /** - * Utility method to constructs a new RouteError-variant APIError + * Utility method to constructs a new InvalidRoute-variant APIError */ -struct LDKAPIError APIError_route_error(struct LDKStr err); +struct LDKAPIError APIError_invalid_route(struct LDKStr err); /** * Utility method to constructs a new ChannelUnavailable-variant APIError @@ -19135,13 +19850,27 @@ 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); +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); +/** + * Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. + */ +void PrintableString_free(struct LDKPrintableString this_obj); + +struct LDKStr PrintableString_get_a(const struct LDKPrintableString *NONNULL_PTR this_ptr); + +void PrintableString_set_a(struct LDKPrintableString *NONNULL_PTR this_ptr, struct LDKStr val); + +/** + * Constructs a new PrintableString given each field + */ +MUST_USE_RES struct LDKPrintableString PrintableString_new(struct LDKStr a_arg); + /** * Calls the free function if one is set */ @@ -20188,10 +20917,38 @@ bool UserConfig_get_manually_accept_inbound_channels(const struct LDKUserConfig */ void UserConfig_set_manually_accept_inbound_channels(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); +/** + * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over + * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC + * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. + * + * Setting this to true may break backwards compatibility with LDK versions < 0.0.113. + * + * Default value: false. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted + */ +bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_PTR this_ptr); + +/** + * If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over + * fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC + * intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. + * + * Setting this to true may break backwards compatibility with LDK versions < 0.0.113. + * + * Default value: false. + * + * [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + * [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted + */ +void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); + /** * Constructs a new UserConfig given each field */ -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); +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, bool accept_intercept_htlcs_arg); /** * Creates a copy of the UserConfig @@ -20393,6 +21150,11 @@ enum LDKConfirmationTarget ConfirmationTarget_normal(void); */ enum LDKConfirmationTarget ConfirmationTarget_high_priority(void); +/** + * Checks if two ConfirmationTargets contain equal inner contents. + */ +uint64_t ConfirmationTarget_hash(const enum LDKConfirmationTarget *NONNULL_PTR o); + /** * Checks if two ConfirmationTargets contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -20482,6 +21244,11 @@ MUST_USE_RES struct LDKCResult_LockedChannelMonitorNoneZ ChainMonitor_get_monito */ MUST_USE_RES struct LDKCVec_OutPointZ ChainMonitor_list_monitors(const struct LDKChainMonitor *NONNULL_PTR this_arg); +/** + * Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). + */ +MUST_USE_RES struct LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ ChainMonitor_list_pending_monitor_updates(const struct LDKChainMonitor *NONNULL_PTR this_arg); + /** * Indicates the persistence of a [`ChannelMonitor`] has completed after * [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation. @@ -20748,9 +21515,11 @@ MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_m * Gets the list of pending events which were generated by previous actions, clearing the list * in the process. * - * This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to - * EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do - * no internal locking in ChannelMonitors. + * This is called by the [`EventsProvider::process_pending_events`] implementation for + * [`ChainMonitor`]. + * + * [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events + * [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor */ MUST_USE_RES struct LDKCVec_EventZ ChannelMonitor_get_and_clear_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg); @@ -20839,7 +21608,7 @@ MUST_USE_RES struct LDKCVec_TransactionOutputsZ ChannelMonitor_best_block_update /** * Returns the set of txids that should be monitored for re-organization out of the chain. */ -MUST_USE_RES struct LDKCVec_TxidZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKCVec_C2Tuple_TxidBlockHashZZ ChannelMonitor_get_relevant_txids(const struct LDKChannelMonitor *NONNULL_PTR this_arg); /** * Gets the latest best block which was connected either via the [`chain::Listen`] or @@ -20939,46 +21708,46 @@ struct LDKCResult_OutPointDecodeErrorZ OutPoint_read(struct LDKu8slice ser); void DelayedPaymentOutputDescriptor_free(struct LDKDelayedPaymentOutputDescriptor this_obj); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ struct LDKOutPoint DelayedPaymentOutputDescriptor_get_outpoint(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ void DelayedPaymentOutputDescriptor_set_outpoint(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * Per commitment point to derive delayed_payment_key by key holder + * Per commitment point to derive the delayed payment key by key holder. */ struct LDKPublicKey DelayedPaymentOutputDescriptor_get_per_commitment_point(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * Per commitment point to derive delayed_payment_key by key holder + * Per commitment point to derive the delayed payment key by key holder. */ void DelayedPaymentOutputDescriptor_set_per_commitment_point(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in * the witness_script. */ uint16_t DelayedPaymentOutputDescriptor_get_to_self_delay(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The nSequence value which must be set in the spending input to satisfy the OP_CSV in + * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in * the witness_script. */ void DelayedPaymentOutputDescriptor_set_to_self_delay(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, uint16_t val); /** - * The output which is referenced by the given outpoint + * 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 + * The output which is referenced by the given outpoint. */ void DelayedPaymentOutputDescriptor_set_output(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); @@ -20995,16 +21764,14 @@ struct LDKPublicKey DelayedPaymentOutputDescriptor_get_revocation_pubkey(const s void DelayedPaymentOutputDescriptor_set_revocation_pubkey(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ const uint8_t (*DelayedPaymentOutputDescriptor_get_channel_keys_id(const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ void DelayedPaymentOutputDescriptor_set_channel_keys_id(struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); @@ -21051,38 +21818,36 @@ struct LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ DelayedPaymentOutpu void StaticPaymentOutputDescriptor_free(struct LDKStaticPaymentOutputDescriptor this_obj); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ struct LDKOutPoint StaticPaymentOutputDescriptor_get_outpoint(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr); /** - * The outpoint which is spendable + * The outpoint which is spendable. */ void StaticPaymentOutputDescriptor_set_outpoint(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKOutPoint val); /** - * The output which is referenced by the given outpoint + * 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 + * The output which is referenced by the given outpoint. */ void StaticPaymentOutputDescriptor_set_output(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKTxOut val); /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ const uint8_t (*StaticPaymentOutputDescriptor_get_channel_keys_id(const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr))[32]; /** - * Arbitrary identification information returned by a call to - * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in - * the channel to spend the output. + * Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. + * This may be useful in re-deriving keys used in the channel to spend the output. */ void StaticPaymentOutputDescriptor_set_channel_keys_id(struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); @@ -21169,11 +21934,6 @@ struct LDKCResult_SpendableOutputDescriptorDecodeErrorZ SpendableOutputDescripto */ void BaseSign_free(struct LDKBaseSign this_ptr); -/** - * Creates a copy of a Sign - */ -struct LDKSign Sign_clone(const struct LDKSign *NONNULL_PTR orig); - /** * Calls the free function if one is set */ @@ -21205,62 +21965,64 @@ void KeysInterface_free(struct LDKKeysInterface this_ptr); void InMemorySigner_free(struct LDKInMemorySigner this_obj); /** - * Private key of anchor tx + * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the + * holder's anchor output in a commitment transaction, if one is present. */ const uint8_t (*InMemorySigner_get_funding_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Private key of anchor tx + * Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the + * holder's anchor output in a commitment transaction, if one is present. */ void InMemorySigner_set_funding_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder secret key for blinded revocation pubkey + * Holder secret key for blinded revocation pubkey. */ const uint8_t (*InMemorySigner_get_revocation_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder secret key for blinded revocation pubkey + * Holder secret key for blinded revocation pubkey. */ void InMemorySigner_set_revocation_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ const uint8_t (*InMemorySigner_get_payment_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder secret key used for our balance in counterparty-broadcasted commitment transactions + * Holder secret key used for our balance in counterparty-broadcasted commitment transactions. */ void InMemorySigner_set_payment_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder secret key used in HTLC tx + * Holder secret key used in an HTLC transaction. */ const uint8_t (*InMemorySigner_get_delayed_payment_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder secret key used in HTLC tx + * Holder secret key used in an HTLC transaction. */ void InMemorySigner_set_delayed_payment_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Holder htlc secret key used in commitment tx htlc outputs + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ const uint8_t (*InMemorySigner_get_htlc_base_key(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Holder htlc secret key used in commitment tx htlc outputs + * Holder HTLC secret key used in commitment transaction HTLC outputs. */ void InMemorySigner_set_htlc_base_key(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKSecretKey val); /** - * Commitment seed + * Commitment seed. */ const uint8_t (*InMemorySigner_get_commitment_seed(const struct LDKInMemorySigner *NONNULL_PTR this_ptr))[32]; /** - * Commitment seed + * Commitment seed. */ void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); @@ -21270,76 +22032,87 @@ void InMemorySigner_set_commitment_seed(struct LDKInMemorySigner *NONNULL_PTR th struct LDKInMemorySigner InMemorySigner_clone(const struct LDKInMemorySigner *NONNULL_PTR orig); /** - * Create a new InMemorySigner + * Creates a new [`InMemorySigner`]. */ MUST_USE_RES struct LDKInMemorySigner InMemorySigner_new(struct LDKSecretKey node_secret, struct LDKSecretKey funding_key, struct LDKSecretKey revocation_base_key, struct LDKSecretKey payment_key, struct LDKSecretKey delayed_payment_base_key, struct LDKSecretKey htlc_base_key, struct LDKThirtyTwoBytes commitment_seed, uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** - * Counterparty pubkeys. - * Will panic if ready_channel wasn't called. + * Returns the counterparty's pubkeys. + * + * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. */ MUST_USE_RES struct LDKChannelPublicKeys InMemorySigner_counterparty_pubkeys(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The contest_delay value specified by our counterparty and applied on holder-broadcastable - * transactions, ie the amount of time that we have to wait to recover our funds if we + * Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable + * transactions, i.e., the amount of time that we have to wait to recover our funds if we * broadcast a transaction. - * Will panic if ready_channel wasn't called. + * + * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. */ MUST_USE_RES uint16_t InMemorySigner_counterparty_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * The contest_delay value specified by us and applied on transactions broadcastable - * by our counterparty, ie the amount of time that they have to wait to recover their funds + * Returns the `contest_delay` value specified by us and applied on transactions broadcastable + * by our counterparty, i.e., the amount of time that they have to wait to recover their funds * if they broadcast a transaction. - * Will panic if ready_channel wasn't called. + * + * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. */ MUST_USE_RES uint16_t InMemorySigner_holder_selected_contest_delay(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Whether the holder is the initiator - * Will panic if ready_channel wasn't called. + * Returns whether the holder is the initiator. + * + * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. */ MUST_USE_RES bool InMemorySigner_is_outbound(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** * Funding outpoint - * Will panic if ready_channel wasn't called. + * + * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. */ MUST_USE_RES struct LDKOutPoint InMemorySigner_funding_outpoint(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Obtain a ChannelTransactionParameters for this channel, to be used when verifying or + * Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or * building transactions. * - * Will panic if ready_channel wasn't called. + * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. */ MUST_USE_RES struct LDKChannelTransactionParameters InMemorySigner_get_channel_parameters(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Whether anchors should be used. - * Will panic if ready_channel wasn't called. + * Returns whether anchors should be used. + * + * Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. */ MUST_USE_RES bool InMemorySigner_opt_anchors(const struct LDKInMemorySigner *NONNULL_PTR this_arg); /** - * Sign the single input of spend_tx at index `input_idx` which spends the output - * described by descriptor, returning the witness stack for the input. + * Sign the single input of `spend_tx` at index `input_idx`, which spends the output described + * by `descriptor`, returning the witness stack for the input. + * + * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, + * is not spending the outpoint described by [`descriptor.outpoint`], + * or if an output descriptor `script_pubkey` does not match the one we can spend. * - * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * is not spending the outpoint described by `descriptor.outpoint`, - * or if an output descriptor script_pubkey does not match the one we can spend. + * [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint */ MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_counterparty_payment_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKStaticPaymentOutputDescriptor *NONNULL_PTR descriptor); /** - * Sign the single input of spend_tx at index `input_idx` which spends the output - * described by descriptor, returning the witness stack for the input. + * Sign the single input of `spend_tx` at index `input_idx` which spends the output + * described by `descriptor`, returning the witness stack for the input. * - * Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, - * is not spending the outpoint described by `descriptor.outpoint`, does not have a - * sequence set to `descriptor.to_self_delay`, or if an output descriptor - * script_pubkey does not match the one we can spend. + * Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, + * is not spending the outpoint described by [`descriptor.outpoint`], does not have a + * sequence set to [`descriptor.to_self_delay`], or if an output descriptor + * `script_pubkey` does not match the one we can spend. + * + * [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint + * [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay */ MUST_USE_RES struct LDKCResult_CVec_CVec_u8ZZNoneZ InMemorySigner_sign_dynamic_p2wsh_input(const struct LDKInMemorySigner *NONNULL_PTR this_arg, struct LDKTransaction spend_tx, uintptr_t input_idx, const struct LDKDelayedPaymentOutputDescriptor *NONNULL_PTR descriptor); @@ -21371,39 +22144,33 @@ struct LDKCResult_InMemorySignerDecodeErrorZ InMemorySigner_read(struct LDKu8sli void KeysManager_free(struct LDKKeysManager this_obj); /** - * Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your - * CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). - * starting_time isn't strictly required to actually be a time, but it must absolutely, + * Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g., + * your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). + * `starting_time` isn't strictly required to actually be a time, but it must absolutely, * without a doubt, be unique to this instance. ie if you start multiple times with the same - * seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to - * simply use the current time (with very high precision). + * `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this + * is to simply use the current time (with very high precision). * - * The seed MUST be backed up safely prior to use so that the keys can be re-created, however, - * obviously, starting_time should be unique every time you reload the library - it is only + * The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however, + * obviously, `starting_time` should be unique every time you reload the library - it is only * used to generate new ephemeral key data (which will be stored by the individual channel if * necessary). * * Note that the seed is required to recover certain on-chain funds independent of - * ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any - * channel, and some on-chain during-closing funds. + * [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required + * for any channel, and some on-chain during-closing funds. * - * Note that until the 0.1 release there is no guarantee of backward compatibility between - * versions. Once the library is more fully supported, the docs will be updated to include a - * detailed description of the guarantee. + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ MUST_USE_RES struct LDKKeysManager KeysManager_new(const uint8_t (*seed)[32], uint64_t starting_time_secs, uint32_t starting_time_nanos); /** - * Derive an old Sign containing per-channel secrets based on a key derivation parameters. - * - * Key derivation parameters are accessible through a per-channel secrets - * Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of - * onchain output detection for which a corresponding delayed_payment_key must be derived. + * Derive an old [`Sign`] containing per-channel secrets based on a key derivation parameters. */ MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const struct LDKKeysManager *NONNULL_PTR this_arg, uint64_t channel_value_satoshis, const uint8_t (*params)[32]); /** - * Creates a Transaction which spends the given descriptors to the given outputs, plus an + * Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an * output to the given change destination (if sufficient change value remains). The * transaction will have a feerate, at least, of the given value. * @@ -21413,8 +22180,8 @@ MUST_USE_RES struct LDKInMemorySigner KeysManager_derive_channel_keys(const stru * * We do not enforce that outputs meet the dust limit or that any output scripts are standard. * - * May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used - * this KeysManager or one of the `InMemorySigner` created by this KeysManager. + * May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used + * this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. */ MUST_USE_RES struct LDKCResult_TransactionNoneZ KeysManager_spend_spendable_outputs(const struct LDKKeysManager *NONNULL_PTR this_arg, struct LDKCVec_SpendableOutputDescriptorZ descriptors, struct LDKCVec_TxOutZ outputs, struct LDKCVec_u8Z change_destination_script, uint32_t feerate_sat_per_1000_weight); @@ -21436,8 +22203,9 @@ void PhantomKeysManager_free(struct LDKPhantomKeysManager this_obj); struct LDKKeysInterface PhantomKeysManager_as_KeysInterface(const struct LDKPhantomKeysManager *NONNULL_PTR this_arg); /** - * Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed` - * that is shared across all nodes that intend to participate in [phantom node payments] together. + * Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed` + * that is shared across all nodes that intend to participate in [phantom node payments] + * together. * * See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and * `starting_time_nanos`. @@ -21849,14 +22617,18 @@ struct LDKCOption_u64Z ChannelDetails_get_unspendable_punishment_reserve(const s void ChannelDetails_set_unspendable_punishment_reserve(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); /** - * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. + * The `user_channel_id` passed in to create_channel, or a random value if the channel was + * inbound. This may be zero for inbound channels serialized with LDK versions prior to + * 0.0.113. */ -uint64_t ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); +struct LDKU128 ChannelDetails_get_user_channel_id(const struct LDKChannelDetails *NONNULL_PTR this_ptr); /** - * The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. + * The `user_channel_id` passed in to create_channel, or a random value if the channel was + * inbound. This may be zero for inbound channels serialized with LDK versions prior to + * 0.0.113. */ -void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); +void ChannelDetails_set_user_channel_id(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKU128 val); /** * Our total balance. This is the amount we would get if we close the channel. @@ -21990,6 +22762,20 @@ struct LDKCOption_u32Z ChannelDetails_get_confirmations_required(const struct LD */ void ChannelDetails_set_confirmations_required(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); +/** + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + */ +struct LDKCOption_u32Z ChannelDetails_get_confirmations(const struct LDKChannelDetails *NONNULL_PTR this_ptr); + +/** + * The current number of confirmations on the funding transaction. + * + * This value will be `None` for objects serialized with LDK versions prior to 0.0.113. + */ +void ChannelDetails_set_confirmations(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); + /** * The number of blocks (after our commitment transaction confirms) that we will need to wait * until we can claim our funds after we force-close the channel. During this time our @@ -22113,7 +22899,7 @@ void ChannelDetails_set_config(struct LDKChannelDetails *NONNULL_PTR this_ptr, s /** * Constructs a new ChannelDetails given each field */ -MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, 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); +MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKThirtyTwoBytes channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t inbound_capacity_msat_arg, struct LDKCOption_u32Z confirmations_required_arg, struct LDKCOption_u32Z confirmations_arg, struct LDKCOption_u16Z force_close_spend_delay_arg, bool is_outbound_arg, bool is_channel_ready_arg, bool is_usable_arg, bool is_public_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg); /** * Creates a copy of the ChannelDetails @@ -22161,9 +22947,14 @@ struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIErr struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); /** - * Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure + * Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure + */ +struct LDKPaymentSendFailure PaymentSendFailure_all_failed_resend_safe(struct LDKCVec_APIErrorZ a); + +/** + * Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure */ -struct LDKPaymentSendFailure PaymentSendFailure_all_failed_retry_safe(struct LDKCVec_APIErrorZ a); +struct LDKPaymentSendFailure PaymentSendFailure_duplicate_payment(void); /** * Utility method to constructs a new PartialFailure-variant PaymentSendFailure @@ -22241,10 +23032,9 @@ MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configurati * * `user_channel_id` will be provided back as in * [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events - * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0 - * for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here. - * `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise - * ignored. + * correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a + * randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it + * is simply copied to events and otherwise ignored. * * Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is * greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. @@ -22266,7 +23056,7 @@ MUST_USE_RES struct LDKUserConfig ChannelManager_get_current_default_configurati * * Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, uint64_t user_channel_id, struct LDKUserConfig override_config); +MUST_USE_RES struct LDKCResult__u832APIErrorZ ChannelManager_create_channel(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPublicKey their_network_key, uint64_t channel_value_satoshis, uint64_t push_msat, struct LDKU128 user_channel_id, struct LDKUserConfig override_config); /** * Gets the list of open channels, in random order. See ChannelDetail field documentation for @@ -22366,21 +23156,27 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru * Value parameters are provided via the last hop in route, see documentation for RouteHop * fields for more info. * - * Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative - * payment), we don't do anything to stop you! We always try to ensure that if the provided - * next hop knows the preimage to payment_hash they can claim an additional amount as - * specified in the last hop in the route! Thus, you should probably do your own - * payment_preimage tracking (which you should already be doing as they represent \"proof of - * payment\") and prevent double-sends yourself. + * If a pending payment is currently in-flight with the same [`PaymentId`] provided, this + * method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment + * is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an + * [`Event::PaymentSent`]) LDK will not stop you from sending a second payment with the same + * [`PaymentId`]. + * + * Thus, in order to ensure duplicate payments are not sent, you should implement your own + * tracking of payments, including state to indicate once a payment has completed. Because you + * should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should + * consider using the [`PaymentHash`] as the key for tracking payments. In that case, the + * [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. * - * May generate SendHTLCs message(s) event on success, which should be relayed. + * May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via + * [`PeerManager::process_events`]). * * Each path may have a different return value, and PaymentSendValue may return a Vec with * each entry matching the corresponding-index entry in the route paths, see * PaymentSendFailure for more info. * * In general, a path may raise: - * * [`APIError::RouteError`] when an invalid route or forwarding parameter (cltv_delta, fee, + * * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, * node public key) is specified. * * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates * (including due to previous monitor update failure or new permanent monitor update @@ -22397,13 +23193,17 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru * newer nodes, it will be provided to you in the invoice. If you do not have one, the Route * must not contain multiple paths as multi-path payments require a recipient-provided * payment_secret. + * * If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature * bit set (either as required or as available). If multiple paths are present in the Route, * we assume the invoice had the basic_mpp feature set. * + * [`Event::PaymentSent`]: events::Event::PaymentSent + * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events + * * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKCResult_PaymentIdPaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); +MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id); /** * Retries a payment along the given [`Route`]. @@ -22422,15 +23222,21 @@ MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_retry_paym /** * Signals that no further retries for the given payment will occur. * - * After this method returns, any future calls to [`retry_payment`] for the given `payment_id` - * will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated, - * an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining - * pending HTLCs for this payment. + * After this method returns, no future calls to [`retry_payment`] for the given `payment_id` + * are allowed. If no [`Event::PaymentFailed`] event had been generated before, one will be + * generated as soon as there are no remaining pending HTLCs for this payment. * * Note that calling this method does *not* prevent a payment from succeeding. You must still * wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to * determine the ultimate status of a payment. * + * If an [`Event::PaymentFailed`] event is generated and we restart without this + * [`ChannelManager`] having been persisted, the payment may still be in the pending state + * upon restart. This allows further calls to [`retry_payment`] (and requiring a second call + * to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to + * [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`]. + * + * [`abandon_payment`]: Self::abandon_payment * [`retry_payment`]: Self::retry_payment * [`Event::PaymentFailed`]: events::Event::PaymentFailed * [`Event::PaymentSent`]: events::Event::PaymentSent @@ -22444,7 +23250,8 @@ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR * would be able to guess -- otherwise, an intermediate node may claim the payment and it will * never reach the recipient. * - * See [`send_payment`] documentation for more details on the return value of this function. + * See [`send_payment`] documentation for more details on the return value of this function + * and idempotency guarantees provided by the [`PaymentId`] key. * * Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See * [`send_payment`] for more information about the risks of duplicate preimage usage. @@ -22455,7 +23262,7 @@ void ChannelManager_abandon_payment(const struct LDKChannelManager *NONNULL_PTR * * Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None */ -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); +MUST_USE_RES struct LDKCResult_PaymentHashPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id); /** * Send a payment that is probing the given route for liquidity. We calculate the @@ -22524,6 +23331,41 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_funding_transaction_ */ 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); +/** + * Attempts to forward an intercepted HTLC over the provided channel id and with the provided + * amount to forward. Should only be called in response to an [`HTLCIntercepted`] event. + * + * Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time + * channel to a receiving node if the node lacks sufficient inbound liquidity. + * + * To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use + * [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the + * receiver's invoice route hints. These route hints will signal to LDK to generate an + * [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or + * [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event. + * + * Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop + * you from forwarding more than you received. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_forward_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id, const uint8_t (*next_hop_channel_id)[32], struct LDKPublicKey _next_node_id, uint64_t amt_to_forward_msat); + +/** + * Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to + * an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`]. + * + * Errors if the event was not handled in time, in which case the HTLC was automatically failed + * backwards. + * + * [`HTLCIntercepted`]: events::Event::HTLCIntercepted + */ +MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_fail_intercepted_htlc(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes intercept_id); + /** * Processes HTLCs which are pending waiting on random forward delay. * @@ -22550,12 +23392,12 @@ 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 + * after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources * along the path (including in our own channel on which we received it). * * 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 + * second copy of) the [`events::Event::PaymentClaimable`] 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 @@ -22566,7 +23408,7 @@ void ChannelManager_timer_tick_occurred(const struct LDKChannelManager *NONNULL_ 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 + * Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any * [`MessageSendEvent`]s needed to claim the payment. * * Note that calling this method does *not* guarantee that the payment has been claimed. You @@ -22574,16 +23416,15 @@ void ChannelManager_fail_htlc_backwards(const struct LDKChannelManager *NONNULL_ * 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` + * [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` * event matches your expectation. If you fail to do so and call this method, you may provide * the sender \"proof-of-payment\" when they did not fulfill the full expected payment. * - * [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived + * [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable * [`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 */ void ChannelManager_claim_funds(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_preimage); @@ -22610,7 +23451,7 @@ MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDK * [`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); +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, struct LDKU128 user_channel_id); /** * Accepts a request to open a channel after a [`events::Event::OpenChannelRequest`], treating @@ -22632,7 +23473,7 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * [`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_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); +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, struct LDKU128 user_channel_id); /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing @@ -22641,8 +23482,8 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * This differs from [`create_inbound_payment_for_hash`] only in that it generates the * [`PaymentHash`] and [`PaymentPreimage`] for you. * - * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which - * will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be + * The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which + * will have the [`PaymentClaimable::payment_preimage`] field filled in. That should then be * passed directly to [`claim_funds`]. * * See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. @@ -22658,8 +23499,8 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann * Errors if `min_value_msat` is greater than total bitcoin supply. * * [`claim_funds`]: Self::claim_funds - * [`PaymentReceived`]: events::Event::PaymentReceived - * [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage + * [`PaymentClaimable`]: events::Event::PaymentClaimable + * [`PaymentClaimable::payment_preimage`]: events::Event::PaymentClaimable::payment_preimage * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash */ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ ChannelManager_create_inbound_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); @@ -22681,7 +23522,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is * stored external to LDK. * - * A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a + * A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a * payment secret fetched via this method or [`create_inbound_payment`], and which is at least * the `min_value_msat` provided here, if one is provided. * @@ -22691,7 +23532,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * * `min_value_msat` should be set if the invoice being generated contains a value. Any payment * received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` - * before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the + * before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the * sender \"proof-of-payment\" unless they have paid the required amount. * * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for @@ -22702,9 +23543,9 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * * Note that we use block header time to time-out pending inbound payments (with some margin * to compensate for the inaccuracy of block header timestamps). Thus, in practice we will - * accept a payment and generate a [`PaymentReceived`] event for some time after the expiry. + * accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. * If you need exact expiry semantics, you should enforce them upon receipt of - * [`PaymentReceived`]. + * [`PaymentClaimable`]. * * Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` * set to at least [`MIN_FINAL_CLTV_EXPIRY`]. @@ -22720,7 +23561,7 @@ MUST_USE_RES struct LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ Channe * Errors if `min_value_msat` is greater than total bitcoin supply. * * [`create_inbound_payment`]: Self::create_inbound_payment - * [`PaymentReceived`]: events::Event::PaymentReceived + * [`PaymentClaimable`]: events::Event::PaymentClaimable */ MUST_USE_RES struct LDKCResult_PaymentSecretNoneZ ChannelManager_create_inbound_payment_for_hash(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs); @@ -22751,14 +23592,30 @@ MUST_USE_RES struct LDKCResult_PaymentPreimageAPIErrorZ ChannelManager_get_payme * * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager */ -MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES uint64_t ChannelManager_get_phantom_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Gets route hints for use in receiving [phantom node payments]. + * + * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + */ +MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); + +/** + * Gets a fake short channel id for use in receiving intercepted payments. These fake scids are + * used when constructing the route hints for HTLCs intended to be intercepted. See + * [`ChannelManager::forward_intercepted_htlc`]. + * + * Note that this method is not guaranteed to return unique values, you may need to call it a few + * times to get a unique scid. + */ +MUST_USE_RES uint64_t ChannelManager_get_intercept_scid(const struct LDKChannelManager *NONNULL_PTR this_arg); /** - * Gets route hints for use in receiving [phantom node payments]. - * - * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager + * Gets inflight HTLC information by processing pending outbound payments that are in + * our channels. May be used during pathfinding to account for in-use channel liquidity. */ -MUST_USE_RES struct LDKPhantomRouteHints ChannelManager_get_phantom_route_hints(const struct LDKChannelManager *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKInFlightHtlcs ChannelManager_compute_inflight_htlcs(const struct LDKChannelManager *NONNULL_PTR this_arg); /** * Constructs a new MessageSendEventsProvider which calls the relevant methods on this_arg. @@ -22787,17 +23644,24 @@ struct LDKConfirm ChannelManager_as_Confirm(const struct LDKChannelManager *NONN /** * Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool * indicating whether persistence is necessary. Only one listener on - * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken - * up. + * [`await_persistable_update`], [`await_persistable_update_timeout`], or a future returned by + * [`get_persistable_update_future`] is guaranteed to be woken up. * * Note that this method is not available with the `no-std` feature. + * + * [`await_persistable_update`]: Self::await_persistable_update + * [`await_persistable_update_timeout`]: Self::await_persistable_update_timeout + * [`get_persistable_update_future`]: Self::get_persistable_update_future */ MUST_USE_RES bool ChannelManager_await_persistable_update_timeout(const struct LDKChannelManager *NONNULL_PTR this_arg, uint64_t max_wait); /** * Blocks until ChannelManager needs to be persisted. Only one listener on - * `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken - * up. + * [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by + * [`get_persistable_update_future`] is guaranteed to be woken up. + * + * [`await_persistable_update`]: Self::await_persistable_update + * [`get_persistable_update_future`]: Self::get_persistable_update_future */ void ChannelManager_await_persistable_update(const struct LDKChannelManager *NONNULL_PTR this_arg); @@ -26220,6 +27084,47 @@ uint64_t htlc_success_tx_weight(bool opt_anchors); */ uint64_t htlc_timeout_tx_weight(bool opt_anchors); +/** + * Creates a copy of the HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_clone(const enum LDKHTLCClaim *NONNULL_PTR orig); + +/** + * Utility method to constructs a new OfferedTimeout-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_offered_timeout(void); + +/** + * Utility method to constructs a new OfferedPreimage-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_offered_preimage(void); + +/** + * Utility method to constructs a new AcceptedTimeout-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_accepted_timeout(void); + +/** + * Utility method to constructs a new AcceptedPreimage-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_accepted_preimage(void); + +/** + * Utility method to constructs a new Revocation-variant HTLCClaim + */ +enum LDKHTLCClaim HTLCClaim_revocation(void); + +/** + * Checks if two HTLCClaims contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool HTLCClaim_eq(const enum LDKHTLCClaim *NONNULL_PTR a, const enum LDKHTLCClaim *NONNULL_PTR b); + +/** + * Check if a given input witness attempts to claim a HTLC. + */ +MUST_USE_RES struct LDKCOption_HTLCClaimZ HTLCClaim_from_witness(struct LDKWitness witness); + /** * Build the commitment secret from the seed and the commitment number */ @@ -26278,21 +27183,15 @@ struct LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ CounterpartyCommitme /** * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) * from the base secret and the per_commitment_point. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). */ -struct LDKCResult_SecretKeyErrorZ derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); +struct LDKSecretKey derive_private_key(struct LDKPublicKey per_commitment_point, const uint8_t (*base_secret)[32]); /** * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key) * from the base point and the per_commitment_key. This is the public equivalent of * derive_private_key - using only public keys to derive a public key instead of private keys. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). */ -struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); +struct LDKPublicKey derive_public_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey base_point); /** * Derives a per-commitment-transaction revocation key from its constituent parts. @@ -26301,11 +27200,8 @@ struct LDKCResult_PublicKeyErrorZ derive_public_key(struct LDKPublicKey per_comm * commitment transaction, thus per_commitment_secret always come from cheater * and revocation_base_secret always come from punisher, which is the broadcaster * of the transaction spending with this key knowledge. - * - * Note that this is infallible iff we trust that at least one of the two input keys are randomly - * generated (ie our own). */ -struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); +struct LDKSecretKey derive_private_revocation_key(const uint8_t (*per_commitment_secret)[32], const uint8_t (*countersignatory_revocation_base_secret)[32]); /** * Derives a per-commitment-transaction revocation public key from its constituent parts. This is @@ -26320,7 +27216,7 @@ struct LDKCResult_SecretKeyErrorZ derive_private_revocation_key(const uint8_t (* * Note that this is infallible iff we trust that at least one of the two input keys are randomly * generated (ie our own). */ -struct LDKCResult_PublicKeyErrorZ derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); +struct LDKPublicKey derive_public_revocation_key(struct LDKPublicKey per_commitment_point, struct LDKPublicKey countersignatory_revocation_base_point); /** * Frees any resources used by the TxCreationKeys, if is_owned is set and inner is non-NULL. @@ -26512,13 +27408,13 @@ struct LDKCResult_ChannelPublicKeysDecodeErrorZ ChannelPublicKeys_read(struct LD * Create per-state keys from channel base points and the per-commitment point. * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_derive_new(struct LDKPublicKey per_commitment_point, struct LDKPublicKey broadcaster_delayed_payment_base, struct LDKPublicKey broadcaster_htlc_base, struct LDKPublicKey countersignatory_revocation_base, struct LDKPublicKey countersignatory_htlc_base); /** * Generate per-state keys from channel static keys. * Key set is asymmetric and can't be used as part of counter-signatory set of transactions. */ -MUST_USE_RES struct LDKCResult_TxCreationKeysErrorZ TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); +MUST_USE_RES struct LDKTxCreationKeys TxCreationKeys_from_channel_static_keys(struct LDKPublicKey per_commitment_point, const struct LDKChannelPublicKeys *NONNULL_PTR broadcaster_keys, const struct LDKChannelPublicKeys *NONNULL_PTR countersignatory_keys); /** * A script either spendable by the revocation @@ -26642,7 +27538,19 @@ struct LDKCVec_u8Z make_funding_redeemscript(struct LDKPublicKey broadcaster, st * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the * commitment transaction). */ -struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); +struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32], uint32_t feerate_per_kw, uint16_t contest_delay, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc, bool opt_anchors, bool use_non_zero_fee_anchors, struct LDKPublicKey broadcaster_delayed_payment_key, struct LDKPublicKey revocation_key); + +/** + * Returns the witness required to satisfy and spend a HTLC input. + * + * Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKWitness build_htlc_input_witness(struct LDKSignature local_sig, struct LDKSignature remote_sig, struct LDKThirtyTwoBytes preimage, struct LDKu8slice redeem_script, bool opt_anchors); + +/** + * Gets the witnessScript for the to_remote output when anchors are enabled. + */ +struct LDKCVec_u8Z get_to_countersignatory_with_anchors_redeemscript(struct LDKPublicKey payment_point); /** * Gets the witnessScript for an anchor output from the funding public key. @@ -26654,6 +27562,11 @@ struct LDKTransaction build_htlc_transaction(const uint8_t (*commitment_txid)[32 */ struct LDKCVec_u8Z get_anchor_redeemscript(struct LDKPublicKey funding_pubkey); +/** + * Returns the witness required to satisfy and spend an anchor input. + */ +struct LDKWitness build_anchor_input_witness(struct LDKPublicKey funding_key, struct LDKSignature funding_sig); + /** * Frees any resources used by the ChannelTransactionParameters, if is_owned is set and inner is non-NULL. */ @@ -26733,10 +27646,24 @@ enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_anchors(const struct */ void ChannelTransactionParameters_set_opt_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); +/** + * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors) + * It is intended merely for backwards compatibility with signers that need it. + * There is no support for this feature in LDK channel negotiation. + */ +enum LDKCOption_NoneZ ChannelTransactionParameters_get_opt_non_zero_fee_anchors(const struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr); + +/** + * Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors) + * It is intended merely for backwards compatibility with signers that need it. + * There is no support for this feature in LDK channel negotiation. + */ +void ChannelTransactionParameters_set_opt_non_zero_fee_anchors(struct LDKChannelTransactionParameters *NONNULL_PTR this_ptr, enum LDKCOption_NoneZ val); + /** * Constructs a new ChannelTransactionParameters given each field */ -MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg); +MUST_USE_RES struct LDKChannelTransactionParameters ChannelTransactionParameters_new(struct LDKChannelPublicKeys holder_pubkeys_arg, uint16_t holder_selected_contest_delay_arg, bool is_outbound_from_holder_arg, struct LDKCounterpartyChannelTransactionParameters counterparty_parameters_arg, struct LDKOutPoint funding_outpoint_arg, enum LDKCOption_NoneZ opt_anchors_arg, enum LDKCOption_NoneZ opt_non_zero_fee_anchors_arg); /** * Creates a copy of the ChannelTransactionParameters @@ -27193,6 +28120,20 @@ bool ChannelFeatures_eq(const struct LDKChannelFeatures *NONNULL_PTR a, const st */ bool InvoiceFeatures_eq(const struct LDKInvoiceFeatures *NONNULL_PTR a, const struct LDKInvoiceFeatures *NONNULL_PTR b); +/** + * Checks if two OfferFeaturess 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 OfferFeatures_eq(const struct LDKOfferFeatures *NONNULL_PTR a, const struct LDKOfferFeatures *NONNULL_PTR b); + +/** + * Checks if two InvoiceRequestFeaturess 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 InvoiceRequestFeatures_eq(const struct LDKInvoiceRequestFeatures *NONNULL_PTR a, const struct LDKInvoiceRequestFeatures *NONNULL_PTR b); + /** * Checks if two ChannelTypeFeaturess contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -27220,6 +28161,16 @@ struct LDKChannelFeatures ChannelFeatures_clone(const struct LDKChannelFeatures */ struct LDKInvoiceFeatures InvoiceFeatures_clone(const struct LDKInvoiceFeatures *NONNULL_PTR orig); +/** + * Creates a copy of the OfferFeatures + */ +struct LDKOfferFeatures OfferFeatures_clone(const struct LDKOfferFeatures *NONNULL_PTR orig); + +/** + * Creates a copy of the InvoiceRequestFeatures + */ +struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_clone(const struct LDKInvoiceRequestFeatures *NONNULL_PTR orig); + /** * Creates a copy of the ChannelTypeFeatures */ @@ -27245,6 +28196,16 @@ void ChannelFeatures_free(struct LDKChannelFeatures this_obj); */ void InvoiceFeatures_free(struct LDKInvoiceFeatures this_obj); +/** + * Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. + */ +void OfferFeatures_free(struct LDKOfferFeatures this_obj); + +/** + * Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. + */ +void InvoiceRequestFeatures_free(struct LDKInvoiceRequestFeatures this_obj); + /** * Frees any resources used by the ChannelTypeFeatures, if is_owned is set and inner is non-NULL. */ @@ -27294,6 +28255,28 @@ MUST_USE_RES struct LDKInvoiceFeatures InvoiceFeatures_empty(void); */ MUST_USE_RES bool InvoiceFeatures_requires_unknown_bits(const struct LDKInvoiceFeatures *NONNULL_PTR this_arg); +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKOfferFeatures OfferFeatures_empty(void); + +/** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ +MUST_USE_RES bool OfferFeatures_requires_unknown_bits(const struct LDKOfferFeatures *NONNULL_PTR this_arg); + +/** + * Create a blank Features with no features set + */ +MUST_USE_RES struct LDKInvoiceRequestFeatures InvoiceRequestFeatures_empty(void); + +/** + * Returns true if this `Features` object contains unknown feature flags which are set as + * \"required\". + */ +MUST_USE_RES bool InvoiceRequestFeatures_requires_unknown_bits(const struct LDKInvoiceRequestFeatures *NONNULL_PTR this_arg); + /** * Create a blank Features with no features set */ @@ -27355,6 +28338,26 @@ struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures */ struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); +/** + * Serialize the OfferFeatures object into a byte array which can be read by OfferFeatures_read + */ +struct LDKCVec_u8Z OfferFeatures_write(const struct LDKOfferFeatures *NONNULL_PTR obj); + +/** + * Read a OfferFeatures from a byte array, created by OfferFeatures_write + */ +struct LDKCResult_OfferFeaturesDecodeErrorZ OfferFeatures_read(struct LDKu8slice ser); + +/** + * Serialize the InvoiceRequestFeatures object into a byte array which can be read by InvoiceRequestFeatures_read + */ +struct LDKCVec_u8Z InvoiceRequestFeatures_write(const struct LDKInvoiceRequestFeatures *NONNULL_PTR obj); + +/** + * Read a InvoiceRequestFeatures from a byte array, created by InvoiceRequestFeatures_write + */ +struct LDKCResult_InvoiceRequestFeaturesDecodeErrorZ InvoiceRequestFeatures_read(struct LDKu8slice ser); + /** * Set this feature as optional. */ @@ -28245,10 +29248,11 @@ MUST_USE_RES struct LDKP2PGossipSync P2PGossipSync_new(const struct LDKNetworkGr 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 + * Handles any network updates originating from [`Event`]s. + * + * [`Event`]: crate::util::events::Event */ -struct LDKEventHandler NetworkGraph_as_EventHandler(const struct LDKNetworkGraph *NONNULL_PTR this_arg); +void NetworkGraph_handle_network_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKNetworkUpdate *NONNULL_PTR network_update); /** * Constructs a new RoutingMessageHandler which calls the relevant methods on this_arg. @@ -28513,13 +29517,6 @@ struct LDKDirectedChannelInfo DirectedChannelInfo_clone(const struct LDKDirected */ MUST_USE_RES struct LDKChannelInfo DirectedChannelInfo_channel(const struct LDKDirectedChannelInfo *NONNULL_PTR this_arg); -/** - * Returns information for the direction. - * - * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None - */ -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. */ @@ -28557,7 +29554,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 LDKCOption_u64Z htlc_maximum_msat); +struct LDKEffectiveCapacity EffectiveCapacity_total(uint64_t capacity_msat, uint64_t htlc_maximum_msat); /** * Utility method to constructs a new Infinite-variant EffectiveCapacity @@ -29046,6 +30043,79 @@ MUST_USE_RES struct LDKCVec_NodeIdZ ReadOnlyNetworkGraph_list_nodes(const struct */ MUST_USE_RES struct LDKCOption_CVec_NetAddressZZ ReadOnlyNetworkGraph_get_addresses(const struct LDKReadOnlyNetworkGraph *NONNULL_PTR this_arg, struct LDKPublicKey pubkey); +/** + * Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. + */ +void DefaultRouter_free(struct LDKDefaultRouter this_obj); + +/** + * Creates a new router. + */ +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. + * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is + */ +struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); + +/** + * Calls the free function if one is set + */ +void Router_free(struct LDKRouter this_ptr); + +/** + * Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. + */ +void ScorerAccountingForInFlightHtlcs_free(struct LDKScorerAccountingForInFlightHtlcs this_obj); + +/** + * Initialize a new `ScorerAccountingForInFlightHtlcs`. + */ +MUST_USE_RES struct LDKScorerAccountingForInFlightHtlcs ScorerAccountingForInFlightHtlcs_new(struct LDKScore scorer, struct LDKInFlightHtlcs inflight_htlcs); + +/** + * Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read + */ +struct LDKCVec_u8Z ScorerAccountingForInFlightHtlcs_write(const struct LDKScorerAccountingForInFlightHtlcs *NONNULL_PTR 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 ScorerAccountingForInFlightHtlcs_as_Score(const struct LDKScorerAccountingForInFlightHtlcs *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); + +/** + * Creates a copy of the InFlightHtlcs + */ +struct LDKInFlightHtlcs InFlightHtlcs_clone(const struct LDKInFlightHtlcs *NONNULL_PTR orig); + +/** + * Constructs an empty `InFlightHtlcs`. + */ +MUST_USE_RES struct LDKInFlightHtlcs InFlightHtlcs_new(void); + +/** + * 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); + /** * Frees any resources used by the RouteHop, if is_owned is set and inner is non-NULL. */ @@ -30221,9 +31291,14 @@ struct LDKCVec_u8Z ProbabilisticScorer_write(const struct LDKProbabilisticScorer 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. + * Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL. + */ +void BlindedPath_free(struct LDKBlindedPath this_obj); + +/** + * Creates a copy of the BlindedPath */ -void BlindedRoute_free(struct LDKBlindedRoute this_obj); +struct LDKBlindedPath BlindedPath_clone(const struct LDKBlindedPath *NONNULL_PTR orig); /** * Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. @@ -30231,22 +31306,27 @@ void BlindedRoute_free(struct LDKBlindedRoute this_obj); void BlindedHop_free(struct LDKBlindedHop this_obj); /** - * Create a blinded route to be forwarded along `node_pks`. The last node pubkey in `node_pks` + * Creates a copy of the BlindedHop + */ +struct LDKBlindedHop BlindedHop_clone(const struct LDKBlindedHop *NONNULL_PTR orig); + +/** + * Create a blinded path to be forwarded along `node_pks`. The last node pubkey in `node_pks` * will be the destination node. * * 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); +MUST_USE_RES struct LDKCResult_BlindedPathNoneZ BlindedPath_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 + * Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read */ -struct LDKCVec_u8Z BlindedRoute_write(const struct LDKBlindedRoute *NONNULL_PTR obj); +struct LDKCVec_u8Z BlindedPath_write(const struct LDKBlindedPath *NONNULL_PTR obj); /** - * Read a BlindedRoute from a byte array, created by BlindedRoute_write + * Read a BlindedPath from a byte array, created by BlindedPath_write */ -struct LDKCResult_BlindedRouteDecodeErrorZ BlindedRoute_read(struct LDKu8slice ser); +struct LDKCResult_BlindedPathDecodeErrorZ BlindedPath_read(struct LDKu8slice ser); /** * Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read @@ -30268,15 +31348,20 @@ void OnionMessenger_free(struct LDKOnionMessenger this_obj); */ void Destination_free(struct LDKDestination this_ptr); +/** + * Creates a copy of the Destination + */ +struct LDKDestination Destination_clone(const struct LDKDestination *NONNULL_PTR orig); + /** * Utility method to constructs a new Node-variant Destination */ struct LDKDestination Destination_node(struct LDKPublicKey a); /** - * Utility method to constructs a new BlindedRoute-variant Destination + * Utility method to constructs a new BlindedPath-variant Destination */ -struct LDKDestination Destination_blinded_route(struct LDKBlindedRoute a); +struct LDKDestination Destination_blinded_path(struct LDKBlindedPath a); /** * Frees any resources used by the SendError @@ -30318,6 +31403,16 @@ struct LDKSendError SendError_invalid_message(void); */ struct LDKSendError SendError_buffer_full(void); +/** + * Utility method to constructs a new GetNodeIdFailed-variant SendError + */ +struct LDKSendError SendError_get_node_id_failed(void); + +/** + * Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError + */ +struct LDKSendError SendError_blinded_path_advance_failed(void); + /** * Checks if two SendErrors contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -30341,7 +31436,7 @@ MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKKeysInterface * * 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_custom_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKCustomOnionMessageContents msg, struct LDKBlindedRoute reply_path); +MUST_USE_RES struct LDKCResult_NoneSendErrorZ OnionMessenger_send_onion_message(const struct LDKOnionMessenger *NONNULL_PTR this_arg, struct LDKCVec_PublicKeyZ intermediate_nodes, struct LDKDestination destination, struct LDKOnionMessageContents message, struct LDKBlindedPath reply_path); /** * Constructs a new OnionMessageHandler which calls the relevant methods on this_arg. @@ -30355,6 +31450,16 @@ struct LDKOnionMessageHandler OnionMessenger_as_OnionMessageHandler(const struct */ struct LDKOnionMessageProvider OnionMessenger_as_OnionMessageProvider(const struct LDKOnionMessenger *NONNULL_PTR this_arg); +/** + * Frees any resources used by the OnionMessageContents + */ +void OnionMessageContents_free(struct LDKOnionMessageContents this_ptr); + +/** + * Utility method to constructs a new Custom-variant OnionMessageContents + */ +struct LDKOnionMessageContents OnionMessageContents_custom(struct LDKCustomOnionMessageContents a); + /** * Calls the free function if one is set */ @@ -30966,7 +32071,7 @@ struct LDKFallback Fallback_clone(const struct LDKFallback *NONNULL_PTR orig); /** * Utility method to constructs a new SegWitProgram-variant Fallback */ -struct LDKFallback Fallback_seg_wit_program(struct LDKu5 version, struct LDKCVec_u8Z program); +struct LDKFallback Fallback_seg_wit_program(struct LDKU5 version, struct LDKCVec_u8Z program); /** * Utility method to constructs a new PubKeyHash-variant Fallback @@ -31474,11 +32579,6 @@ void InvoicePayer_free(struct LDKInvoicePayer this_obj); */ void Payer_free(struct LDKPayer this_ptr); -/** - * Calls the free function if one is set - */ -void Router_free(struct LDKRouter this_ptr); - /** * Frees any resources used by the Retry */ @@ -31546,31 +32646,80 @@ MUST_USE_RES struct LDKInvoicePayer InvoicePayer_new(struct LDKPayer payer, stru /** * Pays the given [`Invoice`], caching it for later use in case a retry is needed. * - * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has - * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so - * for you. + * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long + * as the payment is still pending. Once the payment completes or fails, you must ensure that + * a second payment with the same [`PaymentHash`] is never sent. + * + * If you wish to use a different payment idempotency token, see + * [`Self::pay_invoice_with_id`]. */ MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice); +/** + * Pays the given [`Invoice`] with a custom idempotency key, caching the invoice for later use + * in case a retry is needed. + * + * Note that idempotency is only guaranteed as long as the payment is still pending. Once the + * payment completes or fails, no idempotency guarantees are made. + * + * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] + * has never been paid before. + * + * See [`Self::pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency + * token. + */ +MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, struct LDKThirtyTwoBytes payment_id); + /** * Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in * case a retry is needed. * - * You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has - * never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so - * for you. + * [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long + * as the payment is still pending. Once the payment completes or fails, you must ensure that + * a second payment with the same [`PaymentHash`] is never sent. + * + * If you wish to use a different payment idempotency token, see + * [`Self::pay_zero_value_invoice_with_id`]. */ MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_zero_value_invoice(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats); +/** + * Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key, + * caching the invoice for later use in case a retry is needed. + * + * Note that idempotency is only guaranteed as long as the payment is still pending. Once the + * payment completes or fails, no idempotency guarantees are made. + * + * You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] + * has never been paid before. + * + * See [`Self::pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the + * idempotency token. + */ +MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_zero_value_invoice_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, const struct LDKInvoice *NONNULL_PTR invoice, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); + /** * Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in * case a retry is needed. * - * You should ensure that `payment_preimage` is unique and that its `payment_hash` has never - * been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you. + * The hash of the [`PaymentPreimage`] is used as the [`PaymentId`], which ensures idempotency + * as long as the payment is still pending. Once the payment completes or fails, you must + * ensure that a second payment with the same [`PaymentPreimage`] is never sent. */ MUST_USE_RES struct LDKCResult_PaymentIdPaymentErrorZ InvoicePayer_pay_pubkey(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); +/** + * Pays `pubkey` an amount using the hash of the given preimage and a custom idempotency key, + * caching the invoice for later use in case a retry is needed. + * + * Note that idempotency is only guaranteed as long as the payment is still pending. Once the + * payment completes or fails, no idempotency guarantees are made. + * + * You should ensure that the [`PaymentPreimage`] is unique and the corresponding + * [`PaymentHash`] has never been paid before. + */ +MUST_USE_RES struct LDKCResult_NonePaymentErrorZ InvoicePayer_pay_pubkey_with_id(const struct LDKInvoicePayer *NONNULL_PTR this_arg, struct LDKPublicKey pubkey, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id, uint64_t amount_msats, uint32_t final_cltv_expiry_delta); + /** * Removes the payment cached by the given payment hash. * @@ -31585,27 +32734,6 @@ 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. @@ -31718,21 +32846,12 @@ struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, 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. - */ -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, struct LDKLockableScore scorer); - -/** - * Constructs a new Router which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is + * See [`create_invoice_from_channelmanager_and_duration_since_epoch`] + * This version allows for providing a custom [`PaymentHash`] for the invoice. + * This may be useful if you're building an on-chain swap or involving another protocol where + * the payment hash is also involved outside the scope of lightning. */ -struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); +struct LDKCResult_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKKeysInterface keys_manager, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash); /** * Constructs a new Payer which calls the relevant methods on this_arg. diff --git a/lightning-c-bindings/include/lightningpp.hpp b/lightning-c-bindings/include/lightningpp.hpp index 544d531..3949222 100644 --- a/lightning-c-bindings/include/lightningpp.hpp +++ b/lightning-c-bindings/include/lightningpp.hpp @@ -2,8 +2,7 @@ namespace LDK { // Forward declarations class Str; -class BlindedRoute; -class BlindedHop; +class HTLCClaim; class CounterpartyCommitmentSecrets; class TxCreationKeys; class ChannelPublicKeys; @@ -19,8 +18,14 @@ class CommitmentTransaction; class TrustedCommitmentTransaction; class ShutdownScript; class InvalidShutdownScript; +class BlindedPath; +class BlindedHop; class BackgroundProcessor; class GossipSync; +class DefaultRouter; +class Router; +class ScorerAccountingForInFlightHtlcs; +class InFlightHtlcs; class RouteHop; class Route; class RouteParameters; @@ -61,7 +66,10 @@ class InitFeatures; class NodeFeatures; class ChannelFeatures; class InvoiceFeatures; +class OfferFeatures; +class InvoiceRequestFeatures; class ChannelTypeFeatures; +class OnionMessageContents; class CustomOnionMessageContents; class NodeId; class NetworkGraph; @@ -102,15 +110,31 @@ class UserConfig; class APIError; class BigSize; class Hostname; +class PrintableString; class OutPoint; class CustomMessageReader; class Type; class InvoicePayer; class Payer; -class Router; class Retry; class PaymentError; -class InFlightHtlcs; +class ChannelMonitorUpdate; +class MonitorEvent; +class HTLCUpdate; +class Balance; +class ChannelMonitor; +class ExpandedKey; +class CustomMessageHandler; +class IgnoringMessageHandler; +class ErroringMessageHandler; +class MessageHandler; +class SocketDescriptor; +class PeerHandleError; +class PeerManager; +class OnionMessenger; +class Destination; +class SendError; +class CustomOnionMessageHandler; class ParseError; class ParseOrSemanticError; class Invoice; @@ -131,23 +155,6 @@ class PrivateRoute; class CreationError; class SemanticError; class SignOrCreationError; -class ChannelMonitorUpdate; -class MonitorEvent; -class HTLCUpdate; -class Balance; -class ChannelMonitor; -class ExpandedKey; -class CustomMessageHandler; -class IgnoringMessageHandler; -class ErroringMessageHandler; -class MessageHandler; -class SocketDescriptor; -class PeerHandleError; -class PeerManager; -class OnionMessenger; -class Destination; -class SendError; -class CustomOnionMessageHandler; class RapidGossipSync; class Persister; class DecodeError; @@ -194,7 +201,6 @@ class ChannelMessageHandler; class RoutingMessageHandler; class OnionMessageHandler; class GraphSyncError; -class DefaultRouter; class Level; class Record; class Logger; @@ -204,150 +210,77 @@ class MonitorUpdateId; class Persist; class LockedChannelMonitor; class ChainMonitor; -class CVec_SpendableOutputDescriptorZ; class CResult_LockedChannelMonitorNoneZ; class CResult_PhantomRouteHintsDecodeErrorZ; -class COption_C2Tuple_u64u64ZZ; class CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ; class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ; -class CResult_HTLCUpdateDecodeErrorZ; -class C2Tuple_SignatureCVec_SignatureZZ; class CVec_C2Tuple_u32TxOutZZ; +class CResult_FundingCreatedDecodeErrorZ; class CResult_ChannelInfoDecodeErrorZ; -class COption_WriteableScoreZ; class CResult_NoneSendErrorZ; -class CResult_FundingCreatedDecodeErrorZ; -class CResult_ChannelAnnouncementDecodeErrorZ; -class CResult_PositiveTimestampCreationErrorZ; -class CVec_OutPointZ; class CResult_CVec_u8ZPeerHandleErrorZ; -class CResult_InvoiceFeaturesDecodeErrorZ; +class CResult_GossipTimestampFilterDecodeErrorZ; class COption_NetworkUpdateZ; class COption_u64Z; -class CResult_TxOutAccessErrorZ; -class CResult_TrustedClosingTransactionNoneZ; class CResult_PaymentPreimageAPIErrorZ; -class CResult_ChannelMonitorUpdateDecodeErrorZ; class CResult_RouteHintDecodeErrorZ; -class C2Tuple_PublicKeyTypeZ; -class CResult_NetAddressDecodeErrorZ; +class COption_FilterZ; class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; -class CResult_ChannelReestablishDecodeErrorZ; -class CVec_UpdateAddHTLCZ; class CResult_CommitmentSignedDecodeErrorZ; +class CVec_UpdateAddHTLCZ; class COption_u32Z; -class CResult_InitFeaturesDecodeErrorZ; class CResult_StaticPaymentOutputDescriptorDecodeErrorZ; -class CResult_PublicKeyNoneZ; -class CResult_PaymentIdPaymentSendFailureZ; +class CVec_C2Tuple_TxidBlockHashZZ; class CResult_CommitmentTransactionDecodeErrorZ; class CResult_TransactionNoneZ; class CResult_ClosingSignedFeeRangeDecodeErrorZ; -class CResult_OnionMessageDecodeErrorZ; -class CResult_PingDecodeErrorZ; -class CResult_UnsignedNodeAnnouncementDecodeErrorZ; -class CResult_ReplyChannelRangeDecodeErrorZ; -class CResult_GossipTimestampFilterDecodeErrorZ; -class CVec_TransactionOutputsZ; class CResult_ErrorMessageDecodeErrorZ; class CResult_OpenChannelDecodeErrorZ; -class CVec_CVec_u8ZZ; -class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ; -class CResult_SecretKeyErrorZ; -class CResult_ShutdownScriptDecodeErrorZ; -class CResult_ProbabilisticScorerDecodeErrorZ; class CResult_QueryChannelRangeDecodeErrorZ; -class CResult_TxCreationKeysDecodeErrorZ; -class C2Tuple_usizeTransactionZ; -class CResult_ChannelFeaturesDecodeErrorZ; -class CVec_ChannelMonitorZ; class CVec_TransactionZ; +class C2Tuple_TxidBlockHashZ; +class CResult_ChannelFeaturesDecodeErrorZ; class CResult_ChannelReadyDecodeErrorZ; -class CResult_RouteHopDecodeErrorZ; class CResult_UpdateFeeDecodeErrorZ; -class CResult_NodeAnnouncementDecodeErrorZ; -class CVec_BalanceZ; class CResult_HTLCOutputInCommitmentDecodeErrorZ; class CResult_boolLightningErrorZ; -class CResult_TxCreationKeysErrorZ; -class COption_HTLCDestinationZ; class CResult_NodeIdDecodeErrorZ; +class COption_HTLCDestinationZ; +class C2Tuple_BlockHashChannelMonitorZ; class CResult_ShutdownScriptInvalidShutdownScriptZ; class CResult_NodeAnnouncementInfoDecodeErrorZ; class CResult_COption_NetworkUpdateZDecodeErrorZ; -class CResult_RecoverableSignatureNoneZ; -class C2Tuple_BlockHashChannelMonitorZ; -class C3Tuple_RawInvoice_u832InvoiceSignatureZ; class CVec_UpdateFailMalformedHTLCZ; -class CResult_FundingSignedDecodeErrorZ; -class CResult_NetworkGraphDecodeErrorZ; -class CResult_InvoiceSignOrCreationErrorZ; +class CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ; class CVec_RouteHopZ; -class COption_FilterZ; class COption_CustomOnionMessageContentsZ; -class CResult_NodeInfoDecodeErrorZ; -class CVec_NodeIdZ; -class CResult_RouteLightningErrorZ; -class CResult_ChannelPublicKeysDecodeErrorZ; -class CVec_u8Z; class CVec_C2Tuple_BlockHashChannelMonitorZZ; -class CResult_NonePaymentSendFailureZ; class CVec_ThirtyTwoBytesZ; class CResult_ClosingSignedDecodeErrorZ; +class CResult_NonePaymentErrorZ; class CVec_CResult_NoneAPIErrorZZ; -class CResult_HolderCommitmentTransactionDecodeErrorZ; class CResult_CounterpartyCommitmentSecretsDecodeErrorZ; -class CResult_ChannelCounterpartyDecodeErrorZ; -class CResult_WarningMessageDecodeErrorZ; -class CResult_SignatureNoneZ; -class CVec_RouteHintHopZ; -class CResult_SecretKeyNoneZ; class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ; -class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; +class CVec_RouteHintHopZ; class CResult_PaymentParametersDecodeErrorZ; -class CResult_PaymentPurposeDecodeErrorZ; -class CResult_InitDecodeErrorZ; -class CResult_OutPointDecodeErrorZ; -class CResult_BlindedRouteDecodeErrorZ; -class CVec_ChannelDetailsZ; -class CVec_MessageSendEventZ; +class CVec_U5Z; class CResult_SignDecodeErrorZ; -class COption_NetAddressZ; -class C2Tuple_OutPointScriptZ; -class CResult_RouteHintHopDecodeErrorZ; -class CResult_C2Tuple_SignatureSignatureZNoneZ; -class CResult_UpdateFailMalformedHTLCDecodeErrorZ; -class CResult_SharedSecretNoneZ; -class CVec_TxidZ; +class CResult_UnsignedChannelAnnouncementDecodeErrorZ; class COption_AccessZ; -class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; -class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; class CResult_PongDecodeErrorZ; -class CResult_CVec_CVec_u8ZZNoneZ; +class C2Tuple_OutPointCVec_MonitorUpdateIdZZ; +class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ; class C2Tuple_SignatureSignatureZ; -class C2Tuple_PaymentHashPaymentSecretZ; class C2Tuple_BlockHashChannelManagerZ; class CResult_ChannelTransactionParametersDecodeErrorZ; -class CResult_AcceptChannelDecodeErrorZ; -class CVec_SignatureZ; -class CVec_u64Z; -class CResult_UnsignedChannelAnnouncementDecodeErrorZ; class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ; class C2Tuple_PaymentHashPaymentIdZ; class CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ; class CResult_NoneErrorZ; -class CResult_COption_HTLCDestinationZDecodeErrorZ; class CResult_InFlightHtlcsDecodeErrorZ; -class CResult_StringErrorZ; -class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; -class COption_EventZ; -class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; -class CResult_ChannelTypeFeaturesDecodeErrorZ; +class CResult_COption_HTLCDestinationZDecodeErrorZ; class CResult_SiPrefixParseErrorZ; -class CVec_RouteHintZ; -class COption_u16Z; class CResult_BlindedHopDecodeErrorZ; -class CVec_CVec_RouteHopZZ; class CResult_TrustedCommitmentTransactionNoneZ; class CResult_FixedPenaltyScorerDecodeErrorZ; class CResult_NoneLightningErrorZ; @@ -357,157 +290,221 @@ class CResult_CVec_SignatureZNoneZ; class COption_CVec_NetAddressZZ; class CResult__u832APIErrorZ; class CResult_PaymentIdPaymentErrorZ; -class CResult_DescriptionCreationErrorZ; +class CResult_COption_MonitorEventZDecodeErrorZ; class CResult_RoutingFeesDecodeErrorZ; class CResult_PayeePubKeyErrorZ; -class CResult_COption_MonitorEventZDecodeErrorZ; -class C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ; -class CVec_C2Tuple_PublicKeyTypeZZ; +class CResult_DescriptionCreationErrorZ; +class CResult_QueryShortChannelIdsDecodeErrorZ; class CResult_InvoiceSemanticErrorZ; -class CResult_u32GraphSyncErrorZ; class CResult_UpdateAddHTLCDecodeErrorZ; -class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; -class CResult_NoneAPIErrorZ; -class CVec_NetAddressZ; -class CResult_ChannelDetailsDecodeErrorZ; -class CVec_PublicKeyZ; -class CVec_C2Tuple_usizeTransactionZZ; -class CResult_QueryShortChannelIdsDecodeErrorZ; -class CVec_PhantomRouteHintsZ; class COption_MonitorEventZ; -class C2Tuple_u64u64Z; class COption_TypeZ; class CResult_COption_TypeZDecodeErrorZ; -class C2Tuple_u32TxOutZ; class CResult_UpdateFailHTLCDecodeErrorZ; class CResult_InvoiceParseOrSemanticErrorZ; -class CResult_PaymentSecretNoneZ; -class CResult_ChannelConfigDecodeErrorZ; -class CVec_PrivateRouteZ; -class CResult_SpendableOutputDescriptorDecodeErrorZ; class CResult_RevokeAndACKDecodeErrorZ; +class CResult_SpendableOutputDescriptorDecodeErrorZ; class CResult_UnsignedChannelUpdateDecodeErrorZ; -class CResult_ShutdownDecodeErrorZ; class CVec_EventZ; class CResult_NoneSemanticErrorZ; -class CVec_MonitorEventZ; -class CVec_PaymentPreimageZ; class CVec_C2Tuple_u32ScriptZZ; class CResult_COption_ClosureReasonZDecodeErrorZ; -class CResult_PublicKeyErrorZ; -class CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ; +class CResult_PaymentHashPaymentSendFailureZ; class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ; -class CResult_NoneNoneZ; class CResult_RouteParametersDecodeErrorZ; -class COption_ClosureReasonZ; -class CResult_NodeAliasDecodeErrorZ; -class CVec_APIErrorZ; class CResult_PrivateRouteCreationErrorZ; -class CResult_boolPeerHandleErrorZ; +class CResult_NodeAliasDecodeErrorZ; class CVec_UpdateFulfillHTLCZ; -class CResult_BlindedRouteNoneZ; class CResult_AnnouncementSignaturesDecodeErrorZ; class CResult_UpdateFulfillHTLCDecodeErrorZ; -class CResult_ChannelUpdateDecodeErrorZ; class CResult_NodeFeaturesDecodeErrorZ; -class CVec_u5Z; class CResult_InMemorySignerDecodeErrorZ; -class CResult_PaymentSecretAPIErrorZ; -class CResult_CounterpartyForwardingInfoDecodeErrorZ; +class CResult_ReplyShortChannelIdsEndDecodeErrorZ; class COption_ScalarZ; -class CResult_SignedRawInvoiceParseErrorZ; -class CResult_RouteDecodeErrorZ; -class CResult_BuiltCommitmentTransactionDecodeErrorZ; -class COption_NoneZ; -class CVec_TxOutZ; class CResult_ChannelUpdateInfoDecodeErrorZ; -class C2Tuple_u32ScriptZ; +class CResult_BuiltCommitmentTransactionDecodeErrorZ; class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ; +class CVec_TxOutZ; class CVec_UpdateFailHTLCZ; -class CResult_ReplyShortChannelIdsEndDecodeErrorZ; - -class Str { -private: - LDKStr self; -public: - Str(const Str&) = delete; - Str(Str&& o) : self(o.self) { memset(&o, 0, sizeof(Str)); } - Str(LDKStr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKStr)); } - operator LDKStr() && { LDKStr res = self; memset(&self, 0, sizeof(LDKStr)); return res; } - ~Str() { Str_free(self); } - Str& operator=(Str&& o) { Str_free(self); self = o.self; memset(&o, 0, sizeof(Str)); return *this; } - LDKStr* operator &() { return &self; } - LDKStr* operator ->() { return &self; } - const LDKStr* operator &() const { return &self; } - const LDKStr* operator ->() const { return &self; } -}; -class BlindedRoute { -private: - LDKBlindedRoute self; -public: - BlindedRoute(const BlindedRoute&) = delete; - BlindedRoute(BlindedRoute&& o) : self(o.self) { memset(&o, 0, sizeof(BlindedRoute)); } - BlindedRoute(LDKBlindedRoute&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBlindedRoute)); } - operator LDKBlindedRoute() && { LDKBlindedRoute res = self; memset(&self, 0, sizeof(LDKBlindedRoute)); return res; } - ~BlindedRoute() { BlindedRoute_free(self); } - BlindedRoute& operator=(BlindedRoute&& o) { BlindedRoute_free(self); self = o.self; memset(&o, 0, sizeof(BlindedRoute)); return *this; } - LDKBlindedRoute* operator &() { return &self; } - LDKBlindedRoute* operator ->() { return &self; } - const LDKBlindedRoute* operator &() const { return &self; } - const LDKBlindedRoute* operator ->() const { return &self; } -}; -class BlindedHop { -private: - LDKBlindedHop self; -public: - BlindedHop(const BlindedHop&) = delete; - BlindedHop(BlindedHop&& o) : self(o.self) { memset(&o, 0, sizeof(BlindedHop)); } - BlindedHop(LDKBlindedHop&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBlindedHop)); } - operator LDKBlindedHop() && { LDKBlindedHop res = self; memset(&self, 0, sizeof(LDKBlindedHop)); return res; } - ~BlindedHop() { BlindedHop_free(self); } - BlindedHop& operator=(BlindedHop&& o) { BlindedHop_free(self); self = o.self; memset(&o, 0, sizeof(BlindedHop)); return *this; } - LDKBlindedHop* operator &() { return &self; } - LDKBlindedHop* operator ->() { return &self; } - const LDKBlindedHop* operator &() const { return &self; } - const LDKBlindedHop* operator ->() const { return &self; } -}; -class CounterpartyCommitmentSecrets { -private: - LDKCounterpartyCommitmentSecrets self; -public: - CounterpartyCommitmentSecrets(const CounterpartyCommitmentSecrets&) = delete; - CounterpartyCommitmentSecrets(CounterpartyCommitmentSecrets&& o) : self(o.self) { memset(&o, 0, sizeof(CounterpartyCommitmentSecrets)); } - CounterpartyCommitmentSecrets(LDKCounterpartyCommitmentSecrets&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCounterpartyCommitmentSecrets)); } - operator LDKCounterpartyCommitmentSecrets() && { LDKCounterpartyCommitmentSecrets res = self; memset(&self, 0, sizeof(LDKCounterpartyCommitmentSecrets)); return res; } - ~CounterpartyCommitmentSecrets() { CounterpartyCommitmentSecrets_free(self); } - CounterpartyCommitmentSecrets& operator=(CounterpartyCommitmentSecrets&& o) { CounterpartyCommitmentSecrets_free(self); self = o.self; memset(&o, 0, sizeof(CounterpartyCommitmentSecrets)); return *this; } - LDKCounterpartyCommitmentSecrets* operator &() { return &self; } - LDKCounterpartyCommitmentSecrets* operator ->() { return &self; } - const LDKCounterpartyCommitmentSecrets* operator &() const { return &self; } - const LDKCounterpartyCommitmentSecrets* operator ->() const { return &self; } -}; -class TxCreationKeys { -private: - LDKTxCreationKeys self; -public: - TxCreationKeys(const TxCreationKeys&) = delete; - TxCreationKeys(TxCreationKeys&& o) : self(o.self) { memset(&o, 0, sizeof(TxCreationKeys)); } - TxCreationKeys(LDKTxCreationKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTxCreationKeys)); } - operator LDKTxCreationKeys() && { LDKTxCreationKeys res = self; memset(&self, 0, sizeof(LDKTxCreationKeys)); return res; } - ~TxCreationKeys() { TxCreationKeys_free(self); } - TxCreationKeys& operator=(TxCreationKeys&& o) { TxCreationKeys_free(self); self = o.self; memset(&o, 0, sizeof(TxCreationKeys)); return *this; } - LDKTxCreationKeys* operator &() { return &self; } - LDKTxCreationKeys* operator ->() { return &self; } - const LDKTxCreationKeys* operator &() const { return &self; } - const LDKTxCreationKeys* operator ->() const { return &self; } -}; -class ChannelPublicKeys { -private: - LDKChannelPublicKeys self; -public: - ChannelPublicKeys(const ChannelPublicKeys&) = delete; - ChannelPublicKeys(ChannelPublicKeys&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelPublicKeys)); } - ChannelPublicKeys(LDKChannelPublicKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelPublicKeys)); } +class CVec_SpendableOutputDescriptorZ; +class COption_C2Tuple_u64u64ZZ; +class CResult_ChannelAnnouncementDecodeErrorZ; +class CResult_OfferFeaturesDecodeErrorZ; +class C2Tuple_SignatureCVec_SignatureZZ; +class CResult_HTLCUpdateDecodeErrorZ; +class CVec_OutPointZ; +class COption_WriteableScoreZ; +class CResult_PositiveTimestampCreationErrorZ; +class CResult_InvoiceFeaturesDecodeErrorZ; +class CResult_ChannelMonitorUpdateDecodeErrorZ; +class CResult_ReplyChannelRangeDecodeErrorZ; +class CResult_TxOutAccessErrorZ; +class CResult_TrustedClosingTransactionNoneZ; +class CResult_NetAddressDecodeErrorZ; +class C2Tuple_PublicKeyTypeZ; +class CResult_ChannelReestablishDecodeErrorZ; +class CResult_OnionMessageDecodeErrorZ; +class CResult_UnsignedNodeAnnouncementDecodeErrorZ; +class CResult_InvoiceSignOrCreationErrorZ; +class CResult_InitFeaturesDecodeErrorZ; +class CResult_PublicKeyNoneZ; +class CResult_PingDecodeErrorZ; +class CVec_TransactionOutputsZ; +class COption_HTLCClaimZ; +class CVec_CVec_u8ZZ; +class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ; +class CResult_ShutdownScriptDecodeErrorZ; +class CResult_ProbabilisticScorerDecodeErrorZ; +class CResult_TxCreationKeysDecodeErrorZ; +class C2Tuple_usizeTransactionZ; +class CResult_NodeAnnouncementDecodeErrorZ; +class CResult_BlindedPathDecodeErrorZ; +class CVec_ChannelMonitorZ; +class CResult_RouteHopDecodeErrorZ; +class CVec_BalanceZ; +class CResult_FundingSignedDecodeErrorZ; +class CResult_RecoverableSignatureNoneZ; +class C3Tuple_RawInvoice_u832InvoiceSignatureZ; +class CResult_NetworkGraphDecodeErrorZ; +class CResult_NodeInfoDecodeErrorZ; +class CVec_NodeIdZ; +class CResult_RouteLightningErrorZ; +class CResult_ChannelPublicKeysDecodeErrorZ; +class CVec_u8Z; +class CResult_NonePaymentSendFailureZ; +class CResult_HolderCommitmentTransactionDecodeErrorZ; +class CResult_WarningMessageDecodeErrorZ; +class CResult_ChannelCounterpartyDecodeErrorZ; +class CResult_SignatureNoneZ; +class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ; +class CResult_SecretKeyNoneZ; +class CResult_InitDecodeErrorZ; +class CVec_MonitorUpdateIdZ; +class CResult_PaymentPurposeDecodeErrorZ; +class CResult_OutPointDecodeErrorZ; +class CVec_ChannelDetailsZ; +class CVec_MessageSendEventZ; +class COption_NetAddressZ; +class C2Tuple_OutPointScriptZ; +class CResult_RouteHintHopDecodeErrorZ; +class CResult_C2Tuple_SignatureSignatureZNoneZ; +class CResult_UpdateFailMalformedHTLCDecodeErrorZ; +class CResult_SharedSecretNoneZ; +class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ; +class CResult_CVec_CVec_u8ZZNoneZ; +class C2Tuple_PaymentHashPaymentSecretZ; +class CResult_AcceptChannelDecodeErrorZ; +class CVec_SignatureZ; +class CVec_u64Z; +class CResult_StringErrorZ; +class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ; +class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ; +class COption_EventZ; +class CResult_ChannelTypeFeaturesDecodeErrorZ; +class CVec_RouteHintZ; +class COption_u16Z; +class CVec_CVec_RouteHopZZ; +class CVec_C2Tuple_PublicKeyTypeZZ; +class C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ; +class CResult_u32GraphSyncErrorZ; +class CResult_InvoiceRequestFeaturesDecodeErrorZ; +class CVec_PhantomRouteHintsZ; +class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; +class CResult_NoneAPIErrorZ; +class CVec_NetAddressZ; +class CResult_ChannelDetailsDecodeErrorZ; +class CVec_PublicKeyZ; +class CVec_C2Tuple_usizeTransactionZZ; +class C2Tuple_u64u64Z; +class C2Tuple_u32TxOutZ; +class CResult_PaymentSecretNoneZ; +class CResult_ChannelConfigDecodeErrorZ; +class CVec_PrivateRouteZ; +class CResult_BlindedPathNoneZ; +class CResult_ShutdownDecodeErrorZ; +class CVec_MonitorEventZ; +class CVec_PaymentPreimageZ; +class CResult_PublicKeyErrorZ; +class CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ; +class CResult_NoneNoneZ; +class COption_ClosureReasonZ; +class COption_u128Z; +class CVec_APIErrorZ; +class CResult_boolPeerHandleErrorZ; +class CResult_ChannelUpdateDecodeErrorZ; +class CResult_PaymentSecretAPIErrorZ; +class CResult_CounterpartyForwardingInfoDecodeErrorZ; +class C2Tuple_u32ScriptZ; +class CResult_SignedRawInvoiceParseErrorZ; +class CResult_RouteDecodeErrorZ; +class COption_NoneZ; + +class Str { +private: + LDKStr self; +public: + Str(const Str&) = delete; + Str(Str&& o) : self(o.self) { memset(&o, 0, sizeof(Str)); } + Str(LDKStr&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKStr)); } + operator LDKStr() && { LDKStr res = self; memset(&self, 0, sizeof(LDKStr)); return res; } + ~Str() { Str_free(self); } + Str& operator=(Str&& o) { Str_free(self); self = o.self; memset(&o, 0, sizeof(Str)); return *this; } + LDKStr* operator &() { return &self; } + LDKStr* operator ->() { return &self; } + const LDKStr* operator &() const { return &self; } + const LDKStr* operator ->() const { return &self; } +}; +class HTLCClaim { +private: + LDKHTLCClaim self; +public: + HTLCClaim(const HTLCClaim&) = delete; + HTLCClaim(HTLCClaim&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCClaim)); } + HTLCClaim(LDKHTLCClaim&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCClaim)); } + operator LDKHTLCClaim() && { LDKHTLCClaim res = self; memset(&self, 0, sizeof(LDKHTLCClaim)); return res; } + HTLCClaim& operator=(HTLCClaim&& o) { self = o.self; memset(&o, 0, sizeof(HTLCClaim)); return *this; } + LDKHTLCClaim* operator &() { return &self; } + LDKHTLCClaim* operator ->() { return &self; } + const LDKHTLCClaim* operator &() const { return &self; } + const LDKHTLCClaim* operator ->() const { return &self; } +}; +class CounterpartyCommitmentSecrets { +private: + LDKCounterpartyCommitmentSecrets self; +public: + CounterpartyCommitmentSecrets(const CounterpartyCommitmentSecrets&) = delete; + CounterpartyCommitmentSecrets(CounterpartyCommitmentSecrets&& o) : self(o.self) { memset(&o, 0, sizeof(CounterpartyCommitmentSecrets)); } + CounterpartyCommitmentSecrets(LDKCounterpartyCommitmentSecrets&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCounterpartyCommitmentSecrets)); } + operator LDKCounterpartyCommitmentSecrets() && { LDKCounterpartyCommitmentSecrets res = self; memset(&self, 0, sizeof(LDKCounterpartyCommitmentSecrets)); return res; } + ~CounterpartyCommitmentSecrets() { CounterpartyCommitmentSecrets_free(self); } + CounterpartyCommitmentSecrets& operator=(CounterpartyCommitmentSecrets&& o) { CounterpartyCommitmentSecrets_free(self); self = o.self; memset(&o, 0, sizeof(CounterpartyCommitmentSecrets)); return *this; } + LDKCounterpartyCommitmentSecrets* operator &() { return &self; } + LDKCounterpartyCommitmentSecrets* operator ->() { return &self; } + const LDKCounterpartyCommitmentSecrets* operator &() const { return &self; } + const LDKCounterpartyCommitmentSecrets* operator ->() const { return &self; } +}; +class TxCreationKeys { +private: + LDKTxCreationKeys self; +public: + TxCreationKeys(const TxCreationKeys&) = delete; + TxCreationKeys(TxCreationKeys&& o) : self(o.self) { memset(&o, 0, sizeof(TxCreationKeys)); } + TxCreationKeys(LDKTxCreationKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKTxCreationKeys)); } + operator LDKTxCreationKeys() && { LDKTxCreationKeys res = self; memset(&self, 0, sizeof(LDKTxCreationKeys)); return res; } + ~TxCreationKeys() { TxCreationKeys_free(self); } + TxCreationKeys& operator=(TxCreationKeys&& o) { TxCreationKeys_free(self); self = o.self; memset(&o, 0, sizeof(TxCreationKeys)); return *this; } + LDKTxCreationKeys* operator &() { return &self; } + LDKTxCreationKeys* operator ->() { return &self; } + const LDKTxCreationKeys* operator &() const { return &self; } + const LDKTxCreationKeys* operator ->() const { return &self; } +}; +class ChannelPublicKeys { +private: + LDKChannelPublicKeys self; +public: + ChannelPublicKeys(const ChannelPublicKeys&) = delete; + ChannelPublicKeys(ChannelPublicKeys&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelPublicKeys)); } + ChannelPublicKeys(LDKChannelPublicKeys&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelPublicKeys)); } operator LDKChannelPublicKeys() && { LDKChannelPublicKeys res = self; memset(&self, 0, sizeof(LDKChannelPublicKeys)); return res; } ~ChannelPublicKeys() { ChannelPublicKeys_free(self); } ChannelPublicKeys& operator=(ChannelPublicKeys&& o) { ChannelPublicKeys_free(self); self = o.self; memset(&o, 0, sizeof(ChannelPublicKeys)); return *this; } @@ -696,6 +693,36 @@ public: const LDKInvalidShutdownScript* operator &() const { return &self; } const LDKInvalidShutdownScript* operator ->() const { return &self; } }; +class BlindedPath { +private: + LDKBlindedPath self; +public: + BlindedPath(const BlindedPath&) = delete; + BlindedPath(BlindedPath&& o) : self(o.self) { memset(&o, 0, sizeof(BlindedPath)); } + BlindedPath(LDKBlindedPath&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBlindedPath)); } + operator LDKBlindedPath() && { LDKBlindedPath res = self; memset(&self, 0, sizeof(LDKBlindedPath)); return res; } + ~BlindedPath() { BlindedPath_free(self); } + BlindedPath& operator=(BlindedPath&& o) { BlindedPath_free(self); self = o.self; memset(&o, 0, sizeof(BlindedPath)); return *this; } + LDKBlindedPath* operator &() { return &self; } + LDKBlindedPath* operator ->() { return &self; } + const LDKBlindedPath* operator &() const { return &self; } + const LDKBlindedPath* operator ->() const { return &self; } +}; +class BlindedHop { +private: + LDKBlindedHop self; +public: + BlindedHop(const BlindedHop&) = delete; + BlindedHop(BlindedHop&& o) : self(o.self) { memset(&o, 0, sizeof(BlindedHop)); } + BlindedHop(LDKBlindedHop&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBlindedHop)); } + operator LDKBlindedHop() && { LDKBlindedHop res = self; memset(&self, 0, sizeof(LDKBlindedHop)); return res; } + ~BlindedHop() { BlindedHop_free(self); } + BlindedHop& operator=(BlindedHop&& o) { BlindedHop_free(self); self = o.self; memset(&o, 0, sizeof(BlindedHop)); return *this; } + LDKBlindedHop* operator &() { return &self; } + LDKBlindedHop* operator ->() { return &self; } + const LDKBlindedHop* operator &() const { return &self; } + const LDKBlindedHop* operator ->() const { return &self; } +}; class BackgroundProcessor { private: LDKBackgroundProcessor self; @@ -726,6 +753,95 @@ public: const LDKGossipSync* operator &() const { return &self; } const LDKGossipSync* operator ->() const { return &self; } }; +class DefaultRouter { +private: + LDKDefaultRouter self; +public: + DefaultRouter(const DefaultRouter&) = delete; + DefaultRouter(DefaultRouter&& o) : self(o.self) { memset(&o, 0, sizeof(DefaultRouter)); } + DefaultRouter(LDKDefaultRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDefaultRouter)); } + operator LDKDefaultRouter() && { LDKDefaultRouter res = self; memset(&self, 0, sizeof(LDKDefaultRouter)); return res; } + ~DefaultRouter() { DefaultRouter_free(self); } + DefaultRouter& operator=(DefaultRouter&& o) { DefaultRouter_free(self); self = o.self; memset(&o, 0, sizeof(DefaultRouter)); return *this; } + LDKDefaultRouter* operator &() { return &self; } + LDKDefaultRouter* operator ->() { return &self; } + const LDKDefaultRouter* operator &() const { return &self; } + const LDKDefaultRouter* operator ->() const { return &self; } +}; +class Router { +private: + LDKRouter self; +public: + Router(const Router&) = delete; + Router(Router&& o) : self(o.self) { memset(&o, 0, sizeof(Router)); } + Router(LDKRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouter)); } + operator LDKRouter() && { LDKRouter res = self; memset(&self, 0, sizeof(LDKRouter)); return res; } + ~Router() { Router_free(self); } + Router& operator=(Router&& o) { Router_free(self); self = o.self; memset(&o, 0, sizeof(Router)); return *this; } + LDKRouter* operator &() { return &self; } + LDKRouter* operator ->() { return &self; } + const LDKRouter* operator &() const { return &self; } + const LDKRouter* operator ->() const { return &self; } + /** + * 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 + */ + inline LDK::CResult_RouteLightningErrorZ find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs); + /** + * Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes + * `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment. + * + * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + inline LDK::CResult_RouteLightningErrorZ find_route_with_id(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id); + /** + * Lets the router know that payment through a specific path has failed. + */ + inline void notify_payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + /** + * Lets the router know that payment through a specific path was successful. + */ + inline void notify_payment_path_successful(struct LDKCVec_RouteHopZ path); + /** + * Lets the router know that a payment probe was successful. + */ + inline void notify_payment_probe_successful(struct LDKCVec_RouteHopZ path); + /** + * Lets the router know that a payment probe failed. + */ + inline void notify_payment_probe_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); +}; +class ScorerAccountingForInFlightHtlcs { +private: + LDKScorerAccountingForInFlightHtlcs self; +public: + ScorerAccountingForInFlightHtlcs(const ScorerAccountingForInFlightHtlcs&) = delete; + ScorerAccountingForInFlightHtlcs(ScorerAccountingForInFlightHtlcs&& o) : self(o.self) { memset(&o, 0, sizeof(ScorerAccountingForInFlightHtlcs)); } + ScorerAccountingForInFlightHtlcs(LDKScorerAccountingForInFlightHtlcs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKScorerAccountingForInFlightHtlcs)); } + operator LDKScorerAccountingForInFlightHtlcs() && { LDKScorerAccountingForInFlightHtlcs res = self; memset(&self, 0, sizeof(LDKScorerAccountingForInFlightHtlcs)); return res; } + ~ScorerAccountingForInFlightHtlcs() { ScorerAccountingForInFlightHtlcs_free(self); } + ScorerAccountingForInFlightHtlcs& operator=(ScorerAccountingForInFlightHtlcs&& o) { ScorerAccountingForInFlightHtlcs_free(self); self = o.self; memset(&o, 0, sizeof(ScorerAccountingForInFlightHtlcs)); return *this; } + LDKScorerAccountingForInFlightHtlcs* operator &() { return &self; } + LDKScorerAccountingForInFlightHtlcs* operator ->() { return &self; } + const LDKScorerAccountingForInFlightHtlcs* operator &() const { return &self; } + const LDKScorerAccountingForInFlightHtlcs* operator ->() const { return &self; } +}; +class InFlightHtlcs { +private: + LDKInFlightHtlcs self; +public: + InFlightHtlcs(const InFlightHtlcs&) = delete; + InFlightHtlcs(InFlightHtlcs&& o) : self(o.self) { memset(&o, 0, sizeof(InFlightHtlcs)); } + InFlightHtlcs(LDKInFlightHtlcs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInFlightHtlcs)); } + operator LDKInFlightHtlcs() && { LDKInFlightHtlcs res = self; memset(&self, 0, sizeof(LDKInFlightHtlcs)); return res; } + ~InFlightHtlcs() { InFlightHtlcs_free(self); } + InFlightHtlcs& operator=(InFlightHtlcs&& o) { InFlightHtlcs_free(self); self = o.self; memset(&o, 0, sizeof(InFlightHtlcs)); return *this; } + LDKInFlightHtlcs* operator &() { return &self; } + LDKInFlightHtlcs* operator ->() { return &self; } + const LDKInFlightHtlcs* operator &() const { return &self; } + const LDKInFlightHtlcs* operator ->() const { return &self; } +}; class RouteHop { private: LDKRouteHop self; @@ -1031,7 +1147,7 @@ public: * * See [`EventsProvider`] for details that must be considered when implementing this method. */ - inline void handle_event(const struct LDKEvent *NONNULL_PTR event); + inline void handle_event(struct LDKEvent event); }; class BestBlock { private: @@ -1128,9 +1244,9 @@ public: const LDKConfirm* operator &() const { return &self; } const LDKConfirm* operator ->() const { return &self; } /** - * Processes transactions confirmed in a block with a given header and height. + * Notifies LDK of transactions confirmed in a block with a given header and height. * - * Should be called for any transactions registered by [`Filter::register_tx`] or any + * Must be called for any transactions registered by [`Filter::register_tx`] or any * transactions spending an output registered by [`Filter::register_output`]. Such transactions * appearing in the same block do not need to be included in the same call; instead, multiple * calls with additional transactions may be made so long as they are made in [chain order]. @@ -1144,10 +1260,11 @@ public: */ inline void transactions_confirmed(const uint8_t (*header)[80], struct LDKCVec_C2Tuple_usizeTransactionZZ txdata, uint32_t height); /** - * Processes a transaction that is no longer confirmed as result of a chain reorganization. + * Notifies LDK of 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 will not be returned + * Must be called for any transaction returned by [`get_relevant_txids`] if it has been + * reorganized out of the best chain or if it is no longer confirmed in the block with the + * given block hash. 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 @@ -1155,28 +1272,33 @@ public: */ inline void transaction_unconfirmed(const uint8_t (*txid)[32]); /** - * Processes an update to the best header connected at the given height. + * Notifies LDK of an update to the best header connected at the given height. * - * Should be called when a new header is available but may be skipped for intermediary blocks - * if they become available at the same time. + * Must be called whenever a new chain tip becomes available. May be skipped for intermediary + * blocks. */ inline void best_block_updated(const uint8_t (*header)[80], uint32_t height); /** - * Returns transactions that should be monitored for reorganization out of the chain. + * Returns transactions that must be monitored for reorganization out of the chain along + * with the hash of the block as part of which it had been previously confirmed. * * 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 + * Must be called to determine the subset of transactions that must be monitored for * reorganization. Will be idempotent between calls but may change as a result of calls to the - * other interface methods. Thus, this is useful to determine which transactions may need to be + * other interface methods. Thus, this is useful to determine which transactions must be * given to [`transaction_unconfirmed`]. * + * If any of the returned transactions are confirmed in a block other than the one with the + * given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and + * [`transactions_confirmed`], respectively. + * * [`transactions_confirmed`]: Self::transactions_confirmed * [`transaction_unconfirmed`]: Self::transaction_unconfirmed */ - inline LDK::CVec_TxidZ get_relevant_txids(); + inline LDK::CVec_C2Tuple_TxidBlockHashZZ get_relevant_txids(); }; class ChannelMonitorUpdateStatus { private: @@ -1513,11 +1635,41 @@ public: const LDKInvoiceFeatures* operator &() const { return &self; } const LDKInvoiceFeatures* operator ->() const { return &self; } }; -class ChannelTypeFeatures { +class OfferFeatures { private: - LDKChannelTypeFeatures self; + LDKOfferFeatures self; public: - ChannelTypeFeatures(const ChannelTypeFeatures&) = delete; + OfferFeatures(const OfferFeatures&) = delete; + OfferFeatures(OfferFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(OfferFeatures)); } + OfferFeatures(LDKOfferFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOfferFeatures)); } + operator LDKOfferFeatures() && { LDKOfferFeatures res = self; memset(&self, 0, sizeof(LDKOfferFeatures)); return res; } + ~OfferFeatures() { OfferFeatures_free(self); } + OfferFeatures& operator=(OfferFeatures&& o) { OfferFeatures_free(self); self = o.self; memset(&o, 0, sizeof(OfferFeatures)); return *this; } + LDKOfferFeatures* operator &() { return &self; } + LDKOfferFeatures* operator ->() { return &self; } + const LDKOfferFeatures* operator &() const { return &self; } + const LDKOfferFeatures* operator ->() const { return &self; } +}; +class InvoiceRequestFeatures { +private: + LDKInvoiceRequestFeatures self; +public: + InvoiceRequestFeatures(const InvoiceRequestFeatures&) = delete; + InvoiceRequestFeatures(InvoiceRequestFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestFeatures)); } + InvoiceRequestFeatures(LDKInvoiceRequestFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestFeatures)); } + operator LDKInvoiceRequestFeatures() && { LDKInvoiceRequestFeatures res = self; memset(&self, 0, sizeof(LDKInvoiceRequestFeatures)); return res; } + ~InvoiceRequestFeatures() { InvoiceRequestFeatures_free(self); } + InvoiceRequestFeatures& operator=(InvoiceRequestFeatures&& o) { InvoiceRequestFeatures_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestFeatures)); return *this; } + LDKInvoiceRequestFeatures* operator &() { return &self; } + LDKInvoiceRequestFeatures* operator ->() { return &self; } + const LDKInvoiceRequestFeatures* operator &() const { return &self; } + const LDKInvoiceRequestFeatures* operator ->() const { return &self; } +}; +class ChannelTypeFeatures { +private: + LDKChannelTypeFeatures self; +public: + ChannelTypeFeatures(const ChannelTypeFeatures&) = delete; ChannelTypeFeatures(ChannelTypeFeatures&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelTypeFeatures)); } ChannelTypeFeatures(LDKChannelTypeFeatures&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelTypeFeatures)); } operator LDKChannelTypeFeatures() && { LDKChannelTypeFeatures res = self; memset(&self, 0, sizeof(LDKChannelTypeFeatures)); return res; } @@ -1528,6 +1680,21 @@ public: const LDKChannelTypeFeatures* operator &() const { return &self; } const LDKChannelTypeFeatures* operator ->() const { return &self; } }; +class OnionMessageContents { +private: + LDKOnionMessageContents self; +public: + OnionMessageContents(const OnionMessageContents&) = delete; + OnionMessageContents(OnionMessageContents&& o) : self(o.self) { memset(&o, 0, sizeof(OnionMessageContents)); } + OnionMessageContents(LDKOnionMessageContents&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOnionMessageContents)); } + operator LDKOnionMessageContents() && { LDKOnionMessageContents res = self; memset(&self, 0, sizeof(LDKOnionMessageContents)); return res; } + ~OnionMessageContents() { OnionMessageContents_free(self); } + OnionMessageContents& operator=(OnionMessageContents&& o) { OnionMessageContents_free(self); self = o.self; memset(&o, 0, sizeof(OnionMessageContents)); return *this; } + LDKOnionMessageContents* operator &() { return &self; } + LDKOnionMessageContents* operator ->() { return &self; } + const LDKOnionMessageContents* operator &() const { return &self; } + const LDKOnionMessageContents* operator ->() const { return &self; } +}; class CustomOnionMessageContents { private: LDKCustomOnionMessageContents self; @@ -1804,7 +1971,7 @@ public: /** * Gets the per-commitment point for a specific commitment number * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. */ inline LDKPublicKey get_per_commitment_point(uint64_t idx); /** @@ -1815,7 +1982,7 @@ public: * * May be called more than once for the same index. * - * Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. */ inline LDKThirtyTwoBytes release_commitment_secret(uint64_t idx); /** @@ -1830,14 +1997,14 @@ public: * 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 + * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ inline LDK::CResult_NoneNoneZ validate_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_PaymentPreimageZ preimages); /** - * 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. + * Returns 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 + * [`BaseSign`] object uniquely and lookup or re-derive its keys. */ inline LDKThirtyTwoBytes channel_keys_id(); /** @@ -1852,7 +2019,7 @@ public: * 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 + * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. */ inline LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_PaymentPreimageZ preimages); @@ -1864,17 +2031,21 @@ public: */ inline LDK::CResult_NoneNoneZ validate_counterparty_revocation(uint64_t idx, const uint8_t (*secret)[32]); /** - * 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. + * Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + * + * This will be called + * - with a non-revoked `commitment_tx`. + * - with the latest `commitment_tx` when we initiate a force-close. + * - with the previous `commitment_tx`, just to get claiming HTLC + * signatures, if we are reacting to a [`ChannelMonitor`] + * [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + * that decided to broadcast before it had been updated to the latest `commitment_tx`. + * * 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. + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor */ inline LDK::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_holder_commitment_and_htlcs(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** @@ -1888,9 +2059,9 @@ public: * * 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 + * `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 + * not allow the spending of any funds by itself (you need our holder `revocation_secret` to do * so). */ inline LDK::CResult_SignatureNoneZ sign_justice_revoked_output(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); @@ -1903,14 +2074,15 @@ public: * 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. + * `amount` is the 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 + * `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 + * `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script * (which is committed to in the BIP 143 signatures). */ inline LDK::CResult_SignatureNoneZ sign_justice_revoked_htlc(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32], const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); @@ -1923,12 +2095,12 @@ public: * 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 + * `witness_script` is either an 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. + * `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 + * `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. @@ -1960,17 +2132,13 @@ public: inline LDK::CResult_C2Tuple_SignatureSignatureZNoneZ sign_channel_announcement(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); /** * 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. + * `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. Since these + * are static channel data, they MUST NOT be allowed to change to different values once set, + * as LDK may call this method more than once. * * 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. */ - inline void ready_channel(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); + inline void provide_channel_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters); }; class Sign { private: @@ -2018,24 +2186,24 @@ public: /** * Get node secret key based on the provided [`Recipient`]. * - * The node_id/network_key is the public key that corresponds to this secret key. + * 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` + * This method must return the same value each time it is called with a given [`Recipient`] * parameter. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. */ inline LDK::CResult_SecretKeyNoneZ get_node_secret(enum LDKRecipient recipient); /** * Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in * [`get_node_secret`]. * - * This method must return the same value each time it is called with a given `Recipient` + * This method must return the same value each time it is called with a given [`Recipient`] * parameter. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. * - * [`get_node_secret`]: KeysInterface::get_node_secret + * [`get_node_secret`]: Self::get_node_secret */ inline LDK::CResult_PublicKeyNoneZ get_node_id(enum LDKRecipient recipient); /** @@ -2043,7 +2211,7 @@ public: * one is provided. Note that this tweak can be applied to `other_key` instead of our node * secret, though this is less efficient. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. * * [`node secret`]: Self::get_node_secret */ @@ -2063,12 +2231,21 @@ public: */ inline LDK::ShutdownScript get_shutdown_scriptpubkey(); /** - * Get a new set of Sign for per-channel secrets. These MUST be unique even if you + * 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. */ - inline LDK::Sign get_channel_signer(bool inbound, uint64_t channel_value_satoshis); + inline LDKThirtyTwoBytes generate_channel_keys_id(bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id); + /** + * Derives the private key material backing a `Signer`. + * + * To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through + * [`KeysInterface::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + * re-derived from its `channel_keys_id`, which can be obtained through its trait method + * [`BaseSign::channel_keys_id`]. + */ + inline LDK::Sign derive_channel_signer(uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id); /** * 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 @@ -2078,12 +2255,19 @@ public: */ inline LDKThirtyTwoBytes get_secure_random_bytes(); /** - * Reads a `Signer` for this `KeysInterface` from the given input stream. + * 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). + * [`Sign`]-implementing objects (i.e., [`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. + * + * This method is slowly being phased out -- it will only be called when reading objects + * written by LDK versions prior to 0.0.113. + * + * [`Signer`]: Self::Signer + * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager */ inline LDK::CResult_SignDecodeErrorZ read_chan_signer(struct LDKu8slice reader); /** @@ -2091,13 +2275,13 @@ public: * 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 `hrp` is ASCII bytes, while the invoice data is base32-encoded. * * The secret key used to sign the invoice is dependent on the [`Recipient`]. * - * Errors if the `Recipient` variant is not supported by the implementation. + * Errors if the [`Recipient`] variant is not supported by the implementation. */ - inline LDK::CResult_RecoverableSignatureNoneZ sign_invoice(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient); + inline LDK::CResult_RecoverableSignatureNoneZ sign_invoice(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. * @@ -2396,6 +2580,21 @@ public: const LDKHostname* operator &() const { return &self; } const LDKHostname* operator ->() const { return &self; } }; +class PrintableString { +private: + LDKPrintableString self; +public: + PrintableString(const PrintableString&) = delete; + PrintableString(PrintableString&& o) : self(o.self) { memset(&o, 0, sizeof(PrintableString)); } + PrintableString(LDKPrintableString&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPrintableString)); } + operator LDKPrintableString() && { LDKPrintableString res = self; memset(&self, 0, sizeof(LDKPrintableString)); return res; } + ~PrintableString() { PrintableString_free(self); } + PrintableString& operator=(PrintableString&& o) { PrintableString_free(self); self = o.self; memset(&o, 0, sizeof(PrintableString)); return *this; } + LDKPrintableString* operator &() { return &self; } + LDKPrintableString* operator ->() { return &self; } + const LDKPrintableString* operator &() const { return &self; } + const LDKPrintableString* operator ->() const { return &self; } +}; class OutPoint { private: LDKOutPoint self; @@ -2498,11 +2697,11 @@ public: * * Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::CResult_PaymentIdPaymentSendFailureZ send_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret); + inline LDK::CResult_NonePaymentSendFailureZ send_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id); /** * Sends a spontaneous payment over the Lightning Network using the given [`Route`]. */ - inline LDK::CResult_PaymentIdPaymentSendFailureZ send_spontaneous_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage); + inline LDK::CResult_NonePaymentSendFailureZ send_spontaneous_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id); /** * Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. */ @@ -2511,43 +2710,11 @@ public: * Signals that no further retries for the given payment will occur. */ inline void abandon_payment(struct LDKThirtyTwoBytes payment_id); -}; -class Router { -private: - LDKRouter self; -public: - Router(const Router&) = delete; - Router(Router&& o) : self(o.self) { memset(&o, 0, sizeof(Router)); } - Router(LDKRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRouter)); } - operator LDKRouter() && { LDKRouter res = self; memset(&self, 0, sizeof(LDKRouter)); return res; } - ~Router() { Router_free(self); } - Router& operator=(Router&& o) { Router_free(self); self = o.self; memset(&o, 0, sizeof(Router)); return *this; } - LDKRouter* operator &() { return &self; } - LDKRouter* operator ->() { return &self; } - const LDKRouter* operator &() const { return &self; } - const LDKRouter* operator ->() const { return &self; } - /** - * 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 - */ - inline LDK::CResult_RouteLightningErrorZ find_route(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. - */ - inline void notify_payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); - /** - * Lets the router know that payment through a specific path was successful. - */ - inline void notify_payment_path_successful(struct LDKCVec_RouteHopZ path); - /** - * Lets the router know that a payment probe was successful. - */ - inline void notify_payment_probe_successful(struct LDKCVec_RouteHopZ path); - /** - * Lets the router know that a payment probe failed. + * Construct an [`InFlightHtlcs`] containing information about currently used up liquidity + * across payments. */ - inline void notify_payment_probe_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id); + inline LDK::InFlightHtlcs inflight_htlcs(); }; class Retry { private: @@ -2579,626 +2746,611 @@ public: const LDKPaymentError* operator &() const { return &self; } const LDKPaymentError* operator ->() const { return &self; } }; -class InFlightHtlcs { +class ChannelMonitorUpdate { private: - LDKInFlightHtlcs self; + LDKChannelMonitorUpdate self; public: - InFlightHtlcs(const InFlightHtlcs&) = delete; - InFlightHtlcs(InFlightHtlcs&& o) : self(o.self) { memset(&o, 0, sizeof(InFlightHtlcs)); } - InFlightHtlcs(LDKInFlightHtlcs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInFlightHtlcs)); } - operator LDKInFlightHtlcs() && { LDKInFlightHtlcs res = self; memset(&self, 0, sizeof(LDKInFlightHtlcs)); return res; } - ~InFlightHtlcs() { InFlightHtlcs_free(self); } - InFlightHtlcs& operator=(InFlightHtlcs&& o) { InFlightHtlcs_free(self); self = o.self; memset(&o, 0, sizeof(InFlightHtlcs)); return *this; } - LDKInFlightHtlcs* operator &() { return &self; } - LDKInFlightHtlcs* operator ->() { return &self; } - const LDKInFlightHtlcs* operator &() const { return &self; } - const LDKInFlightHtlcs* operator ->() const { return &self; } + ChannelMonitorUpdate(const ChannelMonitorUpdate&) = delete; + ChannelMonitorUpdate(ChannelMonitorUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdate)); } + ChannelMonitorUpdate(LDKChannelMonitorUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdate)); } + operator LDKChannelMonitorUpdate() && { LDKChannelMonitorUpdate res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdate)); return res; } + ~ChannelMonitorUpdate() { ChannelMonitorUpdate_free(self); } + ChannelMonitorUpdate& operator=(ChannelMonitorUpdate&& o) { ChannelMonitorUpdate_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMonitorUpdate)); return *this; } + LDKChannelMonitorUpdate* operator &() { return &self; } + LDKChannelMonitorUpdate* operator ->() { return &self; } + const LDKChannelMonitorUpdate* operator &() const { return &self; } + const LDKChannelMonitorUpdate* operator ->() const { return &self; } }; -class ParseError { +class MonitorEvent { private: - LDKParseError self; + LDKMonitorEvent self; public: - ParseError(const ParseError&) = delete; - ParseError(ParseError&& o) : self(o.self) { memset(&o, 0, sizeof(ParseError)); } - ParseError(LDKParseError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParseError)); } - operator LDKParseError() && { LDKParseError res = self; memset(&self, 0, sizeof(LDKParseError)); return res; } - ~ParseError() { ParseError_free(self); } - ParseError& operator=(ParseError&& o) { ParseError_free(self); self = o.self; memset(&o, 0, sizeof(ParseError)); return *this; } - LDKParseError* operator &() { return &self; } - LDKParseError* operator ->() { return &self; } - const LDKParseError* operator &() const { return &self; } - const LDKParseError* operator ->() const { return &self; } + MonitorEvent(const MonitorEvent&) = delete; + MonitorEvent(MonitorEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorEvent)); } + MonitorEvent(LDKMonitorEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorEvent)); } + operator LDKMonitorEvent() && { LDKMonitorEvent res = self; memset(&self, 0, sizeof(LDKMonitorEvent)); return res; } + ~MonitorEvent() { MonitorEvent_free(self); } + MonitorEvent& operator=(MonitorEvent&& o) { MonitorEvent_free(self); self = o.self; memset(&o, 0, sizeof(MonitorEvent)); return *this; } + LDKMonitorEvent* operator &() { return &self; } + LDKMonitorEvent* operator ->() { return &self; } + const LDKMonitorEvent* operator &() const { return &self; } + const LDKMonitorEvent* operator ->() const { return &self; } }; -class ParseOrSemanticError { +class HTLCUpdate { private: - LDKParseOrSemanticError self; + LDKHTLCUpdate self; public: - ParseOrSemanticError(const ParseOrSemanticError&) = delete; - ParseOrSemanticError(ParseOrSemanticError&& o) : self(o.self) { memset(&o, 0, sizeof(ParseOrSemanticError)); } - ParseOrSemanticError(LDKParseOrSemanticError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParseOrSemanticError)); } - operator LDKParseOrSemanticError() && { LDKParseOrSemanticError res = self; memset(&self, 0, sizeof(LDKParseOrSemanticError)); return res; } - ~ParseOrSemanticError() { ParseOrSemanticError_free(self); } - ParseOrSemanticError& operator=(ParseOrSemanticError&& o) { ParseOrSemanticError_free(self); self = o.self; memset(&o, 0, sizeof(ParseOrSemanticError)); return *this; } - LDKParseOrSemanticError* operator &() { return &self; } - LDKParseOrSemanticError* operator ->() { return &self; } - const LDKParseOrSemanticError* operator &() const { return &self; } - const LDKParseOrSemanticError* operator ->() const { return &self; } + HTLCUpdate(const HTLCUpdate&) = delete; + HTLCUpdate(HTLCUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCUpdate)); } + HTLCUpdate(LDKHTLCUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCUpdate)); } + operator LDKHTLCUpdate() && { LDKHTLCUpdate res = self; memset(&self, 0, sizeof(LDKHTLCUpdate)); return res; } + ~HTLCUpdate() { HTLCUpdate_free(self); } + HTLCUpdate& operator=(HTLCUpdate&& o) { HTLCUpdate_free(self); self = o.self; memset(&o, 0, sizeof(HTLCUpdate)); return *this; } + LDKHTLCUpdate* operator &() { return &self; } + LDKHTLCUpdate* operator ->() { return &self; } + const LDKHTLCUpdate* operator &() const { return &self; } + const LDKHTLCUpdate* operator ->() const { return &self; } }; -class Invoice { +class Balance { private: - LDKInvoice self; + LDKBalance self; public: - Invoice(const Invoice&) = delete; - Invoice(Invoice&& o) : self(o.self) { memset(&o, 0, sizeof(Invoice)); } - Invoice(LDKInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoice)); } - operator LDKInvoice() && { LDKInvoice res = self; memset(&self, 0, sizeof(LDKInvoice)); return res; } - ~Invoice() { Invoice_free(self); } - Invoice& operator=(Invoice&& o) { Invoice_free(self); self = o.self; memset(&o, 0, sizeof(Invoice)); return *this; } - LDKInvoice* operator &() { return &self; } - LDKInvoice* operator ->() { return &self; } - const LDKInvoice* operator &() const { return &self; } - const LDKInvoice* operator ->() const { return &self; } + Balance(const Balance&) = delete; + Balance(Balance&& o) : self(o.self) { memset(&o, 0, sizeof(Balance)); } + Balance(LDKBalance&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBalance)); } + operator LDKBalance() && { LDKBalance res = self; memset(&self, 0, sizeof(LDKBalance)); return res; } + ~Balance() { Balance_free(self); } + Balance& operator=(Balance&& o) { Balance_free(self); self = o.self; memset(&o, 0, sizeof(Balance)); return *this; } + LDKBalance* operator &() { return &self; } + LDKBalance* operator ->() { return &self; } + const LDKBalance* operator &() const { return &self; } + const LDKBalance* operator ->() const { return &self; } }; -class SignedRawInvoice { +class ChannelMonitor { private: - LDKSignedRawInvoice self; + LDKChannelMonitor self; public: - SignedRawInvoice(const SignedRawInvoice&) = delete; - SignedRawInvoice(SignedRawInvoice&& o) : self(o.self) { memset(&o, 0, sizeof(SignedRawInvoice)); } - SignedRawInvoice(LDKSignedRawInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignedRawInvoice)); } - operator LDKSignedRawInvoice() && { LDKSignedRawInvoice res = self; memset(&self, 0, sizeof(LDKSignedRawInvoice)); return res; } - ~SignedRawInvoice() { SignedRawInvoice_free(self); } - SignedRawInvoice& operator=(SignedRawInvoice&& o) { SignedRawInvoice_free(self); self = o.self; memset(&o, 0, sizeof(SignedRawInvoice)); return *this; } - LDKSignedRawInvoice* operator &() { return &self; } - LDKSignedRawInvoice* operator ->() { return &self; } - const LDKSignedRawInvoice* operator &() const { return &self; } - const LDKSignedRawInvoice* operator ->() const { return &self; } + ChannelMonitor(const ChannelMonitor&) = delete; + ChannelMonitor(ChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitor)); } + ChannelMonitor(LDKChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitor)); } + operator LDKChannelMonitor() && { LDKChannelMonitor res = self; memset(&self, 0, sizeof(LDKChannelMonitor)); return res; } + ~ChannelMonitor() { ChannelMonitor_free(self); } + ChannelMonitor& operator=(ChannelMonitor&& o) { ChannelMonitor_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMonitor)); return *this; } + LDKChannelMonitor* operator &() { return &self; } + LDKChannelMonitor* operator ->() { return &self; } + const LDKChannelMonitor* operator &() const { return &self; } + const LDKChannelMonitor* operator ->() const { return &self; } }; -class RawInvoice { +class ExpandedKey { private: - LDKRawInvoice self; + LDKExpandedKey self; public: - RawInvoice(const RawInvoice&) = delete; - RawInvoice(RawInvoice&& o) : self(o.self) { memset(&o, 0, sizeof(RawInvoice)); } - RawInvoice(LDKRawInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRawInvoice)); } - operator LDKRawInvoice() && { LDKRawInvoice res = self; memset(&self, 0, sizeof(LDKRawInvoice)); return res; } - ~RawInvoice() { RawInvoice_free(self); } - RawInvoice& operator=(RawInvoice&& o) { RawInvoice_free(self); self = o.self; memset(&o, 0, sizeof(RawInvoice)); return *this; } - LDKRawInvoice* operator &() { return &self; } - LDKRawInvoice* operator ->() { return &self; } - const LDKRawInvoice* operator &() const { return &self; } - const LDKRawInvoice* operator ->() const { return &self; } + ExpandedKey(const ExpandedKey&) = delete; + ExpandedKey(ExpandedKey&& o) : self(o.self) { memset(&o, 0, sizeof(ExpandedKey)); } + ExpandedKey(LDKExpandedKey&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKExpandedKey)); } + operator LDKExpandedKey() && { LDKExpandedKey res = self; memset(&self, 0, sizeof(LDKExpandedKey)); return res; } + ~ExpandedKey() { ExpandedKey_free(self); } + ExpandedKey& operator=(ExpandedKey&& o) { ExpandedKey_free(self); self = o.self; memset(&o, 0, sizeof(ExpandedKey)); return *this; } + LDKExpandedKey* operator &() { return &self; } + LDKExpandedKey* operator ->() { return &self; } + const LDKExpandedKey* operator &() const { return &self; } + const LDKExpandedKey* operator ->() const { return &self; } }; -class RawDataPart { +class CustomMessageHandler { private: - LDKRawDataPart self; + LDKCustomMessageHandler self; public: - RawDataPart(const RawDataPart&) = delete; - RawDataPart(RawDataPart&& o) : self(o.self) { memset(&o, 0, sizeof(RawDataPart)); } - RawDataPart(LDKRawDataPart&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRawDataPart)); } - operator LDKRawDataPart() && { LDKRawDataPart res = self; memset(&self, 0, sizeof(LDKRawDataPart)); return res; } - ~RawDataPart() { RawDataPart_free(self); } - RawDataPart& operator=(RawDataPart&& o) { RawDataPart_free(self); self = o.self; memset(&o, 0, sizeof(RawDataPart)); return *this; } - LDKRawDataPart* operator &() { return &self; } - LDKRawDataPart* operator ->() { return &self; } - const LDKRawDataPart* operator &() const { return &self; } - const LDKRawDataPart* operator ->() const { return &self; } + CustomMessageHandler(const CustomMessageHandler&) = delete; + CustomMessageHandler(CustomMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(CustomMessageHandler)); } + CustomMessageHandler(LDKCustomMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomMessageHandler)); } + operator LDKCustomMessageHandler() && { LDKCustomMessageHandler res = self; memset(&self, 0, sizeof(LDKCustomMessageHandler)); return res; } + ~CustomMessageHandler() { CustomMessageHandler_free(self); } + CustomMessageHandler& operator=(CustomMessageHandler&& o) { CustomMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(CustomMessageHandler)); return *this; } + LDKCustomMessageHandler* operator &() { return &self; } + LDKCustomMessageHandler* operator ->() { return &self; } + const LDKCustomMessageHandler* operator &() const { return &self; } + const LDKCustomMessageHandler* operator ->() const { return &self; } + /** + * Called with the message type that was received and the buffer to be read. + * Can return a `MessageHandlingError` if the message could not be handled. + */ + inline LDK::CResult_NoneLightningErrorZ handle_custom_message(struct LDKType msg, struct LDKPublicKey sender_node_id); + /** + * Gets the list of pending messages which were generated by the custom message + * handler, clearing the list in the process. The first tuple element must + * correspond to the intended recipients node ids. If no connection to one of the + * specified node does not exist, the message is simply not sent to it. + */ + inline LDK::CVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg(); }; -class PositiveTimestamp { +class IgnoringMessageHandler { private: - LDKPositiveTimestamp self; + LDKIgnoringMessageHandler self; public: - PositiveTimestamp(const PositiveTimestamp&) = delete; - PositiveTimestamp(PositiveTimestamp&& o) : self(o.self) { memset(&o, 0, sizeof(PositiveTimestamp)); } - PositiveTimestamp(LDKPositiveTimestamp&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPositiveTimestamp)); } - operator LDKPositiveTimestamp() && { LDKPositiveTimestamp res = self; memset(&self, 0, sizeof(LDKPositiveTimestamp)); return res; } - ~PositiveTimestamp() { PositiveTimestamp_free(self); } - PositiveTimestamp& operator=(PositiveTimestamp&& o) { PositiveTimestamp_free(self); self = o.self; memset(&o, 0, sizeof(PositiveTimestamp)); return *this; } - LDKPositiveTimestamp* operator &() { return &self; } - LDKPositiveTimestamp* operator ->() { return &self; } - const LDKPositiveTimestamp* operator &() const { return &self; } - const LDKPositiveTimestamp* operator ->() const { return &self; } -}; -class SiPrefix { -private: - LDKSiPrefix self; -public: - SiPrefix(const SiPrefix&) = delete; - SiPrefix(SiPrefix&& o) : self(o.self) { memset(&o, 0, sizeof(SiPrefix)); } - SiPrefix(LDKSiPrefix&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSiPrefix)); } - operator LDKSiPrefix() && { LDKSiPrefix res = self; memset(&self, 0, sizeof(LDKSiPrefix)); return res; } - SiPrefix& operator=(SiPrefix&& o) { self = o.self; memset(&o, 0, sizeof(SiPrefix)); return *this; } - LDKSiPrefix* operator &() { return &self; } - LDKSiPrefix* operator ->() { return &self; } - const LDKSiPrefix* operator &() const { return &self; } - const LDKSiPrefix* operator ->() const { return &self; } + IgnoringMessageHandler(const IgnoringMessageHandler&) = delete; + IgnoringMessageHandler(IgnoringMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(IgnoringMessageHandler)); } + IgnoringMessageHandler(LDKIgnoringMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKIgnoringMessageHandler)); } + operator LDKIgnoringMessageHandler() && { LDKIgnoringMessageHandler res = self; memset(&self, 0, sizeof(LDKIgnoringMessageHandler)); return res; } + ~IgnoringMessageHandler() { IgnoringMessageHandler_free(self); } + IgnoringMessageHandler& operator=(IgnoringMessageHandler&& o) { IgnoringMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(IgnoringMessageHandler)); return *this; } + LDKIgnoringMessageHandler* operator &() { return &self; } + LDKIgnoringMessageHandler* operator ->() { return &self; } + const LDKIgnoringMessageHandler* operator &() const { return &self; } + const LDKIgnoringMessageHandler* operator ->() const { return &self; } }; -class Currency { +class ErroringMessageHandler { private: - LDKCurrency self; + LDKErroringMessageHandler self; public: - Currency(const Currency&) = delete; - Currency(Currency&& o) : self(o.self) { memset(&o, 0, sizeof(Currency)); } - Currency(LDKCurrency&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCurrency)); } - operator LDKCurrency() && { LDKCurrency res = self; memset(&self, 0, sizeof(LDKCurrency)); return res; } - Currency& operator=(Currency&& o) { self = o.self; memset(&o, 0, sizeof(Currency)); return *this; } - LDKCurrency* operator &() { return &self; } - LDKCurrency* operator ->() { return &self; } - const LDKCurrency* operator &() const { return &self; } - const LDKCurrency* operator ->() const { return &self; } + ErroringMessageHandler(const ErroringMessageHandler&) = delete; + ErroringMessageHandler(ErroringMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(ErroringMessageHandler)); } + ErroringMessageHandler(LDKErroringMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKErroringMessageHandler)); } + operator LDKErroringMessageHandler() && { LDKErroringMessageHandler res = self; memset(&self, 0, sizeof(LDKErroringMessageHandler)); return res; } + ~ErroringMessageHandler() { ErroringMessageHandler_free(self); } + ErroringMessageHandler& operator=(ErroringMessageHandler&& o) { ErroringMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(ErroringMessageHandler)); return *this; } + LDKErroringMessageHandler* operator &() { return &self; } + LDKErroringMessageHandler* operator ->() { return &self; } + const LDKErroringMessageHandler* operator &() const { return &self; } + const LDKErroringMessageHandler* operator ->() const { return &self; } }; -class Sha256 { +class MessageHandler { private: - LDKSha256 self; + LDKMessageHandler self; public: - Sha256(const Sha256&) = delete; - Sha256(Sha256&& o) : self(o.self) { memset(&o, 0, sizeof(Sha256)); } - Sha256(LDKSha256&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSha256)); } - operator LDKSha256() && { LDKSha256 res = self; memset(&self, 0, sizeof(LDKSha256)); return res; } - ~Sha256() { Sha256_free(self); } - Sha256& operator=(Sha256&& o) { Sha256_free(self); self = o.self; memset(&o, 0, sizeof(Sha256)); return *this; } - LDKSha256* operator &() { return &self; } - LDKSha256* operator ->() { return &self; } - const LDKSha256* operator &() const { return &self; } - const LDKSha256* operator ->() const { return &self; } + MessageHandler(const MessageHandler&) = delete; + MessageHandler(MessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(MessageHandler)); } + MessageHandler(LDKMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageHandler)); } + operator LDKMessageHandler() && { LDKMessageHandler res = self; memset(&self, 0, sizeof(LDKMessageHandler)); return res; } + ~MessageHandler() { MessageHandler_free(self); } + MessageHandler& operator=(MessageHandler&& o) { MessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(MessageHandler)); return *this; } + LDKMessageHandler* operator &() { return &self; } + LDKMessageHandler* operator ->() { return &self; } + const LDKMessageHandler* operator &() const { return &self; } + const LDKMessageHandler* operator ->() const { return &self; } }; -class Description { +class SocketDescriptor { private: - LDKDescription self; + LDKSocketDescriptor self; public: - Description(const Description&) = delete; - Description(Description&& o) : self(o.self) { memset(&o, 0, sizeof(Description)); } - Description(LDKDescription&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDescription)); } - operator LDKDescription() && { LDKDescription res = self; memset(&self, 0, sizeof(LDKDescription)); return res; } - ~Description() { Description_free(self); } - Description& operator=(Description&& o) { Description_free(self); self = o.self; memset(&o, 0, sizeof(Description)); return *this; } - LDKDescription* operator &() { return &self; } - LDKDescription* operator ->() { return &self; } - const LDKDescription* operator &() const { return &self; } - const LDKDescription* operator ->() const { return &self; } + SocketDescriptor(const SocketDescriptor&) = delete; + SocketDescriptor(SocketDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(SocketDescriptor)); } + SocketDescriptor(LDKSocketDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSocketDescriptor)); } + operator LDKSocketDescriptor() && { LDKSocketDescriptor res = self; memset(&self, 0, sizeof(LDKSocketDescriptor)); return res; } + ~SocketDescriptor() { SocketDescriptor_free(self); } + SocketDescriptor& operator=(SocketDescriptor&& o) { SocketDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(SocketDescriptor)); return *this; } + LDKSocketDescriptor* operator &() { return &self; } + LDKSocketDescriptor* operator ->() { return &self; } + const LDKSocketDescriptor* operator &() const { return &self; } + const LDKSocketDescriptor* operator ->() const { return &self; } + /** + * Attempts to send some data from the given slice to the peer. + * + * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. + * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be + * called and further write attempts may occur until that time. + * + * If the returned size is smaller than `data.len()`, a + * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be + * written. Additionally, until a `send_data` event completes fully, no further + * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to + * prevent denial-of-service issues, you should not read or buffer any data from the socket + * until then. + * + * If a [`PeerManager::read_event`] call on this descriptor had previously returned true + * (indicating that read events should be paused to prevent DoS in the send buffer), + * `resume_read` may be set indicating that read events on this descriptor should resume. A + * `resume_read` of false carries no meaning, and should not cause any action. + */ + inline uintptr_t send_data(struct LDKu8slice data, bool resume_read); + /** + * Disconnect the socket pointed to by this SocketDescriptor. + * + * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this + * call (doing so is a noop). + */ + inline void disconnect_socket(); + /** Checks if two objects are equal given this object's this_arg pointer and another object. */ + inline bool eq(const struct LDKSocketDescriptor *NONNULL_PTR other_arg); + /** + * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer. + * This is used, for example, for inclusion of this object in a hash map. + */ + inline uint64_t hash(); }; -class PayeePubKey { +class PeerHandleError { private: - LDKPayeePubKey self; + LDKPeerHandleError self; public: - PayeePubKey(const PayeePubKey&) = delete; - PayeePubKey(PayeePubKey&& o) : self(o.self) { memset(&o, 0, sizeof(PayeePubKey)); } - PayeePubKey(LDKPayeePubKey&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPayeePubKey)); } - operator LDKPayeePubKey() && { LDKPayeePubKey res = self; memset(&self, 0, sizeof(LDKPayeePubKey)); return res; } - ~PayeePubKey() { PayeePubKey_free(self); } - PayeePubKey& operator=(PayeePubKey&& o) { PayeePubKey_free(self); self = o.self; memset(&o, 0, sizeof(PayeePubKey)); return *this; } - LDKPayeePubKey* operator &() { return &self; } - LDKPayeePubKey* operator ->() { return &self; } - const LDKPayeePubKey* operator &() const { return &self; } - const LDKPayeePubKey* operator ->() const { return &self; } + PeerHandleError(const PeerHandleError&) = delete; + PeerHandleError(PeerHandleError&& o) : self(o.self) { memset(&o, 0, sizeof(PeerHandleError)); } + PeerHandleError(LDKPeerHandleError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerHandleError)); } + operator LDKPeerHandleError() && { LDKPeerHandleError res = self; memset(&self, 0, sizeof(LDKPeerHandleError)); return res; } + ~PeerHandleError() { PeerHandleError_free(self); } + PeerHandleError& operator=(PeerHandleError&& o) { PeerHandleError_free(self); self = o.self; memset(&o, 0, sizeof(PeerHandleError)); return *this; } + LDKPeerHandleError* operator &() { return &self; } + LDKPeerHandleError* operator ->() { return &self; } + const LDKPeerHandleError* operator &() const { return &self; } + const LDKPeerHandleError* operator ->() const { return &self; } }; -class ExpiryTime { +class PeerManager { private: - LDKExpiryTime self; + LDKPeerManager self; public: - ExpiryTime(const ExpiryTime&) = delete; - ExpiryTime(ExpiryTime&& o) : self(o.self) { memset(&o, 0, sizeof(ExpiryTime)); } - ExpiryTime(LDKExpiryTime&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKExpiryTime)); } - operator LDKExpiryTime() && { LDKExpiryTime res = self; memset(&self, 0, sizeof(LDKExpiryTime)); return res; } - ~ExpiryTime() { ExpiryTime_free(self); } - ExpiryTime& operator=(ExpiryTime&& o) { ExpiryTime_free(self); self = o.self; memset(&o, 0, sizeof(ExpiryTime)); return *this; } - LDKExpiryTime* operator &() { return &self; } - LDKExpiryTime* operator ->() { return &self; } - const LDKExpiryTime* operator &() const { return &self; } - const LDKExpiryTime* operator ->() const { return &self; } + PeerManager(const PeerManager&) = delete; + PeerManager(PeerManager&& o) : self(o.self) { memset(&o, 0, sizeof(PeerManager)); } + PeerManager(LDKPeerManager&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerManager)); } + operator LDKPeerManager() && { LDKPeerManager res = self; memset(&self, 0, sizeof(LDKPeerManager)); return res; } + ~PeerManager() { PeerManager_free(self); } + PeerManager& operator=(PeerManager&& o) { PeerManager_free(self); self = o.self; memset(&o, 0, sizeof(PeerManager)); return *this; } + LDKPeerManager* operator &() { return &self; } + LDKPeerManager* operator ->() { return &self; } + const LDKPeerManager* operator &() const { return &self; } + const LDKPeerManager* operator ->() const { return &self; } }; -class MinFinalCltvExpiry { +class OnionMessenger { private: - LDKMinFinalCltvExpiry self; + LDKOnionMessenger self; public: - MinFinalCltvExpiry(const MinFinalCltvExpiry&) = delete; - MinFinalCltvExpiry(MinFinalCltvExpiry&& o) : self(o.self) { memset(&o, 0, sizeof(MinFinalCltvExpiry)); } - MinFinalCltvExpiry(LDKMinFinalCltvExpiry&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMinFinalCltvExpiry)); } - operator LDKMinFinalCltvExpiry() && { LDKMinFinalCltvExpiry res = self; memset(&self, 0, sizeof(LDKMinFinalCltvExpiry)); return res; } - ~MinFinalCltvExpiry() { MinFinalCltvExpiry_free(self); } - MinFinalCltvExpiry& operator=(MinFinalCltvExpiry&& o) { MinFinalCltvExpiry_free(self); self = o.self; memset(&o, 0, sizeof(MinFinalCltvExpiry)); return *this; } - LDKMinFinalCltvExpiry* operator &() { return &self; } - LDKMinFinalCltvExpiry* operator ->() { return &self; } - const LDKMinFinalCltvExpiry* operator &() const { return &self; } - const LDKMinFinalCltvExpiry* operator ->() const { return &self; } + OnionMessenger(const OnionMessenger&) = delete; + OnionMessenger(OnionMessenger&& o) : self(o.self) { memset(&o, 0, sizeof(OnionMessenger)); } + OnionMessenger(LDKOnionMessenger&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOnionMessenger)); } + operator LDKOnionMessenger() && { LDKOnionMessenger res = self; memset(&self, 0, sizeof(LDKOnionMessenger)); return res; } + ~OnionMessenger() { OnionMessenger_free(self); } + OnionMessenger& operator=(OnionMessenger&& o) { OnionMessenger_free(self); self = o.self; memset(&o, 0, sizeof(OnionMessenger)); return *this; } + LDKOnionMessenger* operator &() { return &self; } + LDKOnionMessenger* operator ->() { return &self; } + const LDKOnionMessenger* operator &() const { return &self; } + const LDKOnionMessenger* operator ->() const { return &self; } }; -class Fallback { +class Destination { private: - LDKFallback self; + LDKDestination self; public: - Fallback(const Fallback&) = delete; - Fallback(Fallback&& o) : self(o.self) { memset(&o, 0, sizeof(Fallback)); } - Fallback(LDKFallback&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFallback)); } - operator LDKFallback() && { LDKFallback res = self; memset(&self, 0, sizeof(LDKFallback)); return res; } - ~Fallback() { Fallback_free(self); } - Fallback& operator=(Fallback&& o) { Fallback_free(self); self = o.self; memset(&o, 0, sizeof(Fallback)); return *this; } - LDKFallback* operator &() { return &self; } - LDKFallback* operator ->() { return &self; } - const LDKFallback* operator &() const { return &self; } - const LDKFallback* operator ->() const { return &self; } + Destination(const Destination&) = delete; + Destination(Destination&& o) : self(o.self) { memset(&o, 0, sizeof(Destination)); } + Destination(LDKDestination&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDestination)); } + operator LDKDestination() && { LDKDestination res = self; memset(&self, 0, sizeof(LDKDestination)); return res; } + ~Destination() { Destination_free(self); } + Destination& operator=(Destination&& o) { Destination_free(self); self = o.self; memset(&o, 0, sizeof(Destination)); return *this; } + LDKDestination* operator &() { return &self; } + LDKDestination* operator ->() { return &self; } + const LDKDestination* operator &() const { return &self; } + const LDKDestination* operator ->() const { return &self; } }; -class InvoiceSignature { +class SendError { private: - LDKInvoiceSignature self; + LDKSendError self; public: - InvoiceSignature(const InvoiceSignature&) = delete; - InvoiceSignature(InvoiceSignature&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceSignature)); } - InvoiceSignature(LDKInvoiceSignature&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceSignature)); } - operator LDKInvoiceSignature() && { LDKInvoiceSignature res = self; memset(&self, 0, sizeof(LDKInvoiceSignature)); return res; } - ~InvoiceSignature() { InvoiceSignature_free(self); } - InvoiceSignature& operator=(InvoiceSignature&& o) { InvoiceSignature_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceSignature)); return *this; } - LDKInvoiceSignature* operator &() { return &self; } - LDKInvoiceSignature* operator ->() { return &self; } - const LDKInvoiceSignature* operator &() const { return &self; } - const LDKInvoiceSignature* operator ->() const { return &self; } + SendError(const SendError&) = delete; + SendError(SendError&& o) : self(o.self) { memset(&o, 0, sizeof(SendError)); } + SendError(LDKSendError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSendError)); } + operator LDKSendError() && { LDKSendError res = self; memset(&self, 0, sizeof(LDKSendError)); return res; } + ~SendError() { SendError_free(self); } + SendError& operator=(SendError&& o) { SendError_free(self); self = o.self; memset(&o, 0, sizeof(SendError)); return *this; } + LDKSendError* operator &() { return &self; } + LDKSendError* operator ->() { return &self; } + const LDKSendError* operator &() const { return &self; } + const LDKSendError* operator ->() const { return &self; } }; -class PrivateRoute { +class CustomOnionMessageHandler { private: - LDKPrivateRoute self; + LDKCustomOnionMessageHandler self; public: - PrivateRoute(const PrivateRoute&) = delete; - PrivateRoute(PrivateRoute&& o) : self(o.self) { memset(&o, 0, sizeof(PrivateRoute)); } - PrivateRoute(LDKPrivateRoute&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPrivateRoute)); } - operator LDKPrivateRoute() && { LDKPrivateRoute res = self; memset(&self, 0, sizeof(LDKPrivateRoute)); return res; } - ~PrivateRoute() { PrivateRoute_free(self); } - PrivateRoute& operator=(PrivateRoute&& o) { PrivateRoute_free(self); self = o.self; memset(&o, 0, sizeof(PrivateRoute)); return *this; } - LDKPrivateRoute* operator &() { return &self; } - LDKPrivateRoute* operator ->() { return &self; } - const LDKPrivateRoute* operator &() const { return &self; } - const LDKPrivateRoute* operator ->() const { return &self; } + CustomOnionMessageHandler(const CustomOnionMessageHandler&) = delete; + CustomOnionMessageHandler(CustomOnionMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(CustomOnionMessageHandler)); } + CustomOnionMessageHandler(LDKCustomOnionMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomOnionMessageHandler)); } + operator LDKCustomOnionMessageHandler() && { LDKCustomOnionMessageHandler res = self; memset(&self, 0, sizeof(LDKCustomOnionMessageHandler)); return res; } + ~CustomOnionMessageHandler() { CustomOnionMessageHandler_free(self); } + CustomOnionMessageHandler& operator=(CustomOnionMessageHandler&& o) { CustomOnionMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(CustomOnionMessageHandler)); return *this; } + LDKCustomOnionMessageHandler* operator &() { return &self; } + LDKCustomOnionMessageHandler* operator ->() { return &self; } + const LDKCustomOnionMessageHandler* operator &() const { return &self; } + const LDKCustomOnionMessageHandler* operator ->() const { return &self; } + /** + * Called with the custom message that was received. + */ + inline void handle_custom_message(struct LDKCustomOnionMessageContents msg); + /** + * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the + * message type is unknown. + */ + inline LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message(uint64_t message_type, struct LDKu8slice buffer); }; -class CreationError { +class ParseError { private: - LDKCreationError self; + LDKParseError self; public: - CreationError(const CreationError&) = delete; - CreationError(CreationError&& o) : self(o.self) { memset(&o, 0, sizeof(CreationError)); } - CreationError(LDKCreationError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCreationError)); } - operator LDKCreationError() && { LDKCreationError res = self; memset(&self, 0, sizeof(LDKCreationError)); return res; } - CreationError& operator=(CreationError&& o) { self = o.self; memset(&o, 0, sizeof(CreationError)); return *this; } - LDKCreationError* operator &() { return &self; } - LDKCreationError* operator ->() { return &self; } - const LDKCreationError* operator &() const { return &self; } - const LDKCreationError* operator ->() const { return &self; } + ParseError(const ParseError&) = delete; + ParseError(ParseError&& o) : self(o.self) { memset(&o, 0, sizeof(ParseError)); } + ParseError(LDKParseError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParseError)); } + operator LDKParseError() && { LDKParseError res = self; memset(&self, 0, sizeof(LDKParseError)); return res; } + ~ParseError() { ParseError_free(self); } + ParseError& operator=(ParseError&& o) { ParseError_free(self); self = o.self; memset(&o, 0, sizeof(ParseError)); return *this; } + LDKParseError* operator &() { return &self; } + LDKParseError* operator ->() { return &self; } + const LDKParseError* operator &() const { return &self; } + const LDKParseError* operator ->() const { return &self; } }; -class SemanticError { +class ParseOrSemanticError { private: - LDKSemanticError self; + LDKParseOrSemanticError self; public: - SemanticError(const SemanticError&) = delete; - SemanticError(SemanticError&& o) : self(o.self) { memset(&o, 0, sizeof(SemanticError)); } - SemanticError(LDKSemanticError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSemanticError)); } - operator LDKSemanticError() && { LDKSemanticError res = self; memset(&self, 0, sizeof(LDKSemanticError)); return res; } - SemanticError& operator=(SemanticError&& o) { self = o.self; memset(&o, 0, sizeof(SemanticError)); return *this; } - LDKSemanticError* operator &() { return &self; } - LDKSemanticError* operator ->() { return &self; } - const LDKSemanticError* operator &() const { return &self; } - const LDKSemanticError* operator ->() const { return &self; } + ParseOrSemanticError(const ParseOrSemanticError&) = delete; + ParseOrSemanticError(ParseOrSemanticError&& o) : self(o.self) { memset(&o, 0, sizeof(ParseOrSemanticError)); } + ParseOrSemanticError(LDKParseOrSemanticError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKParseOrSemanticError)); } + operator LDKParseOrSemanticError() && { LDKParseOrSemanticError res = self; memset(&self, 0, sizeof(LDKParseOrSemanticError)); return res; } + ~ParseOrSemanticError() { ParseOrSemanticError_free(self); } + ParseOrSemanticError& operator=(ParseOrSemanticError&& o) { ParseOrSemanticError_free(self); self = o.self; memset(&o, 0, sizeof(ParseOrSemanticError)); return *this; } + LDKParseOrSemanticError* operator &() { return &self; } + LDKParseOrSemanticError* operator ->() { return &self; } + const LDKParseOrSemanticError* operator &() const { return &self; } + const LDKParseOrSemanticError* operator ->() const { return &self; } }; -class SignOrCreationError { +class Invoice { private: - LDKSignOrCreationError self; + LDKInvoice self; public: - SignOrCreationError(const SignOrCreationError&) = delete; - SignOrCreationError(SignOrCreationError&& o) : self(o.self) { memset(&o, 0, sizeof(SignOrCreationError)); } - SignOrCreationError(LDKSignOrCreationError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignOrCreationError)); } - operator LDKSignOrCreationError() && { LDKSignOrCreationError res = self; memset(&self, 0, sizeof(LDKSignOrCreationError)); return res; } - ~SignOrCreationError() { SignOrCreationError_free(self); } - SignOrCreationError& operator=(SignOrCreationError&& o) { SignOrCreationError_free(self); self = o.self; memset(&o, 0, sizeof(SignOrCreationError)); return *this; } - LDKSignOrCreationError* operator &() { return &self; } - LDKSignOrCreationError* operator ->() { return &self; } - const LDKSignOrCreationError* operator &() const { return &self; } - const LDKSignOrCreationError* operator ->() const { return &self; } + Invoice(const Invoice&) = delete; + Invoice(Invoice&& o) : self(o.self) { memset(&o, 0, sizeof(Invoice)); } + Invoice(LDKInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoice)); } + operator LDKInvoice() && { LDKInvoice res = self; memset(&self, 0, sizeof(LDKInvoice)); return res; } + ~Invoice() { Invoice_free(self); } + Invoice& operator=(Invoice&& o) { Invoice_free(self); self = o.self; memset(&o, 0, sizeof(Invoice)); return *this; } + LDKInvoice* operator &() { return &self; } + LDKInvoice* operator ->() { return &self; } + const LDKInvoice* operator &() const { return &self; } + const LDKInvoice* operator ->() const { return &self; } }; -class ChannelMonitorUpdate { +class SignedRawInvoice { private: - LDKChannelMonitorUpdate self; + LDKSignedRawInvoice self; public: - ChannelMonitorUpdate(const ChannelMonitorUpdate&) = delete; - ChannelMonitorUpdate(ChannelMonitorUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitorUpdate)); } - ChannelMonitorUpdate(LDKChannelMonitorUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitorUpdate)); } - operator LDKChannelMonitorUpdate() && { LDKChannelMonitorUpdate res = self; memset(&self, 0, sizeof(LDKChannelMonitorUpdate)); return res; } - ~ChannelMonitorUpdate() { ChannelMonitorUpdate_free(self); } - ChannelMonitorUpdate& operator=(ChannelMonitorUpdate&& o) { ChannelMonitorUpdate_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMonitorUpdate)); return *this; } - LDKChannelMonitorUpdate* operator &() { return &self; } - LDKChannelMonitorUpdate* operator ->() { return &self; } - const LDKChannelMonitorUpdate* operator &() const { return &self; } - const LDKChannelMonitorUpdate* operator ->() const { return &self; } + SignedRawInvoice(const SignedRawInvoice&) = delete; + SignedRawInvoice(SignedRawInvoice&& o) : self(o.self) { memset(&o, 0, sizeof(SignedRawInvoice)); } + SignedRawInvoice(LDKSignedRawInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignedRawInvoice)); } + operator LDKSignedRawInvoice() && { LDKSignedRawInvoice res = self; memset(&self, 0, sizeof(LDKSignedRawInvoice)); return res; } + ~SignedRawInvoice() { SignedRawInvoice_free(self); } + SignedRawInvoice& operator=(SignedRawInvoice&& o) { SignedRawInvoice_free(self); self = o.self; memset(&o, 0, sizeof(SignedRawInvoice)); return *this; } + LDKSignedRawInvoice* operator &() { return &self; } + LDKSignedRawInvoice* operator ->() { return &self; } + const LDKSignedRawInvoice* operator &() const { return &self; } + const LDKSignedRawInvoice* operator ->() const { return &self; } }; -class MonitorEvent { +class RawInvoice { private: - LDKMonitorEvent self; + LDKRawInvoice self; public: - MonitorEvent(const MonitorEvent&) = delete; - MonitorEvent(MonitorEvent&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorEvent)); } - MonitorEvent(LDKMonitorEvent&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorEvent)); } - operator LDKMonitorEvent() && { LDKMonitorEvent res = self; memset(&self, 0, sizeof(LDKMonitorEvent)); return res; } - ~MonitorEvent() { MonitorEvent_free(self); } - MonitorEvent& operator=(MonitorEvent&& o) { MonitorEvent_free(self); self = o.self; memset(&o, 0, sizeof(MonitorEvent)); return *this; } - LDKMonitorEvent* operator &() { return &self; } - LDKMonitorEvent* operator ->() { return &self; } - const LDKMonitorEvent* operator &() const { return &self; } - const LDKMonitorEvent* operator ->() const { return &self; } + RawInvoice(const RawInvoice&) = delete; + RawInvoice(RawInvoice&& o) : self(o.self) { memset(&o, 0, sizeof(RawInvoice)); } + RawInvoice(LDKRawInvoice&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRawInvoice)); } + operator LDKRawInvoice() && { LDKRawInvoice res = self; memset(&self, 0, sizeof(LDKRawInvoice)); return res; } + ~RawInvoice() { RawInvoice_free(self); } + RawInvoice& operator=(RawInvoice&& o) { RawInvoice_free(self); self = o.self; memset(&o, 0, sizeof(RawInvoice)); return *this; } + LDKRawInvoice* operator &() { return &self; } + LDKRawInvoice* operator ->() { return &self; } + const LDKRawInvoice* operator &() const { return &self; } + const LDKRawInvoice* operator ->() const { return &self; } }; -class HTLCUpdate { +class RawDataPart { private: - LDKHTLCUpdate self; + LDKRawDataPart self; public: - HTLCUpdate(const HTLCUpdate&) = delete; - HTLCUpdate(HTLCUpdate&& o) : self(o.self) { memset(&o, 0, sizeof(HTLCUpdate)); } - HTLCUpdate(LDKHTLCUpdate&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHTLCUpdate)); } - operator LDKHTLCUpdate() && { LDKHTLCUpdate res = self; memset(&self, 0, sizeof(LDKHTLCUpdate)); return res; } - ~HTLCUpdate() { HTLCUpdate_free(self); } - HTLCUpdate& operator=(HTLCUpdate&& o) { HTLCUpdate_free(self); self = o.self; memset(&o, 0, sizeof(HTLCUpdate)); return *this; } - LDKHTLCUpdate* operator &() { return &self; } - LDKHTLCUpdate* operator ->() { return &self; } - const LDKHTLCUpdate* operator &() const { return &self; } - const LDKHTLCUpdate* operator ->() const { return &self; } + RawDataPart(const RawDataPart&) = delete; + RawDataPart(RawDataPart&& o) : self(o.self) { memset(&o, 0, sizeof(RawDataPart)); } + RawDataPart(LDKRawDataPart&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKRawDataPart)); } + operator LDKRawDataPart() && { LDKRawDataPart res = self; memset(&self, 0, sizeof(LDKRawDataPart)); return res; } + ~RawDataPart() { RawDataPart_free(self); } + RawDataPart& operator=(RawDataPart&& o) { RawDataPart_free(self); self = o.self; memset(&o, 0, sizeof(RawDataPart)); return *this; } + LDKRawDataPart* operator &() { return &self; } + LDKRawDataPart* operator ->() { return &self; } + const LDKRawDataPart* operator &() const { return &self; } + const LDKRawDataPart* operator ->() const { return &self; } }; -class Balance { +class PositiveTimestamp { private: - LDKBalance self; + LDKPositiveTimestamp self; public: - Balance(const Balance&) = delete; - Balance(Balance&& o) : self(o.self) { memset(&o, 0, sizeof(Balance)); } - Balance(LDKBalance&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBalance)); } - operator LDKBalance() && { LDKBalance res = self; memset(&self, 0, sizeof(LDKBalance)); return res; } - ~Balance() { Balance_free(self); } - Balance& operator=(Balance&& o) { Balance_free(self); self = o.self; memset(&o, 0, sizeof(Balance)); return *this; } - LDKBalance* operator &() { return &self; } - LDKBalance* operator ->() { return &self; } - const LDKBalance* operator &() const { return &self; } - const LDKBalance* operator ->() const { return &self; } + PositiveTimestamp(const PositiveTimestamp&) = delete; + PositiveTimestamp(PositiveTimestamp&& o) : self(o.self) { memset(&o, 0, sizeof(PositiveTimestamp)); } + PositiveTimestamp(LDKPositiveTimestamp&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPositiveTimestamp)); } + operator LDKPositiveTimestamp() && { LDKPositiveTimestamp res = self; memset(&self, 0, sizeof(LDKPositiveTimestamp)); return res; } + ~PositiveTimestamp() { PositiveTimestamp_free(self); } + PositiveTimestamp& operator=(PositiveTimestamp&& o) { PositiveTimestamp_free(self); self = o.self; memset(&o, 0, sizeof(PositiveTimestamp)); return *this; } + LDKPositiveTimestamp* operator &() { return &self; } + LDKPositiveTimestamp* operator ->() { return &self; } + const LDKPositiveTimestamp* operator &() const { return &self; } + const LDKPositiveTimestamp* operator ->() const { return &self; } }; -class ChannelMonitor { +class SiPrefix { private: - LDKChannelMonitor self; + LDKSiPrefix self; public: - ChannelMonitor(const ChannelMonitor&) = delete; - ChannelMonitor(ChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChannelMonitor)); } - ChannelMonitor(LDKChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChannelMonitor)); } - operator LDKChannelMonitor() && { LDKChannelMonitor res = self; memset(&self, 0, sizeof(LDKChannelMonitor)); return res; } - ~ChannelMonitor() { ChannelMonitor_free(self); } - ChannelMonitor& operator=(ChannelMonitor&& o) { ChannelMonitor_free(self); self = o.self; memset(&o, 0, sizeof(ChannelMonitor)); return *this; } - LDKChannelMonitor* operator &() { return &self; } - LDKChannelMonitor* operator ->() { return &self; } - const LDKChannelMonitor* operator &() const { return &self; } - const LDKChannelMonitor* operator ->() const { return &self; } + SiPrefix(const SiPrefix&) = delete; + SiPrefix(SiPrefix&& o) : self(o.self) { memset(&o, 0, sizeof(SiPrefix)); } + SiPrefix(LDKSiPrefix&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSiPrefix)); } + operator LDKSiPrefix() && { LDKSiPrefix res = self; memset(&self, 0, sizeof(LDKSiPrefix)); return res; } + SiPrefix& operator=(SiPrefix&& o) { self = o.self; memset(&o, 0, sizeof(SiPrefix)); return *this; } + LDKSiPrefix* operator &() { return &self; } + LDKSiPrefix* operator ->() { return &self; } + const LDKSiPrefix* operator &() const { return &self; } + const LDKSiPrefix* operator ->() const { return &self; } }; -class ExpandedKey { +class Currency { private: - LDKExpandedKey self; + LDKCurrency self; public: - ExpandedKey(const ExpandedKey&) = delete; - ExpandedKey(ExpandedKey&& o) : self(o.self) { memset(&o, 0, sizeof(ExpandedKey)); } - ExpandedKey(LDKExpandedKey&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKExpandedKey)); } - operator LDKExpandedKey() && { LDKExpandedKey res = self; memset(&self, 0, sizeof(LDKExpandedKey)); return res; } - ~ExpandedKey() { ExpandedKey_free(self); } - ExpandedKey& operator=(ExpandedKey&& o) { ExpandedKey_free(self); self = o.self; memset(&o, 0, sizeof(ExpandedKey)); return *this; } - LDKExpandedKey* operator &() { return &self; } - LDKExpandedKey* operator ->() { return &self; } - const LDKExpandedKey* operator &() const { return &self; } - const LDKExpandedKey* operator ->() const { return &self; } + Currency(const Currency&) = delete; + Currency(Currency&& o) : self(o.self) { memset(&o, 0, sizeof(Currency)); } + Currency(LDKCurrency&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCurrency)); } + operator LDKCurrency() && { LDKCurrency res = self; memset(&self, 0, sizeof(LDKCurrency)); return res; } + Currency& operator=(Currency&& o) { self = o.self; memset(&o, 0, sizeof(Currency)); return *this; } + LDKCurrency* operator &() { return &self; } + LDKCurrency* operator ->() { return &self; } + const LDKCurrency* operator &() const { return &self; } + const LDKCurrency* operator ->() const { return &self; } }; -class CustomMessageHandler { +class Sha256 { private: - LDKCustomMessageHandler self; + LDKSha256 self; public: - CustomMessageHandler(const CustomMessageHandler&) = delete; - CustomMessageHandler(CustomMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(CustomMessageHandler)); } - CustomMessageHandler(LDKCustomMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomMessageHandler)); } - operator LDKCustomMessageHandler() && { LDKCustomMessageHandler res = self; memset(&self, 0, sizeof(LDKCustomMessageHandler)); return res; } - ~CustomMessageHandler() { CustomMessageHandler_free(self); } - CustomMessageHandler& operator=(CustomMessageHandler&& o) { CustomMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(CustomMessageHandler)); return *this; } - LDKCustomMessageHandler* operator &() { return &self; } - LDKCustomMessageHandler* operator ->() { return &self; } - const LDKCustomMessageHandler* operator &() const { return &self; } - const LDKCustomMessageHandler* operator ->() const { return &self; } - /** - * Called with the message type that was received and the buffer to be read. - * Can return a `MessageHandlingError` if the message could not be handled. - */ - inline LDK::CResult_NoneLightningErrorZ handle_custom_message(struct LDKType msg, struct LDKPublicKey sender_node_id); - /** - * Gets the list of pending messages which were generated by the custom message - * handler, clearing the list in the process. The first tuple element must - * correspond to the intended recipients node ids. If no connection to one of the - * specified node does not exist, the message is simply not sent to it. - */ - inline LDK::CVec_C2Tuple_PublicKeyTypeZZ get_and_clear_pending_msg(); + Sha256(const Sha256&) = delete; + Sha256(Sha256&& o) : self(o.self) { memset(&o, 0, sizeof(Sha256)); } + Sha256(LDKSha256&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSha256)); } + operator LDKSha256() && { LDKSha256 res = self; memset(&self, 0, sizeof(LDKSha256)); return res; } + ~Sha256() { Sha256_free(self); } + Sha256& operator=(Sha256&& o) { Sha256_free(self); self = o.self; memset(&o, 0, sizeof(Sha256)); return *this; } + LDKSha256* operator &() { return &self; } + LDKSha256* operator ->() { return &self; } + const LDKSha256* operator &() const { return &self; } + const LDKSha256* operator ->() const { return &self; } }; -class IgnoringMessageHandler { +class Description { private: - LDKIgnoringMessageHandler self; + LDKDescription self; public: - IgnoringMessageHandler(const IgnoringMessageHandler&) = delete; - IgnoringMessageHandler(IgnoringMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(IgnoringMessageHandler)); } - IgnoringMessageHandler(LDKIgnoringMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKIgnoringMessageHandler)); } - operator LDKIgnoringMessageHandler() && { LDKIgnoringMessageHandler res = self; memset(&self, 0, sizeof(LDKIgnoringMessageHandler)); return res; } - ~IgnoringMessageHandler() { IgnoringMessageHandler_free(self); } - IgnoringMessageHandler& operator=(IgnoringMessageHandler&& o) { IgnoringMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(IgnoringMessageHandler)); return *this; } - LDKIgnoringMessageHandler* operator &() { return &self; } - LDKIgnoringMessageHandler* operator ->() { return &self; } - const LDKIgnoringMessageHandler* operator &() const { return &self; } - const LDKIgnoringMessageHandler* operator ->() const { return &self; } + Description(const Description&) = delete; + Description(Description&& o) : self(o.self) { memset(&o, 0, sizeof(Description)); } + Description(LDKDescription&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDescription)); } + operator LDKDescription() && { LDKDescription res = self; memset(&self, 0, sizeof(LDKDescription)); return res; } + ~Description() { Description_free(self); } + Description& operator=(Description&& o) { Description_free(self); self = o.self; memset(&o, 0, sizeof(Description)); return *this; } + LDKDescription* operator &() { return &self; } + LDKDescription* operator ->() { return &self; } + const LDKDescription* operator &() const { return &self; } + const LDKDescription* operator ->() const { return &self; } }; -class ErroringMessageHandler { +class PayeePubKey { private: - LDKErroringMessageHandler self; + LDKPayeePubKey self; public: - ErroringMessageHandler(const ErroringMessageHandler&) = delete; - ErroringMessageHandler(ErroringMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(ErroringMessageHandler)); } - ErroringMessageHandler(LDKErroringMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKErroringMessageHandler)); } - operator LDKErroringMessageHandler() && { LDKErroringMessageHandler res = self; memset(&self, 0, sizeof(LDKErroringMessageHandler)); return res; } - ~ErroringMessageHandler() { ErroringMessageHandler_free(self); } - ErroringMessageHandler& operator=(ErroringMessageHandler&& o) { ErroringMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(ErroringMessageHandler)); return *this; } - LDKErroringMessageHandler* operator &() { return &self; } - LDKErroringMessageHandler* operator ->() { return &self; } - const LDKErroringMessageHandler* operator &() const { return &self; } - const LDKErroringMessageHandler* operator ->() const { return &self; } + PayeePubKey(const PayeePubKey&) = delete; + PayeePubKey(PayeePubKey&& o) : self(o.self) { memset(&o, 0, sizeof(PayeePubKey)); } + PayeePubKey(LDKPayeePubKey&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPayeePubKey)); } + operator LDKPayeePubKey() && { LDKPayeePubKey res = self; memset(&self, 0, sizeof(LDKPayeePubKey)); return res; } + ~PayeePubKey() { PayeePubKey_free(self); } + PayeePubKey& operator=(PayeePubKey&& o) { PayeePubKey_free(self); self = o.self; memset(&o, 0, sizeof(PayeePubKey)); return *this; } + LDKPayeePubKey* operator &() { return &self; } + LDKPayeePubKey* operator ->() { return &self; } + const LDKPayeePubKey* operator &() const { return &self; } + const LDKPayeePubKey* operator ->() const { return &self; } }; -class MessageHandler { +class ExpiryTime { private: - LDKMessageHandler self; + LDKExpiryTime self; public: - MessageHandler(const MessageHandler&) = delete; - MessageHandler(MessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(MessageHandler)); } - MessageHandler(LDKMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMessageHandler)); } - operator LDKMessageHandler() && { LDKMessageHandler res = self; memset(&self, 0, sizeof(LDKMessageHandler)); return res; } - ~MessageHandler() { MessageHandler_free(self); } - MessageHandler& operator=(MessageHandler&& o) { MessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(MessageHandler)); return *this; } - LDKMessageHandler* operator &() { return &self; } - LDKMessageHandler* operator ->() { return &self; } - const LDKMessageHandler* operator &() const { return &self; } - const LDKMessageHandler* operator ->() const { return &self; } + ExpiryTime(const ExpiryTime&) = delete; + ExpiryTime(ExpiryTime&& o) : self(o.self) { memset(&o, 0, sizeof(ExpiryTime)); } + ExpiryTime(LDKExpiryTime&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKExpiryTime)); } + operator LDKExpiryTime() && { LDKExpiryTime res = self; memset(&self, 0, sizeof(LDKExpiryTime)); return res; } + ~ExpiryTime() { ExpiryTime_free(self); } + ExpiryTime& operator=(ExpiryTime&& o) { ExpiryTime_free(self); self = o.self; memset(&o, 0, sizeof(ExpiryTime)); return *this; } + LDKExpiryTime* operator &() { return &self; } + LDKExpiryTime* operator ->() { return &self; } + const LDKExpiryTime* operator &() const { return &self; } + const LDKExpiryTime* operator ->() const { return &self; } }; -class SocketDescriptor { +class MinFinalCltvExpiry { private: - LDKSocketDescriptor self; + LDKMinFinalCltvExpiry self; public: - SocketDescriptor(const SocketDescriptor&) = delete; - SocketDescriptor(SocketDescriptor&& o) : self(o.self) { memset(&o, 0, sizeof(SocketDescriptor)); } - SocketDescriptor(LDKSocketDescriptor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSocketDescriptor)); } - operator LDKSocketDescriptor() && { LDKSocketDescriptor res = self; memset(&self, 0, sizeof(LDKSocketDescriptor)); return res; } - ~SocketDescriptor() { SocketDescriptor_free(self); } - SocketDescriptor& operator=(SocketDescriptor&& o) { SocketDescriptor_free(self); self = o.self; memset(&o, 0, sizeof(SocketDescriptor)); return *this; } - LDKSocketDescriptor* operator &() { return &self; } - LDKSocketDescriptor* operator ->() { return &self; } - const LDKSocketDescriptor* operator &() const { return &self; } - const LDKSocketDescriptor* operator ->() const { return &self; } - /** - * Attempts to send some data from the given slice to the peer. - * - * Returns the amount of data which was sent, possibly 0 if the socket has since disconnected. - * Note that in the disconnected case, [`PeerManager::socket_disconnected`] must still be - * called and further write attempts may occur until that time. - * - * If the returned size is smaller than `data.len()`, a - * [`PeerManager::write_buffer_space_avail`] call must be made the next time more data can be - * written. Additionally, until a `send_data` event completes fully, no further - * [`PeerManager::read_event`] calls should be made for the same peer! Because this is to - * prevent denial-of-service issues, you should not read or buffer any data from the socket - * until then. - * - * If a [`PeerManager::read_event`] call on this descriptor had previously returned true - * (indicating that read events should be paused to prevent DoS in the send buffer), - * `resume_read` may be set indicating that read events on this descriptor should resume. A - * `resume_read` of false carries no meaning, and should not cause any action. - */ - inline uintptr_t send_data(struct LDKu8slice data, bool resume_read); - /** - * Disconnect the socket pointed to by this SocketDescriptor. - * - * You do *not* need to call [`PeerManager::socket_disconnected`] with this socket after this - * call (doing so is a noop). - */ - inline void disconnect_socket(); - /** Checks if two objects are equal given this object's this_arg pointer and another object. */ - inline bool eq(const struct LDKSocketDescriptor *NONNULL_PTR other_arg); - /** - * Calculate a succinct non-cryptographic hash for an object given its this_arg pointer. - * This is used, for example, for inclusion of this object in a hash map. - */ - inline uint64_t hash(); + MinFinalCltvExpiry(const MinFinalCltvExpiry&) = delete; + MinFinalCltvExpiry(MinFinalCltvExpiry&& o) : self(o.self) { memset(&o, 0, sizeof(MinFinalCltvExpiry)); } + MinFinalCltvExpiry(LDKMinFinalCltvExpiry&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMinFinalCltvExpiry)); } + operator LDKMinFinalCltvExpiry() && { LDKMinFinalCltvExpiry res = self; memset(&self, 0, sizeof(LDKMinFinalCltvExpiry)); return res; } + ~MinFinalCltvExpiry() { MinFinalCltvExpiry_free(self); } + MinFinalCltvExpiry& operator=(MinFinalCltvExpiry&& o) { MinFinalCltvExpiry_free(self); self = o.self; memset(&o, 0, sizeof(MinFinalCltvExpiry)); return *this; } + LDKMinFinalCltvExpiry* operator &() { return &self; } + LDKMinFinalCltvExpiry* operator ->() { return &self; } + const LDKMinFinalCltvExpiry* operator &() const { return &self; } + const LDKMinFinalCltvExpiry* operator ->() const { return &self; } }; -class PeerHandleError { +class Fallback { private: - LDKPeerHandleError self; + LDKFallback self; public: - PeerHandleError(const PeerHandleError&) = delete; - PeerHandleError(PeerHandleError&& o) : self(o.self) { memset(&o, 0, sizeof(PeerHandleError)); } - PeerHandleError(LDKPeerHandleError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerHandleError)); } - operator LDKPeerHandleError() && { LDKPeerHandleError res = self; memset(&self, 0, sizeof(LDKPeerHandleError)); return res; } - ~PeerHandleError() { PeerHandleError_free(self); } - PeerHandleError& operator=(PeerHandleError&& o) { PeerHandleError_free(self); self = o.self; memset(&o, 0, sizeof(PeerHandleError)); return *this; } - LDKPeerHandleError* operator &() { return &self; } - LDKPeerHandleError* operator ->() { return &self; } - const LDKPeerHandleError* operator &() const { return &self; } - const LDKPeerHandleError* operator ->() const { return &self; } + Fallback(const Fallback&) = delete; + Fallback(Fallback&& o) : self(o.self) { memset(&o, 0, sizeof(Fallback)); } + Fallback(LDKFallback&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKFallback)); } + operator LDKFallback() && { LDKFallback res = self; memset(&self, 0, sizeof(LDKFallback)); return res; } + ~Fallback() { Fallback_free(self); } + Fallback& operator=(Fallback&& o) { Fallback_free(self); self = o.self; memset(&o, 0, sizeof(Fallback)); return *this; } + LDKFallback* operator &() { return &self; } + LDKFallback* operator ->() { return &self; } + const LDKFallback* operator &() const { return &self; } + const LDKFallback* operator ->() const { return &self; } }; -class PeerManager { +class InvoiceSignature { private: - LDKPeerManager self; + LDKInvoiceSignature self; public: - PeerManager(const PeerManager&) = delete; - PeerManager(PeerManager&& o) : self(o.self) { memset(&o, 0, sizeof(PeerManager)); } - PeerManager(LDKPeerManager&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPeerManager)); } - operator LDKPeerManager() && { LDKPeerManager res = self; memset(&self, 0, sizeof(LDKPeerManager)); return res; } - ~PeerManager() { PeerManager_free(self); } - PeerManager& operator=(PeerManager&& o) { PeerManager_free(self); self = o.self; memset(&o, 0, sizeof(PeerManager)); return *this; } - LDKPeerManager* operator &() { return &self; } - LDKPeerManager* operator ->() { return &self; } - const LDKPeerManager* operator &() const { return &self; } - const LDKPeerManager* operator ->() const { return &self; } + InvoiceSignature(const InvoiceSignature&) = delete; + InvoiceSignature(InvoiceSignature&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceSignature)); } + InvoiceSignature(LDKInvoiceSignature&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceSignature)); } + operator LDKInvoiceSignature() && { LDKInvoiceSignature res = self; memset(&self, 0, sizeof(LDKInvoiceSignature)); return res; } + ~InvoiceSignature() { InvoiceSignature_free(self); } + InvoiceSignature& operator=(InvoiceSignature&& o) { InvoiceSignature_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceSignature)); return *this; } + LDKInvoiceSignature* operator &() { return &self; } + LDKInvoiceSignature* operator ->() { return &self; } + const LDKInvoiceSignature* operator &() const { return &self; } + const LDKInvoiceSignature* operator ->() const { return &self; } }; -class OnionMessenger { +class PrivateRoute { private: - LDKOnionMessenger self; + LDKPrivateRoute self; public: - OnionMessenger(const OnionMessenger&) = delete; - OnionMessenger(OnionMessenger&& o) : self(o.self) { memset(&o, 0, sizeof(OnionMessenger)); } - OnionMessenger(LDKOnionMessenger&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOnionMessenger)); } - operator LDKOnionMessenger() && { LDKOnionMessenger res = self; memset(&self, 0, sizeof(LDKOnionMessenger)); return res; } - ~OnionMessenger() { OnionMessenger_free(self); } - OnionMessenger& operator=(OnionMessenger&& o) { OnionMessenger_free(self); self = o.self; memset(&o, 0, sizeof(OnionMessenger)); return *this; } - LDKOnionMessenger* operator &() { return &self; } - LDKOnionMessenger* operator ->() { return &self; } - const LDKOnionMessenger* operator &() const { return &self; } - const LDKOnionMessenger* operator ->() const { return &self; } + PrivateRoute(const PrivateRoute&) = delete; + PrivateRoute(PrivateRoute&& o) : self(o.self) { memset(&o, 0, sizeof(PrivateRoute)); } + PrivateRoute(LDKPrivateRoute&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPrivateRoute)); } + operator LDKPrivateRoute() && { LDKPrivateRoute res = self; memset(&self, 0, sizeof(LDKPrivateRoute)); return res; } + ~PrivateRoute() { PrivateRoute_free(self); } + PrivateRoute& operator=(PrivateRoute&& o) { PrivateRoute_free(self); self = o.self; memset(&o, 0, sizeof(PrivateRoute)); return *this; } + LDKPrivateRoute* operator &() { return &self; } + LDKPrivateRoute* operator ->() { return &self; } + const LDKPrivateRoute* operator &() const { return &self; } + const LDKPrivateRoute* operator ->() const { return &self; } }; -class Destination { +class CreationError { private: - LDKDestination self; + LDKCreationError self; public: - Destination(const Destination&) = delete; - Destination(Destination&& o) : self(o.self) { memset(&o, 0, sizeof(Destination)); } - Destination(LDKDestination&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDestination)); } - operator LDKDestination() && { LDKDestination res = self; memset(&self, 0, sizeof(LDKDestination)); return res; } - ~Destination() { Destination_free(self); } - Destination& operator=(Destination&& o) { Destination_free(self); self = o.self; memset(&o, 0, sizeof(Destination)); return *this; } - LDKDestination* operator &() { return &self; } - LDKDestination* operator ->() { return &self; } - const LDKDestination* operator &() const { return &self; } - const LDKDestination* operator ->() const { return &self; } + CreationError(const CreationError&) = delete; + CreationError(CreationError&& o) : self(o.self) { memset(&o, 0, sizeof(CreationError)); } + CreationError(LDKCreationError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCreationError)); } + operator LDKCreationError() && { LDKCreationError res = self; memset(&self, 0, sizeof(LDKCreationError)); return res; } + CreationError& operator=(CreationError&& o) { self = o.self; memset(&o, 0, sizeof(CreationError)); return *this; } + LDKCreationError* operator &() { return &self; } + LDKCreationError* operator ->() { return &self; } + const LDKCreationError* operator &() const { return &self; } + const LDKCreationError* operator ->() const { return &self; } }; -class SendError { +class SemanticError { private: - LDKSendError self; + LDKSemanticError self; public: - SendError(const SendError&) = delete; - SendError(SendError&& o) : self(o.self) { memset(&o, 0, sizeof(SendError)); } - SendError(LDKSendError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSendError)); } - operator LDKSendError() && { LDKSendError res = self; memset(&self, 0, sizeof(LDKSendError)); return res; } - ~SendError() { SendError_free(self); } - SendError& operator=(SendError&& o) { SendError_free(self); self = o.self; memset(&o, 0, sizeof(SendError)); return *this; } - LDKSendError* operator &() { return &self; } - LDKSendError* operator ->() { return &self; } - const LDKSendError* operator &() const { return &self; } - const LDKSendError* operator ->() const { return &self; } + SemanticError(const SemanticError&) = delete; + SemanticError(SemanticError&& o) : self(o.self) { memset(&o, 0, sizeof(SemanticError)); } + SemanticError(LDKSemanticError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSemanticError)); } + operator LDKSemanticError() && { LDKSemanticError res = self; memset(&self, 0, sizeof(LDKSemanticError)); return res; } + SemanticError& operator=(SemanticError&& o) { self = o.self; memset(&o, 0, sizeof(SemanticError)); return *this; } + LDKSemanticError* operator &() { return &self; } + LDKSemanticError* operator ->() { return &self; } + const LDKSemanticError* operator &() const { return &self; } + const LDKSemanticError* operator ->() const { return &self; } }; -class CustomOnionMessageHandler { +class SignOrCreationError { private: - LDKCustomOnionMessageHandler self; + LDKSignOrCreationError self; public: - CustomOnionMessageHandler(const CustomOnionMessageHandler&) = delete; - CustomOnionMessageHandler(CustomOnionMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(CustomOnionMessageHandler)); } - CustomOnionMessageHandler(LDKCustomOnionMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCustomOnionMessageHandler)); } - operator LDKCustomOnionMessageHandler() && { LDKCustomOnionMessageHandler res = self; memset(&self, 0, sizeof(LDKCustomOnionMessageHandler)); return res; } - ~CustomOnionMessageHandler() { CustomOnionMessageHandler_free(self); } - CustomOnionMessageHandler& operator=(CustomOnionMessageHandler&& o) { CustomOnionMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(CustomOnionMessageHandler)); return *this; } - LDKCustomOnionMessageHandler* operator &() { return &self; } - LDKCustomOnionMessageHandler* operator ->() { return &self; } - const LDKCustomOnionMessageHandler* operator &() const { return &self; } - const LDKCustomOnionMessageHandler* operator ->() const { return &self; } - /** - * Called with the custom message that was received. - */ - inline void handle_custom_message(struct LDKCustomOnionMessageContents msg); - /** - * Read a custom message of type `message_type` from `buffer`, returning `Ok(None)` if the - * message type is unknown. - */ - inline LDK::CResult_COption_CustomOnionMessageContentsZDecodeErrorZ read_custom_message(uint64_t message_type, struct LDKu8slice buffer); + SignOrCreationError(const SignOrCreationError&) = delete; + SignOrCreationError(SignOrCreationError&& o) : self(o.self) { memset(&o, 0, sizeof(SignOrCreationError)); } + SignOrCreationError(LDKSignOrCreationError&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKSignOrCreationError)); } + operator LDKSignOrCreationError() && { LDKSignOrCreationError res = self; memset(&self, 0, sizeof(LDKSignOrCreationError)); return res; } + ~SignOrCreationError() { SignOrCreationError_free(self); } + SignOrCreationError& operator=(SignOrCreationError&& o) { SignOrCreationError_free(self); self = o.self; memset(&o, 0, sizeof(SignOrCreationError)); return *this; } + LDKSignOrCreationError* operator &() { return &self; } + LDKSignOrCreationError* operator ->() { return &self; } + const LDKSignOrCreationError* operator &() const { return &self; } + const LDKSignOrCreationError* operator ->() const { return &self; } }; class RapidGossipSync { private: @@ -4119,21 +4271,6 @@ public: const LDKGraphSyncError* operator &() const { return &self; } const LDKGraphSyncError* operator ->() const { return &self; } }; -class DefaultRouter { -private: - LDKDefaultRouter self; -public: - DefaultRouter(const DefaultRouter&) = delete; - DefaultRouter(DefaultRouter&& o) : self(o.self) { memset(&o, 0, sizeof(DefaultRouter)); } - DefaultRouter(LDKDefaultRouter&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDefaultRouter)); } - operator LDKDefaultRouter() && { LDKDefaultRouter res = self; memset(&self, 0, sizeof(LDKDefaultRouter)); return res; } - ~DefaultRouter() { DefaultRouter_free(self); } - DefaultRouter& operator=(DefaultRouter&& o) { DefaultRouter_free(self); self = o.self; memset(&o, 0, sizeof(DefaultRouter)); return *this; } - LDKDefaultRouter* operator &() { return &self; } - LDKDefaultRouter* operator ->() { return &self; } - const LDKDefaultRouter* operator &() const { return &self; } - const LDKDefaultRouter* operator ->() const { return &self; } -}; class Level { private: LDKLevel self; @@ -4302,2405 +4439,2945 @@ public: */ inline LDK::ChannelMonitorUpdateStatus update_persisted_channel(struct LDKOutPoint channel_id, const struct LDKChannelMonitorUpdate *NONNULL_PTR update, const struct LDKChannelMonitor *NONNULL_PTR data, struct LDKMonitorUpdateId update_id); }; -class LockedChannelMonitor { +class LockedChannelMonitor { +private: + LDKLockedChannelMonitor self; +public: + LockedChannelMonitor(const LockedChannelMonitor&) = delete; + LockedChannelMonitor(LockedChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(LockedChannelMonitor)); } + LockedChannelMonitor(LDKLockedChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLockedChannelMonitor)); } + operator LDKLockedChannelMonitor() && { LDKLockedChannelMonitor res = self; memset(&self, 0, sizeof(LDKLockedChannelMonitor)); return res; } + ~LockedChannelMonitor() { LockedChannelMonitor_free(self); } + LockedChannelMonitor& operator=(LockedChannelMonitor&& o) { LockedChannelMonitor_free(self); self = o.self; memset(&o, 0, sizeof(LockedChannelMonitor)); return *this; } + LDKLockedChannelMonitor* operator &() { return &self; } + LDKLockedChannelMonitor* operator ->() { return &self; } + const LDKLockedChannelMonitor* operator &() const { return &self; } + const LDKLockedChannelMonitor* operator ->() const { return &self; } +}; +class ChainMonitor { +private: + LDKChainMonitor self; +public: + ChainMonitor(const ChainMonitor&) = delete; + ChainMonitor(ChainMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChainMonitor)); } + ChainMonitor(LDKChainMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainMonitor)); } + operator LDKChainMonitor() && { LDKChainMonitor res = self; memset(&self, 0, sizeof(LDKChainMonitor)); return res; } + ~ChainMonitor() { ChainMonitor_free(self); } + ChainMonitor& operator=(ChainMonitor&& o) { ChainMonitor_free(self); self = o.self; memset(&o, 0, sizeof(ChainMonitor)); return *this; } + LDKChainMonitor* operator &() { return &self; } + LDKChainMonitor* operator ->() { return &self; } + const LDKChainMonitor* operator &() const { return &self; } + const LDKChainMonitor* operator ->() const { return &self; } +}; +class CResult_LockedChannelMonitorNoneZ { +private: + LDKCResult_LockedChannelMonitorNoneZ self; +public: + CResult_LockedChannelMonitorNoneZ(const CResult_LockedChannelMonitorNoneZ&) = delete; + CResult_LockedChannelMonitorNoneZ(CResult_LockedChannelMonitorNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); } + CResult_LockedChannelMonitorNoneZ(LDKCResult_LockedChannelMonitorNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); } + operator LDKCResult_LockedChannelMonitorNoneZ() && { LDKCResult_LockedChannelMonitorNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); return res; } + ~CResult_LockedChannelMonitorNoneZ() { CResult_LockedChannelMonitorNoneZ_free(self); } + CResult_LockedChannelMonitorNoneZ& operator=(CResult_LockedChannelMonitorNoneZ&& o) { CResult_LockedChannelMonitorNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); return *this; } + LDKCResult_LockedChannelMonitorNoneZ* operator &() { return &self; } + LDKCResult_LockedChannelMonitorNoneZ* operator ->() { return &self; } + const LDKCResult_LockedChannelMonitorNoneZ* operator &() const { return &self; } + const LDKCResult_LockedChannelMonitorNoneZ* operator ->() const { return &self; } +}; +class CResult_PhantomRouteHintsDecodeErrorZ { +private: + LDKCResult_PhantomRouteHintsDecodeErrorZ self; +public: + CResult_PhantomRouteHintsDecodeErrorZ(const CResult_PhantomRouteHintsDecodeErrorZ&) = delete; + CResult_PhantomRouteHintsDecodeErrorZ(CResult_PhantomRouteHintsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); } + CResult_PhantomRouteHintsDecodeErrorZ(LDKCResult_PhantomRouteHintsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); } + operator LDKCResult_PhantomRouteHintsDecodeErrorZ() && { LDKCResult_PhantomRouteHintsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); return res; } + ~CResult_PhantomRouteHintsDecodeErrorZ() { CResult_PhantomRouteHintsDecodeErrorZ_free(self); } + CResult_PhantomRouteHintsDecodeErrorZ& operator=(CResult_PhantomRouteHintsDecodeErrorZ&& o) { CResult_PhantomRouteHintsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); return *this; } + LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() { return &self; } + LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { +private: + LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ self; +public: + CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(const CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&) = delete; + CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); } + CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); } + operator LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ() && { LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); return res; } + ~CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ() { CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(self); } + CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ& operator=(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& o) { CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); return *this; } + LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() { return &self; } + LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +private: + LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ self; +public: + CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&) = delete; + CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); } + CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); } + operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return res; } + ~CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); } + CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return *this; } + LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_u32TxOutZZ { +private: + LDKCVec_C2Tuple_u32TxOutZZ self; +public: + CVec_C2Tuple_u32TxOutZZ(const CVec_C2Tuple_u32TxOutZZ&) = delete; + CVec_C2Tuple_u32TxOutZZ(CVec_C2Tuple_u32TxOutZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); } + CVec_C2Tuple_u32TxOutZZ(LDKCVec_C2Tuple_u32TxOutZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); } + operator LDKCVec_C2Tuple_u32TxOutZZ() && { LDKCVec_C2Tuple_u32TxOutZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); return res; } + ~CVec_C2Tuple_u32TxOutZZ() { CVec_C2Tuple_u32TxOutZZ_free(self); } + CVec_C2Tuple_u32TxOutZZ& operator=(CVec_C2Tuple_u32TxOutZZ&& o) { CVec_C2Tuple_u32TxOutZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); return *this; } + LDKCVec_C2Tuple_u32TxOutZZ* operator &() { return &self; } + LDKCVec_C2Tuple_u32TxOutZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_u32TxOutZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_u32TxOutZZ* operator ->() const { return &self; } +}; +class CResult_FundingCreatedDecodeErrorZ { +private: + LDKCResult_FundingCreatedDecodeErrorZ self; +public: + CResult_FundingCreatedDecodeErrorZ(const CResult_FundingCreatedDecodeErrorZ&) = delete; + CResult_FundingCreatedDecodeErrorZ(CResult_FundingCreatedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingCreatedDecodeErrorZ)); } + CResult_FundingCreatedDecodeErrorZ(LDKCResult_FundingCreatedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingCreatedDecodeErrorZ)); } + operator LDKCResult_FundingCreatedDecodeErrorZ() && { LDKCResult_FundingCreatedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingCreatedDecodeErrorZ)); return res; } + ~CResult_FundingCreatedDecodeErrorZ() { CResult_FundingCreatedDecodeErrorZ_free(self); } + CResult_FundingCreatedDecodeErrorZ& operator=(CResult_FundingCreatedDecodeErrorZ&& o) { CResult_FundingCreatedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingCreatedDecodeErrorZ)); return *this; } + LDKCResult_FundingCreatedDecodeErrorZ* operator &() { return &self; } + LDKCResult_FundingCreatedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_FundingCreatedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_FundingCreatedDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ChannelInfoDecodeErrorZ { +private: + LDKCResult_ChannelInfoDecodeErrorZ self; +public: + CResult_ChannelInfoDecodeErrorZ(const CResult_ChannelInfoDecodeErrorZ&) = delete; + CResult_ChannelInfoDecodeErrorZ(CResult_ChannelInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelInfoDecodeErrorZ)); } + CResult_ChannelInfoDecodeErrorZ(LDKCResult_ChannelInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelInfoDecodeErrorZ)); } + operator LDKCResult_ChannelInfoDecodeErrorZ() && { LDKCResult_ChannelInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelInfoDecodeErrorZ)); return res; } + ~CResult_ChannelInfoDecodeErrorZ() { CResult_ChannelInfoDecodeErrorZ_free(self); } + CResult_ChannelInfoDecodeErrorZ& operator=(CResult_ChannelInfoDecodeErrorZ&& o) { CResult_ChannelInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelInfoDecodeErrorZ)); return *this; } + LDKCResult_ChannelInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelInfoDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_NoneSendErrorZ { +private: + LDKCResult_NoneSendErrorZ self; +public: + CResult_NoneSendErrorZ(const CResult_NoneSendErrorZ&) = delete; + CResult_NoneSendErrorZ(CResult_NoneSendErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneSendErrorZ)); } + CResult_NoneSendErrorZ(LDKCResult_NoneSendErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneSendErrorZ)); } + operator LDKCResult_NoneSendErrorZ() && { LDKCResult_NoneSendErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneSendErrorZ)); return res; } + ~CResult_NoneSendErrorZ() { CResult_NoneSendErrorZ_free(self); } + CResult_NoneSendErrorZ& operator=(CResult_NoneSendErrorZ&& o) { CResult_NoneSendErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneSendErrorZ)); return *this; } + LDKCResult_NoneSendErrorZ* operator &() { return &self; } + LDKCResult_NoneSendErrorZ* operator ->() { return &self; } + const LDKCResult_NoneSendErrorZ* operator &() const { return &self; } + const LDKCResult_NoneSendErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_u8ZPeerHandleErrorZ { +private: + LDKCResult_CVec_u8ZPeerHandleErrorZ self; +public: + CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete; + CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); } + CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); } + operator LDKCResult_CVec_u8ZPeerHandleErrorZ() && { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; } + ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); } + CResult_CVec_u8ZPeerHandleErrorZ& operator=(CResult_CVec_u8ZPeerHandleErrorZ&& o) { CResult_CVec_u8ZPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); return *this; } + LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; } + LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; } +}; +class CResult_GossipTimestampFilterDecodeErrorZ { +private: + LDKCResult_GossipTimestampFilterDecodeErrorZ self; +public: + CResult_GossipTimestampFilterDecodeErrorZ(const CResult_GossipTimestampFilterDecodeErrorZ&) = delete; + CResult_GossipTimestampFilterDecodeErrorZ(CResult_GossipTimestampFilterDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); } + CResult_GossipTimestampFilterDecodeErrorZ(LDKCResult_GossipTimestampFilterDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); } + operator LDKCResult_GossipTimestampFilterDecodeErrorZ() && { LDKCResult_GossipTimestampFilterDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); return res; } + ~CResult_GossipTimestampFilterDecodeErrorZ() { CResult_GossipTimestampFilterDecodeErrorZ_free(self); } + CResult_GossipTimestampFilterDecodeErrorZ& operator=(CResult_GossipTimestampFilterDecodeErrorZ&& o) { CResult_GossipTimestampFilterDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); return *this; } + LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() { return &self; } + LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_NetworkUpdateZ { +private: + LDKCOption_NetworkUpdateZ self; +public: + COption_NetworkUpdateZ(const COption_NetworkUpdateZ&) = delete; + COption_NetworkUpdateZ(COption_NetworkUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NetworkUpdateZ)); } + COption_NetworkUpdateZ(LDKCOption_NetworkUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NetworkUpdateZ)); } + operator LDKCOption_NetworkUpdateZ() && { LDKCOption_NetworkUpdateZ res = self; memset(&self, 0, sizeof(LDKCOption_NetworkUpdateZ)); return res; } + ~COption_NetworkUpdateZ() { COption_NetworkUpdateZ_free(self); } + COption_NetworkUpdateZ& operator=(COption_NetworkUpdateZ&& o) { COption_NetworkUpdateZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NetworkUpdateZ)); return *this; } + LDKCOption_NetworkUpdateZ* operator &() { return &self; } + LDKCOption_NetworkUpdateZ* operator ->() { return &self; } + const LDKCOption_NetworkUpdateZ* operator &() const { return &self; } + const LDKCOption_NetworkUpdateZ* operator ->() const { return &self; } +}; +class COption_u64Z { +private: + LDKCOption_u64Z self; +public: + COption_u64Z(const COption_u64Z&) = delete; + COption_u64Z(COption_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u64Z)); } + COption_u64Z(LDKCOption_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u64Z)); } + operator LDKCOption_u64Z() && { LDKCOption_u64Z res = self; memset(&self, 0, sizeof(LDKCOption_u64Z)); return res; } + ~COption_u64Z() { COption_u64Z_free(self); } + COption_u64Z& operator=(COption_u64Z&& o) { COption_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u64Z)); return *this; } + LDKCOption_u64Z* operator &() { return &self; } + LDKCOption_u64Z* operator ->() { return &self; } + const LDKCOption_u64Z* operator &() const { return &self; } + const LDKCOption_u64Z* operator ->() const { return &self; } +}; +class CResult_PaymentPreimageAPIErrorZ { +private: + LDKCResult_PaymentPreimageAPIErrorZ self; +public: + CResult_PaymentPreimageAPIErrorZ(const CResult_PaymentPreimageAPIErrorZ&) = delete; + CResult_PaymentPreimageAPIErrorZ(CResult_PaymentPreimageAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); } + CResult_PaymentPreimageAPIErrorZ(LDKCResult_PaymentPreimageAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); } + operator LDKCResult_PaymentPreimageAPIErrorZ() && { LDKCResult_PaymentPreimageAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); return res; } + ~CResult_PaymentPreimageAPIErrorZ() { CResult_PaymentPreimageAPIErrorZ_free(self); } + CResult_PaymentPreimageAPIErrorZ& operator=(CResult_PaymentPreimageAPIErrorZ&& o) { CResult_PaymentPreimageAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); return *this; } + LDKCResult_PaymentPreimageAPIErrorZ* operator &() { return &self; } + LDKCResult_PaymentPreimageAPIErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentPreimageAPIErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentPreimageAPIErrorZ* operator ->() const { return &self; } +}; +class CResult_RouteHintDecodeErrorZ { +private: + LDKCResult_RouteHintDecodeErrorZ self; +public: + CResult_RouteHintDecodeErrorZ(const CResult_RouteHintDecodeErrorZ&) = delete; + CResult_RouteHintDecodeErrorZ(CResult_RouteHintDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); } + CResult_RouteHintDecodeErrorZ(LDKCResult_RouteHintDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); } + operator LDKCResult_RouteHintDecodeErrorZ() && { LDKCResult_RouteHintDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); return res; } + ~CResult_RouteHintDecodeErrorZ() { CResult_RouteHintDecodeErrorZ_free(self); } + CResult_RouteHintDecodeErrorZ& operator=(CResult_RouteHintDecodeErrorZ&& o) { CResult_RouteHintDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); return *this; } + LDKCResult_RouteHintDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteHintDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteHintDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteHintDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_FilterZ { +private: + LDKCOption_FilterZ self; +public: + COption_FilterZ(const COption_FilterZ&) = delete; + COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); } + COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); } + operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; } + ~COption_FilterZ() { COption_FilterZ_free(self); } + COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; } + LDKCOption_FilterZ* operator &() { return &self; } + LDKCOption_FilterZ* operator ->() { return &self; } + const LDKCOption_FilterZ* operator &() const { return &self; } + const LDKCOption_FilterZ* operator ->() const { return &self; } +}; +class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { +private: + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self; +public: + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(const COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&) = delete; + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } + operator LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() && { LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; } + ~COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); } + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ& operator=(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return *this; } + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() { return &self; } + LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() { return &self; } + const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; } + const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; } +}; +class CResult_CommitmentSignedDecodeErrorZ { +private: + LDKCResult_CommitmentSignedDecodeErrorZ self; +public: + CResult_CommitmentSignedDecodeErrorZ(const CResult_CommitmentSignedDecodeErrorZ&) = delete; + CResult_CommitmentSignedDecodeErrorZ(CResult_CommitmentSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); } + CResult_CommitmentSignedDecodeErrorZ(LDKCResult_CommitmentSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); } + operator LDKCResult_CommitmentSignedDecodeErrorZ() && { LDKCResult_CommitmentSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); return res; } + ~CResult_CommitmentSignedDecodeErrorZ() { CResult_CommitmentSignedDecodeErrorZ_free(self); } + CResult_CommitmentSignedDecodeErrorZ& operator=(CResult_CommitmentSignedDecodeErrorZ&& o) { CResult_CommitmentSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); return *this; } + LDKCResult_CommitmentSignedDecodeErrorZ* operator &() { return &self; } + LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CommitmentSignedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_UpdateAddHTLCZ { +private: + LDKCVec_UpdateAddHTLCZ self; +public: + CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete; + CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); } + CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); } + operator LDKCVec_UpdateAddHTLCZ() && { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; } + ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); } + CVec_UpdateAddHTLCZ& operator=(CVec_UpdateAddHTLCZ&& o) { CVec_UpdateAddHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); return *this; } + LDKCVec_UpdateAddHTLCZ* operator &() { return &self; } + LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; } +}; +class COption_u32Z { +private: + LDKCOption_u32Z self; +public: + COption_u32Z(const COption_u32Z&) = delete; + COption_u32Z(COption_u32Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u32Z)); } + COption_u32Z(LDKCOption_u32Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u32Z)); } + operator LDKCOption_u32Z() && { LDKCOption_u32Z res = self; memset(&self, 0, sizeof(LDKCOption_u32Z)); return res; } + ~COption_u32Z() { COption_u32Z_free(self); } + COption_u32Z& operator=(COption_u32Z&& o) { COption_u32Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u32Z)); return *this; } + LDKCOption_u32Z* operator &() { return &self; } + LDKCOption_u32Z* operator ->() { return &self; } + const LDKCOption_u32Z* operator &() const { return &self; } + const LDKCOption_u32Z* operator ->() const { return &self; } +}; +class CResult_StaticPaymentOutputDescriptorDecodeErrorZ { +private: + LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ self; +public: + CResult_StaticPaymentOutputDescriptorDecodeErrorZ(const CResult_StaticPaymentOutputDescriptorDecodeErrorZ&) = delete; + CResult_StaticPaymentOutputDescriptorDecodeErrorZ(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); } + CResult_StaticPaymentOutputDescriptorDecodeErrorZ(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); } + operator LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return res; } + ~CResult_StaticPaymentOutputDescriptorDecodeErrorZ() { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); } + CResult_StaticPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return *this; } + LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; } + LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_C2Tuple_TxidBlockHashZZ { +private: + LDKCVec_C2Tuple_TxidBlockHashZZ self; +public: + CVec_C2Tuple_TxidBlockHashZZ(const CVec_C2Tuple_TxidBlockHashZZ&) = delete; + CVec_C2Tuple_TxidBlockHashZZ(CVec_C2Tuple_TxidBlockHashZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidBlockHashZZ)); } + CVec_C2Tuple_TxidBlockHashZZ(LDKCVec_C2Tuple_TxidBlockHashZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidBlockHashZZ)); } + operator LDKCVec_C2Tuple_TxidBlockHashZZ() && { LDKCVec_C2Tuple_TxidBlockHashZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidBlockHashZZ)); return res; } + ~CVec_C2Tuple_TxidBlockHashZZ() { CVec_C2Tuple_TxidBlockHashZZ_free(self); } + CVec_C2Tuple_TxidBlockHashZZ& operator=(CVec_C2Tuple_TxidBlockHashZZ&& o) { CVec_C2Tuple_TxidBlockHashZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidBlockHashZZ)); return *this; } + LDKCVec_C2Tuple_TxidBlockHashZZ* operator &() { return &self; } + LDKCVec_C2Tuple_TxidBlockHashZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_TxidBlockHashZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_TxidBlockHashZZ* operator ->() const { return &self; } +}; +class CResult_CommitmentTransactionDecodeErrorZ { +private: + LDKCResult_CommitmentTransactionDecodeErrorZ self; +public: + CResult_CommitmentTransactionDecodeErrorZ(const CResult_CommitmentTransactionDecodeErrorZ&) = delete; + CResult_CommitmentTransactionDecodeErrorZ(CResult_CommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); } + CResult_CommitmentTransactionDecodeErrorZ(LDKCResult_CommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); } + operator LDKCResult_CommitmentTransactionDecodeErrorZ() && { LDKCResult_CommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); return res; } + ~CResult_CommitmentTransactionDecodeErrorZ() { CResult_CommitmentTransactionDecodeErrorZ_free(self); } + CResult_CommitmentTransactionDecodeErrorZ& operator=(CResult_CommitmentTransactionDecodeErrorZ&& o) { CResult_CommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); return *this; } + LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() { return &self; } + LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_TransactionNoneZ { +private: + LDKCResult_TransactionNoneZ self; +public: + CResult_TransactionNoneZ(const CResult_TransactionNoneZ&) = delete; + CResult_TransactionNoneZ(CResult_TransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionNoneZ)); } + CResult_TransactionNoneZ(LDKCResult_TransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionNoneZ)); } + operator LDKCResult_TransactionNoneZ() && { LDKCResult_TransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionNoneZ)); return res; } + ~CResult_TransactionNoneZ() { CResult_TransactionNoneZ_free(self); } + CResult_TransactionNoneZ& operator=(CResult_TransactionNoneZ&& o) { CResult_TransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionNoneZ)); return *this; } + LDKCResult_TransactionNoneZ* operator &() { return &self; } + LDKCResult_TransactionNoneZ* operator ->() { return &self; } + const LDKCResult_TransactionNoneZ* operator &() const { return &self; } + const LDKCResult_TransactionNoneZ* operator ->() const { return &self; } +}; +class CResult_ClosingSignedFeeRangeDecodeErrorZ { +private: + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ self; +public: + CResult_ClosingSignedFeeRangeDecodeErrorZ(const CResult_ClosingSignedFeeRangeDecodeErrorZ&) = delete; + CResult_ClosingSignedFeeRangeDecodeErrorZ(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); } + CResult_ClosingSignedFeeRangeDecodeErrorZ(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); } + operator LDKCResult_ClosingSignedFeeRangeDecodeErrorZ() && { LDKCResult_ClosingSignedFeeRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); return res; } + ~CResult_ClosingSignedFeeRangeDecodeErrorZ() { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); } + CResult_ClosingSignedFeeRangeDecodeErrorZ& operator=(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); return *this; } + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() { return &self; } + LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_ErrorMessageDecodeErrorZ { +private: + LDKCResult_ErrorMessageDecodeErrorZ self; +public: + CResult_ErrorMessageDecodeErrorZ(const CResult_ErrorMessageDecodeErrorZ&) = delete; + CResult_ErrorMessageDecodeErrorZ(CResult_ErrorMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); } + CResult_ErrorMessageDecodeErrorZ(LDKCResult_ErrorMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); } + operator LDKCResult_ErrorMessageDecodeErrorZ() && { LDKCResult_ErrorMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); return res; } + ~CResult_ErrorMessageDecodeErrorZ() { CResult_ErrorMessageDecodeErrorZ_free(self); } + CResult_ErrorMessageDecodeErrorZ& operator=(CResult_ErrorMessageDecodeErrorZ&& o) { CResult_ErrorMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); return *this; } + LDKCResult_ErrorMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_ErrorMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ErrorMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ErrorMessageDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_OpenChannelDecodeErrorZ { +private: + LDKCResult_OpenChannelDecodeErrorZ self; +public: + CResult_OpenChannelDecodeErrorZ(const CResult_OpenChannelDecodeErrorZ&) = delete; + CResult_OpenChannelDecodeErrorZ(CResult_OpenChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OpenChannelDecodeErrorZ)); } + CResult_OpenChannelDecodeErrorZ(LDKCResult_OpenChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OpenChannelDecodeErrorZ)); } + operator LDKCResult_OpenChannelDecodeErrorZ() && { LDKCResult_OpenChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OpenChannelDecodeErrorZ)); return res; } + ~CResult_OpenChannelDecodeErrorZ() { CResult_OpenChannelDecodeErrorZ_free(self); } + CResult_OpenChannelDecodeErrorZ& operator=(CResult_OpenChannelDecodeErrorZ&& o) { CResult_OpenChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OpenChannelDecodeErrorZ)); return *this; } + LDKCResult_OpenChannelDecodeErrorZ* operator &() { return &self; } + LDKCResult_OpenChannelDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OpenChannelDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OpenChannelDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_QueryChannelRangeDecodeErrorZ { private: - LDKLockedChannelMonitor self; + LDKCResult_QueryChannelRangeDecodeErrorZ self; public: - LockedChannelMonitor(const LockedChannelMonitor&) = delete; - LockedChannelMonitor(LockedChannelMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(LockedChannelMonitor)); } - LockedChannelMonitor(LDKLockedChannelMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKLockedChannelMonitor)); } - operator LDKLockedChannelMonitor() && { LDKLockedChannelMonitor res = self; memset(&self, 0, sizeof(LDKLockedChannelMonitor)); return res; } - ~LockedChannelMonitor() { LockedChannelMonitor_free(self); } - LockedChannelMonitor& operator=(LockedChannelMonitor&& o) { LockedChannelMonitor_free(self); self = o.self; memset(&o, 0, sizeof(LockedChannelMonitor)); return *this; } - LDKLockedChannelMonitor* operator &() { return &self; } - LDKLockedChannelMonitor* operator ->() { return &self; } - const LDKLockedChannelMonitor* operator &() const { return &self; } - const LDKLockedChannelMonitor* operator ->() const { return &self; } + CResult_QueryChannelRangeDecodeErrorZ(const CResult_QueryChannelRangeDecodeErrorZ&) = delete; + CResult_QueryChannelRangeDecodeErrorZ(CResult_QueryChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); } + CResult_QueryChannelRangeDecodeErrorZ(LDKCResult_QueryChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); } + operator LDKCResult_QueryChannelRangeDecodeErrorZ() && { LDKCResult_QueryChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); return res; } + ~CResult_QueryChannelRangeDecodeErrorZ() { CResult_QueryChannelRangeDecodeErrorZ_free(self); } + CResult_QueryChannelRangeDecodeErrorZ& operator=(CResult_QueryChannelRangeDecodeErrorZ&& o) { CResult_QueryChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); return *this; } + LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() { return &self; } + LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() const { return &self; } }; -class ChainMonitor { +class CVec_TransactionZ { private: - LDKChainMonitor self; + LDKCVec_TransactionZ self; public: - ChainMonitor(const ChainMonitor&) = delete; - ChainMonitor(ChainMonitor&& o) : self(o.self) { memset(&o, 0, sizeof(ChainMonitor)); } - ChainMonitor(LDKChainMonitor&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKChainMonitor)); } - operator LDKChainMonitor() && { LDKChainMonitor res = self; memset(&self, 0, sizeof(LDKChainMonitor)); return res; } - ~ChainMonitor() { ChainMonitor_free(self); } - ChainMonitor& operator=(ChainMonitor&& o) { ChainMonitor_free(self); self = o.self; memset(&o, 0, sizeof(ChainMonitor)); return *this; } - LDKChainMonitor* operator &() { return &self; } - LDKChainMonitor* operator ->() { return &self; } - const LDKChainMonitor* operator &() const { return &self; } - const LDKChainMonitor* operator ->() const { return &self; } + CVec_TransactionZ(const CVec_TransactionZ&) = delete; + CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); } + CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); } + operator LDKCVec_TransactionZ() && { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; } + ~CVec_TransactionZ() { CVec_TransactionZ_free(self); } + CVec_TransactionZ& operator=(CVec_TransactionZ&& o) { CVec_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionZ)); return *this; } + LDKCVec_TransactionZ* operator &() { return &self; } + LDKCVec_TransactionZ* operator ->() { return &self; } + const LDKCVec_TransactionZ* operator &() const { return &self; } + const LDKCVec_TransactionZ* operator ->() const { return &self; } }; -class CVec_SpendableOutputDescriptorZ { +class C2Tuple_TxidBlockHashZ { private: - LDKCVec_SpendableOutputDescriptorZ self; + LDKC2Tuple_TxidBlockHashZ self; public: - CVec_SpendableOutputDescriptorZ(const CVec_SpendableOutputDescriptorZ&) = delete; - CVec_SpendableOutputDescriptorZ(CVec_SpendableOutputDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); } - CVec_SpendableOutputDescriptorZ(LDKCVec_SpendableOutputDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); } - operator LDKCVec_SpendableOutputDescriptorZ() && { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; } - ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); } - CVec_SpendableOutputDescriptorZ& operator=(CVec_SpendableOutputDescriptorZ&& o) { CVec_SpendableOutputDescriptorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); return *this; } - LDKCVec_SpendableOutputDescriptorZ* operator &() { return &self; } - LDKCVec_SpendableOutputDescriptorZ* operator ->() { return &self; } - const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; } - const LDKCVec_SpendableOutputDescriptorZ* operator ->() const { return &self; } + C2Tuple_TxidBlockHashZ(const C2Tuple_TxidBlockHashZ&) = delete; + C2Tuple_TxidBlockHashZ(C2Tuple_TxidBlockHashZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidBlockHashZ)); } + C2Tuple_TxidBlockHashZ(LDKC2Tuple_TxidBlockHashZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidBlockHashZ)); } + operator LDKC2Tuple_TxidBlockHashZ() && { LDKC2Tuple_TxidBlockHashZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidBlockHashZ)); return res; } + ~C2Tuple_TxidBlockHashZ() { C2Tuple_TxidBlockHashZ_free(self); } + C2Tuple_TxidBlockHashZ& operator=(C2Tuple_TxidBlockHashZ&& o) { C2Tuple_TxidBlockHashZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidBlockHashZ)); return *this; } + LDKC2Tuple_TxidBlockHashZ* operator &() { return &self; } + LDKC2Tuple_TxidBlockHashZ* operator ->() { return &self; } + const LDKC2Tuple_TxidBlockHashZ* operator &() const { return &self; } + const LDKC2Tuple_TxidBlockHashZ* operator ->() const { return &self; } }; -class CResult_LockedChannelMonitorNoneZ { +class CResult_ChannelFeaturesDecodeErrorZ { private: - LDKCResult_LockedChannelMonitorNoneZ self; + LDKCResult_ChannelFeaturesDecodeErrorZ self; public: - CResult_LockedChannelMonitorNoneZ(const CResult_LockedChannelMonitorNoneZ&) = delete; - CResult_LockedChannelMonitorNoneZ(CResult_LockedChannelMonitorNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); } - CResult_LockedChannelMonitorNoneZ(LDKCResult_LockedChannelMonitorNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); } - operator LDKCResult_LockedChannelMonitorNoneZ() && { LDKCResult_LockedChannelMonitorNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_LockedChannelMonitorNoneZ)); return res; } - ~CResult_LockedChannelMonitorNoneZ() { CResult_LockedChannelMonitorNoneZ_free(self); } - CResult_LockedChannelMonitorNoneZ& operator=(CResult_LockedChannelMonitorNoneZ&& o) { CResult_LockedChannelMonitorNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_LockedChannelMonitorNoneZ)); return *this; } - LDKCResult_LockedChannelMonitorNoneZ* operator &() { return &self; } - LDKCResult_LockedChannelMonitorNoneZ* operator ->() { return &self; } - const LDKCResult_LockedChannelMonitorNoneZ* operator &() const { return &self; } - const LDKCResult_LockedChannelMonitorNoneZ* operator ->() const { return &self; } + CResult_ChannelFeaturesDecodeErrorZ(const CResult_ChannelFeaturesDecodeErrorZ&) = delete; + CResult_ChannelFeaturesDecodeErrorZ(CResult_ChannelFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); } + CResult_ChannelFeaturesDecodeErrorZ(LDKCResult_ChannelFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); } + operator LDKCResult_ChannelFeaturesDecodeErrorZ() && { LDKCResult_ChannelFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); return res; } + ~CResult_ChannelFeaturesDecodeErrorZ() { CResult_ChannelFeaturesDecodeErrorZ_free(self); } + CResult_ChannelFeaturesDecodeErrorZ& operator=(CResult_ChannelFeaturesDecodeErrorZ&& o) { CResult_ChannelFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); return *this; } + LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_PhantomRouteHintsDecodeErrorZ { +class CResult_ChannelReadyDecodeErrorZ { private: - LDKCResult_PhantomRouteHintsDecodeErrorZ self; + LDKCResult_ChannelReadyDecodeErrorZ self; public: - CResult_PhantomRouteHintsDecodeErrorZ(const CResult_PhantomRouteHintsDecodeErrorZ&) = delete; - CResult_PhantomRouteHintsDecodeErrorZ(CResult_PhantomRouteHintsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); } - CResult_PhantomRouteHintsDecodeErrorZ(LDKCResult_PhantomRouteHintsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); } - operator LDKCResult_PhantomRouteHintsDecodeErrorZ() && { LDKCResult_PhantomRouteHintsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PhantomRouteHintsDecodeErrorZ)); return res; } - ~CResult_PhantomRouteHintsDecodeErrorZ() { CResult_PhantomRouteHintsDecodeErrorZ_free(self); } - CResult_PhantomRouteHintsDecodeErrorZ& operator=(CResult_PhantomRouteHintsDecodeErrorZ&& o) { CResult_PhantomRouteHintsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PhantomRouteHintsDecodeErrorZ)); return *this; } - LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() { return &self; } - LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator ->() const { return &self; } + CResult_ChannelReadyDecodeErrorZ(const CResult_ChannelReadyDecodeErrorZ&) = delete; + CResult_ChannelReadyDecodeErrorZ(CResult_ChannelReadyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); } + CResult_ChannelReadyDecodeErrorZ(LDKCResult_ChannelReadyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); } + operator LDKCResult_ChannelReadyDecodeErrorZ() && { LDKCResult_ChannelReadyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); return res; } + ~CResult_ChannelReadyDecodeErrorZ() { CResult_ChannelReadyDecodeErrorZ_free(self); } + CResult_ChannelReadyDecodeErrorZ& operator=(CResult_ChannelReadyDecodeErrorZ&& o) { CResult_ChannelReadyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); return *this; } + LDKCResult_ChannelReadyDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelReadyDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelReadyDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelReadyDecodeErrorZ* operator ->() const { return &self; } }; -class COption_C2Tuple_u64u64ZZ { +class CResult_UpdateFeeDecodeErrorZ { private: - LDKCOption_C2Tuple_u64u64ZZ self; + LDKCResult_UpdateFeeDecodeErrorZ self; public: - COption_C2Tuple_u64u64ZZ(const COption_C2Tuple_u64u64ZZ&) = delete; - COption_C2Tuple_u64u64ZZ(COption_C2Tuple_u64u64ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); } - COption_C2Tuple_u64u64ZZ(LDKCOption_C2Tuple_u64u64ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); } - operator LDKCOption_C2Tuple_u64u64ZZ() && { LDKCOption_C2Tuple_u64u64ZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); return res; } - ~COption_C2Tuple_u64u64ZZ() { COption_C2Tuple_u64u64ZZ_free(self); } - COption_C2Tuple_u64u64ZZ& operator=(COption_C2Tuple_u64u64ZZ&& o) { COption_C2Tuple_u64u64ZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); return *this; } - LDKCOption_C2Tuple_u64u64ZZ* operator &() { return &self; } - LDKCOption_C2Tuple_u64u64ZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_u64u64ZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_u64u64ZZ* operator ->() const { return &self; } + CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete; + CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); } + CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); } + operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; } + ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); } + CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; } + LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; } + LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ { +class CResult_HTLCOutputInCommitmentDecodeErrorZ { private: - LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ self; + LDKCResult_HTLCOutputInCommitmentDecodeErrorZ self; public: - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(const CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&) = delete; - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); } - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); } - operator LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ() && { LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); return res; } - ~CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ() { CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(self); } - CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ& operator=(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ&& o) { CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ)); return *this; } - LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() { return &self; } - LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() { return &self; } - const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator &() const { return &self; } - const LDKCResult_CVec_C2Tuple_BlockHashChannelMonitorZZErrorZ* operator ->() const { return &self; } + CResult_HTLCOutputInCommitmentDecodeErrorZ(const CResult_HTLCOutputInCommitmentDecodeErrorZ&) = delete; + CResult_HTLCOutputInCommitmentDecodeErrorZ(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); } + CResult_HTLCOutputInCommitmentDecodeErrorZ(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); } + operator LDKCResult_HTLCOutputInCommitmentDecodeErrorZ() && { LDKCResult_HTLCOutputInCommitmentDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); return res; } + ~CResult_HTLCOutputInCommitmentDecodeErrorZ() { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); } + CResult_HTLCOutputInCommitmentDecodeErrorZ& operator=(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); return *this; } + LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() { return &self; } + LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +class CResult_boolLightningErrorZ { private: - LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ self; + LDKCResult_boolLightningErrorZ self; public: - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(const CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&) = delete; - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); } - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); } - operator LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() && { LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return res; } - ~CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ() { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); } - CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ& operator=(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ&& o) { CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ)); return *this; } - LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() { return &self; } - LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ* operator ->() const { return &self; } + CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete; + CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); } + CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); } + operator LDKCResult_boolLightningErrorZ() && { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; } + ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); } + CResult_boolLightningErrorZ& operator=(CResult_boolLightningErrorZ&& o) { CResult_boolLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); return *this; } + LDKCResult_boolLightningErrorZ* operator &() { return &self; } + LDKCResult_boolLightningErrorZ* operator ->() { return &self; } + const LDKCResult_boolLightningErrorZ* operator &() const { return &self; } + const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; } }; -class CResult_HTLCUpdateDecodeErrorZ { +class CResult_NodeIdDecodeErrorZ { private: - LDKCResult_HTLCUpdateDecodeErrorZ self; + LDKCResult_NodeIdDecodeErrorZ self; public: - CResult_HTLCUpdateDecodeErrorZ(const CResult_HTLCUpdateDecodeErrorZ&) = delete; - CResult_HTLCUpdateDecodeErrorZ(CResult_HTLCUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); } - CResult_HTLCUpdateDecodeErrorZ(LDKCResult_HTLCUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); } - operator LDKCResult_HTLCUpdateDecodeErrorZ() && { LDKCResult_HTLCUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); return res; } - ~CResult_HTLCUpdateDecodeErrorZ() { CResult_HTLCUpdateDecodeErrorZ_free(self); } - CResult_HTLCUpdateDecodeErrorZ& operator=(CResult_HTLCUpdateDecodeErrorZ&& o) { CResult_HTLCUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); return *this; } - LDKCResult_HTLCUpdateDecodeErrorZ* operator &() { return &self; } - LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_HTLCUpdateDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() const { return &self; } + CResult_NodeIdDecodeErrorZ(const CResult_NodeIdDecodeErrorZ&) = delete; + CResult_NodeIdDecodeErrorZ(CResult_NodeIdDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); } + CResult_NodeIdDecodeErrorZ(LDKCResult_NodeIdDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); } + operator LDKCResult_NodeIdDecodeErrorZ() && { LDKCResult_NodeIdDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); return res; } + ~CResult_NodeIdDecodeErrorZ() { CResult_NodeIdDecodeErrorZ_free(self); } + CResult_NodeIdDecodeErrorZ& operator=(CResult_NodeIdDecodeErrorZ&& o) { CResult_NodeIdDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); return *this; } + LDKCResult_NodeIdDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeIdDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeIdDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeIdDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_HTLCDestinationZ { +private: + LDKCOption_HTLCDestinationZ self; +public: + COption_HTLCDestinationZ(const COption_HTLCDestinationZ&) = delete; + COption_HTLCDestinationZ(COption_HTLCDestinationZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_HTLCDestinationZ)); } + COption_HTLCDestinationZ(LDKCOption_HTLCDestinationZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_HTLCDestinationZ)); } + operator LDKCOption_HTLCDestinationZ() && { LDKCOption_HTLCDestinationZ res = self; memset(&self, 0, sizeof(LDKCOption_HTLCDestinationZ)); return res; } + ~COption_HTLCDestinationZ() { COption_HTLCDestinationZ_free(self); } + COption_HTLCDestinationZ& operator=(COption_HTLCDestinationZ&& o) { COption_HTLCDestinationZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_HTLCDestinationZ)); return *this; } + LDKCOption_HTLCDestinationZ* operator &() { return &self; } + LDKCOption_HTLCDestinationZ* operator ->() { return &self; } + const LDKCOption_HTLCDestinationZ* operator &() const { return &self; } + const LDKCOption_HTLCDestinationZ* operator ->() const { return &self; } +}; +class C2Tuple_BlockHashChannelMonitorZ { +private: + LDKC2Tuple_BlockHashChannelMonitorZ self; +public: + C2Tuple_BlockHashChannelMonitorZ(const C2Tuple_BlockHashChannelMonitorZ&) = delete; + C2Tuple_BlockHashChannelMonitorZ(C2Tuple_BlockHashChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); } + C2Tuple_BlockHashChannelMonitorZ(LDKC2Tuple_BlockHashChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); } + operator LDKC2Tuple_BlockHashChannelMonitorZ() && { LDKC2Tuple_BlockHashChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); return res; } + ~C2Tuple_BlockHashChannelMonitorZ() { C2Tuple_BlockHashChannelMonitorZ_free(self); } + C2Tuple_BlockHashChannelMonitorZ& operator=(C2Tuple_BlockHashChannelMonitorZ&& o) { C2Tuple_BlockHashChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); return *this; } + LDKC2Tuple_BlockHashChannelMonitorZ* operator &() { return &self; } + LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() { return &self; } + const LDKC2Tuple_BlockHashChannelMonitorZ* operator &() const { return &self; } + const LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() const { return &self; } +}; +class CResult_ShutdownScriptInvalidShutdownScriptZ { +private: + LDKCResult_ShutdownScriptInvalidShutdownScriptZ self; +public: + CResult_ShutdownScriptInvalidShutdownScriptZ(const CResult_ShutdownScriptInvalidShutdownScriptZ&) = delete; + CResult_ShutdownScriptInvalidShutdownScriptZ(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); } + CResult_ShutdownScriptInvalidShutdownScriptZ(LDKCResult_ShutdownScriptInvalidShutdownScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); } + operator LDKCResult_ShutdownScriptInvalidShutdownScriptZ() && { LDKCResult_ShutdownScriptInvalidShutdownScriptZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); return res; } + ~CResult_ShutdownScriptInvalidShutdownScriptZ() { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); } + CResult_ShutdownScriptInvalidShutdownScriptZ& operator=(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); return *this; } + LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() { return &self; } + LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() { return &self; } + const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() const { return &self; } + const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() const { return &self; } }; -class C2Tuple_SignatureCVec_SignatureZZ { +class CResult_NodeAnnouncementInfoDecodeErrorZ { private: - LDKC2Tuple_SignatureCVec_SignatureZZ self; + LDKCResult_NodeAnnouncementInfoDecodeErrorZ self; public: - C2Tuple_SignatureCVec_SignatureZZ(const C2Tuple_SignatureCVec_SignatureZZ&) = delete; - C2Tuple_SignatureCVec_SignatureZZ(C2Tuple_SignatureCVec_SignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); } - C2Tuple_SignatureCVec_SignatureZZ(LDKC2Tuple_SignatureCVec_SignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); } - operator LDKC2Tuple_SignatureCVec_SignatureZZ() && { LDKC2Tuple_SignatureCVec_SignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); return res; } - ~C2Tuple_SignatureCVec_SignatureZZ() { C2Tuple_SignatureCVec_SignatureZZ_free(self); } - C2Tuple_SignatureCVec_SignatureZZ& operator=(C2Tuple_SignatureCVec_SignatureZZ&& o) { C2Tuple_SignatureCVec_SignatureZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); return *this; } - LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() { return &self; } - LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() { return &self; } - const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; } - const LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() const { return &self; } + CResult_NodeAnnouncementInfoDecodeErrorZ(const CResult_NodeAnnouncementInfoDecodeErrorZ&) = delete; + CResult_NodeAnnouncementInfoDecodeErrorZ(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); } + CResult_NodeAnnouncementInfoDecodeErrorZ(LDKCResult_NodeAnnouncementInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); } + operator LDKCResult_NodeAnnouncementInfoDecodeErrorZ() && { LDKCResult_NodeAnnouncementInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); return res; } + ~CResult_NodeAnnouncementInfoDecodeErrorZ() { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); } + CResult_NodeAnnouncementInfoDecodeErrorZ& operator=(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); return *this; } + LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_u32TxOutZZ { +class CResult_COption_NetworkUpdateZDecodeErrorZ { private: - LDKCVec_C2Tuple_u32TxOutZZ self; + LDKCResult_COption_NetworkUpdateZDecodeErrorZ self; public: - CVec_C2Tuple_u32TxOutZZ(const CVec_C2Tuple_u32TxOutZZ&) = delete; - CVec_C2Tuple_u32TxOutZZ(CVec_C2Tuple_u32TxOutZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); } - CVec_C2Tuple_u32TxOutZZ(LDKCVec_C2Tuple_u32TxOutZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); } - operator LDKCVec_C2Tuple_u32TxOutZZ() && { LDKCVec_C2Tuple_u32TxOutZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32TxOutZZ)); return res; } - ~CVec_C2Tuple_u32TxOutZZ() { CVec_C2Tuple_u32TxOutZZ_free(self); } - CVec_C2Tuple_u32TxOutZZ& operator=(CVec_C2Tuple_u32TxOutZZ&& o) { CVec_C2Tuple_u32TxOutZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32TxOutZZ)); return *this; } - LDKCVec_C2Tuple_u32TxOutZZ* operator &() { return &self; } - LDKCVec_C2Tuple_u32TxOutZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_u32TxOutZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_u32TxOutZZ* operator ->() const { return &self; } + CResult_COption_NetworkUpdateZDecodeErrorZ(const CResult_COption_NetworkUpdateZDecodeErrorZ&) = delete; + CResult_COption_NetworkUpdateZDecodeErrorZ(CResult_COption_NetworkUpdateZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_NetworkUpdateZDecodeErrorZ)); } + CResult_COption_NetworkUpdateZDecodeErrorZ(LDKCResult_COption_NetworkUpdateZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ)); } + operator LDKCResult_COption_NetworkUpdateZDecodeErrorZ() && { LDKCResult_COption_NetworkUpdateZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ)); return res; } + ~CResult_COption_NetworkUpdateZDecodeErrorZ() { CResult_COption_NetworkUpdateZDecodeErrorZ_free(self); } + CResult_COption_NetworkUpdateZDecodeErrorZ& operator=(CResult_COption_NetworkUpdateZDecodeErrorZ&& o) { CResult_COption_NetworkUpdateZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_NetworkUpdateZDecodeErrorZ)); return *this; } + LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelInfoDecodeErrorZ { +class CVec_UpdateFailMalformedHTLCZ { private: - LDKCResult_ChannelInfoDecodeErrorZ self; + LDKCVec_UpdateFailMalformedHTLCZ self; public: - CResult_ChannelInfoDecodeErrorZ(const CResult_ChannelInfoDecodeErrorZ&) = delete; - CResult_ChannelInfoDecodeErrorZ(CResult_ChannelInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelInfoDecodeErrorZ)); } - CResult_ChannelInfoDecodeErrorZ(LDKCResult_ChannelInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelInfoDecodeErrorZ)); } - operator LDKCResult_ChannelInfoDecodeErrorZ() && { LDKCResult_ChannelInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelInfoDecodeErrorZ)); return res; } - ~CResult_ChannelInfoDecodeErrorZ() { CResult_ChannelInfoDecodeErrorZ_free(self); } - CResult_ChannelInfoDecodeErrorZ& operator=(CResult_ChannelInfoDecodeErrorZ&& o) { CResult_ChannelInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelInfoDecodeErrorZ)); return *this; } - LDKCResult_ChannelInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelInfoDecodeErrorZ* operator ->() const { return &self; } + CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; + CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } + CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } + operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } + ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } + CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; } + LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } }; -class COption_WriteableScoreZ { +class CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { private: - LDKCOption_WriteableScoreZ self; + LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ self; public: - COption_WriteableScoreZ(const COption_WriteableScoreZ&) = delete; - COption_WriteableScoreZ(COption_WriteableScoreZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_WriteableScoreZ)); } - COption_WriteableScoreZ(LDKCOption_WriteableScoreZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_WriteableScoreZ)); } - operator LDKCOption_WriteableScoreZ() && { LDKCOption_WriteableScoreZ res = self; memset(&self, 0, sizeof(LDKCOption_WriteableScoreZ)); return res; } - ~COption_WriteableScoreZ() { COption_WriteableScoreZ_free(self); } - COption_WriteableScoreZ& operator=(COption_WriteableScoreZ&& o) { COption_WriteableScoreZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_WriteableScoreZ)); return *this; } - LDKCOption_WriteableScoreZ* operator &() { return &self; } - LDKCOption_WriteableScoreZ* operator ->() { return &self; } - const LDKCOption_WriteableScoreZ* operator &() const { return &self; } - const LDKCOption_WriteableScoreZ* operator ->() const { return &self; } + CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ(const CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ&) = delete; + CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ(CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ)); } + CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ(LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ)); } + operator LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ() && { LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ)); return res; } + ~CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ() { CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(self); } + CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ& operator=(CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ&& o) { CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ)); return *this; } + LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ* operator &() { return &self; } + LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ* operator ->() const { return &self; } }; -class CResult_NoneSendErrorZ { +class CVec_RouteHopZ { private: - LDKCResult_NoneSendErrorZ self; + LDKCVec_RouteHopZ self; public: - CResult_NoneSendErrorZ(const CResult_NoneSendErrorZ&) = delete; - CResult_NoneSendErrorZ(CResult_NoneSendErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneSendErrorZ)); } - CResult_NoneSendErrorZ(LDKCResult_NoneSendErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneSendErrorZ)); } - operator LDKCResult_NoneSendErrorZ() && { LDKCResult_NoneSendErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneSendErrorZ)); return res; } - ~CResult_NoneSendErrorZ() { CResult_NoneSendErrorZ_free(self); } - CResult_NoneSendErrorZ& operator=(CResult_NoneSendErrorZ&& o) { CResult_NoneSendErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneSendErrorZ)); return *this; } - LDKCResult_NoneSendErrorZ* operator &() { return &self; } - LDKCResult_NoneSendErrorZ* operator ->() { return &self; } - const LDKCResult_NoneSendErrorZ* operator &() const { return &self; } - const LDKCResult_NoneSendErrorZ* operator ->() const { return &self; } + CVec_RouteHopZ(const CVec_RouteHopZ&) = delete; + CVec_RouteHopZ(CVec_RouteHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHopZ)); } + CVec_RouteHopZ(LDKCVec_RouteHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHopZ)); } + operator LDKCVec_RouteHopZ() && { LDKCVec_RouteHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHopZ)); return res; } + ~CVec_RouteHopZ() { CVec_RouteHopZ_free(self); } + CVec_RouteHopZ& operator=(CVec_RouteHopZ&& o) { CVec_RouteHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHopZ)); return *this; } + LDKCVec_RouteHopZ* operator &() { return &self; } + LDKCVec_RouteHopZ* operator ->() { return &self; } + const LDKCVec_RouteHopZ* operator &() const { return &self; } + const LDKCVec_RouteHopZ* operator ->() const { return &self; } }; -class CResult_FundingCreatedDecodeErrorZ { +class COption_CustomOnionMessageContentsZ { private: - LDKCResult_FundingCreatedDecodeErrorZ self; + LDKCOption_CustomOnionMessageContentsZ self; public: - CResult_FundingCreatedDecodeErrorZ(const CResult_FundingCreatedDecodeErrorZ&) = delete; - CResult_FundingCreatedDecodeErrorZ(CResult_FundingCreatedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingCreatedDecodeErrorZ)); } - CResult_FundingCreatedDecodeErrorZ(LDKCResult_FundingCreatedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingCreatedDecodeErrorZ)); } - operator LDKCResult_FundingCreatedDecodeErrorZ() && { LDKCResult_FundingCreatedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingCreatedDecodeErrorZ)); return res; } - ~CResult_FundingCreatedDecodeErrorZ() { CResult_FundingCreatedDecodeErrorZ_free(self); } - CResult_FundingCreatedDecodeErrorZ& operator=(CResult_FundingCreatedDecodeErrorZ&& o) { CResult_FundingCreatedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingCreatedDecodeErrorZ)); return *this; } - LDKCResult_FundingCreatedDecodeErrorZ* operator &() { return &self; } - LDKCResult_FundingCreatedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_FundingCreatedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_FundingCreatedDecodeErrorZ* operator ->() const { return &self; } + COption_CustomOnionMessageContentsZ(const COption_CustomOnionMessageContentsZ&) = delete; + COption_CustomOnionMessageContentsZ(COption_CustomOnionMessageContentsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); } + COption_CustomOnionMessageContentsZ(LDKCOption_CustomOnionMessageContentsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); } + operator LDKCOption_CustomOnionMessageContentsZ() && { LDKCOption_CustomOnionMessageContentsZ res = self; memset(&self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); return res; } + ~COption_CustomOnionMessageContentsZ() { COption_CustomOnionMessageContentsZ_free(self); } + COption_CustomOnionMessageContentsZ& operator=(COption_CustomOnionMessageContentsZ&& o) { COption_CustomOnionMessageContentsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); return *this; } + LDKCOption_CustomOnionMessageContentsZ* operator &() { return &self; } + LDKCOption_CustomOnionMessageContentsZ* operator ->() { return &self; } + const LDKCOption_CustomOnionMessageContentsZ* operator &() const { return &self; } + const LDKCOption_CustomOnionMessageContentsZ* operator ->() const { return &self; } }; -class CResult_ChannelAnnouncementDecodeErrorZ { +class CVec_C2Tuple_BlockHashChannelMonitorZZ { private: - LDKCResult_ChannelAnnouncementDecodeErrorZ self; + LDKCVec_C2Tuple_BlockHashChannelMonitorZZ self; public: - CResult_ChannelAnnouncementDecodeErrorZ(const CResult_ChannelAnnouncementDecodeErrorZ&) = delete; - CResult_ChannelAnnouncementDecodeErrorZ(CResult_ChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); } - CResult_ChannelAnnouncementDecodeErrorZ(LDKCResult_ChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); } - operator LDKCResult_ChannelAnnouncementDecodeErrorZ() && { LDKCResult_ChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); return res; } - ~CResult_ChannelAnnouncementDecodeErrorZ() { CResult_ChannelAnnouncementDecodeErrorZ_free(self); } - CResult_ChannelAnnouncementDecodeErrorZ& operator=(CResult_ChannelAnnouncementDecodeErrorZ&& o) { CResult_ChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); return *this; } - LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } + CVec_C2Tuple_BlockHashChannelMonitorZZ(const CVec_C2Tuple_BlockHashChannelMonitorZZ&) = delete; + CVec_C2Tuple_BlockHashChannelMonitorZZ(CVec_C2Tuple_BlockHashChannelMonitorZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_BlockHashChannelMonitorZZ)); } + CVec_C2Tuple_BlockHashChannelMonitorZZ(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ)); } + operator LDKCVec_C2Tuple_BlockHashChannelMonitorZZ() && { LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ)); return res; } + ~CVec_C2Tuple_BlockHashChannelMonitorZZ() { CVec_C2Tuple_BlockHashChannelMonitorZZ_free(self); } + CVec_C2Tuple_BlockHashChannelMonitorZZ& operator=(CVec_C2Tuple_BlockHashChannelMonitorZZ&& o) { CVec_C2Tuple_BlockHashChannelMonitorZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_BlockHashChannelMonitorZZ)); return *this; } + LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator &() { return &self; } + LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator ->() const { return &self; } }; -class CResult_PositiveTimestampCreationErrorZ { +class CVec_ThirtyTwoBytesZ { private: - LDKCResult_PositiveTimestampCreationErrorZ self; + LDKCVec_ThirtyTwoBytesZ self; public: - CResult_PositiveTimestampCreationErrorZ(const CResult_PositiveTimestampCreationErrorZ&) = delete; - CResult_PositiveTimestampCreationErrorZ(CResult_PositiveTimestampCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); } - CResult_PositiveTimestampCreationErrorZ(LDKCResult_PositiveTimestampCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); } - operator LDKCResult_PositiveTimestampCreationErrorZ() && { LDKCResult_PositiveTimestampCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); return res; } - ~CResult_PositiveTimestampCreationErrorZ() { CResult_PositiveTimestampCreationErrorZ_free(self); } - CResult_PositiveTimestampCreationErrorZ& operator=(CResult_PositiveTimestampCreationErrorZ&& o) { CResult_PositiveTimestampCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); return *this; } - LDKCResult_PositiveTimestampCreationErrorZ* operator &() { return &self; } - LDKCResult_PositiveTimestampCreationErrorZ* operator ->() { return &self; } - const LDKCResult_PositiveTimestampCreationErrorZ* operator &() const { return &self; } - const LDKCResult_PositiveTimestampCreationErrorZ* operator ->() const { return &self; } + CVec_ThirtyTwoBytesZ(const CVec_ThirtyTwoBytesZ&) = delete; + CVec_ThirtyTwoBytesZ(CVec_ThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); } + CVec_ThirtyTwoBytesZ(LDKCVec_ThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); } + operator LDKCVec_ThirtyTwoBytesZ() && { LDKCVec_ThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); return res; } + ~CVec_ThirtyTwoBytesZ() { CVec_ThirtyTwoBytesZ_free(self); } + CVec_ThirtyTwoBytesZ& operator=(CVec_ThirtyTwoBytesZ&& o) { CVec_ThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); return *this; } + LDKCVec_ThirtyTwoBytesZ* operator &() { return &self; } + LDKCVec_ThirtyTwoBytesZ* operator ->() { return &self; } + const LDKCVec_ThirtyTwoBytesZ* operator &() const { return &self; } + const LDKCVec_ThirtyTwoBytesZ* operator ->() const { return &self; } }; -class CVec_OutPointZ { +class CResult_ClosingSignedDecodeErrorZ { private: - LDKCVec_OutPointZ self; + LDKCResult_ClosingSignedDecodeErrorZ self; public: - CVec_OutPointZ(const CVec_OutPointZ&) = delete; - CVec_OutPointZ(CVec_OutPointZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_OutPointZ)); } - CVec_OutPointZ(LDKCVec_OutPointZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_OutPointZ)); } - operator LDKCVec_OutPointZ() && { LDKCVec_OutPointZ res = self; memset(&self, 0, sizeof(LDKCVec_OutPointZ)); return res; } - ~CVec_OutPointZ() { CVec_OutPointZ_free(self); } - CVec_OutPointZ& operator=(CVec_OutPointZ&& o) { CVec_OutPointZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_OutPointZ)); return *this; } - LDKCVec_OutPointZ* operator &() { return &self; } - LDKCVec_OutPointZ* operator ->() { return &self; } - const LDKCVec_OutPointZ* operator &() const { return &self; } - const LDKCVec_OutPointZ* operator ->() const { return &self; } + CResult_ClosingSignedDecodeErrorZ(const CResult_ClosingSignedDecodeErrorZ&) = delete; + CResult_ClosingSignedDecodeErrorZ(CResult_ClosingSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingSignedDecodeErrorZ)); } + CResult_ClosingSignedDecodeErrorZ(LDKCResult_ClosingSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingSignedDecodeErrorZ)); } + operator LDKCResult_ClosingSignedDecodeErrorZ() && { LDKCResult_ClosingSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingSignedDecodeErrorZ)); return res; } + ~CResult_ClosingSignedDecodeErrorZ() { CResult_ClosingSignedDecodeErrorZ_free(self); } + CResult_ClosingSignedDecodeErrorZ& operator=(CResult_ClosingSignedDecodeErrorZ&& o) { CResult_ClosingSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingSignedDecodeErrorZ)); return *this; } + LDKCResult_ClosingSignedDecodeErrorZ* operator &() { return &self; } + LDKCResult_ClosingSignedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ClosingSignedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ClosingSignedDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CVec_u8ZPeerHandleErrorZ { +class CResult_NonePaymentErrorZ { private: - LDKCResult_CVec_u8ZPeerHandleErrorZ self; + LDKCResult_NonePaymentErrorZ self; public: - CResult_CVec_u8ZPeerHandleErrorZ(const CResult_CVec_u8ZPeerHandleErrorZ&) = delete; - CResult_CVec_u8ZPeerHandleErrorZ(CResult_CVec_u8ZPeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); } - CResult_CVec_u8ZPeerHandleErrorZ(LDKCResult_CVec_u8ZPeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); } - operator LDKCResult_CVec_u8ZPeerHandleErrorZ() && { LDKCResult_CVec_u8ZPeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ)); return res; } - ~CResult_CVec_u8ZPeerHandleErrorZ() { CResult_CVec_u8ZPeerHandleErrorZ_free(self); } - CResult_CVec_u8ZPeerHandleErrorZ& operator=(CResult_CVec_u8ZPeerHandleErrorZ&& o) { CResult_CVec_u8ZPeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_u8ZPeerHandleErrorZ)); return *this; } - LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() { return &self; } - LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() { return &self; } - const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator &() const { return &self; } - const LDKCResult_CVec_u8ZPeerHandleErrorZ* operator ->() const { return &self; } + CResult_NonePaymentErrorZ(const CResult_NonePaymentErrorZ&) = delete; + CResult_NonePaymentErrorZ(CResult_NonePaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentErrorZ)); } + CResult_NonePaymentErrorZ(LDKCResult_NonePaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentErrorZ)); } + operator LDKCResult_NonePaymentErrorZ() && { LDKCResult_NonePaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentErrorZ)); return res; } + ~CResult_NonePaymentErrorZ() { CResult_NonePaymentErrorZ_free(self); } + CResult_NonePaymentErrorZ& operator=(CResult_NonePaymentErrorZ&& o) { CResult_NonePaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePaymentErrorZ)); return *this; } + LDKCResult_NonePaymentErrorZ* operator &() { return &self; } + LDKCResult_NonePaymentErrorZ* operator ->() { return &self; } + const LDKCResult_NonePaymentErrorZ* operator &() const { return &self; } + const LDKCResult_NonePaymentErrorZ* operator ->() const { return &self; } }; -class CResult_InvoiceFeaturesDecodeErrorZ { +class CVec_CResult_NoneAPIErrorZZ { private: - LDKCResult_InvoiceFeaturesDecodeErrorZ self; + LDKCVec_CResult_NoneAPIErrorZZ self; public: - CResult_InvoiceFeaturesDecodeErrorZ(const CResult_InvoiceFeaturesDecodeErrorZ&) = delete; - CResult_InvoiceFeaturesDecodeErrorZ(CResult_InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceFeaturesDecodeErrorZ)); } - CResult_InvoiceFeaturesDecodeErrorZ(LDKCResult_InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ)); } - operator LDKCResult_InvoiceFeaturesDecodeErrorZ() && { LDKCResult_InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ)); return res; } - ~CResult_InvoiceFeaturesDecodeErrorZ() { CResult_InvoiceFeaturesDecodeErrorZ_free(self); } - CResult_InvoiceFeaturesDecodeErrorZ& operator=(CResult_InvoiceFeaturesDecodeErrorZ&& o) { CResult_InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceFeaturesDecodeErrorZ)); return *this; } - LDKCResult_InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } + CVec_CResult_NoneAPIErrorZZ(const CVec_CResult_NoneAPIErrorZZ&) = delete; + CVec_CResult_NoneAPIErrorZZ(CVec_CResult_NoneAPIErrorZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CResult_NoneAPIErrorZZ)); } + CVec_CResult_NoneAPIErrorZZ(LDKCVec_CResult_NoneAPIErrorZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CResult_NoneAPIErrorZZ)); } + operator LDKCVec_CResult_NoneAPIErrorZZ() && { LDKCVec_CResult_NoneAPIErrorZZ res = self; memset(&self, 0, sizeof(LDKCVec_CResult_NoneAPIErrorZZ)); return res; } + ~CVec_CResult_NoneAPIErrorZZ() { CVec_CResult_NoneAPIErrorZZ_free(self); } + CVec_CResult_NoneAPIErrorZZ& operator=(CVec_CResult_NoneAPIErrorZZ&& o) { CVec_CResult_NoneAPIErrorZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CResult_NoneAPIErrorZZ)); return *this; } + LDKCVec_CResult_NoneAPIErrorZZ* operator &() { return &self; } + LDKCVec_CResult_NoneAPIErrorZZ* operator ->() { return &self; } + const LDKCVec_CResult_NoneAPIErrorZZ* operator &() const { return &self; } + const LDKCVec_CResult_NoneAPIErrorZZ* operator ->() const { return &self; } +}; +class CResult_CounterpartyCommitmentSecretsDecodeErrorZ { +private: + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ self; +public: + CResult_CounterpartyCommitmentSecretsDecodeErrorZ(const CResult_CounterpartyCommitmentSecretsDecodeErrorZ&) = delete; + CResult_CounterpartyCommitmentSecretsDecodeErrorZ(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } + CResult_CounterpartyCommitmentSecretsDecodeErrorZ(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } + operator LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ() && { LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return res; } + ~CResult_CounterpartyCommitmentSecretsDecodeErrorZ() { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); } + CResult_CounterpartyCommitmentSecretsDecodeErrorZ& operator=(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return *this; } + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() { return &self; } + LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() const { return &self; } }; -class COption_NetworkUpdateZ { +class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { private: - LDKCOption_NetworkUpdateZ self; + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ self; public: - COption_NetworkUpdateZ(const COption_NetworkUpdateZ&) = delete; - COption_NetworkUpdateZ(COption_NetworkUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NetworkUpdateZ)); } - COption_NetworkUpdateZ(LDKCOption_NetworkUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NetworkUpdateZ)); } - operator LDKCOption_NetworkUpdateZ() && { LDKCOption_NetworkUpdateZ res = self; memset(&self, 0, sizeof(LDKCOption_NetworkUpdateZ)); return res; } - ~COption_NetworkUpdateZ() { COption_NetworkUpdateZ_free(self); } - COption_NetworkUpdateZ& operator=(COption_NetworkUpdateZ&& o) { COption_NetworkUpdateZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NetworkUpdateZ)); return *this; } - LDKCOption_NetworkUpdateZ* operator &() { return &self; } - LDKCOption_NetworkUpdateZ* operator ->() { return &self; } - const LDKCOption_NetworkUpdateZ* operator &() const { return &self; } - const LDKCOption_NetworkUpdateZ* operator ->() const { return &self; } + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(const CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&) = delete; + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); } + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); } + operator LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() && { LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return res; } + ~CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); } + CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ& operator=(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return *this; } + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() const { return &self; } }; -class COption_u64Z { +class CVec_RouteHintHopZ { private: - LDKCOption_u64Z self; + LDKCVec_RouteHintHopZ self; public: - COption_u64Z(const COption_u64Z&) = delete; - COption_u64Z(COption_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u64Z)); } - COption_u64Z(LDKCOption_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u64Z)); } - operator LDKCOption_u64Z() && { LDKCOption_u64Z res = self; memset(&self, 0, sizeof(LDKCOption_u64Z)); return res; } - ~COption_u64Z() { COption_u64Z_free(self); } - COption_u64Z& operator=(COption_u64Z&& o) { COption_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u64Z)); return *this; } - LDKCOption_u64Z* operator &() { return &self; } - LDKCOption_u64Z* operator ->() { return &self; } - const LDKCOption_u64Z* operator &() const { return &self; } - const LDKCOption_u64Z* operator ->() const { return &self; } + CVec_RouteHintHopZ(const CVec_RouteHintHopZ&) = delete; + CVec_RouteHintHopZ(CVec_RouteHintHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintHopZ)); } + CVec_RouteHintHopZ(LDKCVec_RouteHintHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintHopZ)); } + operator LDKCVec_RouteHintHopZ() && { LDKCVec_RouteHintHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintHopZ)); return res; } + ~CVec_RouteHintHopZ() { CVec_RouteHintHopZ_free(self); } + CVec_RouteHintHopZ& operator=(CVec_RouteHintHopZ&& o) { CVec_RouteHintHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintHopZ)); return *this; } + LDKCVec_RouteHintHopZ* operator &() { return &self; } + LDKCVec_RouteHintHopZ* operator ->() { return &self; } + const LDKCVec_RouteHintHopZ* operator &() const { return &self; } + const LDKCVec_RouteHintHopZ* operator ->() const { return &self; } }; -class CResult_TxOutAccessErrorZ { +class CResult_PaymentParametersDecodeErrorZ { private: - LDKCResult_TxOutAccessErrorZ self; + LDKCResult_PaymentParametersDecodeErrorZ self; public: - CResult_TxOutAccessErrorZ(const CResult_TxOutAccessErrorZ&) = delete; - CResult_TxOutAccessErrorZ(CResult_TxOutAccessErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); } - CResult_TxOutAccessErrorZ(LDKCResult_TxOutAccessErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); } - operator LDKCResult_TxOutAccessErrorZ() && { LDKCResult_TxOutAccessErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); return res; } - ~CResult_TxOutAccessErrorZ() { CResult_TxOutAccessErrorZ_free(self); } - CResult_TxOutAccessErrorZ& operator=(CResult_TxOutAccessErrorZ&& o) { CResult_TxOutAccessErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); return *this; } - LDKCResult_TxOutAccessErrorZ* operator &() { return &self; } - LDKCResult_TxOutAccessErrorZ* operator ->() { return &self; } - const LDKCResult_TxOutAccessErrorZ* operator &() const { return &self; } - const LDKCResult_TxOutAccessErrorZ* operator ->() const { return &self; } + CResult_PaymentParametersDecodeErrorZ(const CResult_PaymentParametersDecodeErrorZ&) = delete; + CResult_PaymentParametersDecodeErrorZ(CResult_PaymentParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); } + CResult_PaymentParametersDecodeErrorZ(LDKCResult_PaymentParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); } + operator LDKCResult_PaymentParametersDecodeErrorZ() && { LDKCResult_PaymentParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); return res; } + ~CResult_PaymentParametersDecodeErrorZ() { CResult_PaymentParametersDecodeErrorZ_free(self); } + CResult_PaymentParametersDecodeErrorZ& operator=(CResult_PaymentParametersDecodeErrorZ&& o) { CResult_PaymentParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); return *this; } + LDKCResult_PaymentParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentParametersDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TrustedClosingTransactionNoneZ { +class CVec_U5Z { private: - LDKCResult_TrustedClosingTransactionNoneZ self; + LDKCVec_U5Z self; public: - CResult_TrustedClosingTransactionNoneZ(const CResult_TrustedClosingTransactionNoneZ&) = delete; - CResult_TrustedClosingTransactionNoneZ(CResult_TrustedClosingTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); } - CResult_TrustedClosingTransactionNoneZ(LDKCResult_TrustedClosingTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); } - operator LDKCResult_TrustedClosingTransactionNoneZ() && { LDKCResult_TrustedClosingTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); return res; } - ~CResult_TrustedClosingTransactionNoneZ() { CResult_TrustedClosingTransactionNoneZ_free(self); } - CResult_TrustedClosingTransactionNoneZ& operator=(CResult_TrustedClosingTransactionNoneZ&& o) { CResult_TrustedClosingTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); return *this; } - LDKCResult_TrustedClosingTransactionNoneZ* operator &() { return &self; } - LDKCResult_TrustedClosingTransactionNoneZ* operator ->() { return &self; } - const LDKCResult_TrustedClosingTransactionNoneZ* operator &() const { return &self; } - const LDKCResult_TrustedClosingTransactionNoneZ* operator ->() const { return &self; } + CVec_U5Z(const CVec_U5Z&) = delete; + CVec_U5Z(CVec_U5Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_U5Z)); } + CVec_U5Z(LDKCVec_U5Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_U5Z)); } + operator LDKCVec_U5Z() && { LDKCVec_U5Z res = self; memset(&self, 0, sizeof(LDKCVec_U5Z)); return res; } + ~CVec_U5Z() { CVec_U5Z_free(self); } + CVec_U5Z& operator=(CVec_U5Z&& o) { CVec_U5Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_U5Z)); return *this; } + LDKCVec_U5Z* operator &() { return &self; } + LDKCVec_U5Z* operator ->() { return &self; } + const LDKCVec_U5Z* operator &() const { return &self; } + const LDKCVec_U5Z* operator ->() const { return &self; } }; -class CResult_PaymentPreimageAPIErrorZ { +class CResult_SignDecodeErrorZ { private: - LDKCResult_PaymentPreimageAPIErrorZ self; + LDKCResult_SignDecodeErrorZ self; public: - CResult_PaymentPreimageAPIErrorZ(const CResult_PaymentPreimageAPIErrorZ&) = delete; - CResult_PaymentPreimageAPIErrorZ(CResult_PaymentPreimageAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); } - CResult_PaymentPreimageAPIErrorZ(LDKCResult_PaymentPreimageAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); } - operator LDKCResult_PaymentPreimageAPIErrorZ() && { LDKCResult_PaymentPreimageAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPreimageAPIErrorZ)); return res; } - ~CResult_PaymentPreimageAPIErrorZ() { CResult_PaymentPreimageAPIErrorZ_free(self); } - CResult_PaymentPreimageAPIErrorZ& operator=(CResult_PaymentPreimageAPIErrorZ&& o) { CResult_PaymentPreimageAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPreimageAPIErrorZ)); return *this; } - LDKCResult_PaymentPreimageAPIErrorZ* operator &() { return &self; } - LDKCResult_PaymentPreimageAPIErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentPreimageAPIErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentPreimageAPIErrorZ* operator ->() const { return &self; } + CResult_SignDecodeErrorZ(const CResult_SignDecodeErrorZ&) = delete; + CResult_SignDecodeErrorZ(CResult_SignDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignDecodeErrorZ)); } + CResult_SignDecodeErrorZ(LDKCResult_SignDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignDecodeErrorZ)); } + operator LDKCResult_SignDecodeErrorZ() && { LDKCResult_SignDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SignDecodeErrorZ)); return res; } + ~CResult_SignDecodeErrorZ() { CResult_SignDecodeErrorZ_free(self); } + CResult_SignDecodeErrorZ& operator=(CResult_SignDecodeErrorZ&& o) { CResult_SignDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignDecodeErrorZ)); return *this; } + LDKCResult_SignDecodeErrorZ* operator &() { return &self; } + LDKCResult_SignDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_SignDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_SignDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelMonitorUpdateDecodeErrorZ { +class CResult_UnsignedChannelAnnouncementDecodeErrorZ { private: - LDKCResult_ChannelMonitorUpdateDecodeErrorZ self; + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ self; public: - CResult_ChannelMonitorUpdateDecodeErrorZ(const CResult_ChannelMonitorUpdateDecodeErrorZ&) = delete; - CResult_ChannelMonitorUpdateDecodeErrorZ(CResult_ChannelMonitorUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateDecodeErrorZ)); } - CResult_ChannelMonitorUpdateDecodeErrorZ(LDKCResult_ChannelMonitorUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ)); } - operator LDKCResult_ChannelMonitorUpdateDecodeErrorZ() && { LDKCResult_ChannelMonitorUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ)); return res; } - ~CResult_ChannelMonitorUpdateDecodeErrorZ() { CResult_ChannelMonitorUpdateDecodeErrorZ_free(self); } - CResult_ChannelMonitorUpdateDecodeErrorZ& operator=(CResult_ChannelMonitorUpdateDecodeErrorZ&& o) { CResult_ChannelMonitorUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateDecodeErrorZ)); return *this; } - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator ->() const { return &self; } + CResult_UnsignedChannelAnnouncementDecodeErrorZ(const CResult_UnsignedChannelAnnouncementDecodeErrorZ&) = delete; + CResult_UnsignedChannelAnnouncementDecodeErrorZ(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); } + CResult_UnsignedChannelAnnouncementDecodeErrorZ(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); } + operator LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); return res; } + ~CResult_UnsignedChannelAnnouncementDecodeErrorZ() { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); } + CResult_UnsignedChannelAnnouncementDecodeErrorZ& operator=(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_RouteHintDecodeErrorZ { +class COption_AccessZ { private: - LDKCResult_RouteHintDecodeErrorZ self; + LDKCOption_AccessZ self; public: - CResult_RouteHintDecodeErrorZ(const CResult_RouteHintDecodeErrorZ&) = delete; - CResult_RouteHintDecodeErrorZ(CResult_RouteHintDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); } - CResult_RouteHintDecodeErrorZ(LDKCResult_RouteHintDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); } - operator LDKCResult_RouteHintDecodeErrorZ() && { LDKCResult_RouteHintDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintDecodeErrorZ)); return res; } - ~CResult_RouteHintDecodeErrorZ() { CResult_RouteHintDecodeErrorZ_free(self); } - CResult_RouteHintDecodeErrorZ& operator=(CResult_RouteHintDecodeErrorZ&& o) { CResult_RouteHintDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintDecodeErrorZ)); return *this; } - LDKCResult_RouteHintDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteHintDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteHintDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteHintDecodeErrorZ* operator ->() const { return &self; } + COption_AccessZ(const COption_AccessZ&) = delete; + COption_AccessZ(COption_AccessZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_AccessZ)); } + COption_AccessZ(LDKCOption_AccessZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_AccessZ)); } + operator LDKCOption_AccessZ() && { LDKCOption_AccessZ res = self; memset(&self, 0, sizeof(LDKCOption_AccessZ)); return res; } + ~COption_AccessZ() { COption_AccessZ_free(self); } + COption_AccessZ& operator=(COption_AccessZ&& o) { COption_AccessZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_AccessZ)); return *this; } + LDKCOption_AccessZ* operator &() { return &self; } + LDKCOption_AccessZ* operator ->() { return &self; } + const LDKCOption_AccessZ* operator &() const { return &self; } + const LDKCOption_AccessZ* operator ->() const { return &self; } }; -class C2Tuple_PublicKeyTypeZ { +class CResult_PongDecodeErrorZ { private: - LDKC2Tuple_PublicKeyTypeZ self; + LDKCResult_PongDecodeErrorZ self; public: - C2Tuple_PublicKeyTypeZ(const C2Tuple_PublicKeyTypeZ&) = delete; - C2Tuple_PublicKeyTypeZ(C2Tuple_PublicKeyTypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); } - C2Tuple_PublicKeyTypeZ(LDKC2Tuple_PublicKeyTypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); } - operator LDKC2Tuple_PublicKeyTypeZ() && { LDKC2Tuple_PublicKeyTypeZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); return res; } - ~C2Tuple_PublicKeyTypeZ() { C2Tuple_PublicKeyTypeZ_free(self); } - C2Tuple_PublicKeyTypeZ& operator=(C2Tuple_PublicKeyTypeZ&& o) { C2Tuple_PublicKeyTypeZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); return *this; } - LDKC2Tuple_PublicKeyTypeZ* operator &() { return &self; } - LDKC2Tuple_PublicKeyTypeZ* operator ->() { return &self; } - const LDKC2Tuple_PublicKeyTypeZ* operator &() const { return &self; } - const LDKC2Tuple_PublicKeyTypeZ* operator ->() const { return &self; } + CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete; + CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); } + CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); } + operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; } + ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); } + CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; } + LDKCResult_PongDecodeErrorZ* operator &() { return &self; } + LDKCResult_PongDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NetAddressDecodeErrorZ { +class C2Tuple_OutPointCVec_MonitorUpdateIdZZ { private: - LDKCResult_NetAddressDecodeErrorZ self; + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ self; public: - CResult_NetAddressDecodeErrorZ(const CResult_NetAddressDecodeErrorZ&) = delete; - CResult_NetAddressDecodeErrorZ(CResult_NetAddressDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetAddressDecodeErrorZ)); } - CResult_NetAddressDecodeErrorZ(LDKCResult_NetAddressDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetAddressDecodeErrorZ)); } - operator LDKCResult_NetAddressDecodeErrorZ() && { LDKCResult_NetAddressDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NetAddressDecodeErrorZ)); return res; } - ~CResult_NetAddressDecodeErrorZ() { CResult_NetAddressDecodeErrorZ_free(self); } - CResult_NetAddressDecodeErrorZ& operator=(CResult_NetAddressDecodeErrorZ&& o) { CResult_NetAddressDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetAddressDecodeErrorZ)); return *this; } - LDKCResult_NetAddressDecodeErrorZ* operator &() { return &self; } - LDKCResult_NetAddressDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NetAddressDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NetAddressDecodeErrorZ* operator ->() const { return &self; } + C2Tuple_OutPointCVec_MonitorUpdateIdZZ(const C2Tuple_OutPointCVec_MonitorUpdateIdZZ&) = delete; + C2Tuple_OutPointCVec_MonitorUpdateIdZZ(C2Tuple_OutPointCVec_MonitorUpdateIdZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointCVec_MonitorUpdateIdZZ)); } + C2Tuple_OutPointCVec_MonitorUpdateIdZZ(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ)); } + operator LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ() && { LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ)); return res; } + ~C2Tuple_OutPointCVec_MonitorUpdateIdZZ() { C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(self); } + C2Tuple_OutPointCVec_MonitorUpdateIdZZ& operator=(C2Tuple_OutPointCVec_MonitorUpdateIdZZ&& o) { C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointCVec_MonitorUpdateIdZZ)); return *this; } + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* operator &() { return &self; } + LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* operator ->() { return &self; } + const LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* operator &() const { return &self; } + const LDKC2Tuple_OutPointCVec_MonitorUpdateIdZZ* operator ->() const { return &self; } }; -class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { +class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { private: - LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ self; + LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ self; public: - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(const COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&) = delete; - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); } - operator LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() && { LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = self; memset(&self, 0, sizeof(LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return res; } - ~COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ() { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); } - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ& operator=(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ&& o) { COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ)); return *this; } - LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() { return &self; } - LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() { return &self; } - const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator &() const { return &self; } - const LDKCOption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* operator ->() const { return &self; } + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&) = delete; + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); } + CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelReestablishDecodeErrorZ { +class C2Tuple_SignatureSignatureZ { private: - LDKCResult_ChannelReestablishDecodeErrorZ self; + LDKC2Tuple_SignatureSignatureZ self; public: - CResult_ChannelReestablishDecodeErrorZ(const CResult_ChannelReestablishDecodeErrorZ&) = delete; - CResult_ChannelReestablishDecodeErrorZ(CResult_ChannelReestablishDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReestablishDecodeErrorZ)); } - CResult_ChannelReestablishDecodeErrorZ(LDKCResult_ChannelReestablishDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReestablishDecodeErrorZ)); } - operator LDKCResult_ChannelReestablishDecodeErrorZ() && { LDKCResult_ChannelReestablishDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReestablishDecodeErrorZ)); return res; } - ~CResult_ChannelReestablishDecodeErrorZ() { CResult_ChannelReestablishDecodeErrorZ_free(self); } - CResult_ChannelReestablishDecodeErrorZ& operator=(CResult_ChannelReestablishDecodeErrorZ&& o) { CResult_ChannelReestablishDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReestablishDecodeErrorZ)); return *this; } - LDKCResult_ChannelReestablishDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelReestablishDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() const { return &self; } + C2Tuple_SignatureSignatureZ(const C2Tuple_SignatureSignatureZ&) = delete; + C2Tuple_SignatureSignatureZ(C2Tuple_SignatureSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureSignatureZ)); } + C2Tuple_SignatureSignatureZ(LDKC2Tuple_SignatureSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureSignatureZ)); } + operator LDKC2Tuple_SignatureSignatureZ() && { LDKC2Tuple_SignatureSignatureZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureSignatureZ)); return res; } + ~C2Tuple_SignatureSignatureZ() { C2Tuple_SignatureSignatureZ_free(self); } + C2Tuple_SignatureSignatureZ& operator=(C2Tuple_SignatureSignatureZ&& o) { C2Tuple_SignatureSignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_SignatureSignatureZ)); return *this; } + LDKC2Tuple_SignatureSignatureZ* operator &() { return &self; } + LDKC2Tuple_SignatureSignatureZ* operator ->() { return &self; } + const LDKC2Tuple_SignatureSignatureZ* operator &() const { return &self; } + const LDKC2Tuple_SignatureSignatureZ* operator ->() const { return &self; } }; -class CVec_UpdateAddHTLCZ { +class C2Tuple_BlockHashChannelManagerZ { private: - LDKCVec_UpdateAddHTLCZ self; -public: - CVec_UpdateAddHTLCZ(const CVec_UpdateAddHTLCZ&) = delete; - CVec_UpdateAddHTLCZ(CVec_UpdateAddHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); } - CVec_UpdateAddHTLCZ(LDKCVec_UpdateAddHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); } - operator LDKCVec_UpdateAddHTLCZ() && { LDKCVec_UpdateAddHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateAddHTLCZ)); return res; } - ~CVec_UpdateAddHTLCZ() { CVec_UpdateAddHTLCZ_free(self); } - CVec_UpdateAddHTLCZ& operator=(CVec_UpdateAddHTLCZ&& o) { CVec_UpdateAddHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateAddHTLCZ)); return *this; } - LDKCVec_UpdateAddHTLCZ* operator &() { return &self; } - LDKCVec_UpdateAddHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; } + LDKC2Tuple_BlockHashChannelManagerZ self; +public: + C2Tuple_BlockHashChannelManagerZ(const C2Tuple_BlockHashChannelManagerZ&) = delete; + C2Tuple_BlockHashChannelManagerZ(C2Tuple_BlockHashChannelManagerZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); } + C2Tuple_BlockHashChannelManagerZ(LDKC2Tuple_BlockHashChannelManagerZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); } + operator LDKC2Tuple_BlockHashChannelManagerZ() && { LDKC2Tuple_BlockHashChannelManagerZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); return res; } + ~C2Tuple_BlockHashChannelManagerZ() { C2Tuple_BlockHashChannelManagerZ_free(self); } + C2Tuple_BlockHashChannelManagerZ& operator=(C2Tuple_BlockHashChannelManagerZ&& o) { C2Tuple_BlockHashChannelManagerZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); return *this; } + LDKC2Tuple_BlockHashChannelManagerZ* operator &() { return &self; } + LDKC2Tuple_BlockHashChannelManagerZ* operator ->() { return &self; } + const LDKC2Tuple_BlockHashChannelManagerZ* operator &() const { return &self; } + const LDKC2Tuple_BlockHashChannelManagerZ* operator ->() const { return &self; } }; -class CResult_CommitmentSignedDecodeErrorZ { +class CResult_ChannelTransactionParametersDecodeErrorZ { private: - LDKCResult_CommitmentSignedDecodeErrorZ self; + LDKCResult_ChannelTransactionParametersDecodeErrorZ self; public: - CResult_CommitmentSignedDecodeErrorZ(const CResult_CommitmentSignedDecodeErrorZ&) = delete; - CResult_CommitmentSignedDecodeErrorZ(CResult_CommitmentSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); } - CResult_CommitmentSignedDecodeErrorZ(LDKCResult_CommitmentSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); } - operator LDKCResult_CommitmentSignedDecodeErrorZ() && { LDKCResult_CommitmentSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentSignedDecodeErrorZ)); return res; } - ~CResult_CommitmentSignedDecodeErrorZ() { CResult_CommitmentSignedDecodeErrorZ_free(self); } - CResult_CommitmentSignedDecodeErrorZ& operator=(CResult_CommitmentSignedDecodeErrorZ&& o) { CResult_CommitmentSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentSignedDecodeErrorZ)); return *this; } - LDKCResult_CommitmentSignedDecodeErrorZ* operator &() { return &self; } - LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CommitmentSignedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CommitmentSignedDecodeErrorZ* operator ->() const { return &self; } + CResult_ChannelTransactionParametersDecodeErrorZ(const CResult_ChannelTransactionParametersDecodeErrorZ&) = delete; + CResult_ChannelTransactionParametersDecodeErrorZ(CResult_ChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); } + CResult_ChannelTransactionParametersDecodeErrorZ(LDKCResult_ChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); } + operator LDKCResult_ChannelTransactionParametersDecodeErrorZ() && { LDKCResult_ChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); return res; } + ~CResult_ChannelTransactionParametersDecodeErrorZ() { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); } + CResult_ChannelTransactionParametersDecodeErrorZ& operator=(CResult_ChannelTransactionParametersDecodeErrorZ&& o) { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); return *this; } + LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } }; -class COption_u32Z { +class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { private: - LDKCOption_u32Z self; + LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ self; public: - COption_u32Z(const COption_u32Z&) = delete; - COption_u32Z(COption_u32Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u32Z)); } - COption_u32Z(LDKCOption_u32Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u32Z)); } - operator LDKCOption_u32Z() && { LDKCOption_u32Z res = self; memset(&self, 0, sizeof(LDKCOption_u32Z)); return res; } - ~COption_u32Z() { COption_u32Z_free(self); } - COption_u32Z& operator=(COption_u32Z&& o) { COption_u32Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u32Z)); return *this; } - LDKCOption_u32Z* operator &() { return &self; } - LDKCOption_u32Z* operator ->() { return &self; } - const LDKCOption_u32Z* operator &() const { return &self; } - const LDKCOption_u32Z* operator ->() const { return &self; } + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(const CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&) = delete; + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } + operator LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return res; } + ~CResult_DelayedPaymentOutputDescriptorDecodeErrorZ() { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); } + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return *this; } + LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; } + LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_InitFeaturesDecodeErrorZ { +class C2Tuple_PaymentHashPaymentIdZ { private: - LDKCResult_InitFeaturesDecodeErrorZ self; + LDKC2Tuple_PaymentHashPaymentIdZ self; public: - CResult_InitFeaturesDecodeErrorZ(const CResult_InitFeaturesDecodeErrorZ&) = delete; - CResult_InitFeaturesDecodeErrorZ(CResult_InitFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); } - CResult_InitFeaturesDecodeErrorZ(LDKCResult_InitFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); } - operator LDKCResult_InitFeaturesDecodeErrorZ() && { LDKCResult_InitFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); return res; } - ~CResult_InitFeaturesDecodeErrorZ() { CResult_InitFeaturesDecodeErrorZ_free(self); } - CResult_InitFeaturesDecodeErrorZ& operator=(CResult_InitFeaturesDecodeErrorZ&& o) { CResult_InitFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); return *this; } - LDKCResult_InitFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_InitFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InitFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InitFeaturesDecodeErrorZ* operator ->() const { return &self; } + C2Tuple_PaymentHashPaymentIdZ(const C2Tuple_PaymentHashPaymentIdZ&) = delete; + C2Tuple_PaymentHashPaymentIdZ(C2Tuple_PaymentHashPaymentIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentIdZ)); } + C2Tuple_PaymentHashPaymentIdZ(LDKC2Tuple_PaymentHashPaymentIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentIdZ)); } + operator LDKC2Tuple_PaymentHashPaymentIdZ() && { LDKC2Tuple_PaymentHashPaymentIdZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentIdZ)); return res; } + ~C2Tuple_PaymentHashPaymentIdZ() { C2Tuple_PaymentHashPaymentIdZ_free(self); } + C2Tuple_PaymentHashPaymentIdZ& operator=(C2Tuple_PaymentHashPaymentIdZ&& o) { C2Tuple_PaymentHashPaymentIdZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentIdZ)); return *this; } + LDKC2Tuple_PaymentHashPaymentIdZ* operator &() { return &self; } + LDKC2Tuple_PaymentHashPaymentIdZ* operator ->() { return &self; } + const LDKC2Tuple_PaymentHashPaymentIdZ* operator &() const { return &self; } + const LDKC2Tuple_PaymentHashPaymentIdZ* operator ->() const { return &self; } }; -class CResult_StaticPaymentOutputDescriptorDecodeErrorZ { +class CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { private: - LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ self; + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ self; public: - CResult_StaticPaymentOutputDescriptorDecodeErrorZ(const CResult_StaticPaymentOutputDescriptorDecodeErrorZ&) = delete; - CResult_StaticPaymentOutputDescriptorDecodeErrorZ(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); } - CResult_StaticPaymentOutputDescriptorDecodeErrorZ(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); } - operator LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return res; } - ~CResult_StaticPaymentOutputDescriptorDecodeErrorZ() { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); } - CResult_StaticPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_StaticPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StaticPaymentOutputDescriptorDecodeErrorZ)); return *this; } - LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; } - LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(const CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&) = delete; + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); } + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); } + operator LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ() && { LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); return res; } + ~CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ() { CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(self); } + CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ& operator=(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& o) { CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); return *this; } + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator ->() const { return &self; } }; -class CResult_PublicKeyNoneZ { +class CResult_NoneErrorZ { private: - LDKCResult_PublicKeyNoneZ self; + LDKCResult_NoneErrorZ self; public: - CResult_PublicKeyNoneZ(const CResult_PublicKeyNoneZ&) = delete; - CResult_PublicKeyNoneZ(CResult_PublicKeyNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); } - CResult_PublicKeyNoneZ(LDKCResult_PublicKeyNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); } - operator LDKCResult_PublicKeyNoneZ() && { LDKCResult_PublicKeyNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); return res; } - ~CResult_PublicKeyNoneZ() { CResult_PublicKeyNoneZ_free(self); } - CResult_PublicKeyNoneZ& operator=(CResult_PublicKeyNoneZ&& o) { CResult_PublicKeyNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); return *this; } - LDKCResult_PublicKeyNoneZ* operator &() { return &self; } - LDKCResult_PublicKeyNoneZ* operator ->() { return &self; } - const LDKCResult_PublicKeyNoneZ* operator &() const { return &self; } - const LDKCResult_PublicKeyNoneZ* operator ->() const { return &self; } + CResult_NoneErrorZ(const CResult_NoneErrorZ&) = delete; + CResult_NoneErrorZ(CResult_NoneErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneErrorZ)); } + CResult_NoneErrorZ(LDKCResult_NoneErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneErrorZ)); } + operator LDKCResult_NoneErrorZ() && { LDKCResult_NoneErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneErrorZ)); return res; } + ~CResult_NoneErrorZ() { CResult_NoneErrorZ_free(self); } + CResult_NoneErrorZ& operator=(CResult_NoneErrorZ&& o) { CResult_NoneErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneErrorZ)); return *this; } + LDKCResult_NoneErrorZ* operator &() { return &self; } + LDKCResult_NoneErrorZ* operator ->() { return &self; } + const LDKCResult_NoneErrorZ* operator &() const { return &self; } + const LDKCResult_NoneErrorZ* operator ->() const { return &self; } }; -class CResult_PaymentIdPaymentSendFailureZ { +class CResult_InFlightHtlcsDecodeErrorZ { private: - LDKCResult_PaymentIdPaymentSendFailureZ self; + LDKCResult_InFlightHtlcsDecodeErrorZ self; public: - CResult_PaymentIdPaymentSendFailureZ(const CResult_PaymentIdPaymentSendFailureZ&) = delete; - CResult_PaymentIdPaymentSendFailureZ(CResult_PaymentIdPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentIdPaymentSendFailureZ)); } - CResult_PaymentIdPaymentSendFailureZ(LDKCResult_PaymentIdPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentIdPaymentSendFailureZ)); } - operator LDKCResult_PaymentIdPaymentSendFailureZ() && { LDKCResult_PaymentIdPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentIdPaymentSendFailureZ)); return res; } - ~CResult_PaymentIdPaymentSendFailureZ() { CResult_PaymentIdPaymentSendFailureZ_free(self); } - CResult_PaymentIdPaymentSendFailureZ& operator=(CResult_PaymentIdPaymentSendFailureZ&& o) { CResult_PaymentIdPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentIdPaymentSendFailureZ)); return *this; } - LDKCResult_PaymentIdPaymentSendFailureZ* operator &() { return &self; } - LDKCResult_PaymentIdPaymentSendFailureZ* operator ->() { return &self; } - const LDKCResult_PaymentIdPaymentSendFailureZ* operator &() const { return &self; } - const LDKCResult_PaymentIdPaymentSendFailureZ* operator ->() const { return &self; } + CResult_InFlightHtlcsDecodeErrorZ(const CResult_InFlightHtlcsDecodeErrorZ&) = delete; + CResult_InFlightHtlcsDecodeErrorZ(CResult_InFlightHtlcsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); } + CResult_InFlightHtlcsDecodeErrorZ(LDKCResult_InFlightHtlcsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); } + operator LDKCResult_InFlightHtlcsDecodeErrorZ() && { LDKCResult_InFlightHtlcsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); return res; } + ~CResult_InFlightHtlcsDecodeErrorZ() { CResult_InFlightHtlcsDecodeErrorZ_free(self); } + CResult_InFlightHtlcsDecodeErrorZ& operator=(CResult_InFlightHtlcsDecodeErrorZ&& o) { CResult_InFlightHtlcsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); return *this; } + LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() { return &self; } + LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CommitmentTransactionDecodeErrorZ { +class CResult_COption_HTLCDestinationZDecodeErrorZ { private: - LDKCResult_CommitmentTransactionDecodeErrorZ self; + LDKCResult_COption_HTLCDestinationZDecodeErrorZ self; public: - CResult_CommitmentTransactionDecodeErrorZ(const CResult_CommitmentTransactionDecodeErrorZ&) = delete; - CResult_CommitmentTransactionDecodeErrorZ(CResult_CommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); } - CResult_CommitmentTransactionDecodeErrorZ(LDKCResult_CommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); } - operator LDKCResult_CommitmentTransactionDecodeErrorZ() && { LDKCResult_CommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CommitmentTransactionDecodeErrorZ)); return res; } - ~CResult_CommitmentTransactionDecodeErrorZ() { CResult_CommitmentTransactionDecodeErrorZ_free(self); } - CResult_CommitmentTransactionDecodeErrorZ& operator=(CResult_CommitmentTransactionDecodeErrorZ&& o) { CResult_CommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CommitmentTransactionDecodeErrorZ)); return *this; } - LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() { return &self; } - LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CommitmentTransactionDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } + CResult_COption_HTLCDestinationZDecodeErrorZ(const CResult_COption_HTLCDestinationZDecodeErrorZ&) = delete; + CResult_COption_HTLCDestinationZDecodeErrorZ(CResult_COption_HTLCDestinationZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_HTLCDestinationZDecodeErrorZ)); } + CResult_COption_HTLCDestinationZDecodeErrorZ(LDKCResult_COption_HTLCDestinationZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ)); } + operator LDKCResult_COption_HTLCDestinationZDecodeErrorZ() && { LDKCResult_COption_HTLCDestinationZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ)); return res; } + ~CResult_COption_HTLCDestinationZDecodeErrorZ() { CResult_COption_HTLCDestinationZDecodeErrorZ_free(self); } + CResult_COption_HTLCDestinationZDecodeErrorZ& operator=(CResult_COption_HTLCDestinationZDecodeErrorZ&& o) { CResult_COption_HTLCDestinationZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_HTLCDestinationZDecodeErrorZ)); return *this; } + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TransactionNoneZ { +class CResult_SiPrefixParseErrorZ { private: - LDKCResult_TransactionNoneZ self; + LDKCResult_SiPrefixParseErrorZ self; public: - CResult_TransactionNoneZ(const CResult_TransactionNoneZ&) = delete; - CResult_TransactionNoneZ(CResult_TransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionNoneZ)); } - CResult_TransactionNoneZ(LDKCResult_TransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionNoneZ)); } - operator LDKCResult_TransactionNoneZ() && { LDKCResult_TransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionNoneZ)); return res; } - ~CResult_TransactionNoneZ() { CResult_TransactionNoneZ_free(self); } - CResult_TransactionNoneZ& operator=(CResult_TransactionNoneZ&& o) { CResult_TransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionNoneZ)); return *this; } - LDKCResult_TransactionNoneZ* operator &() { return &self; } - LDKCResult_TransactionNoneZ* operator ->() { return &self; } - const LDKCResult_TransactionNoneZ* operator &() const { return &self; } - const LDKCResult_TransactionNoneZ* operator ->() const { return &self; } + CResult_SiPrefixParseErrorZ(const CResult_SiPrefixParseErrorZ&) = delete; + CResult_SiPrefixParseErrorZ(CResult_SiPrefixParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixParseErrorZ)); } + CResult_SiPrefixParseErrorZ(LDKCResult_SiPrefixParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixParseErrorZ)); } + operator LDKCResult_SiPrefixParseErrorZ() && { LDKCResult_SiPrefixParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixParseErrorZ)); return res; } + ~CResult_SiPrefixParseErrorZ() { CResult_SiPrefixParseErrorZ_free(self); } + CResult_SiPrefixParseErrorZ& operator=(CResult_SiPrefixParseErrorZ&& o) { CResult_SiPrefixParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixParseErrorZ)); return *this; } + LDKCResult_SiPrefixParseErrorZ* operator &() { return &self; } + LDKCResult_SiPrefixParseErrorZ* operator ->() { return &self; } + const LDKCResult_SiPrefixParseErrorZ* operator &() const { return &self; } + const LDKCResult_SiPrefixParseErrorZ* operator ->() const { return &self; } }; -class CResult_ClosingSignedFeeRangeDecodeErrorZ { +class CResult_BlindedHopDecodeErrorZ { private: - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ self; + LDKCResult_BlindedHopDecodeErrorZ self; public: - CResult_ClosingSignedFeeRangeDecodeErrorZ(const CResult_ClosingSignedFeeRangeDecodeErrorZ&) = delete; - CResult_ClosingSignedFeeRangeDecodeErrorZ(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); } - CResult_ClosingSignedFeeRangeDecodeErrorZ(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); } - operator LDKCResult_ClosingSignedFeeRangeDecodeErrorZ() && { LDKCResult_ClosingSignedFeeRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingSignedFeeRangeDecodeErrorZ)); return res; } - ~CResult_ClosingSignedFeeRangeDecodeErrorZ() { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); } - CResult_ClosingSignedFeeRangeDecodeErrorZ& operator=(CResult_ClosingSignedFeeRangeDecodeErrorZ&& o) { CResult_ClosingSignedFeeRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingSignedFeeRangeDecodeErrorZ)); return *this; } - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() { return &self; } - LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ClosingSignedFeeRangeDecodeErrorZ* operator ->() const { return &self; } + CResult_BlindedHopDecodeErrorZ(const CResult_BlindedHopDecodeErrorZ&) = delete; + CResult_BlindedHopDecodeErrorZ(CResult_BlindedHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); } + CResult_BlindedHopDecodeErrorZ(LDKCResult_BlindedHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); } + operator LDKCResult_BlindedHopDecodeErrorZ() && { LDKCResult_BlindedHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); return res; } + ~CResult_BlindedHopDecodeErrorZ() { CResult_BlindedHopDecodeErrorZ_free(self); } + CResult_BlindedHopDecodeErrorZ& operator=(CResult_BlindedHopDecodeErrorZ&& o) { CResult_BlindedHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); return *this; } + LDKCResult_BlindedHopDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedHopDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedHopDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedHopDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_OnionMessageDecodeErrorZ { +class CResult_TrustedCommitmentTransactionNoneZ { private: - LDKCResult_OnionMessageDecodeErrorZ self; + LDKCResult_TrustedCommitmentTransactionNoneZ self; public: - CResult_OnionMessageDecodeErrorZ(const CResult_OnionMessageDecodeErrorZ&) = delete; - CResult_OnionMessageDecodeErrorZ(CResult_OnionMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); } - CResult_OnionMessageDecodeErrorZ(LDKCResult_OnionMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); } - operator LDKCResult_OnionMessageDecodeErrorZ() && { LDKCResult_OnionMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); return res; } - ~CResult_OnionMessageDecodeErrorZ() { CResult_OnionMessageDecodeErrorZ_free(self); } - CResult_OnionMessageDecodeErrorZ& operator=(CResult_OnionMessageDecodeErrorZ&& o) { CResult_OnionMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); return *this; } - LDKCResult_OnionMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_OnionMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OnionMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OnionMessageDecodeErrorZ* operator ->() const { return &self; } + CResult_TrustedCommitmentTransactionNoneZ(const CResult_TrustedCommitmentTransactionNoneZ&) = delete; + CResult_TrustedCommitmentTransactionNoneZ(CResult_TrustedCommitmentTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedCommitmentTransactionNoneZ)); } + CResult_TrustedCommitmentTransactionNoneZ(LDKCResult_TrustedCommitmentTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); } + operator LDKCResult_TrustedCommitmentTransactionNoneZ() && { LDKCResult_TrustedCommitmentTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); return res; } + ~CResult_TrustedCommitmentTransactionNoneZ() { CResult_TrustedCommitmentTransactionNoneZ_free(self); } + CResult_TrustedCommitmentTransactionNoneZ& operator=(CResult_TrustedCommitmentTransactionNoneZ&& o) { CResult_TrustedCommitmentTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrustedCommitmentTransactionNoneZ)); return *this; } + LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() { return &self; } + LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() { return &self; } + const LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() const { return &self; } + const LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() const { return &self; } }; -class CResult_PingDecodeErrorZ { +class CResult_FixedPenaltyScorerDecodeErrorZ { private: - LDKCResult_PingDecodeErrorZ self; + LDKCResult_FixedPenaltyScorerDecodeErrorZ self; public: - CResult_PingDecodeErrorZ(const CResult_PingDecodeErrorZ&) = delete; - CResult_PingDecodeErrorZ(CResult_PingDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PingDecodeErrorZ)); } - CResult_PingDecodeErrorZ(LDKCResult_PingDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PingDecodeErrorZ)); } - operator LDKCResult_PingDecodeErrorZ() && { LDKCResult_PingDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PingDecodeErrorZ)); return res; } - ~CResult_PingDecodeErrorZ() { CResult_PingDecodeErrorZ_free(self); } - CResult_PingDecodeErrorZ& operator=(CResult_PingDecodeErrorZ&& o) { CResult_PingDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PingDecodeErrorZ)); return *this; } - LDKCResult_PingDecodeErrorZ* operator &() { return &self; } - LDKCResult_PingDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PingDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PingDecodeErrorZ* operator ->() const { return &self; } + CResult_FixedPenaltyScorerDecodeErrorZ(const CResult_FixedPenaltyScorerDecodeErrorZ&) = delete; + CResult_FixedPenaltyScorerDecodeErrorZ(CResult_FixedPenaltyScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FixedPenaltyScorerDecodeErrorZ)); } + CResult_FixedPenaltyScorerDecodeErrorZ(LDKCResult_FixedPenaltyScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ)); } + operator LDKCResult_FixedPenaltyScorerDecodeErrorZ() && { LDKCResult_FixedPenaltyScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ)); return res; } + ~CResult_FixedPenaltyScorerDecodeErrorZ() { CResult_FixedPenaltyScorerDecodeErrorZ_free(self); } + CResult_FixedPenaltyScorerDecodeErrorZ& operator=(CResult_FixedPenaltyScorerDecodeErrorZ&& o) { CResult_FixedPenaltyScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FixedPenaltyScorerDecodeErrorZ)); return *this; } + LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator &() { return &self; } + LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_UnsignedNodeAnnouncementDecodeErrorZ { +class CResult_NoneLightningErrorZ { private: - LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ self; + LDKCResult_NoneLightningErrorZ self; public: - CResult_UnsignedNodeAnnouncementDecodeErrorZ(const CResult_UnsignedNodeAnnouncementDecodeErrorZ&) = delete; - CResult_UnsignedNodeAnnouncementDecodeErrorZ(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); } - CResult_UnsignedNodeAnnouncementDecodeErrorZ(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); } - operator LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); return res; } - ~CResult_UnsignedNodeAnnouncementDecodeErrorZ() { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); } - CResult_UnsignedNodeAnnouncementDecodeErrorZ& operator=(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); return *this; } - LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() { return &self; } - LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } + CResult_NoneLightningErrorZ(const CResult_NoneLightningErrorZ&) = delete; + CResult_NoneLightningErrorZ(CResult_NoneLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); } + CResult_NoneLightningErrorZ(LDKCResult_NoneLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); } + operator LDKCResult_NoneLightningErrorZ() && { LDKCResult_NoneLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); return res; } + ~CResult_NoneLightningErrorZ() { CResult_NoneLightningErrorZ_free(self); } + CResult_NoneLightningErrorZ& operator=(CResult_NoneLightningErrorZ&& o) { CResult_NoneLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); return *this; } + LDKCResult_NoneLightningErrorZ* operator &() { return &self; } + LDKCResult_NoneLightningErrorZ* operator ->() { return &self; } + const LDKCResult_NoneLightningErrorZ* operator &() const { return &self; } + const LDKCResult_NoneLightningErrorZ* operator ->() const { return &self; } }; -class CResult_ReplyChannelRangeDecodeErrorZ { +class CResult_NonePeerHandleErrorZ { private: - LDKCResult_ReplyChannelRangeDecodeErrorZ self; + LDKCResult_NonePeerHandleErrorZ self; public: - CResult_ReplyChannelRangeDecodeErrorZ(const CResult_ReplyChannelRangeDecodeErrorZ&) = delete; - CResult_ReplyChannelRangeDecodeErrorZ(CResult_ReplyChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); } - CResult_ReplyChannelRangeDecodeErrorZ(LDKCResult_ReplyChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); } - operator LDKCResult_ReplyChannelRangeDecodeErrorZ() && { LDKCResult_ReplyChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); return res; } - ~CResult_ReplyChannelRangeDecodeErrorZ() { CResult_ReplyChannelRangeDecodeErrorZ_free(self); } - CResult_ReplyChannelRangeDecodeErrorZ& operator=(CResult_ReplyChannelRangeDecodeErrorZ&& o) { CResult_ReplyChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); return *this; } - LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() { return &self; } - LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; } + CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete; + CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); } + CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); } + operator LDKCResult_NonePeerHandleErrorZ() && { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; } + ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); } + CResult_NonePeerHandleErrorZ& operator=(CResult_NonePeerHandleErrorZ&& o) { CResult_NonePeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); return *this; } + LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; } + LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; } + const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; } + const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; } }; -class CResult_GossipTimestampFilterDecodeErrorZ { +class CResult_COption_EventZDecodeErrorZ { private: - LDKCResult_GossipTimestampFilterDecodeErrorZ self; + LDKCResult_COption_EventZDecodeErrorZ self; public: - CResult_GossipTimestampFilterDecodeErrorZ(const CResult_GossipTimestampFilterDecodeErrorZ&) = delete; - CResult_GossipTimestampFilterDecodeErrorZ(CResult_GossipTimestampFilterDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); } - CResult_GossipTimestampFilterDecodeErrorZ(LDKCResult_GossipTimestampFilterDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); } - operator LDKCResult_GossipTimestampFilterDecodeErrorZ() && { LDKCResult_GossipTimestampFilterDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_GossipTimestampFilterDecodeErrorZ)); return res; } - ~CResult_GossipTimestampFilterDecodeErrorZ() { CResult_GossipTimestampFilterDecodeErrorZ_free(self); } - CResult_GossipTimestampFilterDecodeErrorZ& operator=(CResult_GossipTimestampFilterDecodeErrorZ&& o) { CResult_GossipTimestampFilterDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_GossipTimestampFilterDecodeErrorZ)); return *this; } - LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() { return &self; } - LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_GossipTimestampFilterDecodeErrorZ* operator ->() const { return &self; } + CResult_COption_EventZDecodeErrorZ(const CResult_COption_EventZDecodeErrorZ&) = delete; + CResult_COption_EventZDecodeErrorZ(CResult_COption_EventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); } + CResult_COption_EventZDecodeErrorZ(LDKCResult_COption_EventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); } + operator LDKCResult_COption_EventZDecodeErrorZ() && { LDKCResult_COption_EventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); return res; } + ~CResult_COption_EventZDecodeErrorZ() { CResult_COption_EventZDecodeErrorZ_free(self); } + CResult_COption_EventZDecodeErrorZ& operator=(CResult_COption_EventZDecodeErrorZ&& o) { CResult_COption_EventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); return *this; } + LDKCResult_COption_EventZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_EventZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_EventZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_EventZDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_TransactionOutputsZ { +class CResult_CVec_SignatureZNoneZ { private: - LDKCVec_TransactionOutputsZ self; + LDKCResult_CVec_SignatureZNoneZ self; public: - CVec_TransactionOutputsZ(const CVec_TransactionOutputsZ&) = delete; - CVec_TransactionOutputsZ(CVec_TransactionOutputsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionOutputsZ)); } - CVec_TransactionOutputsZ(LDKCVec_TransactionOutputsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionOutputsZ)); } - operator LDKCVec_TransactionOutputsZ() && { LDKCVec_TransactionOutputsZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionOutputsZ)); return res; } - ~CVec_TransactionOutputsZ() { CVec_TransactionOutputsZ_free(self); } - CVec_TransactionOutputsZ& operator=(CVec_TransactionOutputsZ&& o) { CVec_TransactionOutputsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionOutputsZ)); return *this; } - LDKCVec_TransactionOutputsZ* operator &() { return &self; } - LDKCVec_TransactionOutputsZ* operator ->() { return &self; } - const LDKCVec_TransactionOutputsZ* operator &() const { return &self; } - const LDKCVec_TransactionOutputsZ* operator ->() const { return &self; } + CResult_CVec_SignatureZNoneZ(const CResult_CVec_SignatureZNoneZ&) = delete; + CResult_CVec_SignatureZNoneZ(CResult_CVec_SignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); } + CResult_CVec_SignatureZNoneZ(LDKCResult_CVec_SignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); } + operator LDKCResult_CVec_SignatureZNoneZ() && { LDKCResult_CVec_SignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); return res; } + ~CResult_CVec_SignatureZNoneZ() { CResult_CVec_SignatureZNoneZ_free(self); } + CResult_CVec_SignatureZNoneZ& operator=(CResult_CVec_SignatureZNoneZ&& o) { CResult_CVec_SignatureZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); return *this; } + LDKCResult_CVec_SignatureZNoneZ* operator &() { return &self; } + LDKCResult_CVec_SignatureZNoneZ* operator ->() { return &self; } + const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; } + const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; } }; -class CResult_ErrorMessageDecodeErrorZ { +class COption_CVec_NetAddressZZ { private: - LDKCResult_ErrorMessageDecodeErrorZ self; + LDKCOption_CVec_NetAddressZZ self; public: - CResult_ErrorMessageDecodeErrorZ(const CResult_ErrorMessageDecodeErrorZ&) = delete; - CResult_ErrorMessageDecodeErrorZ(CResult_ErrorMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); } - CResult_ErrorMessageDecodeErrorZ(LDKCResult_ErrorMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); } - operator LDKCResult_ErrorMessageDecodeErrorZ() && { LDKCResult_ErrorMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ErrorMessageDecodeErrorZ)); return res; } - ~CResult_ErrorMessageDecodeErrorZ() { CResult_ErrorMessageDecodeErrorZ_free(self); } - CResult_ErrorMessageDecodeErrorZ& operator=(CResult_ErrorMessageDecodeErrorZ&& o) { CResult_ErrorMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ErrorMessageDecodeErrorZ)); return *this; } - LDKCResult_ErrorMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_ErrorMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ErrorMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ErrorMessageDecodeErrorZ* operator ->() const { return &self; } + COption_CVec_NetAddressZZ(const COption_CVec_NetAddressZZ&) = delete; + COption_CVec_NetAddressZZ(COption_CVec_NetAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); } + COption_CVec_NetAddressZZ(LDKCOption_CVec_NetAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); } + operator LDKCOption_CVec_NetAddressZZ() && { LDKCOption_CVec_NetAddressZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); return res; } + ~COption_CVec_NetAddressZZ() { COption_CVec_NetAddressZZ_free(self); } + COption_CVec_NetAddressZZ& operator=(COption_CVec_NetAddressZZ&& o) { COption_CVec_NetAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); return *this; } + LDKCOption_CVec_NetAddressZZ* operator &() { return &self; } + LDKCOption_CVec_NetAddressZZ* operator ->() { return &self; } + const LDKCOption_CVec_NetAddressZZ* operator &() const { return &self; } + const LDKCOption_CVec_NetAddressZZ* operator ->() const { return &self; } }; -class CResult_OpenChannelDecodeErrorZ { +class CResult__u832APIErrorZ { private: - LDKCResult_OpenChannelDecodeErrorZ self; + LDKCResult__u832APIErrorZ self; public: - CResult_OpenChannelDecodeErrorZ(const CResult_OpenChannelDecodeErrorZ&) = delete; - CResult_OpenChannelDecodeErrorZ(CResult_OpenChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OpenChannelDecodeErrorZ)); } - CResult_OpenChannelDecodeErrorZ(LDKCResult_OpenChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OpenChannelDecodeErrorZ)); } - operator LDKCResult_OpenChannelDecodeErrorZ() && { LDKCResult_OpenChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OpenChannelDecodeErrorZ)); return res; } - ~CResult_OpenChannelDecodeErrorZ() { CResult_OpenChannelDecodeErrorZ_free(self); } - CResult_OpenChannelDecodeErrorZ& operator=(CResult_OpenChannelDecodeErrorZ&& o) { CResult_OpenChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OpenChannelDecodeErrorZ)); return *this; } - LDKCResult_OpenChannelDecodeErrorZ* operator &() { return &self; } - LDKCResult_OpenChannelDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OpenChannelDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OpenChannelDecodeErrorZ* operator ->() const { return &self; } + CResult__u832APIErrorZ(const CResult__u832APIErrorZ&) = delete; + CResult__u832APIErrorZ(CResult__u832APIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult__u832APIErrorZ)); } + CResult__u832APIErrorZ(LDKCResult__u832APIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult__u832APIErrorZ)); } + operator LDKCResult__u832APIErrorZ() && { LDKCResult__u832APIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult__u832APIErrorZ)); return res; } + ~CResult__u832APIErrorZ() { CResult__u832APIErrorZ_free(self); } + CResult__u832APIErrorZ& operator=(CResult__u832APIErrorZ&& o) { CResult__u832APIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult__u832APIErrorZ)); return *this; } + LDKCResult__u832APIErrorZ* operator &() { return &self; } + LDKCResult__u832APIErrorZ* operator ->() { return &self; } + const LDKCResult__u832APIErrorZ* operator &() const { return &self; } + const LDKCResult__u832APIErrorZ* operator ->() const { return &self; } }; -class CVec_CVec_u8ZZ { +class CResult_PaymentIdPaymentErrorZ { private: - LDKCVec_CVec_u8ZZ self; + LDKCResult_PaymentIdPaymentErrorZ self; public: - CVec_CVec_u8ZZ(const CVec_CVec_u8ZZ&) = delete; - CVec_CVec_u8ZZ(CVec_CVec_u8ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_u8ZZ)); } - CVec_CVec_u8ZZ(LDKCVec_CVec_u8ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_u8ZZ)); } - operator LDKCVec_CVec_u8ZZ() && { LDKCVec_CVec_u8ZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_u8ZZ)); return res; } - ~CVec_CVec_u8ZZ() { CVec_CVec_u8ZZ_free(self); } - CVec_CVec_u8ZZ& operator=(CVec_CVec_u8ZZ&& o) { CVec_CVec_u8ZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CVec_u8ZZ)); return *this; } - LDKCVec_CVec_u8ZZ* operator &() { return &self; } - LDKCVec_CVec_u8ZZ* operator ->() { return &self; } - const LDKCVec_CVec_u8ZZ* operator &() const { return &self; } - const LDKCVec_CVec_u8ZZ* operator ->() const { return &self; } + CResult_PaymentIdPaymentErrorZ(const CResult_PaymentIdPaymentErrorZ&) = delete; + CResult_PaymentIdPaymentErrorZ(CResult_PaymentIdPaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); } + CResult_PaymentIdPaymentErrorZ(LDKCResult_PaymentIdPaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); } + operator LDKCResult_PaymentIdPaymentErrorZ() && { LDKCResult_PaymentIdPaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); return res; } + ~CResult_PaymentIdPaymentErrorZ() { CResult_PaymentIdPaymentErrorZ_free(self); } + CResult_PaymentIdPaymentErrorZ& operator=(CResult_PaymentIdPaymentErrorZ&& o) { CResult_PaymentIdPaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); return *this; } + LDKCResult_PaymentIdPaymentErrorZ* operator &() { return &self; } + LDKCResult_PaymentIdPaymentErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentIdPaymentErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentIdPaymentErrorZ* operator ->() const { return &self; } }; -class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { +class CResult_COption_MonitorEventZDecodeErrorZ { private: - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ self; + LDKCResult_COption_MonitorEventZDecodeErrorZ self; public: - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(const CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&) = delete; - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } - operator LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ() && { LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return res; } - ~CResult_COption_CustomOnionMessageContentsZDecodeErrorZ() { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); } - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ& operator=(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return *this; } - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; } + CResult_COption_MonitorEventZDecodeErrorZ(const CResult_COption_MonitorEventZDecodeErrorZ&) = delete; + CResult_COption_MonitorEventZDecodeErrorZ(CResult_COption_MonitorEventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); } + CResult_COption_MonitorEventZDecodeErrorZ(LDKCResult_COption_MonitorEventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); } + operator LDKCResult_COption_MonitorEventZDecodeErrorZ() && { LDKCResult_COption_MonitorEventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); return res; } + ~CResult_COption_MonitorEventZDecodeErrorZ() { CResult_COption_MonitorEventZDecodeErrorZ_free(self); } + CResult_COption_MonitorEventZDecodeErrorZ& operator=(CResult_COption_MonitorEventZDecodeErrorZ&& o) { CResult_COption_MonitorEventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); return *this; } + LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_SecretKeyErrorZ { +class CResult_RoutingFeesDecodeErrorZ { private: - LDKCResult_SecretKeyErrorZ self; + LDKCResult_RoutingFeesDecodeErrorZ self; public: - CResult_SecretKeyErrorZ(const CResult_SecretKeyErrorZ&) = delete; - CResult_SecretKeyErrorZ(CResult_SecretKeyErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SecretKeyErrorZ)); } - CResult_SecretKeyErrorZ(LDKCResult_SecretKeyErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SecretKeyErrorZ)); } - operator LDKCResult_SecretKeyErrorZ() && { LDKCResult_SecretKeyErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SecretKeyErrorZ)); return res; } - ~CResult_SecretKeyErrorZ() { CResult_SecretKeyErrorZ_free(self); } - CResult_SecretKeyErrorZ& operator=(CResult_SecretKeyErrorZ&& o) { CResult_SecretKeyErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SecretKeyErrorZ)); return *this; } - LDKCResult_SecretKeyErrorZ* operator &() { return &self; } - LDKCResult_SecretKeyErrorZ* operator ->() { return &self; } - const LDKCResult_SecretKeyErrorZ* operator &() const { return &self; } - const LDKCResult_SecretKeyErrorZ* operator ->() const { return &self; } + CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete; + CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); } + CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); } + operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; } + ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); } + CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; } + LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; } + LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ShutdownScriptDecodeErrorZ { +class CResult_PayeePubKeyErrorZ { private: - LDKCResult_ShutdownScriptDecodeErrorZ self; + LDKCResult_PayeePubKeyErrorZ self; public: - CResult_ShutdownScriptDecodeErrorZ(const CResult_ShutdownScriptDecodeErrorZ&) = delete; - CResult_ShutdownScriptDecodeErrorZ(CResult_ShutdownScriptDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); } - CResult_ShutdownScriptDecodeErrorZ(LDKCResult_ShutdownScriptDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); } - operator LDKCResult_ShutdownScriptDecodeErrorZ() && { LDKCResult_ShutdownScriptDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); return res; } - ~CResult_ShutdownScriptDecodeErrorZ() { CResult_ShutdownScriptDecodeErrorZ_free(self); } - CResult_ShutdownScriptDecodeErrorZ& operator=(CResult_ShutdownScriptDecodeErrorZ&& o) { CResult_ShutdownScriptDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); return *this; } - LDKCResult_ShutdownScriptDecodeErrorZ* operator &() { return &self; } - LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ShutdownScriptDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() const { return &self; } + CResult_PayeePubKeyErrorZ(const CResult_PayeePubKeyErrorZ&) = delete; + CResult_PayeePubKeyErrorZ(CResult_PayeePubKeyErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PayeePubKeyErrorZ)); } + CResult_PayeePubKeyErrorZ(LDKCResult_PayeePubKeyErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PayeePubKeyErrorZ)); } + operator LDKCResult_PayeePubKeyErrorZ() && { LDKCResult_PayeePubKeyErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PayeePubKeyErrorZ)); return res; } + ~CResult_PayeePubKeyErrorZ() { CResult_PayeePubKeyErrorZ_free(self); } + CResult_PayeePubKeyErrorZ& operator=(CResult_PayeePubKeyErrorZ&& o) { CResult_PayeePubKeyErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PayeePubKeyErrorZ)); return *this; } + LDKCResult_PayeePubKeyErrorZ* operator &() { return &self; } + LDKCResult_PayeePubKeyErrorZ* operator ->() { return &self; } + const LDKCResult_PayeePubKeyErrorZ* operator &() const { return &self; } + const LDKCResult_PayeePubKeyErrorZ* operator ->() const { return &self; } }; -class CResult_ProbabilisticScorerDecodeErrorZ { +class CResult_DescriptionCreationErrorZ { private: - LDKCResult_ProbabilisticScorerDecodeErrorZ self; + LDKCResult_DescriptionCreationErrorZ self; public: - CResult_ProbabilisticScorerDecodeErrorZ(const CResult_ProbabilisticScorerDecodeErrorZ&) = delete; - CResult_ProbabilisticScorerDecodeErrorZ(CResult_ProbabilisticScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); } - CResult_ProbabilisticScorerDecodeErrorZ(LDKCResult_ProbabilisticScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); } - operator LDKCResult_ProbabilisticScorerDecodeErrorZ() && { LDKCResult_ProbabilisticScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); return res; } - ~CResult_ProbabilisticScorerDecodeErrorZ() { CResult_ProbabilisticScorerDecodeErrorZ_free(self); } - CResult_ProbabilisticScorerDecodeErrorZ& operator=(CResult_ProbabilisticScorerDecodeErrorZ&& o) { CResult_ProbabilisticScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); return *this; } - LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() { return &self; } - LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() const { return &self; } + CResult_DescriptionCreationErrorZ(const CResult_DescriptionCreationErrorZ&) = delete; + CResult_DescriptionCreationErrorZ(CResult_DescriptionCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); } + CResult_DescriptionCreationErrorZ(LDKCResult_DescriptionCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); } + operator LDKCResult_DescriptionCreationErrorZ() && { LDKCResult_DescriptionCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); return res; } + ~CResult_DescriptionCreationErrorZ() { CResult_DescriptionCreationErrorZ_free(self); } + CResult_DescriptionCreationErrorZ& operator=(CResult_DescriptionCreationErrorZ&& o) { CResult_DescriptionCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); return *this; } + LDKCResult_DescriptionCreationErrorZ* operator &() { return &self; } + LDKCResult_DescriptionCreationErrorZ* operator ->() { return &self; } + const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } + const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } }; -class CResult_QueryChannelRangeDecodeErrorZ { +class CResult_QueryShortChannelIdsDecodeErrorZ { private: - LDKCResult_QueryChannelRangeDecodeErrorZ self; + LDKCResult_QueryShortChannelIdsDecodeErrorZ self; public: - CResult_QueryChannelRangeDecodeErrorZ(const CResult_QueryChannelRangeDecodeErrorZ&) = delete; - CResult_QueryChannelRangeDecodeErrorZ(CResult_QueryChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); } - CResult_QueryChannelRangeDecodeErrorZ(LDKCResult_QueryChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); } - operator LDKCResult_QueryChannelRangeDecodeErrorZ() && { LDKCResult_QueryChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryChannelRangeDecodeErrorZ)); return res; } - ~CResult_QueryChannelRangeDecodeErrorZ() { CResult_QueryChannelRangeDecodeErrorZ_free(self); } - CResult_QueryChannelRangeDecodeErrorZ& operator=(CResult_QueryChannelRangeDecodeErrorZ&& o) { CResult_QueryChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryChannelRangeDecodeErrorZ)); return *this; } - LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() { return &self; } - LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_QueryChannelRangeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_QueryChannelRangeDecodeErrorZ* operator ->() const { return &self; } + CResult_QueryShortChannelIdsDecodeErrorZ(const CResult_QueryShortChannelIdsDecodeErrorZ&) = delete; + CResult_QueryShortChannelIdsDecodeErrorZ(CResult_QueryShortChannelIdsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); } + CResult_QueryShortChannelIdsDecodeErrorZ(LDKCResult_QueryShortChannelIdsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); } + operator LDKCResult_QueryShortChannelIdsDecodeErrorZ() && { LDKCResult_QueryShortChannelIdsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); return res; } + ~CResult_QueryShortChannelIdsDecodeErrorZ() { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); } + CResult_QueryShortChannelIdsDecodeErrorZ& operator=(CResult_QueryShortChannelIdsDecodeErrorZ&& o) { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); return *this; } + LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() { return &self; } + LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TxCreationKeysDecodeErrorZ { +class CResult_InvoiceSemanticErrorZ { private: - LDKCResult_TxCreationKeysDecodeErrorZ self; + LDKCResult_InvoiceSemanticErrorZ self; public: - CResult_TxCreationKeysDecodeErrorZ(const CResult_TxCreationKeysDecodeErrorZ&) = delete; - CResult_TxCreationKeysDecodeErrorZ(CResult_TxCreationKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); } - CResult_TxCreationKeysDecodeErrorZ(LDKCResult_TxCreationKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); } - operator LDKCResult_TxCreationKeysDecodeErrorZ() && { LDKCResult_TxCreationKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); return res; } - ~CResult_TxCreationKeysDecodeErrorZ() { CResult_TxCreationKeysDecodeErrorZ_free(self); } - CResult_TxCreationKeysDecodeErrorZ& operator=(CResult_TxCreationKeysDecodeErrorZ&& o) { CResult_TxCreationKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); return *this; } - LDKCResult_TxCreationKeysDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxCreationKeysDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxCreationKeysDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxCreationKeysDecodeErrorZ* operator ->() const { return &self; } + CResult_InvoiceSemanticErrorZ(const CResult_InvoiceSemanticErrorZ&) = delete; + CResult_InvoiceSemanticErrorZ(CResult_InvoiceSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSemanticErrorZ)); } + CResult_InvoiceSemanticErrorZ(LDKCResult_InvoiceSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSemanticErrorZ)); } + operator LDKCResult_InvoiceSemanticErrorZ() && { LDKCResult_InvoiceSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSemanticErrorZ)); return res; } + ~CResult_InvoiceSemanticErrorZ() { CResult_InvoiceSemanticErrorZ_free(self); } + CResult_InvoiceSemanticErrorZ& operator=(CResult_InvoiceSemanticErrorZ&& o) { CResult_InvoiceSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSemanticErrorZ)); return *this; } + LDKCResult_InvoiceSemanticErrorZ* operator &() { return &self; } + LDKCResult_InvoiceSemanticErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceSemanticErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceSemanticErrorZ* operator ->() const { return &self; } }; -class C2Tuple_usizeTransactionZ { +class CResult_UpdateAddHTLCDecodeErrorZ { private: - LDKC2Tuple_usizeTransactionZ self; + LDKCResult_UpdateAddHTLCDecodeErrorZ self; public: - C2Tuple_usizeTransactionZ(const C2Tuple_usizeTransactionZ&) = delete; - C2Tuple_usizeTransactionZ(C2Tuple_usizeTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); } - C2Tuple_usizeTransactionZ(LDKC2Tuple_usizeTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); } - operator LDKC2Tuple_usizeTransactionZ() && { LDKC2Tuple_usizeTransactionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); return res; } - ~C2Tuple_usizeTransactionZ() { C2Tuple_usizeTransactionZ_free(self); } - C2Tuple_usizeTransactionZ& operator=(C2Tuple_usizeTransactionZ&& o) { C2Tuple_usizeTransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); return *this; } - LDKC2Tuple_usizeTransactionZ* operator &() { return &self; } - LDKC2Tuple_usizeTransactionZ* operator ->() { return &self; } - const LDKC2Tuple_usizeTransactionZ* operator &() const { return &self; } - const LDKC2Tuple_usizeTransactionZ* operator ->() const { return &self; } + CResult_UpdateAddHTLCDecodeErrorZ(const CResult_UpdateAddHTLCDecodeErrorZ&) = delete; + CResult_UpdateAddHTLCDecodeErrorZ(CResult_UpdateAddHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); } + CResult_UpdateAddHTLCDecodeErrorZ(LDKCResult_UpdateAddHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); } + operator LDKCResult_UpdateAddHTLCDecodeErrorZ() && { LDKCResult_UpdateAddHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); return res; } + ~CResult_UpdateAddHTLCDecodeErrorZ() { CResult_UpdateAddHTLCDecodeErrorZ_free(self); } + CResult_UpdateAddHTLCDecodeErrorZ& operator=(CResult_UpdateAddHTLCDecodeErrorZ&& o) { CResult_UpdateAddHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); return *this; } + LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() { return &self; } + LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelFeaturesDecodeErrorZ { +class COption_MonitorEventZ { private: - LDKCResult_ChannelFeaturesDecodeErrorZ self; + LDKCOption_MonitorEventZ self; public: - CResult_ChannelFeaturesDecodeErrorZ(const CResult_ChannelFeaturesDecodeErrorZ&) = delete; - CResult_ChannelFeaturesDecodeErrorZ(CResult_ChannelFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); } - CResult_ChannelFeaturesDecodeErrorZ(LDKCResult_ChannelFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); } - operator LDKCResult_ChannelFeaturesDecodeErrorZ() && { LDKCResult_ChannelFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelFeaturesDecodeErrorZ)); return res; } - ~CResult_ChannelFeaturesDecodeErrorZ() { CResult_ChannelFeaturesDecodeErrorZ_free(self); } - CResult_ChannelFeaturesDecodeErrorZ& operator=(CResult_ChannelFeaturesDecodeErrorZ&& o) { CResult_ChannelFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelFeaturesDecodeErrorZ)); return *this; } - LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelFeaturesDecodeErrorZ* operator ->() const { return &self; } + COption_MonitorEventZ(const COption_MonitorEventZ&) = delete; + COption_MonitorEventZ(COption_MonitorEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_MonitorEventZ)); } + COption_MonitorEventZ(LDKCOption_MonitorEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_MonitorEventZ)); } + operator LDKCOption_MonitorEventZ() && { LDKCOption_MonitorEventZ res = self; memset(&self, 0, sizeof(LDKCOption_MonitorEventZ)); return res; } + ~COption_MonitorEventZ() { COption_MonitorEventZ_free(self); } + COption_MonitorEventZ& operator=(COption_MonitorEventZ&& o) { COption_MonitorEventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_MonitorEventZ)); return *this; } + LDKCOption_MonitorEventZ* operator &() { return &self; } + LDKCOption_MonitorEventZ* operator ->() { return &self; } + const LDKCOption_MonitorEventZ* operator &() const { return &self; } + const LDKCOption_MonitorEventZ* operator ->() const { return &self; } }; -class CVec_ChannelMonitorZ { +class COption_TypeZ { private: - LDKCVec_ChannelMonitorZ self; + LDKCOption_TypeZ self; public: - CVec_ChannelMonitorZ(const CVec_ChannelMonitorZ&) = delete; - CVec_ChannelMonitorZ(CVec_ChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); } - CVec_ChannelMonitorZ(LDKCVec_ChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelMonitorZ)); } - operator LDKCVec_ChannelMonitorZ() && { LDKCVec_ChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelMonitorZ)); return res; } - ~CVec_ChannelMonitorZ() { CVec_ChannelMonitorZ_free(self); } - CVec_ChannelMonitorZ& operator=(CVec_ChannelMonitorZ&& o) { CVec_ChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); return *this; } - LDKCVec_ChannelMonitorZ* operator &() { return &self; } - LDKCVec_ChannelMonitorZ* operator ->() { return &self; } - const LDKCVec_ChannelMonitorZ* operator &() const { return &self; } - const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; } + COption_TypeZ(const COption_TypeZ&) = delete; + COption_TypeZ(COption_TypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_TypeZ)); } + COption_TypeZ(LDKCOption_TypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_TypeZ)); } + operator LDKCOption_TypeZ() && { LDKCOption_TypeZ res = self; memset(&self, 0, sizeof(LDKCOption_TypeZ)); return res; } + ~COption_TypeZ() { COption_TypeZ_free(self); } + COption_TypeZ& operator=(COption_TypeZ&& o) { COption_TypeZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_TypeZ)); return *this; } + LDKCOption_TypeZ* operator &() { return &self; } + LDKCOption_TypeZ* operator ->() { return &self; } + const LDKCOption_TypeZ* operator &() const { return &self; } + const LDKCOption_TypeZ* operator ->() const { return &self; } }; -class CVec_TransactionZ { +class CResult_COption_TypeZDecodeErrorZ { private: - LDKCVec_TransactionZ self; + LDKCResult_COption_TypeZDecodeErrorZ self; public: - CVec_TransactionZ(const CVec_TransactionZ&) = delete; - CVec_TransactionZ(CVec_TransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionZ)); } - CVec_TransactionZ(LDKCVec_TransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionZ)); } - operator LDKCVec_TransactionZ() && { LDKCVec_TransactionZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionZ)); return res; } - ~CVec_TransactionZ() { CVec_TransactionZ_free(self); } - CVec_TransactionZ& operator=(CVec_TransactionZ&& o) { CVec_TransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionZ)); return *this; } - LDKCVec_TransactionZ* operator &() { return &self; } - LDKCVec_TransactionZ* operator ->() { return &self; } - const LDKCVec_TransactionZ* operator &() const { return &self; } - const LDKCVec_TransactionZ* operator ->() const { return &self; } + CResult_COption_TypeZDecodeErrorZ(const CResult_COption_TypeZDecodeErrorZ&) = delete; + CResult_COption_TypeZDecodeErrorZ(CResult_COption_TypeZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_TypeZDecodeErrorZ)); } + CResult_COption_TypeZDecodeErrorZ(LDKCResult_COption_TypeZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_TypeZDecodeErrorZ)); } + operator LDKCResult_COption_TypeZDecodeErrorZ() && { LDKCResult_COption_TypeZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_TypeZDecodeErrorZ)); return res; } + ~CResult_COption_TypeZDecodeErrorZ() { CResult_COption_TypeZDecodeErrorZ_free(self); } + CResult_COption_TypeZDecodeErrorZ& operator=(CResult_COption_TypeZDecodeErrorZ&& o) { CResult_COption_TypeZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_TypeZDecodeErrorZ)); return *this; } + LDKCResult_COption_TypeZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_TypeZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_TypeZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_TypeZDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelReadyDecodeErrorZ { +class CResult_UpdateFailHTLCDecodeErrorZ { private: - LDKCResult_ChannelReadyDecodeErrorZ self; + LDKCResult_UpdateFailHTLCDecodeErrorZ self; public: - CResult_ChannelReadyDecodeErrorZ(const CResult_ChannelReadyDecodeErrorZ&) = delete; - CResult_ChannelReadyDecodeErrorZ(CResult_ChannelReadyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); } - CResult_ChannelReadyDecodeErrorZ(LDKCResult_ChannelReadyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); } - operator LDKCResult_ChannelReadyDecodeErrorZ() && { LDKCResult_ChannelReadyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReadyDecodeErrorZ)); return res; } - ~CResult_ChannelReadyDecodeErrorZ() { CResult_ChannelReadyDecodeErrorZ_free(self); } - CResult_ChannelReadyDecodeErrorZ& operator=(CResult_ChannelReadyDecodeErrorZ&& o) { CResult_ChannelReadyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReadyDecodeErrorZ)); return *this; } - LDKCResult_ChannelReadyDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelReadyDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelReadyDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelReadyDecodeErrorZ* operator ->() const { return &self; } + CResult_UpdateFailHTLCDecodeErrorZ(const CResult_UpdateFailHTLCDecodeErrorZ&) = delete; + CResult_UpdateFailHTLCDecodeErrorZ(CResult_UpdateFailHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFailHTLCDecodeErrorZ)); } + CResult_UpdateFailHTLCDecodeErrorZ(LDKCResult_UpdateFailHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ)); } + operator LDKCResult_UpdateFailHTLCDecodeErrorZ() && { LDKCResult_UpdateFailHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ)); return res; } + ~CResult_UpdateFailHTLCDecodeErrorZ() { CResult_UpdateFailHTLCDecodeErrorZ_free(self); } + CResult_UpdateFailHTLCDecodeErrorZ& operator=(CResult_UpdateFailHTLCDecodeErrorZ&& o) { CResult_UpdateFailHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFailHTLCDecodeErrorZ)); return *this; } + LDKCResult_UpdateFailHTLCDecodeErrorZ* operator &() { return &self; } + LDKCResult_UpdateFailHTLCDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_RouteHopDecodeErrorZ { +class CResult_InvoiceParseOrSemanticErrorZ { private: - LDKCResult_RouteHopDecodeErrorZ self; + LDKCResult_InvoiceParseOrSemanticErrorZ self; public: - CResult_RouteHopDecodeErrorZ(const CResult_RouteHopDecodeErrorZ&) = delete; - CResult_RouteHopDecodeErrorZ(CResult_RouteHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); } - CResult_RouteHopDecodeErrorZ(LDKCResult_RouteHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); } - operator LDKCResult_RouteHopDecodeErrorZ() && { LDKCResult_RouteHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); return res; } - ~CResult_RouteHopDecodeErrorZ() { CResult_RouteHopDecodeErrorZ_free(self); } - CResult_RouteHopDecodeErrorZ& operator=(CResult_RouteHopDecodeErrorZ&& o) { CResult_RouteHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); return *this; } - LDKCResult_RouteHopDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteHopDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteHopDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteHopDecodeErrorZ* operator ->() const { return &self; } + CResult_InvoiceParseOrSemanticErrorZ(const CResult_InvoiceParseOrSemanticErrorZ&) = delete; + CResult_InvoiceParseOrSemanticErrorZ(CResult_InvoiceParseOrSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceParseOrSemanticErrorZ)); } + CResult_InvoiceParseOrSemanticErrorZ(LDKCResult_InvoiceParseOrSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ)); } + operator LDKCResult_InvoiceParseOrSemanticErrorZ() && { LDKCResult_InvoiceParseOrSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ)); return res; } + ~CResult_InvoiceParseOrSemanticErrorZ() { CResult_InvoiceParseOrSemanticErrorZ_free(self); } + CResult_InvoiceParseOrSemanticErrorZ& operator=(CResult_InvoiceParseOrSemanticErrorZ&& o) { CResult_InvoiceParseOrSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceParseOrSemanticErrorZ)); return *this; } + LDKCResult_InvoiceParseOrSemanticErrorZ* operator &() { return &self; } + LDKCResult_InvoiceParseOrSemanticErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceParseOrSemanticErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceParseOrSemanticErrorZ* operator ->() const { return &self; } }; -class CResult_UpdateFeeDecodeErrorZ { +class CResult_RevokeAndACKDecodeErrorZ { private: - LDKCResult_UpdateFeeDecodeErrorZ self; + LDKCResult_RevokeAndACKDecodeErrorZ self; public: - CResult_UpdateFeeDecodeErrorZ(const CResult_UpdateFeeDecodeErrorZ&) = delete; - CResult_UpdateFeeDecodeErrorZ(CResult_UpdateFeeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); } - CResult_UpdateFeeDecodeErrorZ(LDKCResult_UpdateFeeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); } - operator LDKCResult_UpdateFeeDecodeErrorZ() && { LDKCResult_UpdateFeeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFeeDecodeErrorZ)); return res; } - ~CResult_UpdateFeeDecodeErrorZ() { CResult_UpdateFeeDecodeErrorZ_free(self); } - CResult_UpdateFeeDecodeErrorZ& operator=(CResult_UpdateFeeDecodeErrorZ&& o) { CResult_UpdateFeeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFeeDecodeErrorZ)); return *this; } - LDKCResult_UpdateFeeDecodeErrorZ* operator &() { return &self; } - LDKCResult_UpdateFeeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateFeeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateFeeDecodeErrorZ* operator ->() const { return &self; } + CResult_RevokeAndACKDecodeErrorZ(const CResult_RevokeAndACKDecodeErrorZ&) = delete; + CResult_RevokeAndACKDecodeErrorZ(CResult_RevokeAndACKDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); } + CResult_RevokeAndACKDecodeErrorZ(LDKCResult_RevokeAndACKDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); } + operator LDKCResult_RevokeAndACKDecodeErrorZ() && { LDKCResult_RevokeAndACKDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); return res; } + ~CResult_RevokeAndACKDecodeErrorZ() { CResult_RevokeAndACKDecodeErrorZ_free(self); } + CResult_RevokeAndACKDecodeErrorZ& operator=(CResult_RevokeAndACKDecodeErrorZ&& o) { CResult_RevokeAndACKDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); return *this; } + LDKCResult_RevokeAndACKDecodeErrorZ* operator &() { return &self; } + LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RevokeAndACKDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NodeAnnouncementDecodeErrorZ { +class CResult_SpendableOutputDescriptorDecodeErrorZ { private: - LDKCResult_NodeAnnouncementDecodeErrorZ self; + LDKCResult_SpendableOutputDescriptorDecodeErrorZ self; public: - CResult_NodeAnnouncementDecodeErrorZ(const CResult_NodeAnnouncementDecodeErrorZ&) = delete; - CResult_NodeAnnouncementDecodeErrorZ(CResult_NodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); } - CResult_NodeAnnouncementDecodeErrorZ(LDKCResult_NodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); } - operator LDKCResult_NodeAnnouncementDecodeErrorZ() && { LDKCResult_NodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); return res; } - ~CResult_NodeAnnouncementDecodeErrorZ() { CResult_NodeAnnouncementDecodeErrorZ_free(self); } - CResult_NodeAnnouncementDecodeErrorZ& operator=(CResult_NodeAnnouncementDecodeErrorZ&& o) { CResult_NodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); return *this; } - LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } + CResult_SpendableOutputDescriptorDecodeErrorZ(const CResult_SpendableOutputDescriptorDecodeErrorZ&) = delete; + CResult_SpendableOutputDescriptorDecodeErrorZ(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); } + CResult_SpendableOutputDescriptorDecodeErrorZ(LDKCResult_SpendableOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); } + operator LDKCResult_SpendableOutputDescriptorDecodeErrorZ() && { LDKCResult_SpendableOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); return res; } + ~CResult_SpendableOutputDescriptorDecodeErrorZ() { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); } + CResult_SpendableOutputDescriptorDecodeErrorZ& operator=(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); return *this; } + LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() { return &self; } + LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_UnsignedChannelUpdateDecodeErrorZ { +private: + LDKCResult_UnsignedChannelUpdateDecodeErrorZ self; +public: + CResult_UnsignedChannelUpdateDecodeErrorZ(const CResult_UnsignedChannelUpdateDecodeErrorZ&) = delete; + CResult_UnsignedChannelUpdateDecodeErrorZ(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); } + CResult_UnsignedChannelUpdateDecodeErrorZ(LDKCResult_UnsignedChannelUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); } + operator LDKCResult_UnsignedChannelUpdateDecodeErrorZ() && { LDKCResult_UnsignedChannelUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); return res; } + ~CResult_UnsignedChannelUpdateDecodeErrorZ() { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); } + CResult_UnsignedChannelUpdateDecodeErrorZ& operator=(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); return *this; } + LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_BalanceZ { +class CVec_EventZ { private: - LDKCVec_BalanceZ self; + LDKCVec_EventZ self; public: - CVec_BalanceZ(const CVec_BalanceZ&) = delete; - CVec_BalanceZ(CVec_BalanceZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_BalanceZ)); } - CVec_BalanceZ(LDKCVec_BalanceZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_BalanceZ)); } - operator LDKCVec_BalanceZ() && { LDKCVec_BalanceZ res = self; memset(&self, 0, sizeof(LDKCVec_BalanceZ)); return res; } - ~CVec_BalanceZ() { CVec_BalanceZ_free(self); } - CVec_BalanceZ& operator=(CVec_BalanceZ&& o) { CVec_BalanceZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_BalanceZ)); return *this; } - LDKCVec_BalanceZ* operator &() { return &self; } - LDKCVec_BalanceZ* operator ->() { return &self; } - const LDKCVec_BalanceZ* operator &() const { return &self; } - const LDKCVec_BalanceZ* operator ->() const { return &self; } + CVec_EventZ(const CVec_EventZ&) = delete; + CVec_EventZ(CVec_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_EventZ)); } + CVec_EventZ(LDKCVec_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_EventZ)); } + operator LDKCVec_EventZ() && { LDKCVec_EventZ res = self; memset(&self, 0, sizeof(LDKCVec_EventZ)); return res; } + ~CVec_EventZ() { CVec_EventZ_free(self); } + CVec_EventZ& operator=(CVec_EventZ&& o) { CVec_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_EventZ)); return *this; } + LDKCVec_EventZ* operator &() { return &self; } + LDKCVec_EventZ* operator ->() { return &self; } + const LDKCVec_EventZ* operator &() const { return &self; } + const LDKCVec_EventZ* operator ->() const { return &self; } }; -class CResult_HTLCOutputInCommitmentDecodeErrorZ { +class CResult_NoneSemanticErrorZ { private: - LDKCResult_HTLCOutputInCommitmentDecodeErrorZ self; + LDKCResult_NoneSemanticErrorZ self; public: - CResult_HTLCOutputInCommitmentDecodeErrorZ(const CResult_HTLCOutputInCommitmentDecodeErrorZ&) = delete; - CResult_HTLCOutputInCommitmentDecodeErrorZ(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); } - CResult_HTLCOutputInCommitmentDecodeErrorZ(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); } - operator LDKCResult_HTLCOutputInCommitmentDecodeErrorZ() && { LDKCResult_HTLCOutputInCommitmentDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCOutputInCommitmentDecodeErrorZ)); return res; } - ~CResult_HTLCOutputInCommitmentDecodeErrorZ() { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); } - CResult_HTLCOutputInCommitmentDecodeErrorZ& operator=(CResult_HTLCOutputInCommitmentDecodeErrorZ&& o) { CResult_HTLCOutputInCommitmentDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCOutputInCommitmentDecodeErrorZ)); return *this; } - LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() { return &self; } - LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_HTLCOutputInCommitmentDecodeErrorZ* operator ->() const { return &self; } + CResult_NoneSemanticErrorZ(const CResult_NoneSemanticErrorZ&) = delete; + CResult_NoneSemanticErrorZ(CResult_NoneSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneSemanticErrorZ)); } + CResult_NoneSemanticErrorZ(LDKCResult_NoneSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneSemanticErrorZ)); } + operator LDKCResult_NoneSemanticErrorZ() && { LDKCResult_NoneSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneSemanticErrorZ)); return res; } + ~CResult_NoneSemanticErrorZ() { CResult_NoneSemanticErrorZ_free(self); } + CResult_NoneSemanticErrorZ& operator=(CResult_NoneSemanticErrorZ&& o) { CResult_NoneSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneSemanticErrorZ)); return *this; } + LDKCResult_NoneSemanticErrorZ* operator &() { return &self; } + LDKCResult_NoneSemanticErrorZ* operator ->() { return &self; } + const LDKCResult_NoneSemanticErrorZ* operator &() const { return &self; } + const LDKCResult_NoneSemanticErrorZ* operator ->() const { return &self; } }; -class CResult_boolLightningErrorZ { +class CVec_C2Tuple_u32ScriptZZ { private: - LDKCResult_boolLightningErrorZ self; + LDKCVec_C2Tuple_u32ScriptZZ self; public: - CResult_boolLightningErrorZ(const CResult_boolLightningErrorZ&) = delete; - CResult_boolLightningErrorZ(CResult_boolLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); } - CResult_boolLightningErrorZ(LDKCResult_boolLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_boolLightningErrorZ)); } - operator LDKCResult_boolLightningErrorZ() && { LDKCResult_boolLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_boolLightningErrorZ)); return res; } - ~CResult_boolLightningErrorZ() { CResult_boolLightningErrorZ_free(self); } - CResult_boolLightningErrorZ& operator=(CResult_boolLightningErrorZ&& o) { CResult_boolLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_boolLightningErrorZ)); return *this; } - LDKCResult_boolLightningErrorZ* operator &() { return &self; } - LDKCResult_boolLightningErrorZ* operator ->() { return &self; } - const LDKCResult_boolLightningErrorZ* operator &() const { return &self; } - const LDKCResult_boolLightningErrorZ* operator ->() const { return &self; } + CVec_C2Tuple_u32ScriptZZ(const CVec_C2Tuple_u32ScriptZZ&) = delete; + CVec_C2Tuple_u32ScriptZZ(CVec_C2Tuple_u32ScriptZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32ScriptZZ)); } + CVec_C2Tuple_u32ScriptZZ(LDKCVec_C2Tuple_u32ScriptZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32ScriptZZ)); } + operator LDKCVec_C2Tuple_u32ScriptZZ() && { LDKCVec_C2Tuple_u32ScriptZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32ScriptZZ)); return res; } + ~CVec_C2Tuple_u32ScriptZZ() { CVec_C2Tuple_u32ScriptZZ_free(self); } + CVec_C2Tuple_u32ScriptZZ& operator=(CVec_C2Tuple_u32ScriptZZ&& o) { CVec_C2Tuple_u32ScriptZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32ScriptZZ)); return *this; } + LDKCVec_C2Tuple_u32ScriptZZ* operator &() { return &self; } + LDKCVec_C2Tuple_u32ScriptZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_u32ScriptZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_u32ScriptZZ* operator ->() const { return &self; } }; -class CResult_TxCreationKeysErrorZ { +class CResult_COption_ClosureReasonZDecodeErrorZ { private: - LDKCResult_TxCreationKeysErrorZ self; + LDKCResult_COption_ClosureReasonZDecodeErrorZ self; public: - CResult_TxCreationKeysErrorZ(const CResult_TxCreationKeysErrorZ&) = delete; - CResult_TxCreationKeysErrorZ(CResult_TxCreationKeysErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysErrorZ)); } - CResult_TxCreationKeysErrorZ(LDKCResult_TxCreationKeysErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysErrorZ)); } - operator LDKCResult_TxCreationKeysErrorZ() && { LDKCResult_TxCreationKeysErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysErrorZ)); return res; } - ~CResult_TxCreationKeysErrorZ() { CResult_TxCreationKeysErrorZ_free(self); } - CResult_TxCreationKeysErrorZ& operator=(CResult_TxCreationKeysErrorZ&& o) { CResult_TxCreationKeysErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCreationKeysErrorZ)); return *this; } - LDKCResult_TxCreationKeysErrorZ* operator &() { return &self; } - LDKCResult_TxCreationKeysErrorZ* operator ->() { return &self; } - const LDKCResult_TxCreationKeysErrorZ* operator &() const { return &self; } - const LDKCResult_TxCreationKeysErrorZ* operator ->() const { return &self; } + CResult_COption_ClosureReasonZDecodeErrorZ(const CResult_COption_ClosureReasonZDecodeErrorZ&) = delete; + CResult_COption_ClosureReasonZDecodeErrorZ(CResult_COption_ClosureReasonZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_ClosureReasonZDecodeErrorZ)); } + CResult_COption_ClosureReasonZDecodeErrorZ(LDKCResult_COption_ClosureReasonZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ)); } + operator LDKCResult_COption_ClosureReasonZDecodeErrorZ() && { LDKCResult_COption_ClosureReasonZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ)); return res; } + ~CResult_COption_ClosureReasonZDecodeErrorZ() { CResult_COption_ClosureReasonZDecodeErrorZ_free(self); } + CResult_COption_ClosureReasonZDecodeErrorZ& operator=(CResult_COption_ClosureReasonZDecodeErrorZ&& o) { CResult_COption_ClosureReasonZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_ClosureReasonZDecodeErrorZ)); return *this; } + LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() const { return &self; } }; -class COption_HTLCDestinationZ { +class CResult_PaymentHashPaymentSendFailureZ { private: - LDKCOption_HTLCDestinationZ self; + LDKCResult_PaymentHashPaymentSendFailureZ self; public: - COption_HTLCDestinationZ(const COption_HTLCDestinationZ&) = delete; - COption_HTLCDestinationZ(COption_HTLCDestinationZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_HTLCDestinationZ)); } - COption_HTLCDestinationZ(LDKCOption_HTLCDestinationZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_HTLCDestinationZ)); } - operator LDKCOption_HTLCDestinationZ() && { LDKCOption_HTLCDestinationZ res = self; memset(&self, 0, sizeof(LDKCOption_HTLCDestinationZ)); return res; } - ~COption_HTLCDestinationZ() { COption_HTLCDestinationZ_free(self); } - COption_HTLCDestinationZ& operator=(COption_HTLCDestinationZ&& o) { COption_HTLCDestinationZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_HTLCDestinationZ)); return *this; } - LDKCOption_HTLCDestinationZ* operator &() { return &self; } - LDKCOption_HTLCDestinationZ* operator ->() { return &self; } - const LDKCOption_HTLCDestinationZ* operator &() const { return &self; } - const LDKCOption_HTLCDestinationZ* operator ->() const { return &self; } + CResult_PaymentHashPaymentSendFailureZ(const CResult_PaymentHashPaymentSendFailureZ&) = delete; + CResult_PaymentHashPaymentSendFailureZ(CResult_PaymentHashPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentHashPaymentSendFailureZ)); } + CResult_PaymentHashPaymentSendFailureZ(LDKCResult_PaymentHashPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentHashPaymentSendFailureZ)); } + operator LDKCResult_PaymentHashPaymentSendFailureZ() && { LDKCResult_PaymentHashPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentHashPaymentSendFailureZ)); return res; } + ~CResult_PaymentHashPaymentSendFailureZ() { CResult_PaymentHashPaymentSendFailureZ_free(self); } + CResult_PaymentHashPaymentSendFailureZ& operator=(CResult_PaymentHashPaymentSendFailureZ&& o) { CResult_PaymentHashPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentHashPaymentSendFailureZ)); return *this; } + LDKCResult_PaymentHashPaymentSendFailureZ* operator &() { return &self; } + LDKCResult_PaymentHashPaymentSendFailureZ* operator ->() { return &self; } + const LDKCResult_PaymentHashPaymentSendFailureZ* operator &() const { return &self; } + const LDKCResult_PaymentHashPaymentSendFailureZ* operator ->() const { return &self; } }; -class CResult_NodeIdDecodeErrorZ { +class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { private: - LDKCResult_NodeIdDecodeErrorZ self; + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self; public: - CResult_NodeIdDecodeErrorZ(const CResult_NodeIdDecodeErrorZ&) = delete; - CResult_NodeIdDecodeErrorZ(CResult_NodeIdDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); } - CResult_NodeIdDecodeErrorZ(LDKCResult_NodeIdDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); } - operator LDKCResult_NodeIdDecodeErrorZ() && { LDKCResult_NodeIdDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeIdDecodeErrorZ)); return res; } - ~CResult_NodeIdDecodeErrorZ() { CResult_NodeIdDecodeErrorZ_free(self); } - CResult_NodeIdDecodeErrorZ& operator=(CResult_NodeIdDecodeErrorZ&& o) { CResult_NodeIdDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeIdDecodeErrorZ)); return *this; } - LDKCResult_NodeIdDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeIdDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeIdDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeIdDecodeErrorZ* operator ->() const { return &self; } + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(const C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&) = delete; + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } + operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() && { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; } + ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); } + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ& operator=(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return *this; } + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() { return &self; } + LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() { return &self; } + const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; } + const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; } }; -class CResult_ShutdownScriptInvalidShutdownScriptZ { +class CResult_RouteParametersDecodeErrorZ { private: - LDKCResult_ShutdownScriptInvalidShutdownScriptZ self; + LDKCResult_RouteParametersDecodeErrorZ self; public: - CResult_ShutdownScriptInvalidShutdownScriptZ(const CResult_ShutdownScriptInvalidShutdownScriptZ&) = delete; - CResult_ShutdownScriptInvalidShutdownScriptZ(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); } - CResult_ShutdownScriptInvalidShutdownScriptZ(LDKCResult_ShutdownScriptInvalidShutdownScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); } - operator LDKCResult_ShutdownScriptInvalidShutdownScriptZ() && { LDKCResult_ShutdownScriptInvalidShutdownScriptZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptInvalidShutdownScriptZ)); return res; } - ~CResult_ShutdownScriptInvalidShutdownScriptZ() { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); } - CResult_ShutdownScriptInvalidShutdownScriptZ& operator=(CResult_ShutdownScriptInvalidShutdownScriptZ&& o) { CResult_ShutdownScriptInvalidShutdownScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptInvalidShutdownScriptZ)); return *this; } - LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() { return &self; } - LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() { return &self; } - const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator &() const { return &self; } - const LDKCResult_ShutdownScriptInvalidShutdownScriptZ* operator ->() const { return &self; } + CResult_RouteParametersDecodeErrorZ(const CResult_RouteParametersDecodeErrorZ&) = delete; + CResult_RouteParametersDecodeErrorZ(CResult_RouteParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); } + CResult_RouteParametersDecodeErrorZ(LDKCResult_RouteParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); } + operator LDKCResult_RouteParametersDecodeErrorZ() && { LDKCResult_RouteParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); return res; } + ~CResult_RouteParametersDecodeErrorZ() { CResult_RouteParametersDecodeErrorZ_free(self); } + CResult_RouteParametersDecodeErrorZ& operator=(CResult_RouteParametersDecodeErrorZ&& o) { CResult_RouteParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); return *this; } + LDKCResult_RouteParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteParametersDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NodeAnnouncementInfoDecodeErrorZ { +class CResult_PrivateRouteCreationErrorZ { private: - LDKCResult_NodeAnnouncementInfoDecodeErrorZ self; + LDKCResult_PrivateRouteCreationErrorZ self; public: - CResult_NodeAnnouncementInfoDecodeErrorZ(const CResult_NodeAnnouncementInfoDecodeErrorZ&) = delete; - CResult_NodeAnnouncementInfoDecodeErrorZ(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); } - CResult_NodeAnnouncementInfoDecodeErrorZ(LDKCResult_NodeAnnouncementInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); } - operator LDKCResult_NodeAnnouncementInfoDecodeErrorZ() && { LDKCResult_NodeAnnouncementInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementInfoDecodeErrorZ)); return res; } - ~CResult_NodeAnnouncementInfoDecodeErrorZ() { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); } - CResult_NodeAnnouncementInfoDecodeErrorZ& operator=(CResult_NodeAnnouncementInfoDecodeErrorZ&& o) { CResult_NodeAnnouncementInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementInfoDecodeErrorZ)); return *this; } - LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeAnnouncementInfoDecodeErrorZ* operator ->() const { return &self; } + CResult_PrivateRouteCreationErrorZ(const CResult_PrivateRouteCreationErrorZ&) = delete; + CResult_PrivateRouteCreationErrorZ(CResult_PrivateRouteCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); } + CResult_PrivateRouteCreationErrorZ(LDKCResult_PrivateRouteCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); } + operator LDKCResult_PrivateRouteCreationErrorZ() && { LDKCResult_PrivateRouteCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); return res; } + ~CResult_PrivateRouteCreationErrorZ() { CResult_PrivateRouteCreationErrorZ_free(self); } + CResult_PrivateRouteCreationErrorZ& operator=(CResult_PrivateRouteCreationErrorZ&& o) { CResult_PrivateRouteCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); return *this; } + LDKCResult_PrivateRouteCreationErrorZ* operator &() { return &self; } + LDKCResult_PrivateRouteCreationErrorZ* operator ->() { return &self; } + const LDKCResult_PrivateRouteCreationErrorZ* operator &() const { return &self; } + const LDKCResult_PrivateRouteCreationErrorZ* operator ->() const { return &self; } }; -class CResult_COption_NetworkUpdateZDecodeErrorZ { +class CResult_NodeAliasDecodeErrorZ { private: - LDKCResult_COption_NetworkUpdateZDecodeErrorZ self; + LDKCResult_NodeAliasDecodeErrorZ self; public: - CResult_COption_NetworkUpdateZDecodeErrorZ(const CResult_COption_NetworkUpdateZDecodeErrorZ&) = delete; - CResult_COption_NetworkUpdateZDecodeErrorZ(CResult_COption_NetworkUpdateZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_NetworkUpdateZDecodeErrorZ)); } - CResult_COption_NetworkUpdateZDecodeErrorZ(LDKCResult_COption_NetworkUpdateZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ)); } - operator LDKCResult_COption_NetworkUpdateZDecodeErrorZ() && { LDKCResult_COption_NetworkUpdateZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_NetworkUpdateZDecodeErrorZ)); return res; } - ~CResult_COption_NetworkUpdateZDecodeErrorZ() { CResult_COption_NetworkUpdateZDecodeErrorZ_free(self); } - CResult_COption_NetworkUpdateZDecodeErrorZ& operator=(CResult_COption_NetworkUpdateZDecodeErrorZ&& o) { CResult_COption_NetworkUpdateZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_NetworkUpdateZDecodeErrorZ)); return *this; } - LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_NetworkUpdateZDecodeErrorZ* operator ->() const { return &self; } + CResult_NodeAliasDecodeErrorZ(const CResult_NodeAliasDecodeErrorZ&) = delete; + CResult_NodeAliasDecodeErrorZ(CResult_NodeAliasDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); } + CResult_NodeAliasDecodeErrorZ(LDKCResult_NodeAliasDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); } + operator LDKCResult_NodeAliasDecodeErrorZ() && { LDKCResult_NodeAliasDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); return res; } + ~CResult_NodeAliasDecodeErrorZ() { CResult_NodeAliasDecodeErrorZ_free(self); } + CResult_NodeAliasDecodeErrorZ& operator=(CResult_NodeAliasDecodeErrorZ&& o) { CResult_NodeAliasDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); return *this; } + LDKCResult_NodeAliasDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeAliasDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeAliasDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeAliasDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_RecoverableSignatureNoneZ { +class CVec_UpdateFulfillHTLCZ { private: - LDKCResult_RecoverableSignatureNoneZ self; + LDKCVec_UpdateFulfillHTLCZ self; public: - CResult_RecoverableSignatureNoneZ(const CResult_RecoverableSignatureNoneZ&) = delete; - CResult_RecoverableSignatureNoneZ(CResult_RecoverableSignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); } - CResult_RecoverableSignatureNoneZ(LDKCResult_RecoverableSignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); } - operator LDKCResult_RecoverableSignatureNoneZ() && { LDKCResult_RecoverableSignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); return res; } - ~CResult_RecoverableSignatureNoneZ() { CResult_RecoverableSignatureNoneZ_free(self); } - CResult_RecoverableSignatureNoneZ& operator=(CResult_RecoverableSignatureNoneZ&& o) { CResult_RecoverableSignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); return *this; } - LDKCResult_RecoverableSignatureNoneZ* operator &() { return &self; } - LDKCResult_RecoverableSignatureNoneZ* operator ->() { return &self; } - const LDKCResult_RecoverableSignatureNoneZ* operator &() const { return &self; } - const LDKCResult_RecoverableSignatureNoneZ* operator ->() const { return &self; } + CVec_UpdateFulfillHTLCZ(const CVec_UpdateFulfillHTLCZ&) = delete; + CVec_UpdateFulfillHTLCZ(CVec_UpdateFulfillHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); } + CVec_UpdateFulfillHTLCZ(LDKCVec_UpdateFulfillHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); } + operator LDKCVec_UpdateFulfillHTLCZ() && { LDKCVec_UpdateFulfillHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); return res; } + ~CVec_UpdateFulfillHTLCZ() { CVec_UpdateFulfillHTLCZ_free(self); } + CVec_UpdateFulfillHTLCZ& operator=(CVec_UpdateFulfillHTLCZ&& o) { CVec_UpdateFulfillHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); return *this; } + LDKCVec_UpdateFulfillHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFulfillHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFulfillHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFulfillHTLCZ* operator ->() const { return &self; } }; -class C2Tuple_BlockHashChannelMonitorZ { +class CResult_AnnouncementSignaturesDecodeErrorZ { private: - LDKC2Tuple_BlockHashChannelMonitorZ self; + LDKCResult_AnnouncementSignaturesDecodeErrorZ self; public: - C2Tuple_BlockHashChannelMonitorZ(const C2Tuple_BlockHashChannelMonitorZ&) = delete; - C2Tuple_BlockHashChannelMonitorZ(C2Tuple_BlockHashChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); } - C2Tuple_BlockHashChannelMonitorZ(LDKC2Tuple_BlockHashChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); } - operator LDKC2Tuple_BlockHashChannelMonitorZ() && { LDKC2Tuple_BlockHashChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelMonitorZ)); return res; } - ~C2Tuple_BlockHashChannelMonitorZ() { C2Tuple_BlockHashChannelMonitorZ_free(self); } - C2Tuple_BlockHashChannelMonitorZ& operator=(C2Tuple_BlockHashChannelMonitorZ&& o) { C2Tuple_BlockHashChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelMonitorZ)); return *this; } - LDKC2Tuple_BlockHashChannelMonitorZ* operator &() { return &self; } - LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() { return &self; } - const LDKC2Tuple_BlockHashChannelMonitorZ* operator &() const { return &self; } - const LDKC2Tuple_BlockHashChannelMonitorZ* operator ->() const { return &self; } + CResult_AnnouncementSignaturesDecodeErrorZ(const CResult_AnnouncementSignaturesDecodeErrorZ&) = delete; + CResult_AnnouncementSignaturesDecodeErrorZ(CResult_AnnouncementSignaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AnnouncementSignaturesDecodeErrorZ)); } + CResult_AnnouncementSignaturesDecodeErrorZ(LDKCResult_AnnouncementSignaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ)); } + operator LDKCResult_AnnouncementSignaturesDecodeErrorZ() && { LDKCResult_AnnouncementSignaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ)); return res; } + ~CResult_AnnouncementSignaturesDecodeErrorZ() { CResult_AnnouncementSignaturesDecodeErrorZ_free(self); } + CResult_AnnouncementSignaturesDecodeErrorZ& operator=(CResult_AnnouncementSignaturesDecodeErrorZ&& o) { CResult_AnnouncementSignaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AnnouncementSignaturesDecodeErrorZ)); return *this; } + LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_UpdateFulfillHTLCDecodeErrorZ { +private: + LDKCResult_UpdateFulfillHTLCDecodeErrorZ self; +public: + CResult_UpdateFulfillHTLCDecodeErrorZ(const CResult_UpdateFulfillHTLCDecodeErrorZ&) = delete; + CResult_UpdateFulfillHTLCDecodeErrorZ(CResult_UpdateFulfillHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFulfillHTLCDecodeErrorZ)); } + CResult_UpdateFulfillHTLCDecodeErrorZ(LDKCResult_UpdateFulfillHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ)); } + operator LDKCResult_UpdateFulfillHTLCDecodeErrorZ() && { LDKCResult_UpdateFulfillHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ)); return res; } + ~CResult_UpdateFulfillHTLCDecodeErrorZ() { CResult_UpdateFulfillHTLCDecodeErrorZ_free(self); } + CResult_UpdateFulfillHTLCDecodeErrorZ& operator=(CResult_UpdateFulfillHTLCDecodeErrorZ&& o) { CResult_UpdateFulfillHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFulfillHTLCDecodeErrorZ)); return *this; } + LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator &() { return &self; } + LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator ->() const { return &self; } }; -class C3Tuple_RawInvoice_u832InvoiceSignatureZ { +class CResult_NodeFeaturesDecodeErrorZ { private: - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ self; + LDKCResult_NodeFeaturesDecodeErrorZ self; public: - C3Tuple_RawInvoice_u832InvoiceSignatureZ(const C3Tuple_RawInvoice_u832InvoiceSignatureZ&) = delete; - C3Tuple_RawInvoice_u832InvoiceSignatureZ(C3Tuple_RawInvoice_u832InvoiceSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_RawInvoice_u832InvoiceSignatureZ)); } - C3Tuple_RawInvoice_u832InvoiceSignatureZ(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ)); } - operator LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ() && { LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ)); return res; } - ~C3Tuple_RawInvoice_u832InvoiceSignatureZ() { C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(self); } - C3Tuple_RawInvoice_u832InvoiceSignatureZ& operator=(C3Tuple_RawInvoice_u832InvoiceSignatureZ&& o) { C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_RawInvoice_u832InvoiceSignatureZ)); return *this; } - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator &() { return &self; } - LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator ->() { return &self; } - const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator &() const { return &self; } - const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator ->() const { return &self; } + CResult_NodeFeaturesDecodeErrorZ(const CResult_NodeFeaturesDecodeErrorZ&) = delete; + CResult_NodeFeaturesDecodeErrorZ(CResult_NodeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); } + CResult_NodeFeaturesDecodeErrorZ(LDKCResult_NodeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); } + operator LDKCResult_NodeFeaturesDecodeErrorZ() && { LDKCResult_NodeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); return res; } + ~CResult_NodeFeaturesDecodeErrorZ() { CResult_NodeFeaturesDecodeErrorZ_free(self); } + CResult_NodeFeaturesDecodeErrorZ& operator=(CResult_NodeFeaturesDecodeErrorZ&& o) { CResult_NodeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); return *this; } + LDKCResult_NodeFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_UpdateFailMalformedHTLCZ { +class CResult_InMemorySignerDecodeErrorZ { private: - LDKCVec_UpdateFailMalformedHTLCZ self; + LDKCResult_InMemorySignerDecodeErrorZ self; public: - CVec_UpdateFailMalformedHTLCZ(const CVec_UpdateFailMalformedHTLCZ&) = delete; - CVec_UpdateFailMalformedHTLCZ(CVec_UpdateFailMalformedHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); } - CVec_UpdateFailMalformedHTLCZ(LDKCVec_UpdateFailMalformedHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); } - operator LDKCVec_UpdateFailMalformedHTLCZ() && { LDKCVec_UpdateFailMalformedHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailMalformedHTLCZ)); return res; } - ~CVec_UpdateFailMalformedHTLCZ() { CVec_UpdateFailMalformedHTLCZ_free(self); } - CVec_UpdateFailMalformedHTLCZ& operator=(CVec_UpdateFailMalformedHTLCZ&& o) { CVec_UpdateFailMalformedHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailMalformedHTLCZ)); return *this; } - LDKCVec_UpdateFailMalformedHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFailMalformedHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFailMalformedHTLCZ* operator ->() const { return &self; } + CResult_InMemorySignerDecodeErrorZ(const CResult_InMemorySignerDecodeErrorZ&) = delete; + CResult_InMemorySignerDecodeErrorZ(CResult_InMemorySignerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InMemorySignerDecodeErrorZ)); } + CResult_InMemorySignerDecodeErrorZ(LDKCResult_InMemorySignerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InMemorySignerDecodeErrorZ)); } + operator LDKCResult_InMemorySignerDecodeErrorZ() && { LDKCResult_InMemorySignerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InMemorySignerDecodeErrorZ)); return res; } + ~CResult_InMemorySignerDecodeErrorZ() { CResult_InMemorySignerDecodeErrorZ_free(self); } + CResult_InMemorySignerDecodeErrorZ& operator=(CResult_InMemorySignerDecodeErrorZ&& o) { CResult_InMemorySignerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InMemorySignerDecodeErrorZ)); return *this; } + LDKCResult_InMemorySignerDecodeErrorZ* operator &() { return &self; } + LDKCResult_InMemorySignerDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InMemorySignerDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InMemorySignerDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_FundingSignedDecodeErrorZ { +class CResult_ReplyShortChannelIdsEndDecodeErrorZ { private: - LDKCResult_FundingSignedDecodeErrorZ self; + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self; public: - CResult_FundingSignedDecodeErrorZ(const CResult_FundingSignedDecodeErrorZ&) = delete; - CResult_FundingSignedDecodeErrorZ(CResult_FundingSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingSignedDecodeErrorZ)); } - CResult_FundingSignedDecodeErrorZ(LDKCResult_FundingSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingSignedDecodeErrorZ)); } - operator LDKCResult_FundingSignedDecodeErrorZ() && { LDKCResult_FundingSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingSignedDecodeErrorZ)); return res; } - ~CResult_FundingSignedDecodeErrorZ() { CResult_FundingSignedDecodeErrorZ_free(self); } - CResult_FundingSignedDecodeErrorZ& operator=(CResult_FundingSignedDecodeErrorZ&& o) { CResult_FundingSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingSignedDecodeErrorZ)); return *this; } - LDKCResult_FundingSignedDecodeErrorZ* operator &() { return &self; } - LDKCResult_FundingSignedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_FundingSignedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_FundingSignedDecodeErrorZ* operator ->() const { return &self; } + CResult_ReplyShortChannelIdsEndDecodeErrorZ(const CResult_ReplyShortChannelIdsEndDecodeErrorZ&) = delete; + CResult_ReplyShortChannelIdsEndDecodeErrorZ(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); } + CResult_ReplyShortChannelIdsEndDecodeErrorZ(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); } + operator LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ() && { LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); return res; } + ~CResult_ReplyShortChannelIdsEndDecodeErrorZ() { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); } + CResult_ReplyShortChannelIdsEndDecodeErrorZ& operator=(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); return *this; } + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() { return &self; } + LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NetworkGraphDecodeErrorZ { +class COption_ScalarZ { private: - LDKCResult_NetworkGraphDecodeErrorZ self; + LDKCOption_ScalarZ self; public: - CResult_NetworkGraphDecodeErrorZ(const CResult_NetworkGraphDecodeErrorZ&) = delete; - CResult_NetworkGraphDecodeErrorZ(CResult_NetworkGraphDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetworkGraphDecodeErrorZ)); } - CResult_NetworkGraphDecodeErrorZ(LDKCResult_NetworkGraphDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetworkGraphDecodeErrorZ)); } - operator LDKCResult_NetworkGraphDecodeErrorZ() && { LDKCResult_NetworkGraphDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NetworkGraphDecodeErrorZ)); return res; } - ~CResult_NetworkGraphDecodeErrorZ() { CResult_NetworkGraphDecodeErrorZ_free(self); } - CResult_NetworkGraphDecodeErrorZ& operator=(CResult_NetworkGraphDecodeErrorZ&& o) { CResult_NetworkGraphDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetworkGraphDecodeErrorZ)); return *this; } - LDKCResult_NetworkGraphDecodeErrorZ* operator &() { return &self; } - LDKCResult_NetworkGraphDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NetworkGraphDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NetworkGraphDecodeErrorZ* operator ->() const { return &self; } + COption_ScalarZ(const COption_ScalarZ&) = delete; + COption_ScalarZ(COption_ScalarZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ScalarZ)); } + COption_ScalarZ(LDKCOption_ScalarZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ScalarZ)); } + operator LDKCOption_ScalarZ() && { LDKCOption_ScalarZ res = self; memset(&self, 0, sizeof(LDKCOption_ScalarZ)); return res; } + ~COption_ScalarZ() { COption_ScalarZ_free(self); } + COption_ScalarZ& operator=(COption_ScalarZ&& o) { COption_ScalarZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ScalarZ)); return *this; } + LDKCOption_ScalarZ* operator &() { return &self; } + LDKCOption_ScalarZ* operator ->() { return &self; } + const LDKCOption_ScalarZ* operator &() const { return &self; } + const LDKCOption_ScalarZ* operator ->() const { return &self; } }; -class CResult_InvoiceSignOrCreationErrorZ { +class CResult_ChannelUpdateInfoDecodeErrorZ { private: - LDKCResult_InvoiceSignOrCreationErrorZ self; + LDKCResult_ChannelUpdateInfoDecodeErrorZ self; public: - CResult_InvoiceSignOrCreationErrorZ(const CResult_InvoiceSignOrCreationErrorZ&) = delete; - CResult_InvoiceSignOrCreationErrorZ(CResult_InvoiceSignOrCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); } - CResult_InvoiceSignOrCreationErrorZ(LDKCResult_InvoiceSignOrCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); } - operator LDKCResult_InvoiceSignOrCreationErrorZ() && { LDKCResult_InvoiceSignOrCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); return res; } - ~CResult_InvoiceSignOrCreationErrorZ() { CResult_InvoiceSignOrCreationErrorZ_free(self); } - CResult_InvoiceSignOrCreationErrorZ& operator=(CResult_InvoiceSignOrCreationErrorZ&& o) { CResult_InvoiceSignOrCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); return *this; } - LDKCResult_InvoiceSignOrCreationErrorZ* operator &() { return &self; } - LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceSignOrCreationErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() const { return &self; } + CResult_ChannelUpdateInfoDecodeErrorZ(const CResult_ChannelUpdateInfoDecodeErrorZ&) = delete; + CResult_ChannelUpdateInfoDecodeErrorZ(CResult_ChannelUpdateInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); } + CResult_ChannelUpdateInfoDecodeErrorZ(LDKCResult_ChannelUpdateInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); } + operator LDKCResult_ChannelUpdateInfoDecodeErrorZ() && { LDKCResult_ChannelUpdateInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); return res; } + ~CResult_ChannelUpdateInfoDecodeErrorZ() { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); } + CResult_ChannelUpdateInfoDecodeErrorZ& operator=(CResult_ChannelUpdateInfoDecodeErrorZ&& o) { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); return *this; } + LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_RouteHopZ { +class CResult_BuiltCommitmentTransactionDecodeErrorZ { private: - LDKCVec_RouteHopZ self; + LDKCResult_BuiltCommitmentTransactionDecodeErrorZ self; public: - CVec_RouteHopZ(const CVec_RouteHopZ&) = delete; - CVec_RouteHopZ(CVec_RouteHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHopZ)); } - CVec_RouteHopZ(LDKCVec_RouteHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHopZ)); } - operator LDKCVec_RouteHopZ() && { LDKCVec_RouteHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHopZ)); return res; } - ~CVec_RouteHopZ() { CVec_RouteHopZ_free(self); } - CVec_RouteHopZ& operator=(CVec_RouteHopZ&& o) { CVec_RouteHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHopZ)); return *this; } - LDKCVec_RouteHopZ* operator &() { return &self; } - LDKCVec_RouteHopZ* operator ->() { return &self; } - const LDKCVec_RouteHopZ* operator &() const { return &self; } - const LDKCVec_RouteHopZ* operator ->() const { return &self; } + CResult_BuiltCommitmentTransactionDecodeErrorZ(const CResult_BuiltCommitmentTransactionDecodeErrorZ&) = delete; + CResult_BuiltCommitmentTransactionDecodeErrorZ(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); } + CResult_BuiltCommitmentTransactionDecodeErrorZ(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); } + operator LDKCResult_BuiltCommitmentTransactionDecodeErrorZ() && { LDKCResult_BuiltCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); return res; } + ~CResult_BuiltCommitmentTransactionDecodeErrorZ() { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); } + CResult_BuiltCommitmentTransactionDecodeErrorZ& operator=(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); return *this; } + LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() { return &self; } + LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } }; -class COption_FilterZ { +class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { private: - LDKCOption_FilterZ self; + LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self; public: - COption_FilterZ(const COption_FilterZ&) = delete; - COption_FilterZ(COption_FilterZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_FilterZ)); } - COption_FilterZ(LDKCOption_FilterZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_FilterZ)); } - operator LDKCOption_FilterZ() && { LDKCOption_FilterZ res = self; memset(&self, 0, sizeof(LDKCOption_FilterZ)); return res; } - ~COption_FilterZ() { COption_FilterZ_free(self); } - COption_FilterZ& operator=(COption_FilterZ&& o) { COption_FilterZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_FilterZ)); return *this; } - LDKCOption_FilterZ* operator &() { return &self; } - LDKCOption_FilterZ* operator ->() { return &self; } - const LDKCOption_FilterZ* operator &() const { return &self; } - const LDKCOption_FilterZ* operator ->() const { return &self; } + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete; + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); } + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; } }; -class COption_CustomOnionMessageContentsZ { +class CVec_TxOutZ { private: - LDKCOption_CustomOnionMessageContentsZ self; + LDKCVec_TxOutZ self; public: - COption_CustomOnionMessageContentsZ(const COption_CustomOnionMessageContentsZ&) = delete; - COption_CustomOnionMessageContentsZ(COption_CustomOnionMessageContentsZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); } - COption_CustomOnionMessageContentsZ(LDKCOption_CustomOnionMessageContentsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); } - operator LDKCOption_CustomOnionMessageContentsZ() && { LDKCOption_CustomOnionMessageContentsZ res = self; memset(&self, 0, sizeof(LDKCOption_CustomOnionMessageContentsZ)); return res; } - ~COption_CustomOnionMessageContentsZ() { COption_CustomOnionMessageContentsZ_free(self); } - COption_CustomOnionMessageContentsZ& operator=(COption_CustomOnionMessageContentsZ&& o) { COption_CustomOnionMessageContentsZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CustomOnionMessageContentsZ)); return *this; } - LDKCOption_CustomOnionMessageContentsZ* operator &() { return &self; } - LDKCOption_CustomOnionMessageContentsZ* operator ->() { return &self; } - const LDKCOption_CustomOnionMessageContentsZ* operator &() const { return &self; } - const LDKCOption_CustomOnionMessageContentsZ* operator ->() const { return &self; } + CVec_TxOutZ(const CVec_TxOutZ&) = delete; + CVec_TxOutZ(CVec_TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TxOutZ)); } + CVec_TxOutZ(LDKCVec_TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TxOutZ)); } + operator LDKCVec_TxOutZ() && { LDKCVec_TxOutZ res = self; memset(&self, 0, sizeof(LDKCVec_TxOutZ)); return res; } + ~CVec_TxOutZ() { CVec_TxOutZ_free(self); } + CVec_TxOutZ& operator=(CVec_TxOutZ&& o) { CVec_TxOutZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TxOutZ)); return *this; } + LDKCVec_TxOutZ* operator &() { return &self; } + LDKCVec_TxOutZ* operator ->() { return &self; } + const LDKCVec_TxOutZ* operator &() const { return &self; } + const LDKCVec_TxOutZ* operator ->() const { return &self; } }; -class CResult_NodeInfoDecodeErrorZ { +class CVec_UpdateFailHTLCZ { private: - LDKCResult_NodeInfoDecodeErrorZ self; + LDKCVec_UpdateFailHTLCZ self; public: - CResult_NodeInfoDecodeErrorZ(const CResult_NodeInfoDecodeErrorZ&) = delete; - CResult_NodeInfoDecodeErrorZ(CResult_NodeInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); } - CResult_NodeInfoDecodeErrorZ(LDKCResult_NodeInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); } - operator LDKCResult_NodeInfoDecodeErrorZ() && { LDKCResult_NodeInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); return res; } - ~CResult_NodeInfoDecodeErrorZ() { CResult_NodeInfoDecodeErrorZ_free(self); } - CResult_NodeInfoDecodeErrorZ& operator=(CResult_NodeInfoDecodeErrorZ&& o) { CResult_NodeInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); return *this; } - LDKCResult_NodeInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeInfoDecodeErrorZ* operator ->() const { return &self; } + CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete; + CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); } + CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); } + operator LDKCVec_UpdateFailHTLCZ() && { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; } + ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); } + CVec_UpdateFailHTLCZ& operator=(CVec_UpdateFailHTLCZ&& o) { CVec_UpdateFailHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); return *this; } + LDKCVec_UpdateFailHTLCZ* operator &() { return &self; } + LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; } + const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; } + const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; } }; -class CVec_NodeIdZ { +class CVec_SpendableOutputDescriptorZ { private: - LDKCVec_NodeIdZ self; + LDKCVec_SpendableOutputDescriptorZ self; public: - CVec_NodeIdZ(const CVec_NodeIdZ&) = delete; - CVec_NodeIdZ(CVec_NodeIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NodeIdZ)); } - CVec_NodeIdZ(LDKCVec_NodeIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NodeIdZ)); } - operator LDKCVec_NodeIdZ() && { LDKCVec_NodeIdZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeIdZ)); return res; } - ~CVec_NodeIdZ() { CVec_NodeIdZ_free(self); } - CVec_NodeIdZ& operator=(CVec_NodeIdZ&& o) { CVec_NodeIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_NodeIdZ)); return *this; } - LDKCVec_NodeIdZ* operator &() { return &self; } - LDKCVec_NodeIdZ* operator ->() { return &self; } - const LDKCVec_NodeIdZ* operator &() const { return &self; } - const LDKCVec_NodeIdZ* operator ->() const { return &self; } + CVec_SpendableOutputDescriptorZ(const CVec_SpendableOutputDescriptorZ&) = delete; + CVec_SpendableOutputDescriptorZ(CVec_SpendableOutputDescriptorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); } + CVec_SpendableOutputDescriptorZ(LDKCVec_SpendableOutputDescriptorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); } + operator LDKCVec_SpendableOutputDescriptorZ() && { LDKCVec_SpendableOutputDescriptorZ res = self; memset(&self, 0, sizeof(LDKCVec_SpendableOutputDescriptorZ)); return res; } + ~CVec_SpendableOutputDescriptorZ() { CVec_SpendableOutputDescriptorZ_free(self); } + CVec_SpendableOutputDescriptorZ& operator=(CVec_SpendableOutputDescriptorZ&& o) { CVec_SpendableOutputDescriptorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SpendableOutputDescriptorZ)); return *this; } + LDKCVec_SpendableOutputDescriptorZ* operator &() { return &self; } + LDKCVec_SpendableOutputDescriptorZ* operator ->() { return &self; } + const LDKCVec_SpendableOutputDescriptorZ* operator &() const { return &self; } + const LDKCVec_SpendableOutputDescriptorZ* operator ->() const { return &self; } }; -class CResult_RouteLightningErrorZ { -private: - LDKCResult_RouteLightningErrorZ self; -public: - CResult_RouteLightningErrorZ(const CResult_RouteLightningErrorZ&) = delete; - CResult_RouteLightningErrorZ(CResult_RouteLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); } - CResult_RouteLightningErrorZ(LDKCResult_RouteLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); } - operator LDKCResult_RouteLightningErrorZ() && { LDKCResult_RouteLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); return res; } - ~CResult_RouteLightningErrorZ() { CResult_RouteLightningErrorZ_free(self); } - CResult_RouteLightningErrorZ& operator=(CResult_RouteLightningErrorZ&& o) { CResult_RouteLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); return *this; } - LDKCResult_RouteLightningErrorZ* operator &() { return &self; } - LDKCResult_RouteLightningErrorZ* operator ->() { return &self; } - const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; } - const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; } +class COption_C2Tuple_u64u64ZZ { +private: + LDKCOption_C2Tuple_u64u64ZZ self; +public: + COption_C2Tuple_u64u64ZZ(const COption_C2Tuple_u64u64ZZ&) = delete; + COption_C2Tuple_u64u64ZZ(COption_C2Tuple_u64u64ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); } + COption_C2Tuple_u64u64ZZ(LDKCOption_C2Tuple_u64u64ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); } + operator LDKCOption_C2Tuple_u64u64ZZ() && { LDKCOption_C2Tuple_u64u64ZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_u64u64ZZ)); return res; } + ~COption_C2Tuple_u64u64ZZ() { COption_C2Tuple_u64u64ZZ_free(self); } + COption_C2Tuple_u64u64ZZ& operator=(COption_C2Tuple_u64u64ZZ&& o) { COption_C2Tuple_u64u64ZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_u64u64ZZ)); return *this; } + LDKCOption_C2Tuple_u64u64ZZ* operator &() { return &self; } + LDKCOption_C2Tuple_u64u64ZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_u64u64ZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_u64u64ZZ* operator ->() const { return &self; } }; -class CResult_ChannelPublicKeysDecodeErrorZ { +class CResult_ChannelAnnouncementDecodeErrorZ { private: - LDKCResult_ChannelPublicKeysDecodeErrorZ self; + LDKCResult_ChannelAnnouncementDecodeErrorZ self; public: - CResult_ChannelPublicKeysDecodeErrorZ(const CResult_ChannelPublicKeysDecodeErrorZ&) = delete; - CResult_ChannelPublicKeysDecodeErrorZ(CResult_ChannelPublicKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); } - CResult_ChannelPublicKeysDecodeErrorZ(LDKCResult_ChannelPublicKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); } - operator LDKCResult_ChannelPublicKeysDecodeErrorZ() && { LDKCResult_ChannelPublicKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); return res; } - ~CResult_ChannelPublicKeysDecodeErrorZ() { CResult_ChannelPublicKeysDecodeErrorZ_free(self); } - CResult_ChannelPublicKeysDecodeErrorZ& operator=(CResult_ChannelPublicKeysDecodeErrorZ&& o) { CResult_ChannelPublicKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); return *this; } - LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() const { return &self; } + CResult_ChannelAnnouncementDecodeErrorZ(const CResult_ChannelAnnouncementDecodeErrorZ&) = delete; + CResult_ChannelAnnouncementDecodeErrorZ(CResult_ChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); } + CResult_ChannelAnnouncementDecodeErrorZ(LDKCResult_ChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); } + operator LDKCResult_ChannelAnnouncementDecodeErrorZ() && { LDKCResult_ChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelAnnouncementDecodeErrorZ)); return res; } + ~CResult_ChannelAnnouncementDecodeErrorZ() { CResult_ChannelAnnouncementDecodeErrorZ_free(self); } + CResult_ChannelAnnouncementDecodeErrorZ& operator=(CResult_ChannelAnnouncementDecodeErrorZ&& o) { CResult_ChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_u8Z { +class CResult_OfferFeaturesDecodeErrorZ { private: - LDKCVec_u8Z self; + LDKCResult_OfferFeaturesDecodeErrorZ self; public: - CVec_u8Z(const CVec_u8Z&) = delete; - CVec_u8Z(CVec_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u8Z)); } - CVec_u8Z(LDKCVec_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u8Z)); } - operator LDKCVec_u8Z() && { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; } - ~CVec_u8Z() { CVec_u8Z_free(self); } - CVec_u8Z& operator=(CVec_u8Z&& o) { CVec_u8Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u8Z)); return *this; } - LDKCVec_u8Z* operator &() { return &self; } - LDKCVec_u8Z* operator ->() { return &self; } - const LDKCVec_u8Z* operator &() const { return &self; } - const LDKCVec_u8Z* operator ->() const { return &self; } + CResult_OfferFeaturesDecodeErrorZ(const CResult_OfferFeaturesDecodeErrorZ&) = delete; + CResult_OfferFeaturesDecodeErrorZ(CResult_OfferFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OfferFeaturesDecodeErrorZ)); } + CResult_OfferFeaturesDecodeErrorZ(LDKCResult_OfferFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OfferFeaturesDecodeErrorZ)); } + operator LDKCResult_OfferFeaturesDecodeErrorZ() && { LDKCResult_OfferFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OfferFeaturesDecodeErrorZ)); return res; } + ~CResult_OfferFeaturesDecodeErrorZ() { CResult_OfferFeaturesDecodeErrorZ_free(self); } + CResult_OfferFeaturesDecodeErrorZ& operator=(CResult_OfferFeaturesDecodeErrorZ&& o) { CResult_OfferFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OfferFeaturesDecodeErrorZ)); return *this; } + LDKCResult_OfferFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_OfferFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OfferFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OfferFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_BlockHashChannelMonitorZZ { +class C2Tuple_SignatureCVec_SignatureZZ { private: - LDKCVec_C2Tuple_BlockHashChannelMonitorZZ self; + LDKC2Tuple_SignatureCVec_SignatureZZ self; public: - CVec_C2Tuple_BlockHashChannelMonitorZZ(const CVec_C2Tuple_BlockHashChannelMonitorZZ&) = delete; - CVec_C2Tuple_BlockHashChannelMonitorZZ(CVec_C2Tuple_BlockHashChannelMonitorZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_BlockHashChannelMonitorZZ)); } - CVec_C2Tuple_BlockHashChannelMonitorZZ(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ)); } - operator LDKCVec_C2Tuple_BlockHashChannelMonitorZZ() && { LDKCVec_C2Tuple_BlockHashChannelMonitorZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_BlockHashChannelMonitorZZ)); return res; } - ~CVec_C2Tuple_BlockHashChannelMonitorZZ() { CVec_C2Tuple_BlockHashChannelMonitorZZ_free(self); } - CVec_C2Tuple_BlockHashChannelMonitorZZ& operator=(CVec_C2Tuple_BlockHashChannelMonitorZZ&& o) { CVec_C2Tuple_BlockHashChannelMonitorZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_BlockHashChannelMonitorZZ)); return *this; } - LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator &() { return &self; } - LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_BlockHashChannelMonitorZZ* operator ->() const { return &self; } + C2Tuple_SignatureCVec_SignatureZZ(const C2Tuple_SignatureCVec_SignatureZZ&) = delete; + C2Tuple_SignatureCVec_SignatureZZ(C2Tuple_SignatureCVec_SignatureZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); } + C2Tuple_SignatureCVec_SignatureZZ(LDKC2Tuple_SignatureCVec_SignatureZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); } + operator LDKC2Tuple_SignatureCVec_SignatureZZ() && { LDKC2Tuple_SignatureCVec_SignatureZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ)); return res; } + ~C2Tuple_SignatureCVec_SignatureZZ() { C2Tuple_SignatureCVec_SignatureZZ_free(self); } + C2Tuple_SignatureCVec_SignatureZZ& operator=(C2Tuple_SignatureCVec_SignatureZZ&& o) { C2Tuple_SignatureCVec_SignatureZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_SignatureCVec_SignatureZZ)); return *this; } + LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() { return &self; } + LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() { return &self; } + const LDKC2Tuple_SignatureCVec_SignatureZZ* operator &() const { return &self; } + const LDKC2Tuple_SignatureCVec_SignatureZZ* operator ->() const { return &self; } }; -class CResult_NonePaymentSendFailureZ { +class CResult_HTLCUpdateDecodeErrorZ { private: - LDKCResult_NonePaymentSendFailureZ self; + LDKCResult_HTLCUpdateDecodeErrorZ self; public: - CResult_NonePaymentSendFailureZ(const CResult_NonePaymentSendFailureZ&) = delete; - CResult_NonePaymentSendFailureZ(CResult_NonePaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); } - CResult_NonePaymentSendFailureZ(LDKCResult_NonePaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); } - operator LDKCResult_NonePaymentSendFailureZ() && { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; } - ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); } - CResult_NonePaymentSendFailureZ& operator=(CResult_NonePaymentSendFailureZ&& o) { CResult_NonePaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); return *this; } - LDKCResult_NonePaymentSendFailureZ* operator &() { return &self; } - LDKCResult_NonePaymentSendFailureZ* operator ->() { return &self; } - const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; } - const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; } + CResult_HTLCUpdateDecodeErrorZ(const CResult_HTLCUpdateDecodeErrorZ&) = delete; + CResult_HTLCUpdateDecodeErrorZ(CResult_HTLCUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); } + CResult_HTLCUpdateDecodeErrorZ(LDKCResult_HTLCUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); } + operator LDKCResult_HTLCUpdateDecodeErrorZ() && { LDKCResult_HTLCUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HTLCUpdateDecodeErrorZ)); return res; } + ~CResult_HTLCUpdateDecodeErrorZ() { CResult_HTLCUpdateDecodeErrorZ_free(self); } + CResult_HTLCUpdateDecodeErrorZ& operator=(CResult_HTLCUpdateDecodeErrorZ&& o) { CResult_HTLCUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HTLCUpdateDecodeErrorZ)); return *this; } + LDKCResult_HTLCUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HTLCUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HTLCUpdateDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_ThirtyTwoBytesZ { +class CVec_OutPointZ { private: - LDKCVec_ThirtyTwoBytesZ self; + LDKCVec_OutPointZ self; public: - CVec_ThirtyTwoBytesZ(const CVec_ThirtyTwoBytesZ&) = delete; - CVec_ThirtyTwoBytesZ(CVec_ThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); } - CVec_ThirtyTwoBytesZ(LDKCVec_ThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); } - operator LDKCVec_ThirtyTwoBytesZ() && { LDKCVec_ThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKCVec_ThirtyTwoBytesZ)); return res; } - ~CVec_ThirtyTwoBytesZ() { CVec_ThirtyTwoBytesZ_free(self); } - CVec_ThirtyTwoBytesZ& operator=(CVec_ThirtyTwoBytesZ&& o) { CVec_ThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ThirtyTwoBytesZ)); return *this; } - LDKCVec_ThirtyTwoBytesZ* operator &() { return &self; } - LDKCVec_ThirtyTwoBytesZ* operator ->() { return &self; } - const LDKCVec_ThirtyTwoBytesZ* operator &() const { return &self; } - const LDKCVec_ThirtyTwoBytesZ* operator ->() const { return &self; } + CVec_OutPointZ(const CVec_OutPointZ&) = delete; + CVec_OutPointZ(CVec_OutPointZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_OutPointZ)); } + CVec_OutPointZ(LDKCVec_OutPointZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_OutPointZ)); } + operator LDKCVec_OutPointZ() && { LDKCVec_OutPointZ res = self; memset(&self, 0, sizeof(LDKCVec_OutPointZ)); return res; } + ~CVec_OutPointZ() { CVec_OutPointZ_free(self); } + CVec_OutPointZ& operator=(CVec_OutPointZ&& o) { CVec_OutPointZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_OutPointZ)); return *this; } + LDKCVec_OutPointZ* operator &() { return &self; } + LDKCVec_OutPointZ* operator ->() { return &self; } + const LDKCVec_OutPointZ* operator &() const { return &self; } + const LDKCVec_OutPointZ* operator ->() const { return &self; } }; -class CResult_ClosingSignedDecodeErrorZ { +class COption_WriteableScoreZ { private: - LDKCResult_ClosingSignedDecodeErrorZ self; + LDKCOption_WriteableScoreZ self; public: - CResult_ClosingSignedDecodeErrorZ(const CResult_ClosingSignedDecodeErrorZ&) = delete; - CResult_ClosingSignedDecodeErrorZ(CResult_ClosingSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ClosingSignedDecodeErrorZ)); } - CResult_ClosingSignedDecodeErrorZ(LDKCResult_ClosingSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ClosingSignedDecodeErrorZ)); } - operator LDKCResult_ClosingSignedDecodeErrorZ() && { LDKCResult_ClosingSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ClosingSignedDecodeErrorZ)); return res; } - ~CResult_ClosingSignedDecodeErrorZ() { CResult_ClosingSignedDecodeErrorZ_free(self); } - CResult_ClosingSignedDecodeErrorZ& operator=(CResult_ClosingSignedDecodeErrorZ&& o) { CResult_ClosingSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ClosingSignedDecodeErrorZ)); return *this; } - LDKCResult_ClosingSignedDecodeErrorZ* operator &() { return &self; } - LDKCResult_ClosingSignedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ClosingSignedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ClosingSignedDecodeErrorZ* operator ->() const { return &self; } + COption_WriteableScoreZ(const COption_WriteableScoreZ&) = delete; + COption_WriteableScoreZ(COption_WriteableScoreZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_WriteableScoreZ)); } + COption_WriteableScoreZ(LDKCOption_WriteableScoreZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_WriteableScoreZ)); } + operator LDKCOption_WriteableScoreZ() && { LDKCOption_WriteableScoreZ res = self; memset(&self, 0, sizeof(LDKCOption_WriteableScoreZ)); return res; } + ~COption_WriteableScoreZ() { COption_WriteableScoreZ_free(self); } + COption_WriteableScoreZ& operator=(COption_WriteableScoreZ&& o) { COption_WriteableScoreZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_WriteableScoreZ)); return *this; } + LDKCOption_WriteableScoreZ* operator &() { return &self; } + LDKCOption_WriteableScoreZ* operator ->() { return &self; } + const LDKCOption_WriteableScoreZ* operator &() const { return &self; } + const LDKCOption_WriteableScoreZ* operator ->() const { return &self; } }; -class CVec_CResult_NoneAPIErrorZZ { +class CResult_PositiveTimestampCreationErrorZ { private: - LDKCVec_CResult_NoneAPIErrorZZ self; + LDKCResult_PositiveTimestampCreationErrorZ self; public: - CVec_CResult_NoneAPIErrorZZ(const CVec_CResult_NoneAPIErrorZZ&) = delete; - CVec_CResult_NoneAPIErrorZZ(CVec_CResult_NoneAPIErrorZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CResult_NoneAPIErrorZZ)); } - CVec_CResult_NoneAPIErrorZZ(LDKCVec_CResult_NoneAPIErrorZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CResult_NoneAPIErrorZZ)); } - operator LDKCVec_CResult_NoneAPIErrorZZ() && { LDKCVec_CResult_NoneAPIErrorZZ res = self; memset(&self, 0, sizeof(LDKCVec_CResult_NoneAPIErrorZZ)); return res; } - ~CVec_CResult_NoneAPIErrorZZ() { CVec_CResult_NoneAPIErrorZZ_free(self); } - CVec_CResult_NoneAPIErrorZZ& operator=(CVec_CResult_NoneAPIErrorZZ&& o) { CVec_CResult_NoneAPIErrorZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CResult_NoneAPIErrorZZ)); return *this; } - LDKCVec_CResult_NoneAPIErrorZZ* operator &() { return &self; } - LDKCVec_CResult_NoneAPIErrorZZ* operator ->() { return &self; } - const LDKCVec_CResult_NoneAPIErrorZZ* operator &() const { return &self; } - const LDKCVec_CResult_NoneAPIErrorZZ* operator ->() const { return &self; } + CResult_PositiveTimestampCreationErrorZ(const CResult_PositiveTimestampCreationErrorZ&) = delete; + CResult_PositiveTimestampCreationErrorZ(CResult_PositiveTimestampCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); } + CResult_PositiveTimestampCreationErrorZ(LDKCResult_PositiveTimestampCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); } + operator LDKCResult_PositiveTimestampCreationErrorZ() && { LDKCResult_PositiveTimestampCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PositiveTimestampCreationErrorZ)); return res; } + ~CResult_PositiveTimestampCreationErrorZ() { CResult_PositiveTimestampCreationErrorZ_free(self); } + CResult_PositiveTimestampCreationErrorZ& operator=(CResult_PositiveTimestampCreationErrorZ&& o) { CResult_PositiveTimestampCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PositiveTimestampCreationErrorZ)); return *this; } + LDKCResult_PositiveTimestampCreationErrorZ* operator &() { return &self; } + LDKCResult_PositiveTimestampCreationErrorZ* operator ->() { return &self; } + const LDKCResult_PositiveTimestampCreationErrorZ* operator &() const { return &self; } + const LDKCResult_PositiveTimestampCreationErrorZ* operator ->() const { return &self; } }; -class CResult_HolderCommitmentTransactionDecodeErrorZ { +class CResult_InvoiceFeaturesDecodeErrorZ { private: - LDKCResult_HolderCommitmentTransactionDecodeErrorZ self; + LDKCResult_InvoiceFeaturesDecodeErrorZ self; public: - CResult_HolderCommitmentTransactionDecodeErrorZ(const CResult_HolderCommitmentTransactionDecodeErrorZ&) = delete; - CResult_HolderCommitmentTransactionDecodeErrorZ(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); } - CResult_HolderCommitmentTransactionDecodeErrorZ(LDKCResult_HolderCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); } - operator LDKCResult_HolderCommitmentTransactionDecodeErrorZ() && { LDKCResult_HolderCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); return res; } - ~CResult_HolderCommitmentTransactionDecodeErrorZ() { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); } - CResult_HolderCommitmentTransactionDecodeErrorZ& operator=(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); return *this; } - LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() { return &self; } - LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } + CResult_InvoiceFeaturesDecodeErrorZ(const CResult_InvoiceFeaturesDecodeErrorZ&) = delete; + CResult_InvoiceFeaturesDecodeErrorZ(CResult_InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceFeaturesDecodeErrorZ)); } + CResult_InvoiceFeaturesDecodeErrorZ(LDKCResult_InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ)); } + operator LDKCResult_InvoiceFeaturesDecodeErrorZ() && { LDKCResult_InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceFeaturesDecodeErrorZ)); return res; } + ~CResult_InvoiceFeaturesDecodeErrorZ() { CResult_InvoiceFeaturesDecodeErrorZ_free(self); } + CResult_InvoiceFeaturesDecodeErrorZ& operator=(CResult_InvoiceFeaturesDecodeErrorZ&& o) { CResult_InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceFeaturesDecodeErrorZ)); return *this; } + LDKCResult_InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CounterpartyCommitmentSecretsDecodeErrorZ { +class CResult_ChannelMonitorUpdateDecodeErrorZ { private: - LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ self; + LDKCResult_ChannelMonitorUpdateDecodeErrorZ self; public: - CResult_CounterpartyCommitmentSecretsDecodeErrorZ(const CResult_CounterpartyCommitmentSecretsDecodeErrorZ&) = delete; - CResult_CounterpartyCommitmentSecretsDecodeErrorZ(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } - CResult_CounterpartyCommitmentSecretsDecodeErrorZ(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); } - operator LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ() && { LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return res; } - ~CResult_CounterpartyCommitmentSecretsDecodeErrorZ() { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); } - CResult_CounterpartyCommitmentSecretsDecodeErrorZ& operator=(CResult_CounterpartyCommitmentSecretsDecodeErrorZ&& o) { CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyCommitmentSecretsDecodeErrorZ)); return *this; } - LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() { return &self; } - LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CounterpartyCommitmentSecretsDecodeErrorZ* operator ->() const { return &self; } + CResult_ChannelMonitorUpdateDecodeErrorZ(const CResult_ChannelMonitorUpdateDecodeErrorZ&) = delete; + CResult_ChannelMonitorUpdateDecodeErrorZ(CResult_ChannelMonitorUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateDecodeErrorZ)); } + CResult_ChannelMonitorUpdateDecodeErrorZ(LDKCResult_ChannelMonitorUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ)); } + operator LDKCResult_ChannelMonitorUpdateDecodeErrorZ() && { LDKCResult_ChannelMonitorUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelMonitorUpdateDecodeErrorZ)); return res; } + ~CResult_ChannelMonitorUpdateDecodeErrorZ() { CResult_ChannelMonitorUpdateDecodeErrorZ_free(self); } + CResult_ChannelMonitorUpdateDecodeErrorZ& operator=(CResult_ChannelMonitorUpdateDecodeErrorZ&& o) { CResult_ChannelMonitorUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelMonitorUpdateDecodeErrorZ)); return *this; } + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelMonitorUpdateDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelCounterpartyDecodeErrorZ { +class CResult_ReplyChannelRangeDecodeErrorZ { private: - LDKCResult_ChannelCounterpartyDecodeErrorZ self; + LDKCResult_ReplyChannelRangeDecodeErrorZ self; public: - CResult_ChannelCounterpartyDecodeErrorZ(const CResult_ChannelCounterpartyDecodeErrorZ&) = delete; - CResult_ChannelCounterpartyDecodeErrorZ(CResult_ChannelCounterpartyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelCounterpartyDecodeErrorZ)); } - CResult_ChannelCounterpartyDecodeErrorZ(LDKCResult_ChannelCounterpartyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ)); } - operator LDKCResult_ChannelCounterpartyDecodeErrorZ() && { LDKCResult_ChannelCounterpartyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ)); return res; } - ~CResult_ChannelCounterpartyDecodeErrorZ() { CResult_ChannelCounterpartyDecodeErrorZ_free(self); } - CResult_ChannelCounterpartyDecodeErrorZ& operator=(CResult_ChannelCounterpartyDecodeErrorZ&& o) { CResult_ChannelCounterpartyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelCounterpartyDecodeErrorZ)); return *this; } - LDKCResult_ChannelCounterpartyDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelCounterpartyDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator ->() const { return &self; } + CResult_ReplyChannelRangeDecodeErrorZ(const CResult_ReplyChannelRangeDecodeErrorZ&) = delete; + CResult_ReplyChannelRangeDecodeErrorZ(CResult_ReplyChannelRangeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); } + CResult_ReplyChannelRangeDecodeErrorZ(LDKCResult_ReplyChannelRangeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); } + operator LDKCResult_ReplyChannelRangeDecodeErrorZ() && { LDKCResult_ReplyChannelRangeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyChannelRangeDecodeErrorZ)); return res; } + ~CResult_ReplyChannelRangeDecodeErrorZ() { CResult_ReplyChannelRangeDecodeErrorZ_free(self); } + CResult_ReplyChannelRangeDecodeErrorZ& operator=(CResult_ReplyChannelRangeDecodeErrorZ&& o) { CResult_ReplyChannelRangeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyChannelRangeDecodeErrorZ)); return *this; } + LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() { return &self; } + LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ReplyChannelRangeDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_WarningMessageDecodeErrorZ { +class CResult_TxOutAccessErrorZ { private: - LDKCResult_WarningMessageDecodeErrorZ self; + LDKCResult_TxOutAccessErrorZ self; public: - CResult_WarningMessageDecodeErrorZ(const CResult_WarningMessageDecodeErrorZ&) = delete; - CResult_WarningMessageDecodeErrorZ(CResult_WarningMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_WarningMessageDecodeErrorZ)); } - CResult_WarningMessageDecodeErrorZ(LDKCResult_WarningMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_WarningMessageDecodeErrorZ)); } - operator LDKCResult_WarningMessageDecodeErrorZ() && { LDKCResult_WarningMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_WarningMessageDecodeErrorZ)); return res; } - ~CResult_WarningMessageDecodeErrorZ() { CResult_WarningMessageDecodeErrorZ_free(self); } - CResult_WarningMessageDecodeErrorZ& operator=(CResult_WarningMessageDecodeErrorZ&& o) { CResult_WarningMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_WarningMessageDecodeErrorZ)); return *this; } - LDKCResult_WarningMessageDecodeErrorZ* operator &() { return &self; } - LDKCResult_WarningMessageDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_WarningMessageDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_WarningMessageDecodeErrorZ* operator ->() const { return &self; } + CResult_TxOutAccessErrorZ(const CResult_TxOutAccessErrorZ&) = delete; + CResult_TxOutAccessErrorZ(CResult_TxOutAccessErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); } + CResult_TxOutAccessErrorZ(LDKCResult_TxOutAccessErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); } + operator LDKCResult_TxOutAccessErrorZ() && { LDKCResult_TxOutAccessErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxOutAccessErrorZ)); return res; } + ~CResult_TxOutAccessErrorZ() { CResult_TxOutAccessErrorZ_free(self); } + CResult_TxOutAccessErrorZ& operator=(CResult_TxOutAccessErrorZ&& o) { CResult_TxOutAccessErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxOutAccessErrorZ)); return *this; } + LDKCResult_TxOutAccessErrorZ* operator &() { return &self; } + LDKCResult_TxOutAccessErrorZ* operator ->() { return &self; } + const LDKCResult_TxOutAccessErrorZ* operator &() const { return &self; } + const LDKCResult_TxOutAccessErrorZ* operator ->() const { return &self; } }; -class CResult_SignatureNoneZ { +class CResult_TrustedClosingTransactionNoneZ { private: - LDKCResult_SignatureNoneZ self; + LDKCResult_TrustedClosingTransactionNoneZ self; public: - CResult_SignatureNoneZ(const CResult_SignatureNoneZ&) = delete; - CResult_SignatureNoneZ(CResult_SignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignatureNoneZ)); } - CResult_SignatureNoneZ(LDKCResult_SignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignatureNoneZ)); } - operator LDKCResult_SignatureNoneZ() && { LDKCResult_SignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignatureNoneZ)); return res; } - ~CResult_SignatureNoneZ() { CResult_SignatureNoneZ_free(self); } - CResult_SignatureNoneZ& operator=(CResult_SignatureNoneZ&& o) { CResult_SignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignatureNoneZ)); return *this; } - LDKCResult_SignatureNoneZ* operator &() { return &self; } - LDKCResult_SignatureNoneZ* operator ->() { return &self; } - const LDKCResult_SignatureNoneZ* operator &() const { return &self; } - const LDKCResult_SignatureNoneZ* operator ->() const { return &self; } + CResult_TrustedClosingTransactionNoneZ(const CResult_TrustedClosingTransactionNoneZ&) = delete; + CResult_TrustedClosingTransactionNoneZ(CResult_TrustedClosingTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); } + CResult_TrustedClosingTransactionNoneZ(LDKCResult_TrustedClosingTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); } + operator LDKCResult_TrustedClosingTransactionNoneZ() && { LDKCResult_TrustedClosingTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedClosingTransactionNoneZ)); return res; } + ~CResult_TrustedClosingTransactionNoneZ() { CResult_TrustedClosingTransactionNoneZ_free(self); } + CResult_TrustedClosingTransactionNoneZ& operator=(CResult_TrustedClosingTransactionNoneZ&& o) { CResult_TrustedClosingTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrustedClosingTransactionNoneZ)); return *this; } + LDKCResult_TrustedClosingTransactionNoneZ* operator &() { return &self; } + LDKCResult_TrustedClosingTransactionNoneZ* operator ->() { return &self; } + const LDKCResult_TrustedClosingTransactionNoneZ* operator &() const { return &self; } + const LDKCResult_TrustedClosingTransactionNoneZ* operator ->() const { return &self; } }; -class CVec_RouteHintHopZ { +class CResult_NetAddressDecodeErrorZ { private: - LDKCVec_RouteHintHopZ self; + LDKCResult_NetAddressDecodeErrorZ self; public: - CVec_RouteHintHopZ(const CVec_RouteHintHopZ&) = delete; - CVec_RouteHintHopZ(CVec_RouteHintHopZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintHopZ)); } - CVec_RouteHintHopZ(LDKCVec_RouteHintHopZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintHopZ)); } - operator LDKCVec_RouteHintHopZ() && { LDKCVec_RouteHintHopZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintHopZ)); return res; } - ~CVec_RouteHintHopZ() { CVec_RouteHintHopZ_free(self); } - CVec_RouteHintHopZ& operator=(CVec_RouteHintHopZ&& o) { CVec_RouteHintHopZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintHopZ)); return *this; } - LDKCVec_RouteHintHopZ* operator &() { return &self; } - LDKCVec_RouteHintHopZ* operator ->() { return &self; } - const LDKCVec_RouteHintHopZ* operator &() const { return &self; } - const LDKCVec_RouteHintHopZ* operator ->() const { return &self; } + CResult_NetAddressDecodeErrorZ(const CResult_NetAddressDecodeErrorZ&) = delete; + CResult_NetAddressDecodeErrorZ(CResult_NetAddressDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetAddressDecodeErrorZ)); } + CResult_NetAddressDecodeErrorZ(LDKCResult_NetAddressDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetAddressDecodeErrorZ)); } + operator LDKCResult_NetAddressDecodeErrorZ() && { LDKCResult_NetAddressDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NetAddressDecodeErrorZ)); return res; } + ~CResult_NetAddressDecodeErrorZ() { CResult_NetAddressDecodeErrorZ_free(self); } + CResult_NetAddressDecodeErrorZ& operator=(CResult_NetAddressDecodeErrorZ&& o) { CResult_NetAddressDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetAddressDecodeErrorZ)); return *this; } + LDKCResult_NetAddressDecodeErrorZ* operator &() { return &self; } + LDKCResult_NetAddressDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NetAddressDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NetAddressDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_SecretKeyNoneZ { +class C2Tuple_PublicKeyTypeZ { private: - LDKCResult_SecretKeyNoneZ self; + LDKC2Tuple_PublicKeyTypeZ self; public: - CResult_SecretKeyNoneZ(const CResult_SecretKeyNoneZ&) = delete; - CResult_SecretKeyNoneZ(CResult_SecretKeyNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SecretKeyNoneZ)); } - CResult_SecretKeyNoneZ(LDKCResult_SecretKeyNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SecretKeyNoneZ)); } - operator LDKCResult_SecretKeyNoneZ() && { LDKCResult_SecretKeyNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SecretKeyNoneZ)); return res; } - ~CResult_SecretKeyNoneZ() { CResult_SecretKeyNoneZ_free(self); } - CResult_SecretKeyNoneZ& operator=(CResult_SecretKeyNoneZ&& o) { CResult_SecretKeyNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SecretKeyNoneZ)); return *this; } - LDKCResult_SecretKeyNoneZ* operator &() { return &self; } - LDKCResult_SecretKeyNoneZ* operator ->() { return &self; } - const LDKCResult_SecretKeyNoneZ* operator &() const { return &self; } - const LDKCResult_SecretKeyNoneZ* operator ->() const { return &self; } + C2Tuple_PublicKeyTypeZ(const C2Tuple_PublicKeyTypeZ&) = delete; + C2Tuple_PublicKeyTypeZ(C2Tuple_PublicKeyTypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); } + C2Tuple_PublicKeyTypeZ(LDKC2Tuple_PublicKeyTypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); } + operator LDKC2Tuple_PublicKeyTypeZ() && { LDKC2Tuple_PublicKeyTypeZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyTypeZ)); return res; } + ~C2Tuple_PublicKeyTypeZ() { C2Tuple_PublicKeyTypeZ_free(self); } + C2Tuple_PublicKeyTypeZ& operator=(C2Tuple_PublicKeyTypeZ&& o) { C2Tuple_PublicKeyTypeZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyTypeZ)); return *this; } + LDKC2Tuple_PublicKeyTypeZ* operator &() { return &self; } + LDKC2Tuple_PublicKeyTypeZ* operator ->() { return &self; } + const LDKC2Tuple_PublicKeyTypeZ* operator &() const { return &self; } + const LDKC2Tuple_PublicKeyTypeZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { +class CResult_ChannelReestablishDecodeErrorZ { private: - LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ self; + LDKCResult_ChannelReestablishDecodeErrorZ self; public: - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(const CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&) = delete; - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); } - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); } - operator LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() && { LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return res; } - ~CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ() { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); } - CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ& operator=(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ&& o) { CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ)); return *this; } - LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() { return &self; } - LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentSecretZNoneZ* operator ->() const { return &self; } + CResult_ChannelReestablishDecodeErrorZ(const CResult_ChannelReestablishDecodeErrorZ&) = delete; + CResult_ChannelReestablishDecodeErrorZ(CResult_ChannelReestablishDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelReestablishDecodeErrorZ)); } + CResult_ChannelReestablishDecodeErrorZ(LDKCResult_ChannelReestablishDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelReestablishDecodeErrorZ)); } + operator LDKCResult_ChannelReestablishDecodeErrorZ() && { LDKCResult_ChannelReestablishDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelReestablishDecodeErrorZ)); return res; } + ~CResult_ChannelReestablishDecodeErrorZ() { CResult_ChannelReestablishDecodeErrorZ_free(self); } + CResult_ChannelReestablishDecodeErrorZ& operator=(CResult_ChannelReestablishDecodeErrorZ&& o) { CResult_ChannelReestablishDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelReestablishDecodeErrorZ)); return *this; } + LDKCResult_ChannelReestablishDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelReestablishDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelReestablishDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +class CResult_OnionMessageDecodeErrorZ { private: - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self; + LDKCResult_OnionMessageDecodeErrorZ self; public: - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(const C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&) = delete; - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } - operator LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() && { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return res; } - ~C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); } - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ& operator=(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return *this; } - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() { return &self; } - LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() const { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() const { return &self; } + CResult_OnionMessageDecodeErrorZ(const CResult_OnionMessageDecodeErrorZ&) = delete; + CResult_OnionMessageDecodeErrorZ(CResult_OnionMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); } + CResult_OnionMessageDecodeErrorZ(LDKCResult_OnionMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); } + operator LDKCResult_OnionMessageDecodeErrorZ() && { LDKCResult_OnionMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OnionMessageDecodeErrorZ)); return res; } + ~CResult_OnionMessageDecodeErrorZ() { CResult_OnionMessageDecodeErrorZ_free(self); } + CResult_OnionMessageDecodeErrorZ& operator=(CResult_OnionMessageDecodeErrorZ&& o) { CResult_OnionMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OnionMessageDecodeErrorZ)); return *this; } + LDKCResult_OnionMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_OnionMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OnionMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OnionMessageDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_PaymentParametersDecodeErrorZ { +class CResult_UnsignedNodeAnnouncementDecodeErrorZ { private: - LDKCResult_PaymentParametersDecodeErrorZ self; + LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ self; public: - CResult_PaymentParametersDecodeErrorZ(const CResult_PaymentParametersDecodeErrorZ&) = delete; - CResult_PaymentParametersDecodeErrorZ(CResult_PaymentParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); } - CResult_PaymentParametersDecodeErrorZ(LDKCResult_PaymentParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); } - operator LDKCResult_PaymentParametersDecodeErrorZ() && { LDKCResult_PaymentParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentParametersDecodeErrorZ)); return res; } - ~CResult_PaymentParametersDecodeErrorZ() { CResult_PaymentParametersDecodeErrorZ_free(self); } - CResult_PaymentParametersDecodeErrorZ& operator=(CResult_PaymentParametersDecodeErrorZ&& o) { CResult_PaymentParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentParametersDecodeErrorZ)); return *this; } - LDKCResult_PaymentParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_PaymentParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentParametersDecodeErrorZ* operator ->() const { return &self; } + CResult_UnsignedNodeAnnouncementDecodeErrorZ(const CResult_UnsignedNodeAnnouncementDecodeErrorZ&) = delete; + CResult_UnsignedNodeAnnouncementDecodeErrorZ(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); } + CResult_UnsignedNodeAnnouncementDecodeErrorZ(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); } + operator LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ)); return res; } + ~CResult_UnsignedNodeAnnouncementDecodeErrorZ() { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); } + CResult_UnsignedNodeAnnouncementDecodeErrorZ& operator=(CResult_UnsignedNodeAnnouncementDecodeErrorZ&& o) { CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedNodeAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UnsignedNodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_PaymentPurposeDecodeErrorZ { +class CResult_InvoiceSignOrCreationErrorZ { private: - LDKCResult_PaymentPurposeDecodeErrorZ self; + LDKCResult_InvoiceSignOrCreationErrorZ self; public: - CResult_PaymentPurposeDecodeErrorZ(const CResult_PaymentPurposeDecodeErrorZ&) = delete; - CResult_PaymentPurposeDecodeErrorZ(CResult_PaymentPurposeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); } - CResult_PaymentPurposeDecodeErrorZ(LDKCResult_PaymentPurposeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); } - operator LDKCResult_PaymentPurposeDecodeErrorZ() && { LDKCResult_PaymentPurposeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); return res; } - ~CResult_PaymentPurposeDecodeErrorZ() { CResult_PaymentPurposeDecodeErrorZ_free(self); } - CResult_PaymentPurposeDecodeErrorZ& operator=(CResult_PaymentPurposeDecodeErrorZ&& o) { CResult_PaymentPurposeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); return *this; } - LDKCResult_PaymentPurposeDecodeErrorZ* operator &() { return &self; } - LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentPurposeDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() const { return &self; } + CResult_InvoiceSignOrCreationErrorZ(const CResult_InvoiceSignOrCreationErrorZ&) = delete; + CResult_InvoiceSignOrCreationErrorZ(CResult_InvoiceSignOrCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); } + CResult_InvoiceSignOrCreationErrorZ(LDKCResult_InvoiceSignOrCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); } + operator LDKCResult_InvoiceSignOrCreationErrorZ() && { LDKCResult_InvoiceSignOrCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSignOrCreationErrorZ)); return res; } + ~CResult_InvoiceSignOrCreationErrorZ() { CResult_InvoiceSignOrCreationErrorZ_free(self); } + CResult_InvoiceSignOrCreationErrorZ& operator=(CResult_InvoiceSignOrCreationErrorZ&& o) { CResult_InvoiceSignOrCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSignOrCreationErrorZ)); return *this; } + LDKCResult_InvoiceSignOrCreationErrorZ* operator &() { return &self; } + LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceSignOrCreationErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceSignOrCreationErrorZ* operator ->() const { return &self; } }; -class CResult_InitDecodeErrorZ { +class CResult_InitFeaturesDecodeErrorZ { private: - LDKCResult_InitDecodeErrorZ self; + LDKCResult_InitFeaturesDecodeErrorZ self; public: - CResult_InitDecodeErrorZ(const CResult_InitDecodeErrorZ&) = delete; - CResult_InitDecodeErrorZ(CResult_InitDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); } - CResult_InitDecodeErrorZ(LDKCResult_InitDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); } - operator LDKCResult_InitDecodeErrorZ() && { LDKCResult_InitDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); return res; } - ~CResult_InitDecodeErrorZ() { CResult_InitDecodeErrorZ_free(self); } - CResult_InitDecodeErrorZ& operator=(CResult_InitDecodeErrorZ&& o) { CResult_InitDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); return *this; } - LDKCResult_InitDecodeErrorZ* operator &() { return &self; } - LDKCResult_InitDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InitDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InitDecodeErrorZ* operator ->() const { return &self; } + CResult_InitFeaturesDecodeErrorZ(const CResult_InitFeaturesDecodeErrorZ&) = delete; + CResult_InitFeaturesDecodeErrorZ(CResult_InitFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); } + CResult_InitFeaturesDecodeErrorZ(LDKCResult_InitFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); } + operator LDKCResult_InitFeaturesDecodeErrorZ() && { LDKCResult_InitFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitFeaturesDecodeErrorZ)); return res; } + ~CResult_InitFeaturesDecodeErrorZ() { CResult_InitFeaturesDecodeErrorZ_free(self); } + CResult_InitFeaturesDecodeErrorZ& operator=(CResult_InitFeaturesDecodeErrorZ&& o) { CResult_InitFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitFeaturesDecodeErrorZ)); return *this; } + LDKCResult_InitFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_InitFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InitFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InitFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_OutPointDecodeErrorZ { +class CResult_PublicKeyNoneZ { private: - LDKCResult_OutPointDecodeErrorZ self; + LDKCResult_PublicKeyNoneZ self; public: - CResult_OutPointDecodeErrorZ(const CResult_OutPointDecodeErrorZ&) = delete; - CResult_OutPointDecodeErrorZ(CResult_OutPointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); } - CResult_OutPointDecodeErrorZ(LDKCResult_OutPointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); } - operator LDKCResult_OutPointDecodeErrorZ() && { LDKCResult_OutPointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); return res; } - ~CResult_OutPointDecodeErrorZ() { CResult_OutPointDecodeErrorZ_free(self); } - CResult_OutPointDecodeErrorZ& operator=(CResult_OutPointDecodeErrorZ&& o) { CResult_OutPointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); return *this; } - LDKCResult_OutPointDecodeErrorZ* operator &() { return &self; } - LDKCResult_OutPointDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OutPointDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OutPointDecodeErrorZ* operator ->() const { return &self; } + CResult_PublicKeyNoneZ(const CResult_PublicKeyNoneZ&) = delete; + CResult_PublicKeyNoneZ(CResult_PublicKeyNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); } + CResult_PublicKeyNoneZ(LDKCResult_PublicKeyNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); } + operator LDKCResult_PublicKeyNoneZ() && { LDKCResult_PublicKeyNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_PublicKeyNoneZ)); return res; } + ~CResult_PublicKeyNoneZ() { CResult_PublicKeyNoneZ_free(self); } + CResult_PublicKeyNoneZ& operator=(CResult_PublicKeyNoneZ&& o) { CResult_PublicKeyNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PublicKeyNoneZ)); return *this; } + LDKCResult_PublicKeyNoneZ* operator &() { return &self; } + LDKCResult_PublicKeyNoneZ* operator ->() { return &self; } + const LDKCResult_PublicKeyNoneZ* operator &() const { return &self; } + const LDKCResult_PublicKeyNoneZ* operator ->() const { return &self; } }; -class CResult_BlindedRouteDecodeErrorZ { +class CResult_PingDecodeErrorZ { private: - LDKCResult_BlindedRouteDecodeErrorZ self; + LDKCResult_PingDecodeErrorZ self; public: - CResult_BlindedRouteDecodeErrorZ(const CResult_BlindedRouteDecodeErrorZ&) = delete; - CResult_BlindedRouteDecodeErrorZ(CResult_BlindedRouteDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedRouteDecodeErrorZ)); } - CResult_BlindedRouteDecodeErrorZ(LDKCResult_BlindedRouteDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedRouteDecodeErrorZ)); } - operator LDKCResult_BlindedRouteDecodeErrorZ() && { LDKCResult_BlindedRouteDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedRouteDecodeErrorZ)); return res; } - ~CResult_BlindedRouteDecodeErrorZ() { CResult_BlindedRouteDecodeErrorZ_free(self); } - CResult_BlindedRouteDecodeErrorZ& operator=(CResult_BlindedRouteDecodeErrorZ&& o) { CResult_BlindedRouteDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedRouteDecodeErrorZ)); return *this; } - LDKCResult_BlindedRouteDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedRouteDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedRouteDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedRouteDecodeErrorZ* operator ->() const { return &self; } + CResult_PingDecodeErrorZ(const CResult_PingDecodeErrorZ&) = delete; + CResult_PingDecodeErrorZ(CResult_PingDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PingDecodeErrorZ)); } + CResult_PingDecodeErrorZ(LDKCResult_PingDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PingDecodeErrorZ)); } + operator LDKCResult_PingDecodeErrorZ() && { LDKCResult_PingDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PingDecodeErrorZ)); return res; } + ~CResult_PingDecodeErrorZ() { CResult_PingDecodeErrorZ_free(self); } + CResult_PingDecodeErrorZ& operator=(CResult_PingDecodeErrorZ&& o) { CResult_PingDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PingDecodeErrorZ)); return *this; } + LDKCResult_PingDecodeErrorZ* operator &() { return &self; } + LDKCResult_PingDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PingDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PingDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_ChannelDetailsZ { +class CVec_TransactionOutputsZ { private: - LDKCVec_ChannelDetailsZ self; + LDKCVec_TransactionOutputsZ self; public: - CVec_ChannelDetailsZ(const CVec_ChannelDetailsZ&) = delete; - CVec_ChannelDetailsZ(CVec_ChannelDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); } - CVec_ChannelDetailsZ(LDKCVec_ChannelDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelDetailsZ)); } - operator LDKCVec_ChannelDetailsZ() && { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; } - ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); } - CVec_ChannelDetailsZ& operator=(CVec_ChannelDetailsZ&& o) { CVec_ChannelDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); return *this; } - LDKCVec_ChannelDetailsZ* operator &() { return &self; } - LDKCVec_ChannelDetailsZ* operator ->() { return &self; } - const LDKCVec_ChannelDetailsZ* operator &() const { return &self; } - const LDKCVec_ChannelDetailsZ* operator ->() const { return &self; } + CVec_TransactionOutputsZ(const CVec_TransactionOutputsZ&) = delete; + CVec_TransactionOutputsZ(CVec_TransactionOutputsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TransactionOutputsZ)); } + CVec_TransactionOutputsZ(LDKCVec_TransactionOutputsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TransactionOutputsZ)); } + operator LDKCVec_TransactionOutputsZ() && { LDKCVec_TransactionOutputsZ res = self; memset(&self, 0, sizeof(LDKCVec_TransactionOutputsZ)); return res; } + ~CVec_TransactionOutputsZ() { CVec_TransactionOutputsZ_free(self); } + CVec_TransactionOutputsZ& operator=(CVec_TransactionOutputsZ&& o) { CVec_TransactionOutputsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TransactionOutputsZ)); return *this; } + LDKCVec_TransactionOutputsZ* operator &() { return &self; } + LDKCVec_TransactionOutputsZ* operator ->() { return &self; } + const LDKCVec_TransactionOutputsZ* operator &() const { return &self; } + const LDKCVec_TransactionOutputsZ* operator ->() const { return &self; } }; -class CVec_MessageSendEventZ { +class COption_HTLCClaimZ { private: - LDKCVec_MessageSendEventZ self; + LDKCOption_HTLCClaimZ self; public: - CVec_MessageSendEventZ(const CVec_MessageSendEventZ&) = delete; - CVec_MessageSendEventZ(CVec_MessageSendEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MessageSendEventZ)); } - CVec_MessageSendEventZ(LDKCVec_MessageSendEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MessageSendEventZ)); } - operator LDKCVec_MessageSendEventZ() && { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; } - ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); } - CVec_MessageSendEventZ& operator=(CVec_MessageSendEventZ&& o) { CVec_MessageSendEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MessageSendEventZ)); return *this; } - LDKCVec_MessageSendEventZ* operator &() { return &self; } - LDKCVec_MessageSendEventZ* operator ->() { return &self; } - const LDKCVec_MessageSendEventZ* operator &() const { return &self; } - const LDKCVec_MessageSendEventZ* operator ->() const { return &self; } + COption_HTLCClaimZ(const COption_HTLCClaimZ&) = delete; + COption_HTLCClaimZ(COption_HTLCClaimZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_HTLCClaimZ)); } + COption_HTLCClaimZ(LDKCOption_HTLCClaimZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_HTLCClaimZ)); } + operator LDKCOption_HTLCClaimZ() && { LDKCOption_HTLCClaimZ res = self; memset(&self, 0, sizeof(LDKCOption_HTLCClaimZ)); return res; } + ~COption_HTLCClaimZ() { COption_HTLCClaimZ_free(self); } + COption_HTLCClaimZ& operator=(COption_HTLCClaimZ&& o) { COption_HTLCClaimZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_HTLCClaimZ)); return *this; } + LDKCOption_HTLCClaimZ* operator &() { return &self; } + LDKCOption_HTLCClaimZ* operator ->() { return &self; } + const LDKCOption_HTLCClaimZ* operator &() const { return &self; } + const LDKCOption_HTLCClaimZ* operator ->() const { return &self; } }; -class CResult_SignDecodeErrorZ { +class CVec_CVec_u8ZZ { private: - LDKCResult_SignDecodeErrorZ self; + LDKCVec_CVec_u8ZZ self; public: - CResult_SignDecodeErrorZ(const CResult_SignDecodeErrorZ&) = delete; - CResult_SignDecodeErrorZ(CResult_SignDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignDecodeErrorZ)); } - CResult_SignDecodeErrorZ(LDKCResult_SignDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignDecodeErrorZ)); } - operator LDKCResult_SignDecodeErrorZ() && { LDKCResult_SignDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SignDecodeErrorZ)); return res; } - ~CResult_SignDecodeErrorZ() { CResult_SignDecodeErrorZ_free(self); } - CResult_SignDecodeErrorZ& operator=(CResult_SignDecodeErrorZ&& o) { CResult_SignDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignDecodeErrorZ)); return *this; } - LDKCResult_SignDecodeErrorZ* operator &() { return &self; } - LDKCResult_SignDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_SignDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_SignDecodeErrorZ* operator ->() const { return &self; } + CVec_CVec_u8ZZ(const CVec_CVec_u8ZZ&) = delete; + CVec_CVec_u8ZZ(CVec_CVec_u8ZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_u8ZZ)); } + CVec_CVec_u8ZZ(LDKCVec_CVec_u8ZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_u8ZZ)); } + operator LDKCVec_CVec_u8ZZ() && { LDKCVec_CVec_u8ZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_u8ZZ)); return res; } + ~CVec_CVec_u8ZZ() { CVec_CVec_u8ZZ_free(self); } + CVec_CVec_u8ZZ& operator=(CVec_CVec_u8ZZ&& o) { CVec_CVec_u8ZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CVec_u8ZZ)); return *this; } + LDKCVec_CVec_u8ZZ* operator &() { return &self; } + LDKCVec_CVec_u8ZZ* operator ->() { return &self; } + const LDKCVec_CVec_u8ZZ* operator &() const { return &self; } + const LDKCVec_CVec_u8ZZ* operator ->() const { return &self; } }; -class COption_NetAddressZ { +class CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { private: - LDKCOption_NetAddressZ self; + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ self; public: - COption_NetAddressZ(const COption_NetAddressZ&) = delete; - COption_NetAddressZ(COption_NetAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NetAddressZ)); } - COption_NetAddressZ(LDKCOption_NetAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NetAddressZ)); } - operator LDKCOption_NetAddressZ() && { LDKCOption_NetAddressZ res = self; memset(&self, 0, sizeof(LDKCOption_NetAddressZ)); return res; } - ~COption_NetAddressZ() { COption_NetAddressZ_free(self); } - COption_NetAddressZ& operator=(COption_NetAddressZ&& o) { COption_NetAddressZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NetAddressZ)); return *this; } - LDKCOption_NetAddressZ* operator &() { return &self; } - LDKCOption_NetAddressZ* operator ->() { return &self; } - const LDKCOption_NetAddressZ* operator &() const { return &self; } - const LDKCOption_NetAddressZ* operator ->() const { return &self; } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(const CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&) = delete; + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); } + operator LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ() && { LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return res; } + ~CResult_COption_CustomOnionMessageContentsZDecodeErrorZ() { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ& operator=(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ&& o) { CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_CustomOnionMessageContentsZDecodeErrorZ)); return *this; } + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_CustomOnionMessageContentsZDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_OutPointScriptZ { +class CResult_ShutdownScriptDecodeErrorZ { private: - LDKC2Tuple_OutPointScriptZ self; + LDKCResult_ShutdownScriptDecodeErrorZ self; public: - C2Tuple_OutPointScriptZ(const C2Tuple_OutPointScriptZ&) = delete; - C2Tuple_OutPointScriptZ(C2Tuple_OutPointScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); } - C2Tuple_OutPointScriptZ(LDKC2Tuple_OutPointScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); } - operator LDKC2Tuple_OutPointScriptZ() && { LDKC2Tuple_OutPointScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); return res; } - ~C2Tuple_OutPointScriptZ() { C2Tuple_OutPointScriptZ_free(self); } - C2Tuple_OutPointScriptZ& operator=(C2Tuple_OutPointScriptZ&& o) { C2Tuple_OutPointScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); return *this; } - LDKC2Tuple_OutPointScriptZ* operator &() { return &self; } - LDKC2Tuple_OutPointScriptZ* operator ->() { return &self; } - const LDKC2Tuple_OutPointScriptZ* operator &() const { return &self; } - const LDKC2Tuple_OutPointScriptZ* operator ->() const { return &self; } + CResult_ShutdownScriptDecodeErrorZ(const CResult_ShutdownScriptDecodeErrorZ&) = delete; + CResult_ShutdownScriptDecodeErrorZ(CResult_ShutdownScriptDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); } + CResult_ShutdownScriptDecodeErrorZ(LDKCResult_ShutdownScriptDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); } + operator LDKCResult_ShutdownScriptDecodeErrorZ() && { LDKCResult_ShutdownScriptDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ShutdownScriptDecodeErrorZ)); return res; } + ~CResult_ShutdownScriptDecodeErrorZ() { CResult_ShutdownScriptDecodeErrorZ_free(self); } + CResult_ShutdownScriptDecodeErrorZ& operator=(CResult_ShutdownScriptDecodeErrorZ&& o) { CResult_ShutdownScriptDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ShutdownScriptDecodeErrorZ)); return *this; } + LDKCResult_ShutdownScriptDecodeErrorZ* operator &() { return &self; } + LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ShutdownScriptDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ShutdownScriptDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_RouteHintHopDecodeErrorZ { +class CResult_ProbabilisticScorerDecodeErrorZ { private: - LDKCResult_RouteHintHopDecodeErrorZ self; + LDKCResult_ProbabilisticScorerDecodeErrorZ self; public: - CResult_RouteHintHopDecodeErrorZ(const CResult_RouteHintHopDecodeErrorZ&) = delete; - CResult_RouteHintHopDecodeErrorZ(CResult_RouteHintHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); } - CResult_RouteHintHopDecodeErrorZ(LDKCResult_RouteHintHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); } - operator LDKCResult_RouteHintHopDecodeErrorZ() && { LDKCResult_RouteHintHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); return res; } - ~CResult_RouteHintHopDecodeErrorZ() { CResult_RouteHintHopDecodeErrorZ_free(self); } - CResult_RouteHintHopDecodeErrorZ& operator=(CResult_RouteHintHopDecodeErrorZ&& o) { CResult_RouteHintHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); return *this; } - LDKCResult_RouteHintHopDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteHintHopDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteHintHopDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteHintHopDecodeErrorZ* operator ->() const { return &self; } + CResult_ProbabilisticScorerDecodeErrorZ(const CResult_ProbabilisticScorerDecodeErrorZ&) = delete; + CResult_ProbabilisticScorerDecodeErrorZ(CResult_ProbabilisticScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); } + CResult_ProbabilisticScorerDecodeErrorZ(LDKCResult_ProbabilisticScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); } + operator LDKCResult_ProbabilisticScorerDecodeErrorZ() && { LDKCResult_ProbabilisticScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ProbabilisticScorerDecodeErrorZ)); return res; } + ~CResult_ProbabilisticScorerDecodeErrorZ() { CResult_ProbabilisticScorerDecodeErrorZ_free(self); } + CResult_ProbabilisticScorerDecodeErrorZ& operator=(CResult_ProbabilisticScorerDecodeErrorZ&& o) { CResult_ProbabilisticScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ProbabilisticScorerDecodeErrorZ)); return *this; } + LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() { return &self; } + LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_SignatureSignatureZNoneZ { +class CResult_TxCreationKeysDecodeErrorZ { private: - LDKCResult_C2Tuple_SignatureSignatureZNoneZ self; + LDKCResult_TxCreationKeysDecodeErrorZ self; public: - CResult_C2Tuple_SignatureSignatureZNoneZ(const CResult_C2Tuple_SignatureSignatureZNoneZ&) = delete; - CResult_C2Tuple_SignatureSignatureZNoneZ(CResult_C2Tuple_SignatureSignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureSignatureZNoneZ)); } - CResult_C2Tuple_SignatureSignatureZNoneZ(LDKCResult_C2Tuple_SignatureSignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ)); } - operator LDKCResult_C2Tuple_SignatureSignatureZNoneZ() && { LDKCResult_C2Tuple_SignatureSignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ)); return res; } - ~CResult_C2Tuple_SignatureSignatureZNoneZ() { CResult_C2Tuple_SignatureSignatureZNoneZ_free(self); } - CResult_C2Tuple_SignatureSignatureZNoneZ& operator=(CResult_C2Tuple_SignatureSignatureZNoneZ&& o) { CResult_C2Tuple_SignatureSignatureZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureSignatureZNoneZ)); return *this; } - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator &() { return &self; } - LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator ->() const { return &self; } + CResult_TxCreationKeysDecodeErrorZ(const CResult_TxCreationKeysDecodeErrorZ&) = delete; + CResult_TxCreationKeysDecodeErrorZ(CResult_TxCreationKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); } + CResult_TxCreationKeysDecodeErrorZ(LDKCResult_TxCreationKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); } + operator LDKCResult_TxCreationKeysDecodeErrorZ() && { LDKCResult_TxCreationKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxCreationKeysDecodeErrorZ)); return res; } + ~CResult_TxCreationKeysDecodeErrorZ() { CResult_TxCreationKeysDecodeErrorZ_free(self); } + CResult_TxCreationKeysDecodeErrorZ& operator=(CResult_TxCreationKeysDecodeErrorZ&& o) { CResult_TxCreationKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxCreationKeysDecodeErrorZ)); return *this; } + LDKCResult_TxCreationKeysDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxCreationKeysDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxCreationKeysDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxCreationKeysDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_UpdateFailMalformedHTLCDecodeErrorZ { +class C2Tuple_usizeTransactionZ { private: - LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ self; + LDKC2Tuple_usizeTransactionZ self; public: - CResult_UpdateFailMalformedHTLCDecodeErrorZ(const CResult_UpdateFailMalformedHTLCDecodeErrorZ&) = delete; - CResult_UpdateFailMalformedHTLCDecodeErrorZ(CResult_UpdateFailMalformedHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFailMalformedHTLCDecodeErrorZ)); } - CResult_UpdateFailMalformedHTLCDecodeErrorZ(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ)); } - operator LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ() && { LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ)); return res; } - ~CResult_UpdateFailMalformedHTLCDecodeErrorZ() { CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(self); } - CResult_UpdateFailMalformedHTLCDecodeErrorZ& operator=(CResult_UpdateFailMalformedHTLCDecodeErrorZ&& o) { CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFailMalformedHTLCDecodeErrorZ)); return *this; } - LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator &() { return &self; } - LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator ->() const { return &self; } + C2Tuple_usizeTransactionZ(const C2Tuple_usizeTransactionZ&) = delete; + C2Tuple_usizeTransactionZ(C2Tuple_usizeTransactionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); } + C2Tuple_usizeTransactionZ(LDKC2Tuple_usizeTransactionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); } + operator LDKC2Tuple_usizeTransactionZ() && { LDKC2Tuple_usizeTransactionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_usizeTransactionZ)); return res; } + ~C2Tuple_usizeTransactionZ() { C2Tuple_usizeTransactionZ_free(self); } + C2Tuple_usizeTransactionZ& operator=(C2Tuple_usizeTransactionZ&& o) { C2Tuple_usizeTransactionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_usizeTransactionZ)); return *this; } + LDKC2Tuple_usizeTransactionZ* operator &() { return &self; } + LDKC2Tuple_usizeTransactionZ* operator ->() { return &self; } + const LDKC2Tuple_usizeTransactionZ* operator &() const { return &self; } + const LDKC2Tuple_usizeTransactionZ* operator ->() const { return &self; } }; -class CResult_SharedSecretNoneZ { +class CResult_NodeAnnouncementDecodeErrorZ { private: - LDKCResult_SharedSecretNoneZ self; + LDKCResult_NodeAnnouncementDecodeErrorZ self; public: - CResult_SharedSecretNoneZ(const CResult_SharedSecretNoneZ&) = delete; - CResult_SharedSecretNoneZ(CResult_SharedSecretNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SharedSecretNoneZ)); } - CResult_SharedSecretNoneZ(LDKCResult_SharedSecretNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SharedSecretNoneZ)); } - operator LDKCResult_SharedSecretNoneZ() && { LDKCResult_SharedSecretNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SharedSecretNoneZ)); return res; } - ~CResult_SharedSecretNoneZ() { CResult_SharedSecretNoneZ_free(self); } - CResult_SharedSecretNoneZ& operator=(CResult_SharedSecretNoneZ&& o) { CResult_SharedSecretNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SharedSecretNoneZ)); return *this; } - LDKCResult_SharedSecretNoneZ* operator &() { return &self; } - LDKCResult_SharedSecretNoneZ* operator ->() { return &self; } - const LDKCResult_SharedSecretNoneZ* operator &() const { return &self; } - const LDKCResult_SharedSecretNoneZ* operator ->() const { return &self; } + CResult_NodeAnnouncementDecodeErrorZ(const CResult_NodeAnnouncementDecodeErrorZ&) = delete; + CResult_NodeAnnouncementDecodeErrorZ(CResult_NodeAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); } + CResult_NodeAnnouncementDecodeErrorZ(LDKCResult_NodeAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); } + operator LDKCResult_NodeAnnouncementDecodeErrorZ() && { LDKCResult_NodeAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAnnouncementDecodeErrorZ)); return res; } + ~CResult_NodeAnnouncementDecodeErrorZ() { CResult_NodeAnnouncementDecodeErrorZ_free(self); } + CResult_NodeAnnouncementDecodeErrorZ& operator=(CResult_NodeAnnouncementDecodeErrorZ&& o) { CResult_NodeAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAnnouncementDecodeErrorZ)); return *this; } + LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeAnnouncementDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeAnnouncementDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_TxidZ { +class CResult_BlindedPathDecodeErrorZ { private: - LDKCVec_TxidZ self; + LDKCResult_BlindedPathDecodeErrorZ self; public: - CVec_TxidZ(const CVec_TxidZ&) = delete; - CVec_TxidZ(CVec_TxidZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TxidZ)); } - CVec_TxidZ(LDKCVec_TxidZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TxidZ)); } - operator LDKCVec_TxidZ() && { LDKCVec_TxidZ res = self; memset(&self, 0, sizeof(LDKCVec_TxidZ)); return res; } - ~CVec_TxidZ() { CVec_TxidZ_free(self); } - CVec_TxidZ& operator=(CVec_TxidZ&& o) { CVec_TxidZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TxidZ)); return *this; } - LDKCVec_TxidZ* operator &() { return &self; } - LDKCVec_TxidZ* operator ->() { return &self; } - const LDKCVec_TxidZ* operator &() const { return &self; } - const LDKCVec_TxidZ* operator ->() const { return &self; } + CResult_BlindedPathDecodeErrorZ(const CResult_BlindedPathDecodeErrorZ&) = delete; + CResult_BlindedPathDecodeErrorZ(CResult_BlindedPathDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedPathDecodeErrorZ)); } + CResult_BlindedPathDecodeErrorZ(LDKCResult_BlindedPathDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedPathDecodeErrorZ)); } + operator LDKCResult_BlindedPathDecodeErrorZ() && { LDKCResult_BlindedPathDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedPathDecodeErrorZ)); return res; } + ~CResult_BlindedPathDecodeErrorZ() { CResult_BlindedPathDecodeErrorZ_free(self); } + CResult_BlindedPathDecodeErrorZ& operator=(CResult_BlindedPathDecodeErrorZ&& o) { CResult_BlindedPathDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedPathDecodeErrorZ)); return *this; } + LDKCResult_BlindedPathDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedPathDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedPathDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedPathDecodeErrorZ* operator ->() const { return &self; } }; -class COption_AccessZ { +class CVec_ChannelMonitorZ { private: - LDKCOption_AccessZ self; + LDKCVec_ChannelMonitorZ self; public: - COption_AccessZ(const COption_AccessZ&) = delete; - COption_AccessZ(COption_AccessZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_AccessZ)); } - COption_AccessZ(LDKCOption_AccessZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_AccessZ)); } - operator LDKCOption_AccessZ() && { LDKCOption_AccessZ res = self; memset(&self, 0, sizeof(LDKCOption_AccessZ)); return res; } - ~COption_AccessZ() { COption_AccessZ_free(self); } - COption_AccessZ& operator=(COption_AccessZ&& o) { COption_AccessZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_AccessZ)); return *this; } - LDKCOption_AccessZ* operator &() { return &self; } - LDKCOption_AccessZ* operator ->() { return &self; } - const LDKCOption_AccessZ* operator &() const { return &self; } - const LDKCOption_AccessZ* operator ->() const { return &self; } + CVec_ChannelMonitorZ(const CVec_ChannelMonitorZ&) = delete; + CVec_ChannelMonitorZ(CVec_ChannelMonitorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); } + CVec_ChannelMonitorZ(LDKCVec_ChannelMonitorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelMonitorZ)); } + operator LDKCVec_ChannelMonitorZ() && { LDKCVec_ChannelMonitorZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelMonitorZ)); return res; } + ~CVec_ChannelMonitorZ() { CVec_ChannelMonitorZ_free(self); } + CVec_ChannelMonitorZ& operator=(CVec_ChannelMonitorZ&& o) { CVec_ChannelMonitorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelMonitorZ)); return *this; } + LDKCVec_ChannelMonitorZ* operator &() { return &self; } + LDKCVec_ChannelMonitorZ* operator ->() { return &self; } + const LDKCVec_ChannelMonitorZ* operator &() const { return &self; } + const LDKCVec_ChannelMonitorZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { +class CResult_RouteHopDecodeErrorZ { private: - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ self; + LDKCResult_RouteHopDecodeErrorZ self; public: - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete; - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } - operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() && { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; } - ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); } - CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ& operator=(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return *this; } - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; } - LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; } + CResult_RouteHopDecodeErrorZ(const CResult_RouteHopDecodeErrorZ&) = delete; + CResult_RouteHopDecodeErrorZ(CResult_RouteHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); } + CResult_RouteHopDecodeErrorZ(LDKCResult_RouteHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); } + operator LDKCResult_RouteHopDecodeErrorZ() && { LDKCResult_RouteHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHopDecodeErrorZ)); return res; } + ~CResult_RouteHopDecodeErrorZ() { CResult_RouteHopDecodeErrorZ_free(self); } + CResult_RouteHopDecodeErrorZ& operator=(CResult_RouteHopDecodeErrorZ&& o) { CResult_RouteHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHopDecodeErrorZ)); return *this; } + LDKCResult_RouteHopDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteHopDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteHopDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteHopDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { +class CVec_BalanceZ { private: - LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ self; + LDKCVec_BalanceZ self; public: - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&) = delete; - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); } - operator LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return res; } - ~CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); } - CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ)); return *this; } - LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() { return &self; } - LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ* operator ->() const { return &self; } + CVec_BalanceZ(const CVec_BalanceZ&) = delete; + CVec_BalanceZ(CVec_BalanceZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_BalanceZ)); } + CVec_BalanceZ(LDKCVec_BalanceZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_BalanceZ)); } + operator LDKCVec_BalanceZ() && { LDKCVec_BalanceZ res = self; memset(&self, 0, sizeof(LDKCVec_BalanceZ)); return res; } + ~CVec_BalanceZ() { CVec_BalanceZ_free(self); } + CVec_BalanceZ& operator=(CVec_BalanceZ&& o) { CVec_BalanceZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_BalanceZ)); return *this; } + LDKCVec_BalanceZ* operator &() { return &self; } + LDKCVec_BalanceZ* operator ->() { return &self; } + const LDKCVec_BalanceZ* operator &() const { return &self; } + const LDKCVec_BalanceZ* operator ->() const { return &self; } }; -class CResult_PongDecodeErrorZ { +class CResult_FundingSignedDecodeErrorZ { private: - LDKCResult_PongDecodeErrorZ self; + LDKCResult_FundingSignedDecodeErrorZ self; public: - CResult_PongDecodeErrorZ(const CResult_PongDecodeErrorZ&) = delete; - CResult_PongDecodeErrorZ(CResult_PongDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); } - CResult_PongDecodeErrorZ(LDKCResult_PongDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); } - operator LDKCResult_PongDecodeErrorZ() && { LDKCResult_PongDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PongDecodeErrorZ)); return res; } - ~CResult_PongDecodeErrorZ() { CResult_PongDecodeErrorZ_free(self); } - CResult_PongDecodeErrorZ& operator=(CResult_PongDecodeErrorZ&& o) { CResult_PongDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PongDecodeErrorZ)); return *this; } - LDKCResult_PongDecodeErrorZ* operator &() { return &self; } - LDKCResult_PongDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PongDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PongDecodeErrorZ* operator ->() const { return &self; } + CResult_FundingSignedDecodeErrorZ(const CResult_FundingSignedDecodeErrorZ&) = delete; + CResult_FundingSignedDecodeErrorZ(CResult_FundingSignedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FundingSignedDecodeErrorZ)); } + CResult_FundingSignedDecodeErrorZ(LDKCResult_FundingSignedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FundingSignedDecodeErrorZ)); } + operator LDKCResult_FundingSignedDecodeErrorZ() && { LDKCResult_FundingSignedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FundingSignedDecodeErrorZ)); return res; } + ~CResult_FundingSignedDecodeErrorZ() { CResult_FundingSignedDecodeErrorZ_free(self); } + CResult_FundingSignedDecodeErrorZ& operator=(CResult_FundingSignedDecodeErrorZ&& o) { CResult_FundingSignedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FundingSignedDecodeErrorZ)); return *this; } + LDKCResult_FundingSignedDecodeErrorZ* operator &() { return &self; } + LDKCResult_FundingSignedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_FundingSignedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_FundingSignedDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CVec_CVec_u8ZZNoneZ { +class CResult_RecoverableSignatureNoneZ { private: - LDKCResult_CVec_CVec_u8ZZNoneZ self; + LDKCResult_RecoverableSignatureNoneZ self; public: - CResult_CVec_CVec_u8ZZNoneZ(const CResult_CVec_CVec_u8ZZNoneZ&) = delete; - CResult_CVec_CVec_u8ZZNoneZ(CResult_CVec_CVec_u8ZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_CVec_u8ZZNoneZ)); } - CResult_CVec_CVec_u8ZZNoneZ(LDKCResult_CVec_CVec_u8ZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ)); } - operator LDKCResult_CVec_CVec_u8ZZNoneZ() && { LDKCResult_CVec_CVec_u8ZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ)); return res; } - ~CResult_CVec_CVec_u8ZZNoneZ() { CResult_CVec_CVec_u8ZZNoneZ_free(self); } - CResult_CVec_CVec_u8ZZNoneZ& operator=(CResult_CVec_CVec_u8ZZNoneZ&& o) { CResult_CVec_CVec_u8ZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_CVec_u8ZZNoneZ)); return *this; } - LDKCResult_CVec_CVec_u8ZZNoneZ* operator &() { return &self; } - LDKCResult_CVec_CVec_u8ZZNoneZ* operator ->() { return &self; } - const LDKCResult_CVec_CVec_u8ZZNoneZ* operator &() const { return &self; } - const LDKCResult_CVec_CVec_u8ZZNoneZ* operator ->() const { return &self; } + CResult_RecoverableSignatureNoneZ(const CResult_RecoverableSignatureNoneZ&) = delete; + CResult_RecoverableSignatureNoneZ(CResult_RecoverableSignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); } + CResult_RecoverableSignatureNoneZ(LDKCResult_RecoverableSignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); } + operator LDKCResult_RecoverableSignatureNoneZ() && { LDKCResult_RecoverableSignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_RecoverableSignatureNoneZ)); return res; } + ~CResult_RecoverableSignatureNoneZ() { CResult_RecoverableSignatureNoneZ_free(self); } + CResult_RecoverableSignatureNoneZ& operator=(CResult_RecoverableSignatureNoneZ&& o) { CResult_RecoverableSignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RecoverableSignatureNoneZ)); return *this; } + LDKCResult_RecoverableSignatureNoneZ* operator &() { return &self; } + LDKCResult_RecoverableSignatureNoneZ* operator ->() { return &self; } + const LDKCResult_RecoverableSignatureNoneZ* operator &() const { return &self; } + const LDKCResult_RecoverableSignatureNoneZ* operator ->() const { return &self; } }; -class C2Tuple_SignatureSignatureZ { +class C3Tuple_RawInvoice_u832InvoiceSignatureZ { private: - LDKC2Tuple_SignatureSignatureZ self; + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ self; public: - C2Tuple_SignatureSignatureZ(const C2Tuple_SignatureSignatureZ&) = delete; - C2Tuple_SignatureSignatureZ(C2Tuple_SignatureSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_SignatureSignatureZ)); } - C2Tuple_SignatureSignatureZ(LDKC2Tuple_SignatureSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_SignatureSignatureZ)); } - operator LDKC2Tuple_SignatureSignatureZ() && { LDKC2Tuple_SignatureSignatureZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_SignatureSignatureZ)); return res; } - ~C2Tuple_SignatureSignatureZ() { C2Tuple_SignatureSignatureZ_free(self); } - C2Tuple_SignatureSignatureZ& operator=(C2Tuple_SignatureSignatureZ&& o) { C2Tuple_SignatureSignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_SignatureSignatureZ)); return *this; } - LDKC2Tuple_SignatureSignatureZ* operator &() { return &self; } - LDKC2Tuple_SignatureSignatureZ* operator ->() { return &self; } - const LDKC2Tuple_SignatureSignatureZ* operator &() const { return &self; } - const LDKC2Tuple_SignatureSignatureZ* operator ->() const { return &self; } + C3Tuple_RawInvoice_u832InvoiceSignatureZ(const C3Tuple_RawInvoice_u832InvoiceSignatureZ&) = delete; + C3Tuple_RawInvoice_u832InvoiceSignatureZ(C3Tuple_RawInvoice_u832InvoiceSignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_RawInvoice_u832InvoiceSignatureZ)); } + C3Tuple_RawInvoice_u832InvoiceSignatureZ(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ)); } + operator LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ() && { LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ)); return res; } + ~C3Tuple_RawInvoice_u832InvoiceSignatureZ() { C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(self); } + C3Tuple_RawInvoice_u832InvoiceSignatureZ& operator=(C3Tuple_RawInvoice_u832InvoiceSignatureZ&& o) { C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_RawInvoice_u832InvoiceSignatureZ)); return *this; } + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator &() { return &self; } + LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator ->() { return &self; } + const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator &() const { return &self; } + const LDKC3Tuple_RawInvoice_u832InvoiceSignatureZ* operator ->() const { return &self; } }; -class C2Tuple_PaymentHashPaymentSecretZ { +class CResult_NetworkGraphDecodeErrorZ { private: - LDKC2Tuple_PaymentHashPaymentSecretZ self; + LDKCResult_NetworkGraphDecodeErrorZ self; public: - C2Tuple_PaymentHashPaymentSecretZ(const C2Tuple_PaymentHashPaymentSecretZ&) = delete; - C2Tuple_PaymentHashPaymentSecretZ(C2Tuple_PaymentHashPaymentSecretZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentSecretZ)); } - C2Tuple_PaymentHashPaymentSecretZ(LDKC2Tuple_PaymentHashPaymentSecretZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ)); } - operator LDKC2Tuple_PaymentHashPaymentSecretZ() && { LDKC2Tuple_PaymentHashPaymentSecretZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ)); return res; } - ~C2Tuple_PaymentHashPaymentSecretZ() { C2Tuple_PaymentHashPaymentSecretZ_free(self); } - C2Tuple_PaymentHashPaymentSecretZ& operator=(C2Tuple_PaymentHashPaymentSecretZ&& o) { C2Tuple_PaymentHashPaymentSecretZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentSecretZ)); return *this; } - LDKC2Tuple_PaymentHashPaymentSecretZ* operator &() { return &self; } - LDKC2Tuple_PaymentHashPaymentSecretZ* operator ->() { return &self; } - const LDKC2Tuple_PaymentHashPaymentSecretZ* operator &() const { return &self; } - const LDKC2Tuple_PaymentHashPaymentSecretZ* operator ->() const { return &self; } + CResult_NetworkGraphDecodeErrorZ(const CResult_NetworkGraphDecodeErrorZ&) = delete; + CResult_NetworkGraphDecodeErrorZ(CResult_NetworkGraphDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NetworkGraphDecodeErrorZ)); } + CResult_NetworkGraphDecodeErrorZ(LDKCResult_NetworkGraphDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NetworkGraphDecodeErrorZ)); } + operator LDKCResult_NetworkGraphDecodeErrorZ() && { LDKCResult_NetworkGraphDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NetworkGraphDecodeErrorZ)); return res; } + ~CResult_NetworkGraphDecodeErrorZ() { CResult_NetworkGraphDecodeErrorZ_free(self); } + CResult_NetworkGraphDecodeErrorZ& operator=(CResult_NetworkGraphDecodeErrorZ&& o) { CResult_NetworkGraphDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NetworkGraphDecodeErrorZ)); return *this; } + LDKCResult_NetworkGraphDecodeErrorZ* operator &() { return &self; } + LDKCResult_NetworkGraphDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NetworkGraphDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NetworkGraphDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_BlockHashChannelManagerZ { +class CResult_NodeInfoDecodeErrorZ { private: - LDKC2Tuple_BlockHashChannelManagerZ self; + LDKCResult_NodeInfoDecodeErrorZ self; public: - C2Tuple_BlockHashChannelManagerZ(const C2Tuple_BlockHashChannelManagerZ&) = delete; - C2Tuple_BlockHashChannelManagerZ(C2Tuple_BlockHashChannelManagerZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); } - C2Tuple_BlockHashChannelManagerZ(LDKC2Tuple_BlockHashChannelManagerZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); } - operator LDKC2Tuple_BlockHashChannelManagerZ() && { LDKC2Tuple_BlockHashChannelManagerZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_BlockHashChannelManagerZ)); return res; } - ~C2Tuple_BlockHashChannelManagerZ() { C2Tuple_BlockHashChannelManagerZ_free(self); } - C2Tuple_BlockHashChannelManagerZ& operator=(C2Tuple_BlockHashChannelManagerZ&& o) { C2Tuple_BlockHashChannelManagerZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_BlockHashChannelManagerZ)); return *this; } - LDKC2Tuple_BlockHashChannelManagerZ* operator &() { return &self; } - LDKC2Tuple_BlockHashChannelManagerZ* operator ->() { return &self; } - const LDKC2Tuple_BlockHashChannelManagerZ* operator &() const { return &self; } - const LDKC2Tuple_BlockHashChannelManagerZ* operator ->() const { return &self; } + CResult_NodeInfoDecodeErrorZ(const CResult_NodeInfoDecodeErrorZ&) = delete; + CResult_NodeInfoDecodeErrorZ(CResult_NodeInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); } + CResult_NodeInfoDecodeErrorZ(LDKCResult_NodeInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); } + operator LDKCResult_NodeInfoDecodeErrorZ() && { LDKCResult_NodeInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeInfoDecodeErrorZ)); return res; } + ~CResult_NodeInfoDecodeErrorZ() { CResult_NodeInfoDecodeErrorZ_free(self); } + CResult_NodeInfoDecodeErrorZ& operator=(CResult_NodeInfoDecodeErrorZ&& o) { CResult_NodeInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeInfoDecodeErrorZ)); return *this; } + LDKCResult_NodeInfoDecodeErrorZ* operator &() { return &self; } + LDKCResult_NodeInfoDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_NodeInfoDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_NodeInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_ChannelTransactionParametersDecodeErrorZ { +class CVec_NodeIdZ { private: - LDKCResult_ChannelTransactionParametersDecodeErrorZ self; + LDKCVec_NodeIdZ self; public: - CResult_ChannelTransactionParametersDecodeErrorZ(const CResult_ChannelTransactionParametersDecodeErrorZ&) = delete; - CResult_ChannelTransactionParametersDecodeErrorZ(CResult_ChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); } - CResult_ChannelTransactionParametersDecodeErrorZ(LDKCResult_ChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); } - operator LDKCResult_ChannelTransactionParametersDecodeErrorZ() && { LDKCResult_ChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTransactionParametersDecodeErrorZ)); return res; } - ~CResult_ChannelTransactionParametersDecodeErrorZ() { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); } - CResult_ChannelTransactionParametersDecodeErrorZ& operator=(CResult_ChannelTransactionParametersDecodeErrorZ&& o) { CResult_ChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTransactionParametersDecodeErrorZ)); return *this; } - LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } + CVec_NodeIdZ(const CVec_NodeIdZ&) = delete; + CVec_NodeIdZ(CVec_NodeIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_NodeIdZ)); } + CVec_NodeIdZ(LDKCVec_NodeIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_NodeIdZ)); } + operator LDKCVec_NodeIdZ() && { LDKCVec_NodeIdZ res = self; memset(&self, 0, sizeof(LDKCVec_NodeIdZ)); return res; } + ~CVec_NodeIdZ() { CVec_NodeIdZ_free(self); } + CVec_NodeIdZ& operator=(CVec_NodeIdZ&& o) { CVec_NodeIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_NodeIdZ)); return *this; } + LDKCVec_NodeIdZ* operator &() { return &self; } + LDKCVec_NodeIdZ* operator ->() { return &self; } + const LDKCVec_NodeIdZ* operator &() const { return &self; } + const LDKCVec_NodeIdZ* operator ->() const { return &self; } }; -class CResult_AcceptChannelDecodeErrorZ { +class CResult_RouteLightningErrorZ { private: - LDKCResult_AcceptChannelDecodeErrorZ self; + LDKCResult_RouteLightningErrorZ self; public: - CResult_AcceptChannelDecodeErrorZ(const CResult_AcceptChannelDecodeErrorZ&) = delete; - CResult_AcceptChannelDecodeErrorZ(CResult_AcceptChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); } - CResult_AcceptChannelDecodeErrorZ(LDKCResult_AcceptChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); } - operator LDKCResult_AcceptChannelDecodeErrorZ() && { LDKCResult_AcceptChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); return res; } - ~CResult_AcceptChannelDecodeErrorZ() { CResult_AcceptChannelDecodeErrorZ_free(self); } - CResult_AcceptChannelDecodeErrorZ& operator=(CResult_AcceptChannelDecodeErrorZ&& o) { CResult_AcceptChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); return *this; } - LDKCResult_AcceptChannelDecodeErrorZ* operator &() { return &self; } - LDKCResult_AcceptChannelDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_AcceptChannelDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_AcceptChannelDecodeErrorZ* operator ->() const { return &self; } + CResult_RouteLightningErrorZ(const CResult_RouteLightningErrorZ&) = delete; + CResult_RouteLightningErrorZ(CResult_RouteLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); } + CResult_RouteLightningErrorZ(LDKCResult_RouteLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); } + operator LDKCResult_RouteLightningErrorZ() && { LDKCResult_RouteLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteLightningErrorZ)); return res; } + ~CResult_RouteLightningErrorZ() { CResult_RouteLightningErrorZ_free(self); } + CResult_RouteLightningErrorZ& operator=(CResult_RouteLightningErrorZ&& o) { CResult_RouteLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteLightningErrorZ)); return *this; } + LDKCResult_RouteLightningErrorZ* operator &() { return &self; } + LDKCResult_RouteLightningErrorZ* operator ->() { return &self; } + const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; } + const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; } }; -class CVec_SignatureZ { +class CResult_ChannelPublicKeysDecodeErrorZ { private: - LDKCVec_SignatureZ self; + LDKCResult_ChannelPublicKeysDecodeErrorZ self; public: - CVec_SignatureZ(const CVec_SignatureZ&) = delete; - CVec_SignatureZ(CVec_SignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SignatureZ)); } - CVec_SignatureZ(LDKCVec_SignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SignatureZ)); } - operator LDKCVec_SignatureZ() && { LDKCVec_SignatureZ res = self; memset(&self, 0, sizeof(LDKCVec_SignatureZ)); return res; } - ~CVec_SignatureZ() { CVec_SignatureZ_free(self); } - CVec_SignatureZ& operator=(CVec_SignatureZ&& o) { CVec_SignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SignatureZ)); return *this; } - LDKCVec_SignatureZ* operator &() { return &self; } - LDKCVec_SignatureZ* operator ->() { return &self; } - const LDKCVec_SignatureZ* operator &() const { return &self; } - const LDKCVec_SignatureZ* operator ->() const { return &self; } + CResult_ChannelPublicKeysDecodeErrorZ(const CResult_ChannelPublicKeysDecodeErrorZ&) = delete; + CResult_ChannelPublicKeysDecodeErrorZ(CResult_ChannelPublicKeysDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); } + CResult_ChannelPublicKeysDecodeErrorZ(LDKCResult_ChannelPublicKeysDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); } + operator LDKCResult_ChannelPublicKeysDecodeErrorZ() && { LDKCResult_ChannelPublicKeysDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelPublicKeysDecodeErrorZ)); return res; } + ~CResult_ChannelPublicKeysDecodeErrorZ() { CResult_ChannelPublicKeysDecodeErrorZ_free(self); } + CResult_ChannelPublicKeysDecodeErrorZ& operator=(CResult_ChannelPublicKeysDecodeErrorZ&& o) { CResult_ChannelPublicKeysDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelPublicKeysDecodeErrorZ)); return *this; } + LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelPublicKeysDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_u64Z { +class CVec_u8Z { private: - LDKCVec_u64Z self; + LDKCVec_u8Z self; public: - CVec_u64Z(const CVec_u64Z&) = delete; - CVec_u64Z(CVec_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u64Z)); } - CVec_u64Z(LDKCVec_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u64Z)); } - operator LDKCVec_u64Z() && { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; } - ~CVec_u64Z() { CVec_u64Z_free(self); } - CVec_u64Z& operator=(CVec_u64Z&& o) { CVec_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u64Z)); return *this; } - LDKCVec_u64Z* operator &() { return &self; } - LDKCVec_u64Z* operator ->() { return &self; } - const LDKCVec_u64Z* operator &() const { return &self; } - const LDKCVec_u64Z* operator ->() const { return &self; } + CVec_u8Z(const CVec_u8Z&) = delete; + CVec_u8Z(CVec_u8Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u8Z)); } + CVec_u8Z(LDKCVec_u8Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u8Z)); } + operator LDKCVec_u8Z() && { LDKCVec_u8Z res = self; memset(&self, 0, sizeof(LDKCVec_u8Z)); return res; } + ~CVec_u8Z() { CVec_u8Z_free(self); } + CVec_u8Z& operator=(CVec_u8Z&& o) { CVec_u8Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u8Z)); return *this; } + LDKCVec_u8Z* operator &() { return &self; } + LDKCVec_u8Z* operator ->() { return &self; } + const LDKCVec_u8Z* operator &() const { return &self; } + const LDKCVec_u8Z* operator ->() const { return &self; } }; -class CResult_UnsignedChannelAnnouncementDecodeErrorZ { +class CResult_NonePaymentSendFailureZ { private: - LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ self; + LDKCResult_NonePaymentSendFailureZ self; public: - CResult_UnsignedChannelAnnouncementDecodeErrorZ(const CResult_UnsignedChannelAnnouncementDecodeErrorZ&) = delete; - CResult_UnsignedChannelAnnouncementDecodeErrorZ(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); } - CResult_UnsignedChannelAnnouncementDecodeErrorZ(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); } - operator LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ() && { LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ)); return res; } - ~CResult_UnsignedChannelAnnouncementDecodeErrorZ() { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); } - CResult_UnsignedChannelAnnouncementDecodeErrorZ& operator=(CResult_UnsignedChannelAnnouncementDecodeErrorZ&& o) { CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelAnnouncementDecodeErrorZ)); return *this; } - LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() { return &self; } - LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UnsignedChannelAnnouncementDecodeErrorZ* operator ->() const { return &self; } + CResult_NonePaymentSendFailureZ(const CResult_NonePaymentSendFailureZ&) = delete; + CResult_NonePaymentSendFailureZ(CResult_NonePaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); } + CResult_NonePaymentSendFailureZ(LDKCResult_NonePaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); } + operator LDKCResult_NonePaymentSendFailureZ() && { LDKCResult_NonePaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePaymentSendFailureZ)); return res; } + ~CResult_NonePaymentSendFailureZ() { CResult_NonePaymentSendFailureZ_free(self); } + CResult_NonePaymentSendFailureZ& operator=(CResult_NonePaymentSendFailureZ&& o) { CResult_NonePaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePaymentSendFailureZ)); return *this; } + LDKCResult_NonePaymentSendFailureZ* operator &() { return &self; } + LDKCResult_NonePaymentSendFailureZ* operator ->() { return &self; } + const LDKCResult_NonePaymentSendFailureZ* operator &() const { return &self; } + const LDKCResult_NonePaymentSendFailureZ* operator ->() const { return &self; } +}; +class CResult_HolderCommitmentTransactionDecodeErrorZ { +private: + LDKCResult_HolderCommitmentTransactionDecodeErrorZ self; +public: + CResult_HolderCommitmentTransactionDecodeErrorZ(const CResult_HolderCommitmentTransactionDecodeErrorZ&) = delete; + CResult_HolderCommitmentTransactionDecodeErrorZ(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); } + CResult_HolderCommitmentTransactionDecodeErrorZ(LDKCResult_HolderCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); } + operator LDKCResult_HolderCommitmentTransactionDecodeErrorZ() && { LDKCResult_HolderCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HolderCommitmentTransactionDecodeErrorZ)); return res; } + ~CResult_HolderCommitmentTransactionDecodeErrorZ() { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); } + CResult_HolderCommitmentTransactionDecodeErrorZ& operator=(CResult_HolderCommitmentTransactionDecodeErrorZ&& o) { CResult_HolderCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HolderCommitmentTransactionDecodeErrorZ)); return *this; } + LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() { return &self; } + LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { +class CResult_WarningMessageDecodeErrorZ { private: - LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ self; + LDKCResult_WarningMessageDecodeErrorZ self; public: - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(const CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&) = delete; - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); } - operator LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ() && { LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return res; } - ~CResult_DelayedPaymentOutputDescriptorDecodeErrorZ() { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); } - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ& operator=(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ&& o) { CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentOutputDescriptorDecodeErrorZ)); return *this; } - LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() { return &self; } - LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } + CResult_WarningMessageDecodeErrorZ(const CResult_WarningMessageDecodeErrorZ&) = delete; + CResult_WarningMessageDecodeErrorZ(CResult_WarningMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_WarningMessageDecodeErrorZ)); } + CResult_WarningMessageDecodeErrorZ(LDKCResult_WarningMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_WarningMessageDecodeErrorZ)); } + operator LDKCResult_WarningMessageDecodeErrorZ() && { LDKCResult_WarningMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_WarningMessageDecodeErrorZ)); return res; } + ~CResult_WarningMessageDecodeErrorZ() { CResult_WarningMessageDecodeErrorZ_free(self); } + CResult_WarningMessageDecodeErrorZ& operator=(CResult_WarningMessageDecodeErrorZ&& o) { CResult_WarningMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_WarningMessageDecodeErrorZ)); return *this; } + LDKCResult_WarningMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_WarningMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_WarningMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_WarningMessageDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_PaymentHashPaymentIdZ { +class CResult_ChannelCounterpartyDecodeErrorZ { private: - LDKC2Tuple_PaymentHashPaymentIdZ self; + LDKCResult_ChannelCounterpartyDecodeErrorZ self; public: - C2Tuple_PaymentHashPaymentIdZ(const C2Tuple_PaymentHashPaymentIdZ&) = delete; - C2Tuple_PaymentHashPaymentIdZ(C2Tuple_PaymentHashPaymentIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentIdZ)); } - C2Tuple_PaymentHashPaymentIdZ(LDKC2Tuple_PaymentHashPaymentIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentIdZ)); } - operator LDKC2Tuple_PaymentHashPaymentIdZ() && { LDKC2Tuple_PaymentHashPaymentIdZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentIdZ)); return res; } - ~C2Tuple_PaymentHashPaymentIdZ() { C2Tuple_PaymentHashPaymentIdZ_free(self); } - C2Tuple_PaymentHashPaymentIdZ& operator=(C2Tuple_PaymentHashPaymentIdZ&& o) { C2Tuple_PaymentHashPaymentIdZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentIdZ)); return *this; } - LDKC2Tuple_PaymentHashPaymentIdZ* operator &() { return &self; } - LDKC2Tuple_PaymentHashPaymentIdZ* operator ->() { return &self; } - const LDKC2Tuple_PaymentHashPaymentIdZ* operator &() const { return &self; } - const LDKC2Tuple_PaymentHashPaymentIdZ* operator ->() const { return &self; } + CResult_ChannelCounterpartyDecodeErrorZ(const CResult_ChannelCounterpartyDecodeErrorZ&) = delete; + CResult_ChannelCounterpartyDecodeErrorZ(CResult_ChannelCounterpartyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelCounterpartyDecodeErrorZ)); } + CResult_ChannelCounterpartyDecodeErrorZ(LDKCResult_ChannelCounterpartyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ)); } + operator LDKCResult_ChannelCounterpartyDecodeErrorZ() && { LDKCResult_ChannelCounterpartyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelCounterpartyDecodeErrorZ)); return res; } + ~CResult_ChannelCounterpartyDecodeErrorZ() { CResult_ChannelCounterpartyDecodeErrorZ_free(self); } + CResult_ChannelCounterpartyDecodeErrorZ& operator=(CResult_ChannelCounterpartyDecodeErrorZ&& o) { CResult_ChannelCounterpartyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelCounterpartyDecodeErrorZ)); return *this; } + LDKCResult_ChannelCounterpartyDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelCounterpartyDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelCounterpartyDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ { +class CResult_SignatureNoneZ { private: - LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ self; + LDKCResult_SignatureNoneZ self; public: - CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(const CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&) = delete; - CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); } - CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); } - operator LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ() && { LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); return res; } - ~CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ() { CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(self); } - CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ& operator=(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ&& o) { CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ)); return *this; } - LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator &() { return &self; } - LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentSecretZAPIErrorZ* operator ->() const { return &self; } + CResult_SignatureNoneZ(const CResult_SignatureNoneZ&) = delete; + CResult_SignatureNoneZ(CResult_SignatureNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SignatureNoneZ)); } + CResult_SignatureNoneZ(LDKCResult_SignatureNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SignatureNoneZ)); } + operator LDKCResult_SignatureNoneZ() && { LDKCResult_SignatureNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SignatureNoneZ)); return res; } + ~CResult_SignatureNoneZ() { CResult_SignatureNoneZ_free(self); } + CResult_SignatureNoneZ& operator=(CResult_SignatureNoneZ&& o) { CResult_SignatureNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SignatureNoneZ)); return *this; } + LDKCResult_SignatureNoneZ* operator &() { return &self; } + LDKCResult_SignatureNoneZ* operator ->() { return &self; } + const LDKCResult_SignatureNoneZ* operator &() const { return &self; } + const LDKCResult_SignatureNoneZ* operator ->() const { return &self; } }; -class CResult_NoneErrorZ { +class C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { private: - LDKCResult_NoneErrorZ self; + LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ self; public: - CResult_NoneErrorZ(const CResult_NoneErrorZ&) = delete; - CResult_NoneErrorZ(CResult_NoneErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneErrorZ)); } - CResult_NoneErrorZ(LDKCResult_NoneErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneErrorZ)); } - operator LDKCResult_NoneErrorZ() && { LDKCResult_NoneErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneErrorZ)); return res; } - ~CResult_NoneErrorZ() { CResult_NoneErrorZ_free(self); } - CResult_NoneErrorZ& operator=(CResult_NoneErrorZ&& o) { CResult_NoneErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneErrorZ)); return *this; } - LDKCResult_NoneErrorZ* operator &() { return &self; } - LDKCResult_NoneErrorZ* operator ->() { return &self; } - const LDKCResult_NoneErrorZ* operator &() const { return &self; } - const LDKCResult_NoneErrorZ* operator ->() const { return &self; } + C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(const C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&) = delete; + C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } + C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); } + operator LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() && { LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return res; } + ~C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ() { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); } + C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ& operator=(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ&& o) { C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ)); return *this; } + LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() { return &self; } + LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() { return &self; } + const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator &() const { return &self; } + const LDKC2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ* operator ->() const { return &self; } }; -class CResult_COption_HTLCDestinationZDecodeErrorZ { +class CResult_SecretKeyNoneZ { private: - LDKCResult_COption_HTLCDestinationZDecodeErrorZ self; + LDKCResult_SecretKeyNoneZ self; public: - CResult_COption_HTLCDestinationZDecodeErrorZ(const CResult_COption_HTLCDestinationZDecodeErrorZ&) = delete; - CResult_COption_HTLCDestinationZDecodeErrorZ(CResult_COption_HTLCDestinationZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_HTLCDestinationZDecodeErrorZ)); } - CResult_COption_HTLCDestinationZDecodeErrorZ(LDKCResult_COption_HTLCDestinationZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ)); } - operator LDKCResult_COption_HTLCDestinationZDecodeErrorZ() && { LDKCResult_COption_HTLCDestinationZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_HTLCDestinationZDecodeErrorZ)); return res; } - ~CResult_COption_HTLCDestinationZDecodeErrorZ() { CResult_COption_HTLCDestinationZDecodeErrorZ_free(self); } - CResult_COption_HTLCDestinationZDecodeErrorZ& operator=(CResult_COption_HTLCDestinationZDecodeErrorZ&& o) { CResult_COption_HTLCDestinationZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_HTLCDestinationZDecodeErrorZ)); return *this; } - LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_HTLCDestinationZDecodeErrorZ* operator ->() const { return &self; } + CResult_SecretKeyNoneZ(const CResult_SecretKeyNoneZ&) = delete; + CResult_SecretKeyNoneZ(CResult_SecretKeyNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SecretKeyNoneZ)); } + CResult_SecretKeyNoneZ(LDKCResult_SecretKeyNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SecretKeyNoneZ)); } + operator LDKCResult_SecretKeyNoneZ() && { LDKCResult_SecretKeyNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SecretKeyNoneZ)); return res; } + ~CResult_SecretKeyNoneZ() { CResult_SecretKeyNoneZ_free(self); } + CResult_SecretKeyNoneZ& operator=(CResult_SecretKeyNoneZ&& o) { CResult_SecretKeyNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SecretKeyNoneZ)); return *this; } + LDKCResult_SecretKeyNoneZ* operator &() { return &self; } + LDKCResult_SecretKeyNoneZ* operator ->() { return &self; } + const LDKCResult_SecretKeyNoneZ* operator &() const { return &self; } + const LDKCResult_SecretKeyNoneZ* operator ->() const { return &self; } }; -class CResult_InFlightHtlcsDecodeErrorZ { +class CResult_InitDecodeErrorZ { private: - LDKCResult_InFlightHtlcsDecodeErrorZ self; + LDKCResult_InitDecodeErrorZ self; public: - CResult_InFlightHtlcsDecodeErrorZ(const CResult_InFlightHtlcsDecodeErrorZ&) = delete; - CResult_InFlightHtlcsDecodeErrorZ(CResult_InFlightHtlcsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); } - CResult_InFlightHtlcsDecodeErrorZ(LDKCResult_InFlightHtlcsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); } - operator LDKCResult_InFlightHtlcsDecodeErrorZ() && { LDKCResult_InFlightHtlcsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InFlightHtlcsDecodeErrorZ)); return res; } - ~CResult_InFlightHtlcsDecodeErrorZ() { CResult_InFlightHtlcsDecodeErrorZ_free(self); } - CResult_InFlightHtlcsDecodeErrorZ& operator=(CResult_InFlightHtlcsDecodeErrorZ&& o) { CResult_InFlightHtlcsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InFlightHtlcsDecodeErrorZ)); return *this; } - LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() { return &self; } - LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InFlightHtlcsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InFlightHtlcsDecodeErrorZ* operator ->() const { return &self; } + CResult_InitDecodeErrorZ(const CResult_InitDecodeErrorZ&) = delete; + CResult_InitDecodeErrorZ(CResult_InitDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); } + CResult_InitDecodeErrorZ(LDKCResult_InitDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); } + operator LDKCResult_InitDecodeErrorZ() && { LDKCResult_InitDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InitDecodeErrorZ)); return res; } + ~CResult_InitDecodeErrorZ() { CResult_InitDecodeErrorZ_free(self); } + CResult_InitDecodeErrorZ& operator=(CResult_InitDecodeErrorZ&& o) { CResult_InitDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InitDecodeErrorZ)); return *this; } + LDKCResult_InitDecodeErrorZ* operator &() { return &self; } + LDKCResult_InitDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InitDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InitDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_StringErrorZ { +class CVec_MonitorUpdateIdZ { private: - LDKCResult_StringErrorZ self; + LDKCVec_MonitorUpdateIdZ self; public: - CResult_StringErrorZ(const CResult_StringErrorZ&) = delete; - CResult_StringErrorZ(CResult_StringErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StringErrorZ)); } - CResult_StringErrorZ(LDKCResult_StringErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StringErrorZ)); } - operator LDKCResult_StringErrorZ() && { LDKCResult_StringErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StringErrorZ)); return res; } - ~CResult_StringErrorZ() { CResult_StringErrorZ_free(self); } - CResult_StringErrorZ& operator=(CResult_StringErrorZ&& o) { CResult_StringErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StringErrorZ)); return *this; } - LDKCResult_StringErrorZ* operator &() { return &self; } - LDKCResult_StringErrorZ* operator ->() { return &self; } - const LDKCResult_StringErrorZ* operator &() const { return &self; } - const LDKCResult_StringErrorZ* operator ->() const { return &self; } + CVec_MonitorUpdateIdZ(const CVec_MonitorUpdateIdZ&) = delete; + CVec_MonitorUpdateIdZ(CVec_MonitorUpdateIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MonitorUpdateIdZ)); } + CVec_MonitorUpdateIdZ(LDKCVec_MonitorUpdateIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MonitorUpdateIdZ)); } + operator LDKCVec_MonitorUpdateIdZ() && { LDKCVec_MonitorUpdateIdZ res = self; memset(&self, 0, sizeof(LDKCVec_MonitorUpdateIdZ)); return res; } + ~CVec_MonitorUpdateIdZ() { CVec_MonitorUpdateIdZ_free(self); } + CVec_MonitorUpdateIdZ& operator=(CVec_MonitorUpdateIdZ&& o) { CVec_MonitorUpdateIdZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MonitorUpdateIdZ)); return *this; } + LDKCVec_MonitorUpdateIdZ* operator &() { return &self; } + LDKCVec_MonitorUpdateIdZ* operator ->() { return &self; } + const LDKCVec_MonitorUpdateIdZ* operator &() const { return &self; } + const LDKCVec_MonitorUpdateIdZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +class CResult_PaymentPurposeDecodeErrorZ { private: - LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ self; + LDKCResult_PaymentPurposeDecodeErrorZ self; public: - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(const CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&) = delete; - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); } - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); } - operator LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ() && { LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); return res; } - ~CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ() { CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(self); } - CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ& operator=(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& o) { CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); return *this; } - LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator &() { return &self; } - LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator ->() const { return &self; } + CResult_PaymentPurposeDecodeErrorZ(const CResult_PaymentPurposeDecodeErrorZ&) = delete; + CResult_PaymentPurposeDecodeErrorZ(CResult_PaymentPurposeDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); } + CResult_PaymentPurposeDecodeErrorZ(LDKCResult_PaymentPurposeDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); } + operator LDKCResult_PaymentPurposeDecodeErrorZ() && { LDKCResult_PaymentPurposeDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentPurposeDecodeErrorZ)); return res; } + ~CResult_PaymentPurposeDecodeErrorZ() { CResult_PaymentPurposeDecodeErrorZ_free(self); } + CResult_PaymentPurposeDecodeErrorZ& operator=(CResult_PaymentPurposeDecodeErrorZ&& o) { CResult_PaymentPurposeDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentPurposeDecodeErrorZ)); return *this; } + LDKCResult_PaymentPurposeDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentPurposeDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentPurposeDecodeErrorZ* operator ->() const { return &self; } }; -class COption_EventZ { +class CResult_OutPointDecodeErrorZ { private: - LDKCOption_EventZ self; + LDKCResult_OutPointDecodeErrorZ self; public: - COption_EventZ(const COption_EventZ&) = delete; - COption_EventZ(COption_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_EventZ)); } - COption_EventZ(LDKCOption_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_EventZ)); } - operator LDKCOption_EventZ() && { LDKCOption_EventZ res = self; memset(&self, 0, sizeof(LDKCOption_EventZ)); return res; } - ~COption_EventZ() { COption_EventZ_free(self); } - COption_EventZ& operator=(COption_EventZ&& o) { COption_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_EventZ)); return *this; } - LDKCOption_EventZ* operator &() { return &self; } - LDKCOption_EventZ* operator ->() { return &self; } - const LDKCOption_EventZ* operator &() const { return &self; } - const LDKCOption_EventZ* operator ->() const { return &self; } + CResult_OutPointDecodeErrorZ(const CResult_OutPointDecodeErrorZ&) = delete; + CResult_OutPointDecodeErrorZ(CResult_OutPointDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); } + CResult_OutPointDecodeErrorZ(LDKCResult_OutPointDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); } + operator LDKCResult_OutPointDecodeErrorZ() && { LDKCResult_OutPointDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutPointDecodeErrorZ)); return res; } + ~CResult_OutPointDecodeErrorZ() { CResult_OutPointDecodeErrorZ_free(self); } + CResult_OutPointDecodeErrorZ& operator=(CResult_OutPointDecodeErrorZ&& o) { CResult_OutPointDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutPointDecodeErrorZ)); return *this; } + LDKCResult_OutPointDecodeErrorZ* operator &() { return &self; } + LDKCResult_OutPointDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OutPointDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OutPointDecodeErrorZ* operator ->() const { return &self; } }; -class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +class CVec_ChannelDetailsZ { private: - LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ self; + LDKCVec_ChannelDetailsZ self; public: - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(const C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&) = delete; - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); } - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); } - operator LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ() && { LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); return res; } - ~C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ() { C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(self); } - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ& operator=(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& o) { C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); return *this; } - LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() { return &self; } - LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() const { return &self; } - const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() const { return &self; } + CVec_ChannelDetailsZ(const CVec_ChannelDetailsZ&) = delete; + CVec_ChannelDetailsZ(CVec_ChannelDetailsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); } + CVec_ChannelDetailsZ(LDKCVec_ChannelDetailsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_ChannelDetailsZ)); } + operator LDKCVec_ChannelDetailsZ() && { LDKCVec_ChannelDetailsZ res = self; memset(&self, 0, sizeof(LDKCVec_ChannelDetailsZ)); return res; } + ~CVec_ChannelDetailsZ() { CVec_ChannelDetailsZ_free(self); } + CVec_ChannelDetailsZ& operator=(CVec_ChannelDetailsZ&& o) { CVec_ChannelDetailsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_ChannelDetailsZ)); return *this; } + LDKCVec_ChannelDetailsZ* operator &() { return &self; } + LDKCVec_ChannelDetailsZ* operator ->() { return &self; } + const LDKCVec_ChannelDetailsZ* operator &() const { return &self; } + const LDKCVec_ChannelDetailsZ* operator ->() const { return &self; } }; -class CResult_ChannelTypeFeaturesDecodeErrorZ { +class CVec_MessageSendEventZ { private: - LDKCResult_ChannelTypeFeaturesDecodeErrorZ self; + LDKCVec_MessageSendEventZ self; public: - CResult_ChannelTypeFeaturesDecodeErrorZ(const CResult_ChannelTypeFeaturesDecodeErrorZ&) = delete; - CResult_ChannelTypeFeaturesDecodeErrorZ(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); } - CResult_ChannelTypeFeaturesDecodeErrorZ(LDKCResult_ChannelTypeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); } - operator LDKCResult_ChannelTypeFeaturesDecodeErrorZ() && { LDKCResult_ChannelTypeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); return res; } - ~CResult_ChannelTypeFeaturesDecodeErrorZ() { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); } - CResult_ChannelTypeFeaturesDecodeErrorZ& operator=(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); return *this; } - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() const { return &self; } + CVec_MessageSendEventZ(const CVec_MessageSendEventZ&) = delete; + CVec_MessageSendEventZ(CVec_MessageSendEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_MessageSendEventZ)); } + CVec_MessageSendEventZ(LDKCVec_MessageSendEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_MessageSendEventZ)); } + operator LDKCVec_MessageSendEventZ() && { LDKCVec_MessageSendEventZ res = self; memset(&self, 0, sizeof(LDKCVec_MessageSendEventZ)); return res; } + ~CVec_MessageSendEventZ() { CVec_MessageSendEventZ_free(self); } + CVec_MessageSendEventZ& operator=(CVec_MessageSendEventZ&& o) { CVec_MessageSendEventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_MessageSendEventZ)); return *this; } + LDKCVec_MessageSendEventZ* operator &() { return &self; } + LDKCVec_MessageSendEventZ* operator ->() { return &self; } + const LDKCVec_MessageSendEventZ* operator &() const { return &self; } + const LDKCVec_MessageSendEventZ* operator ->() const { return &self; } }; -class CResult_SiPrefixParseErrorZ { +class COption_NetAddressZ { private: - LDKCResult_SiPrefixParseErrorZ self; + LDKCOption_NetAddressZ self; public: - CResult_SiPrefixParseErrorZ(const CResult_SiPrefixParseErrorZ&) = delete; - CResult_SiPrefixParseErrorZ(CResult_SiPrefixParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixParseErrorZ)); } - CResult_SiPrefixParseErrorZ(LDKCResult_SiPrefixParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixParseErrorZ)); } - operator LDKCResult_SiPrefixParseErrorZ() && { LDKCResult_SiPrefixParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixParseErrorZ)); return res; } - ~CResult_SiPrefixParseErrorZ() { CResult_SiPrefixParseErrorZ_free(self); } - CResult_SiPrefixParseErrorZ& operator=(CResult_SiPrefixParseErrorZ&& o) { CResult_SiPrefixParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixParseErrorZ)); return *this; } - LDKCResult_SiPrefixParseErrorZ* operator &() { return &self; } - LDKCResult_SiPrefixParseErrorZ* operator ->() { return &self; } - const LDKCResult_SiPrefixParseErrorZ* operator &() const { return &self; } - const LDKCResult_SiPrefixParseErrorZ* operator ->() const { return &self; } + COption_NetAddressZ(const COption_NetAddressZ&) = delete; + COption_NetAddressZ(COption_NetAddressZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_NetAddressZ)); } + COption_NetAddressZ(LDKCOption_NetAddressZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_NetAddressZ)); } + operator LDKCOption_NetAddressZ() && { LDKCOption_NetAddressZ res = self; memset(&self, 0, sizeof(LDKCOption_NetAddressZ)); return res; } + ~COption_NetAddressZ() { COption_NetAddressZ_free(self); } + COption_NetAddressZ& operator=(COption_NetAddressZ&& o) { COption_NetAddressZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_NetAddressZ)); return *this; } + LDKCOption_NetAddressZ* operator &() { return &self; } + LDKCOption_NetAddressZ* operator ->() { return &self; } + const LDKCOption_NetAddressZ* operator &() const { return &self; } + const LDKCOption_NetAddressZ* operator ->() const { return &self; } }; -class CVec_RouteHintZ { +class C2Tuple_OutPointScriptZ { private: - LDKCVec_RouteHintZ self; + LDKC2Tuple_OutPointScriptZ self; public: - CVec_RouteHintZ(const CVec_RouteHintZ&) = delete; - CVec_RouteHintZ(CVec_RouteHintZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintZ)); } - CVec_RouteHintZ(LDKCVec_RouteHintZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintZ)); } - operator LDKCVec_RouteHintZ() && { LDKCVec_RouteHintZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintZ)); return res; } - ~CVec_RouteHintZ() { CVec_RouteHintZ_free(self); } - CVec_RouteHintZ& operator=(CVec_RouteHintZ&& o) { CVec_RouteHintZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintZ)); return *this; } - LDKCVec_RouteHintZ* operator &() { return &self; } - LDKCVec_RouteHintZ* operator ->() { return &self; } - const LDKCVec_RouteHintZ* operator &() const { return &self; } - const LDKCVec_RouteHintZ* operator ->() const { return &self; } + C2Tuple_OutPointScriptZ(const C2Tuple_OutPointScriptZ&) = delete; + C2Tuple_OutPointScriptZ(C2Tuple_OutPointScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); } + C2Tuple_OutPointScriptZ(LDKC2Tuple_OutPointScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); } + operator LDKC2Tuple_OutPointScriptZ() && { LDKC2Tuple_OutPointScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_OutPointScriptZ)); return res; } + ~C2Tuple_OutPointScriptZ() { C2Tuple_OutPointScriptZ_free(self); } + C2Tuple_OutPointScriptZ& operator=(C2Tuple_OutPointScriptZ&& o) { C2Tuple_OutPointScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_OutPointScriptZ)); return *this; } + LDKC2Tuple_OutPointScriptZ* operator &() { return &self; } + LDKC2Tuple_OutPointScriptZ* operator ->() { return &self; } + const LDKC2Tuple_OutPointScriptZ* operator &() const { return &self; } + const LDKC2Tuple_OutPointScriptZ* operator ->() const { return &self; } }; -class COption_u16Z { +class CResult_RouteHintHopDecodeErrorZ { private: - LDKCOption_u16Z self; + LDKCResult_RouteHintHopDecodeErrorZ self; public: - COption_u16Z(const COption_u16Z&) = delete; - COption_u16Z(COption_u16Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u16Z)); } - COption_u16Z(LDKCOption_u16Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u16Z)); } - operator LDKCOption_u16Z() && { LDKCOption_u16Z res = self; memset(&self, 0, sizeof(LDKCOption_u16Z)); return res; } - ~COption_u16Z() { COption_u16Z_free(self); } - COption_u16Z& operator=(COption_u16Z&& o) { COption_u16Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u16Z)); return *this; } - LDKCOption_u16Z* operator &() { return &self; } - LDKCOption_u16Z* operator ->() { return &self; } - const LDKCOption_u16Z* operator &() const { return &self; } - const LDKCOption_u16Z* operator ->() const { return &self; } + CResult_RouteHintHopDecodeErrorZ(const CResult_RouteHintHopDecodeErrorZ&) = delete; + CResult_RouteHintHopDecodeErrorZ(CResult_RouteHintHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); } + CResult_RouteHintHopDecodeErrorZ(LDKCResult_RouteHintHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); } + operator LDKCResult_RouteHintHopDecodeErrorZ() && { LDKCResult_RouteHintHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteHintHopDecodeErrorZ)); return res; } + ~CResult_RouteHintHopDecodeErrorZ() { CResult_RouteHintHopDecodeErrorZ_free(self); } + CResult_RouteHintHopDecodeErrorZ& operator=(CResult_RouteHintHopDecodeErrorZ&& o) { CResult_RouteHintHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteHintHopDecodeErrorZ)); return *this; } + LDKCResult_RouteHintHopDecodeErrorZ* operator &() { return &self; } + LDKCResult_RouteHintHopDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_RouteHintHopDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_RouteHintHopDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_BlindedHopDecodeErrorZ { +class CResult_C2Tuple_SignatureSignatureZNoneZ { private: - LDKCResult_BlindedHopDecodeErrorZ self; + LDKCResult_C2Tuple_SignatureSignatureZNoneZ self; public: - CResult_BlindedHopDecodeErrorZ(const CResult_BlindedHopDecodeErrorZ&) = delete; - CResult_BlindedHopDecodeErrorZ(CResult_BlindedHopDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); } - CResult_BlindedHopDecodeErrorZ(LDKCResult_BlindedHopDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); } - operator LDKCResult_BlindedHopDecodeErrorZ() && { LDKCResult_BlindedHopDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopDecodeErrorZ)); return res; } - ~CResult_BlindedHopDecodeErrorZ() { CResult_BlindedHopDecodeErrorZ_free(self); } - CResult_BlindedHopDecodeErrorZ& operator=(CResult_BlindedHopDecodeErrorZ&& o) { CResult_BlindedHopDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopDecodeErrorZ)); return *this; } - LDKCResult_BlindedHopDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedHopDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedHopDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedHopDecodeErrorZ* operator ->() const { return &self; } + CResult_C2Tuple_SignatureSignatureZNoneZ(const CResult_C2Tuple_SignatureSignatureZNoneZ&) = delete; + CResult_C2Tuple_SignatureSignatureZNoneZ(CResult_C2Tuple_SignatureSignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureSignatureZNoneZ)); } + CResult_C2Tuple_SignatureSignatureZNoneZ(LDKCResult_C2Tuple_SignatureSignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ)); } + operator LDKCResult_C2Tuple_SignatureSignatureZNoneZ() && { LDKCResult_C2Tuple_SignatureSignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureSignatureZNoneZ)); return res; } + ~CResult_C2Tuple_SignatureSignatureZNoneZ() { CResult_C2Tuple_SignatureSignatureZNoneZ_free(self); } + CResult_C2Tuple_SignatureSignatureZNoneZ& operator=(CResult_C2Tuple_SignatureSignatureZNoneZ&& o) { CResult_C2Tuple_SignatureSignatureZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureSignatureZNoneZ)); return *this; } + LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_SignatureSignatureZNoneZ* operator ->() const { return &self; } }; -class CVec_CVec_RouteHopZZ { +class CResult_UpdateFailMalformedHTLCDecodeErrorZ { private: - LDKCVec_CVec_RouteHopZZ self; + LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ self; public: - CVec_CVec_RouteHopZZ(const CVec_CVec_RouteHopZZ&) = delete; - CVec_CVec_RouteHopZZ(CVec_CVec_RouteHopZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); } - CVec_CVec_RouteHopZZ(LDKCVec_CVec_RouteHopZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); } - operator LDKCVec_CVec_RouteHopZZ() && { LDKCVec_CVec_RouteHopZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); return res; } - ~CVec_CVec_RouteHopZZ() { CVec_CVec_RouteHopZZ_free(self); } - CVec_CVec_RouteHopZZ& operator=(CVec_CVec_RouteHopZZ&& o) { CVec_CVec_RouteHopZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); return *this; } - LDKCVec_CVec_RouteHopZZ* operator &() { return &self; } - LDKCVec_CVec_RouteHopZZ* operator ->() { return &self; } - const LDKCVec_CVec_RouteHopZZ* operator &() const { return &self; } - const LDKCVec_CVec_RouteHopZZ* operator ->() const { return &self; } + CResult_UpdateFailMalformedHTLCDecodeErrorZ(const CResult_UpdateFailMalformedHTLCDecodeErrorZ&) = delete; + CResult_UpdateFailMalformedHTLCDecodeErrorZ(CResult_UpdateFailMalformedHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFailMalformedHTLCDecodeErrorZ)); } + CResult_UpdateFailMalformedHTLCDecodeErrorZ(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ)); } + operator LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ() && { LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ)); return res; } + ~CResult_UpdateFailMalformedHTLCDecodeErrorZ() { CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(self); } + CResult_UpdateFailMalformedHTLCDecodeErrorZ& operator=(CResult_UpdateFailMalformedHTLCDecodeErrorZ&& o) { CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFailMalformedHTLCDecodeErrorZ)); return *this; } + LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator &() { return &self; } + LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateFailMalformedHTLCDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_TrustedCommitmentTransactionNoneZ { +class CResult_SharedSecretNoneZ { private: - LDKCResult_TrustedCommitmentTransactionNoneZ self; + LDKCResult_SharedSecretNoneZ self; public: - CResult_TrustedCommitmentTransactionNoneZ(const CResult_TrustedCommitmentTransactionNoneZ&) = delete; - CResult_TrustedCommitmentTransactionNoneZ(CResult_TrustedCommitmentTransactionNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TrustedCommitmentTransactionNoneZ)); } - CResult_TrustedCommitmentTransactionNoneZ(LDKCResult_TrustedCommitmentTransactionNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); } - operator LDKCResult_TrustedCommitmentTransactionNoneZ() && { LDKCResult_TrustedCommitmentTransactionNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_TrustedCommitmentTransactionNoneZ)); return res; } - ~CResult_TrustedCommitmentTransactionNoneZ() { CResult_TrustedCommitmentTransactionNoneZ_free(self); } - CResult_TrustedCommitmentTransactionNoneZ& operator=(CResult_TrustedCommitmentTransactionNoneZ&& o) { CResult_TrustedCommitmentTransactionNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TrustedCommitmentTransactionNoneZ)); return *this; } - LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() { return &self; } - LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() { return &self; } - const LDKCResult_TrustedCommitmentTransactionNoneZ* operator &() const { return &self; } - const LDKCResult_TrustedCommitmentTransactionNoneZ* operator ->() const { return &self; } + CResult_SharedSecretNoneZ(const CResult_SharedSecretNoneZ&) = delete; + CResult_SharedSecretNoneZ(CResult_SharedSecretNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SharedSecretNoneZ)); } + CResult_SharedSecretNoneZ(LDKCResult_SharedSecretNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SharedSecretNoneZ)); } + operator LDKCResult_SharedSecretNoneZ() && { LDKCResult_SharedSecretNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_SharedSecretNoneZ)); return res; } + ~CResult_SharedSecretNoneZ() { CResult_SharedSecretNoneZ_free(self); } + CResult_SharedSecretNoneZ& operator=(CResult_SharedSecretNoneZ&& o) { CResult_SharedSecretNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SharedSecretNoneZ)); return *this; } + LDKCResult_SharedSecretNoneZ* operator &() { return &self; } + LDKCResult_SharedSecretNoneZ* operator ->() { return &self; } + const LDKCResult_SharedSecretNoneZ* operator &() const { return &self; } + const LDKCResult_SharedSecretNoneZ* operator ->() const { return &self; } }; -class CResult_FixedPenaltyScorerDecodeErrorZ { +class CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ { private: - LDKCResult_FixedPenaltyScorerDecodeErrorZ self; + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ self; public: - CResult_FixedPenaltyScorerDecodeErrorZ(const CResult_FixedPenaltyScorerDecodeErrorZ&) = delete; - CResult_FixedPenaltyScorerDecodeErrorZ(CResult_FixedPenaltyScorerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_FixedPenaltyScorerDecodeErrorZ)); } - CResult_FixedPenaltyScorerDecodeErrorZ(LDKCResult_FixedPenaltyScorerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ)); } - operator LDKCResult_FixedPenaltyScorerDecodeErrorZ() && { LDKCResult_FixedPenaltyScorerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_FixedPenaltyScorerDecodeErrorZ)); return res; } - ~CResult_FixedPenaltyScorerDecodeErrorZ() { CResult_FixedPenaltyScorerDecodeErrorZ_free(self); } - CResult_FixedPenaltyScorerDecodeErrorZ& operator=(CResult_FixedPenaltyScorerDecodeErrorZ&& o) { CResult_FixedPenaltyScorerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_FixedPenaltyScorerDecodeErrorZ)); return *this; } - LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator &() { return &self; } - LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_FixedPenaltyScorerDecodeErrorZ* operator ->() const { return &self; } + CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(const CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&) = delete; + CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } + CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); } + operator LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() && { LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return res; } + ~CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ() { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); } + CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ& operator=(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ&& o) { CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ)); return *this; } + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* operator ->() const { return &self; } }; -class CResult_NoneLightningErrorZ { +class CResult_CVec_CVec_u8ZZNoneZ { private: - LDKCResult_NoneLightningErrorZ self; + LDKCResult_CVec_CVec_u8ZZNoneZ self; public: - CResult_NoneLightningErrorZ(const CResult_NoneLightningErrorZ&) = delete; - CResult_NoneLightningErrorZ(CResult_NoneLightningErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); } - CResult_NoneLightningErrorZ(LDKCResult_NoneLightningErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); } - operator LDKCResult_NoneLightningErrorZ() && { LDKCResult_NoneLightningErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneLightningErrorZ)); return res; } - ~CResult_NoneLightningErrorZ() { CResult_NoneLightningErrorZ_free(self); } - CResult_NoneLightningErrorZ& operator=(CResult_NoneLightningErrorZ&& o) { CResult_NoneLightningErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneLightningErrorZ)); return *this; } - LDKCResult_NoneLightningErrorZ* operator &() { return &self; } - LDKCResult_NoneLightningErrorZ* operator ->() { return &self; } - const LDKCResult_NoneLightningErrorZ* operator &() const { return &self; } - const LDKCResult_NoneLightningErrorZ* operator ->() const { return &self; } + CResult_CVec_CVec_u8ZZNoneZ(const CResult_CVec_CVec_u8ZZNoneZ&) = delete; + CResult_CVec_CVec_u8ZZNoneZ(CResult_CVec_CVec_u8ZZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_CVec_u8ZZNoneZ)); } + CResult_CVec_CVec_u8ZZNoneZ(LDKCResult_CVec_CVec_u8ZZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ)); } + operator LDKCResult_CVec_CVec_u8ZZNoneZ() && { LDKCResult_CVec_CVec_u8ZZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_CVec_u8ZZNoneZ)); return res; } + ~CResult_CVec_CVec_u8ZZNoneZ() { CResult_CVec_CVec_u8ZZNoneZ_free(self); } + CResult_CVec_CVec_u8ZZNoneZ& operator=(CResult_CVec_CVec_u8ZZNoneZ&& o) { CResult_CVec_CVec_u8ZZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_CVec_u8ZZNoneZ)); return *this; } + LDKCResult_CVec_CVec_u8ZZNoneZ* operator &() { return &self; } + LDKCResult_CVec_CVec_u8ZZNoneZ* operator ->() { return &self; } + const LDKCResult_CVec_CVec_u8ZZNoneZ* operator &() const { return &self; } + const LDKCResult_CVec_CVec_u8ZZNoneZ* operator ->() const { return &self; } }; -class CResult_NonePeerHandleErrorZ { +class C2Tuple_PaymentHashPaymentSecretZ { private: - LDKCResult_NonePeerHandleErrorZ self; + LDKC2Tuple_PaymentHashPaymentSecretZ self; public: - CResult_NonePeerHandleErrorZ(const CResult_NonePeerHandleErrorZ&) = delete; - CResult_NonePeerHandleErrorZ(CResult_NonePeerHandleErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); } - CResult_NonePeerHandleErrorZ(LDKCResult_NonePeerHandleErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); } - operator LDKCResult_NonePeerHandleErrorZ() && { LDKCResult_NonePeerHandleErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NonePeerHandleErrorZ)); return res; } - ~CResult_NonePeerHandleErrorZ() { CResult_NonePeerHandleErrorZ_free(self); } - CResult_NonePeerHandleErrorZ& operator=(CResult_NonePeerHandleErrorZ&& o) { CResult_NonePeerHandleErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NonePeerHandleErrorZ)); return *this; } - LDKCResult_NonePeerHandleErrorZ* operator &() { return &self; } - LDKCResult_NonePeerHandleErrorZ* operator ->() { return &self; } - const LDKCResult_NonePeerHandleErrorZ* operator &() const { return &self; } - const LDKCResult_NonePeerHandleErrorZ* operator ->() const { return &self; } + C2Tuple_PaymentHashPaymentSecretZ(const C2Tuple_PaymentHashPaymentSecretZ&) = delete; + C2Tuple_PaymentHashPaymentSecretZ(C2Tuple_PaymentHashPaymentSecretZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentSecretZ)); } + C2Tuple_PaymentHashPaymentSecretZ(LDKC2Tuple_PaymentHashPaymentSecretZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ)); } + operator LDKC2Tuple_PaymentHashPaymentSecretZ() && { LDKC2Tuple_PaymentHashPaymentSecretZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PaymentHashPaymentSecretZ)); return res; } + ~C2Tuple_PaymentHashPaymentSecretZ() { C2Tuple_PaymentHashPaymentSecretZ_free(self); } + C2Tuple_PaymentHashPaymentSecretZ& operator=(C2Tuple_PaymentHashPaymentSecretZ&& o) { C2Tuple_PaymentHashPaymentSecretZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PaymentHashPaymentSecretZ)); return *this; } + LDKC2Tuple_PaymentHashPaymentSecretZ* operator &() { return &self; } + LDKC2Tuple_PaymentHashPaymentSecretZ* operator ->() { return &self; } + const LDKC2Tuple_PaymentHashPaymentSecretZ* operator &() const { return &self; } + const LDKC2Tuple_PaymentHashPaymentSecretZ* operator ->() const { return &self; } }; -class CResult_COption_EventZDecodeErrorZ { +class CResult_AcceptChannelDecodeErrorZ { private: - LDKCResult_COption_EventZDecodeErrorZ self; + LDKCResult_AcceptChannelDecodeErrorZ self; public: - CResult_COption_EventZDecodeErrorZ(const CResult_COption_EventZDecodeErrorZ&) = delete; - CResult_COption_EventZDecodeErrorZ(CResult_COption_EventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); } - CResult_COption_EventZDecodeErrorZ(LDKCResult_COption_EventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); } - operator LDKCResult_COption_EventZDecodeErrorZ() && { LDKCResult_COption_EventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_EventZDecodeErrorZ)); return res; } - ~CResult_COption_EventZDecodeErrorZ() { CResult_COption_EventZDecodeErrorZ_free(self); } - CResult_COption_EventZDecodeErrorZ& operator=(CResult_COption_EventZDecodeErrorZ&& o) { CResult_COption_EventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_EventZDecodeErrorZ)); return *this; } - LDKCResult_COption_EventZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_EventZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_EventZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_EventZDecodeErrorZ* operator ->() const { return &self; } + CResult_AcceptChannelDecodeErrorZ(const CResult_AcceptChannelDecodeErrorZ&) = delete; + CResult_AcceptChannelDecodeErrorZ(CResult_AcceptChannelDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); } + CResult_AcceptChannelDecodeErrorZ(LDKCResult_AcceptChannelDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); } + operator LDKCResult_AcceptChannelDecodeErrorZ() && { LDKCResult_AcceptChannelDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AcceptChannelDecodeErrorZ)); return res; } + ~CResult_AcceptChannelDecodeErrorZ() { CResult_AcceptChannelDecodeErrorZ_free(self); } + CResult_AcceptChannelDecodeErrorZ& operator=(CResult_AcceptChannelDecodeErrorZ&& o) { CResult_AcceptChannelDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AcceptChannelDecodeErrorZ)); return *this; } + LDKCResult_AcceptChannelDecodeErrorZ* operator &() { return &self; } + LDKCResult_AcceptChannelDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AcceptChannelDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AcceptChannelDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CVec_SignatureZNoneZ { +class CVec_SignatureZ { private: - LDKCResult_CVec_SignatureZNoneZ self; + LDKCVec_SignatureZ self; public: - CResult_CVec_SignatureZNoneZ(const CResult_CVec_SignatureZNoneZ&) = delete; - CResult_CVec_SignatureZNoneZ(CResult_CVec_SignatureZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); } - CResult_CVec_SignatureZNoneZ(LDKCResult_CVec_SignatureZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); } - operator LDKCResult_CVec_SignatureZNoneZ() && { LDKCResult_CVec_SignatureZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_SignatureZNoneZ)); return res; } - ~CResult_CVec_SignatureZNoneZ() { CResult_CVec_SignatureZNoneZ_free(self); } - CResult_CVec_SignatureZNoneZ& operator=(CResult_CVec_SignatureZNoneZ&& o) { CResult_CVec_SignatureZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_SignatureZNoneZ)); return *this; } - LDKCResult_CVec_SignatureZNoneZ* operator &() { return &self; } - LDKCResult_CVec_SignatureZNoneZ* operator ->() { return &self; } - const LDKCResult_CVec_SignatureZNoneZ* operator &() const { return &self; } - const LDKCResult_CVec_SignatureZNoneZ* operator ->() const { return &self; } + CVec_SignatureZ(const CVec_SignatureZ&) = delete; + CVec_SignatureZ(CVec_SignatureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_SignatureZ)); } + CVec_SignatureZ(LDKCVec_SignatureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_SignatureZ)); } + operator LDKCVec_SignatureZ() && { LDKCVec_SignatureZ res = self; memset(&self, 0, sizeof(LDKCVec_SignatureZ)); return res; } + ~CVec_SignatureZ() { CVec_SignatureZ_free(self); } + CVec_SignatureZ& operator=(CVec_SignatureZ&& o) { CVec_SignatureZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_SignatureZ)); return *this; } + LDKCVec_SignatureZ* operator &() { return &self; } + LDKCVec_SignatureZ* operator ->() { return &self; } + const LDKCVec_SignatureZ* operator &() const { return &self; } + const LDKCVec_SignatureZ* operator ->() const { return &self; } }; -class COption_CVec_NetAddressZZ { +class CVec_u64Z { private: - LDKCOption_CVec_NetAddressZZ self; + LDKCVec_u64Z self; public: - COption_CVec_NetAddressZZ(const COption_CVec_NetAddressZZ&) = delete; - COption_CVec_NetAddressZZ(COption_CVec_NetAddressZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); } - COption_CVec_NetAddressZZ(LDKCOption_CVec_NetAddressZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); } - operator LDKCOption_CVec_NetAddressZZ() && { LDKCOption_CVec_NetAddressZZ res = self; memset(&self, 0, sizeof(LDKCOption_CVec_NetAddressZZ)); return res; } - ~COption_CVec_NetAddressZZ() { COption_CVec_NetAddressZZ_free(self); } - COption_CVec_NetAddressZZ& operator=(COption_CVec_NetAddressZZ&& o) { COption_CVec_NetAddressZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_CVec_NetAddressZZ)); return *this; } - LDKCOption_CVec_NetAddressZZ* operator &() { return &self; } - LDKCOption_CVec_NetAddressZZ* operator ->() { return &self; } - const LDKCOption_CVec_NetAddressZZ* operator &() const { return &self; } - const LDKCOption_CVec_NetAddressZZ* operator ->() const { return &self; } + CVec_u64Z(const CVec_u64Z&) = delete; + CVec_u64Z(CVec_u64Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u64Z)); } + CVec_u64Z(LDKCVec_u64Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u64Z)); } + operator LDKCVec_u64Z() && { LDKCVec_u64Z res = self; memset(&self, 0, sizeof(LDKCVec_u64Z)); return res; } + ~CVec_u64Z() { CVec_u64Z_free(self); } + CVec_u64Z& operator=(CVec_u64Z&& o) { CVec_u64Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u64Z)); return *this; } + LDKCVec_u64Z* operator &() { return &self; } + LDKCVec_u64Z* operator ->() { return &self; } + const LDKCVec_u64Z* operator &() const { return &self; } + const LDKCVec_u64Z* operator ->() const { return &self; } }; -class CResult__u832APIErrorZ { +class CResult_StringErrorZ { private: - LDKCResult__u832APIErrorZ self; + LDKCResult_StringErrorZ self; public: - CResult__u832APIErrorZ(const CResult__u832APIErrorZ&) = delete; - CResult__u832APIErrorZ(CResult__u832APIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult__u832APIErrorZ)); } - CResult__u832APIErrorZ(LDKCResult__u832APIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult__u832APIErrorZ)); } - operator LDKCResult__u832APIErrorZ() && { LDKCResult__u832APIErrorZ res = self; memset(&self, 0, sizeof(LDKCResult__u832APIErrorZ)); return res; } - ~CResult__u832APIErrorZ() { CResult__u832APIErrorZ_free(self); } - CResult__u832APIErrorZ& operator=(CResult__u832APIErrorZ&& o) { CResult__u832APIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult__u832APIErrorZ)); return *this; } - LDKCResult__u832APIErrorZ* operator &() { return &self; } - LDKCResult__u832APIErrorZ* operator ->() { return &self; } - const LDKCResult__u832APIErrorZ* operator &() const { return &self; } - const LDKCResult__u832APIErrorZ* operator ->() const { return &self; } + CResult_StringErrorZ(const CResult_StringErrorZ&) = delete; + CResult_StringErrorZ(CResult_StringErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_StringErrorZ)); } + CResult_StringErrorZ(LDKCResult_StringErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_StringErrorZ)); } + operator LDKCResult_StringErrorZ() && { LDKCResult_StringErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_StringErrorZ)); return res; } + ~CResult_StringErrorZ() { CResult_StringErrorZ_free(self); } + CResult_StringErrorZ& operator=(CResult_StringErrorZ&& o) { CResult_StringErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_StringErrorZ)); return *this; } + LDKCResult_StringErrorZ* operator &() { return &self; } + LDKCResult_StringErrorZ* operator ->() { return &self; } + const LDKCResult_StringErrorZ* operator &() const { return &self; } + const LDKCResult_StringErrorZ* operator ->() const { return &self; } }; -class CResult_PaymentIdPaymentErrorZ { +class C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { private: - LDKCResult_PaymentIdPaymentErrorZ self; + LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ self; public: - CResult_PaymentIdPaymentErrorZ(const CResult_PaymentIdPaymentErrorZ&) = delete; - CResult_PaymentIdPaymentErrorZ(CResult_PaymentIdPaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); } - CResult_PaymentIdPaymentErrorZ(LDKCResult_PaymentIdPaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); } - operator LDKCResult_PaymentIdPaymentErrorZ() && { LDKCResult_PaymentIdPaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentIdPaymentErrorZ)); return res; } - ~CResult_PaymentIdPaymentErrorZ() { CResult_PaymentIdPaymentErrorZ_free(self); } - CResult_PaymentIdPaymentErrorZ& operator=(CResult_PaymentIdPaymentErrorZ&& o) { CResult_PaymentIdPaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentIdPaymentErrorZ)); return *this; } - LDKCResult_PaymentIdPaymentErrorZ* operator &() { return &self; } - LDKCResult_PaymentIdPaymentErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentIdPaymentErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentIdPaymentErrorZ* operator ->() const { return &self; } + C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(const C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&) = delete; + C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); } + C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); } + operator LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ() && { LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); return res; } + ~C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ() { C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(self); } + C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ& operator=(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ&& o) { C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ)); return *this; } + LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() { return &self; } + LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() { return &self; } + const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator &() const { return &self; } + const LDKC2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ* operator ->() const { return &self; } }; -class CResult_DescriptionCreationErrorZ { +class CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { private: - LDKCResult_DescriptionCreationErrorZ self; + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ self; public: - CResult_DescriptionCreationErrorZ(const CResult_DescriptionCreationErrorZ&) = delete; - CResult_DescriptionCreationErrorZ(CResult_DescriptionCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); } - CResult_DescriptionCreationErrorZ(LDKCResult_DescriptionCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); } - operator LDKCResult_DescriptionCreationErrorZ() && { LDKCResult_DescriptionCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DescriptionCreationErrorZ)); return res; } - ~CResult_DescriptionCreationErrorZ() { CResult_DescriptionCreationErrorZ_free(self); } - CResult_DescriptionCreationErrorZ& operator=(CResult_DescriptionCreationErrorZ&& o) { CResult_DescriptionCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DescriptionCreationErrorZ)); return *this; } - LDKCResult_DescriptionCreationErrorZ* operator &() { return &self; } - LDKCResult_DescriptionCreationErrorZ* operator ->() { return &self; } - const LDKCResult_DescriptionCreationErrorZ* operator &() const { return &self; } - const LDKCResult_DescriptionCreationErrorZ* operator ->() const { return &self; } + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(const CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&) = delete; + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); } + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); } + operator LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ() && { LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); return res; } + ~CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ() { CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(self); } + CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ& operator=(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ&& o) { CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ)); return *this; } + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator &() { return &self; } + LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ* operator ->() const { return &self; } }; -class CResult_RoutingFeesDecodeErrorZ { +class COption_EventZ { private: - LDKCResult_RoutingFeesDecodeErrorZ self; + LDKCOption_EventZ self; public: - CResult_RoutingFeesDecodeErrorZ(const CResult_RoutingFeesDecodeErrorZ&) = delete; - CResult_RoutingFeesDecodeErrorZ(CResult_RoutingFeesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); } - CResult_RoutingFeesDecodeErrorZ(LDKCResult_RoutingFeesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); } - operator LDKCResult_RoutingFeesDecodeErrorZ() && { LDKCResult_RoutingFeesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RoutingFeesDecodeErrorZ)); return res; } - ~CResult_RoutingFeesDecodeErrorZ() { CResult_RoutingFeesDecodeErrorZ_free(self); } - CResult_RoutingFeesDecodeErrorZ& operator=(CResult_RoutingFeesDecodeErrorZ&& o) { CResult_RoutingFeesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RoutingFeesDecodeErrorZ)); return *this; } - LDKCResult_RoutingFeesDecodeErrorZ* operator &() { return &self; } - LDKCResult_RoutingFeesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RoutingFeesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RoutingFeesDecodeErrorZ* operator ->() const { return &self; } + COption_EventZ(const COption_EventZ&) = delete; + COption_EventZ(COption_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_EventZ)); } + COption_EventZ(LDKCOption_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_EventZ)); } + operator LDKCOption_EventZ() && { LDKCOption_EventZ res = self; memset(&self, 0, sizeof(LDKCOption_EventZ)); return res; } + ~COption_EventZ() { COption_EventZ_free(self); } + COption_EventZ& operator=(COption_EventZ&& o) { COption_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_EventZ)); return *this; } + LDKCOption_EventZ* operator &() { return &self; } + LDKCOption_EventZ* operator ->() { return &self; } + const LDKCOption_EventZ* operator &() const { return &self; } + const LDKCOption_EventZ* operator ->() const { return &self; } }; -class CResult_PayeePubKeyErrorZ { +class CResult_ChannelTypeFeaturesDecodeErrorZ { private: - LDKCResult_PayeePubKeyErrorZ self; + LDKCResult_ChannelTypeFeaturesDecodeErrorZ self; public: - CResult_PayeePubKeyErrorZ(const CResult_PayeePubKeyErrorZ&) = delete; - CResult_PayeePubKeyErrorZ(CResult_PayeePubKeyErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PayeePubKeyErrorZ)); } - CResult_PayeePubKeyErrorZ(LDKCResult_PayeePubKeyErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PayeePubKeyErrorZ)); } - operator LDKCResult_PayeePubKeyErrorZ() && { LDKCResult_PayeePubKeyErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PayeePubKeyErrorZ)); return res; } - ~CResult_PayeePubKeyErrorZ() { CResult_PayeePubKeyErrorZ_free(self); } - CResult_PayeePubKeyErrorZ& operator=(CResult_PayeePubKeyErrorZ&& o) { CResult_PayeePubKeyErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PayeePubKeyErrorZ)); return *this; } - LDKCResult_PayeePubKeyErrorZ* operator &() { return &self; } - LDKCResult_PayeePubKeyErrorZ* operator ->() { return &self; } - const LDKCResult_PayeePubKeyErrorZ* operator &() const { return &self; } - const LDKCResult_PayeePubKeyErrorZ* operator ->() const { return &self; } + CResult_ChannelTypeFeaturesDecodeErrorZ(const CResult_ChannelTypeFeaturesDecodeErrorZ&) = delete; + CResult_ChannelTypeFeaturesDecodeErrorZ(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); } + CResult_ChannelTypeFeaturesDecodeErrorZ(LDKCResult_ChannelTypeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); } + operator LDKCResult_ChannelTypeFeaturesDecodeErrorZ() && { LDKCResult_ChannelTypeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelTypeFeaturesDecodeErrorZ)); return res; } + ~CResult_ChannelTypeFeaturesDecodeErrorZ() { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); } + CResult_ChannelTypeFeaturesDecodeErrorZ& operator=(CResult_ChannelTypeFeaturesDecodeErrorZ&& o) { CResult_ChannelTypeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelTypeFeaturesDecodeErrorZ)); return *this; } + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_ChannelTypeFeaturesDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_COption_MonitorEventZDecodeErrorZ { +class CVec_RouteHintZ { private: - LDKCResult_COption_MonitorEventZDecodeErrorZ self; + LDKCVec_RouteHintZ self; public: - CResult_COption_MonitorEventZDecodeErrorZ(const CResult_COption_MonitorEventZDecodeErrorZ&) = delete; - CResult_COption_MonitorEventZDecodeErrorZ(CResult_COption_MonitorEventZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); } - CResult_COption_MonitorEventZDecodeErrorZ(LDKCResult_COption_MonitorEventZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); } - operator LDKCResult_COption_MonitorEventZDecodeErrorZ() && { LDKCResult_COption_MonitorEventZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_MonitorEventZDecodeErrorZ)); return res; } - ~CResult_COption_MonitorEventZDecodeErrorZ() { CResult_COption_MonitorEventZDecodeErrorZ_free(self); } - CResult_COption_MonitorEventZDecodeErrorZ& operator=(CResult_COption_MonitorEventZDecodeErrorZ&& o) { CResult_COption_MonitorEventZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_MonitorEventZDecodeErrorZ)); return *this; } - LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_MonitorEventZDecodeErrorZ* operator ->() const { return &self; } + CVec_RouteHintZ(const CVec_RouteHintZ&) = delete; + CVec_RouteHintZ(CVec_RouteHintZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_RouteHintZ)); } + CVec_RouteHintZ(LDKCVec_RouteHintZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_RouteHintZ)); } + operator LDKCVec_RouteHintZ() && { LDKCVec_RouteHintZ res = self; memset(&self, 0, sizeof(LDKCVec_RouteHintZ)); return res; } + ~CVec_RouteHintZ() { CVec_RouteHintZ_free(self); } + CVec_RouteHintZ& operator=(CVec_RouteHintZ&& o) { CVec_RouteHintZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_RouteHintZ)); return *this; } + LDKCVec_RouteHintZ* operator &() { return &self; } + LDKCVec_RouteHintZ* operator ->() { return &self; } + const LDKCVec_RouteHintZ* operator &() const { return &self; } + const LDKCVec_RouteHintZ* operator ->() const { return &self; } }; -class C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { +class COption_u16Z { private: - LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ self; + LDKCOption_u16Z self; public: - C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ(const C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&) = delete; - C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); } - C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); } - operator LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ() && { LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); return res; } - ~C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ() { C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(self); } - C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ& operator=(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&& o) { C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); return *this; } - LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator &() { return &self; } - LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator ->() { return &self; } - const LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator &() const { return &self; } - const LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator ->() const { return &self; } + COption_u16Z(const COption_u16Z&) = delete; + COption_u16Z(COption_u16Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u16Z)); } + COption_u16Z(LDKCOption_u16Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u16Z)); } + operator LDKCOption_u16Z() && { LDKCOption_u16Z res = self; memset(&self, 0, sizeof(LDKCOption_u16Z)); return res; } + ~COption_u16Z() { COption_u16Z_free(self); } + COption_u16Z& operator=(COption_u16Z&& o) { COption_u16Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u16Z)); return *this; } + LDKCOption_u16Z* operator &() { return &self; } + LDKCOption_u16Z* operator ->() { return &self; } + const LDKCOption_u16Z* operator &() const { return &self; } + const LDKCOption_u16Z* operator ->() const { return &self; } +}; +class CVec_CVec_RouteHopZZ { +private: + LDKCVec_CVec_RouteHopZZ self; +public: + CVec_CVec_RouteHopZZ(const CVec_CVec_RouteHopZZ&) = delete; + CVec_CVec_RouteHopZZ(CVec_CVec_RouteHopZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); } + CVec_CVec_RouteHopZZ(LDKCVec_CVec_RouteHopZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); } + operator LDKCVec_CVec_RouteHopZZ() && { LDKCVec_CVec_RouteHopZZ res = self; memset(&self, 0, sizeof(LDKCVec_CVec_RouteHopZZ)); return res; } + ~CVec_CVec_RouteHopZZ() { CVec_CVec_RouteHopZZ_free(self); } + CVec_CVec_RouteHopZZ& operator=(CVec_CVec_RouteHopZZ&& o) { CVec_CVec_RouteHopZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_CVec_RouteHopZZ)); return *this; } + LDKCVec_CVec_RouteHopZZ* operator &() { return &self; } + LDKCVec_CVec_RouteHopZZ* operator ->() { return &self; } + const LDKCVec_CVec_RouteHopZZ* operator &() const { return &self; } + const LDKCVec_CVec_RouteHopZZ* operator ->() const { return &self; } }; class CVec_C2Tuple_PublicKeyTypeZZ { private: @@ -6717,20 +7394,20 @@ public: const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_PublicKeyTypeZZ* operator ->() const { return &self; } }; -class CResult_InvoiceSemanticErrorZ { +class C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ { private: - LDKCResult_InvoiceSemanticErrorZ self; + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ self; public: - CResult_InvoiceSemanticErrorZ(const CResult_InvoiceSemanticErrorZ&) = delete; - CResult_InvoiceSemanticErrorZ(CResult_InvoiceSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceSemanticErrorZ)); } - CResult_InvoiceSemanticErrorZ(LDKCResult_InvoiceSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceSemanticErrorZ)); } - operator LDKCResult_InvoiceSemanticErrorZ() && { LDKCResult_InvoiceSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceSemanticErrorZ)); return res; } - ~CResult_InvoiceSemanticErrorZ() { CResult_InvoiceSemanticErrorZ_free(self); } - CResult_InvoiceSemanticErrorZ& operator=(CResult_InvoiceSemanticErrorZ&& o) { CResult_InvoiceSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceSemanticErrorZ)); return *this; } - LDKCResult_InvoiceSemanticErrorZ* operator &() { return &self; } - LDKCResult_InvoiceSemanticErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceSemanticErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceSemanticErrorZ* operator ->() const { return &self; } + C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ(const C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&) = delete; + C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); } + C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); } + operator LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ() && { LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); return res; } + ~C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ() { C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(self); } + C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ& operator=(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ&& o) { C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_OutPointCVec_MonitorEventZPublicKeyZ)); return *this; } + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator &() { return &self; } + LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator ->() { return &self; } + const LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator &() const { return &self; } + const LDKC3Tuple_OutPointCVec_MonitorEventZPublicKeyZ* operator ->() const { return &self; } }; class CResult_u32GraphSyncErrorZ { private: @@ -6747,20 +7424,35 @@ public: const LDKCResult_u32GraphSyncErrorZ* operator &() const { return &self; } const LDKCResult_u32GraphSyncErrorZ* operator ->() const { return &self; } }; -class CResult_UpdateAddHTLCDecodeErrorZ { +class CResult_InvoiceRequestFeaturesDecodeErrorZ { private: - LDKCResult_UpdateAddHTLCDecodeErrorZ self; + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ self; public: - CResult_UpdateAddHTLCDecodeErrorZ(const CResult_UpdateAddHTLCDecodeErrorZ&) = delete; - CResult_UpdateAddHTLCDecodeErrorZ(CResult_UpdateAddHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); } - CResult_UpdateAddHTLCDecodeErrorZ(LDKCResult_UpdateAddHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); } - operator LDKCResult_UpdateAddHTLCDecodeErrorZ() && { LDKCResult_UpdateAddHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateAddHTLCDecodeErrorZ)); return res; } - ~CResult_UpdateAddHTLCDecodeErrorZ() { CResult_UpdateAddHTLCDecodeErrorZ_free(self); } - CResult_UpdateAddHTLCDecodeErrorZ& operator=(CResult_UpdateAddHTLCDecodeErrorZ&& o) { CResult_UpdateAddHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateAddHTLCDecodeErrorZ)); return *this; } - LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() { return &self; } - LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() const { return &self; } + CResult_InvoiceRequestFeaturesDecodeErrorZ(const CResult_InvoiceRequestFeaturesDecodeErrorZ&) = delete; + CResult_InvoiceRequestFeaturesDecodeErrorZ(CResult_InvoiceRequestFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestFeaturesDecodeErrorZ)); } + CResult_InvoiceRequestFeaturesDecodeErrorZ(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ)); } + operator LDKCResult_InvoiceRequestFeaturesDecodeErrorZ() && { LDKCResult_InvoiceRequestFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestFeaturesDecodeErrorZ)); return res; } + ~CResult_InvoiceRequestFeaturesDecodeErrorZ() { CResult_InvoiceRequestFeaturesDecodeErrorZ_free(self); } + CResult_InvoiceRequestFeaturesDecodeErrorZ& operator=(CResult_InvoiceRequestFeaturesDecodeErrorZ&& o) { CResult_InvoiceRequestFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestFeaturesDecodeErrorZ)); return *this; } + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceRequestFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; +class CVec_PhantomRouteHintsZ { +private: + LDKCVec_PhantomRouteHintsZ self; +public: + CVec_PhantomRouteHintsZ(const CVec_PhantomRouteHintsZ&) = delete; + CVec_PhantomRouteHintsZ(CVec_PhantomRouteHintsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); } + CVec_PhantomRouteHintsZ(LDKCVec_PhantomRouteHintsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); } + operator LDKCVec_PhantomRouteHintsZ() && { LDKCVec_PhantomRouteHintsZ res = self; memset(&self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); return res; } + ~CVec_PhantomRouteHintsZ() { CVec_PhantomRouteHintsZ_free(self); } + CVec_PhantomRouteHintsZ& operator=(CVec_PhantomRouteHintsZ&& o) { CVec_PhantomRouteHintsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); return *this; } + LDKCVec_PhantomRouteHintsZ* operator &() { return &self; } + LDKCVec_PhantomRouteHintsZ* operator ->() { return &self; } + const LDKCVec_PhantomRouteHintsZ* operator &() const { return &self; } + const LDKCVec_PhantomRouteHintsZ* operator ->() const { return &self; } }; class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { private: @@ -6852,51 +7544,6 @@ public: const LDKCVec_C2Tuple_usizeTransactionZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_usizeTransactionZZ* operator ->() const { return &self; } }; -class CResult_QueryShortChannelIdsDecodeErrorZ { -private: - LDKCResult_QueryShortChannelIdsDecodeErrorZ self; -public: - CResult_QueryShortChannelIdsDecodeErrorZ(const CResult_QueryShortChannelIdsDecodeErrorZ&) = delete; - CResult_QueryShortChannelIdsDecodeErrorZ(CResult_QueryShortChannelIdsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); } - CResult_QueryShortChannelIdsDecodeErrorZ(LDKCResult_QueryShortChannelIdsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); } - operator LDKCResult_QueryShortChannelIdsDecodeErrorZ() && { LDKCResult_QueryShortChannelIdsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_QueryShortChannelIdsDecodeErrorZ)); return res; } - ~CResult_QueryShortChannelIdsDecodeErrorZ() { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); } - CResult_QueryShortChannelIdsDecodeErrorZ& operator=(CResult_QueryShortChannelIdsDecodeErrorZ&& o) { CResult_QueryShortChannelIdsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_QueryShortChannelIdsDecodeErrorZ)); return *this; } - LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() { return &self; } - LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_QueryShortChannelIdsDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_PhantomRouteHintsZ { -private: - LDKCVec_PhantomRouteHintsZ self; -public: - CVec_PhantomRouteHintsZ(const CVec_PhantomRouteHintsZ&) = delete; - CVec_PhantomRouteHintsZ(CVec_PhantomRouteHintsZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); } - CVec_PhantomRouteHintsZ(LDKCVec_PhantomRouteHintsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); } - operator LDKCVec_PhantomRouteHintsZ() && { LDKCVec_PhantomRouteHintsZ res = self; memset(&self, 0, sizeof(LDKCVec_PhantomRouteHintsZ)); return res; } - ~CVec_PhantomRouteHintsZ() { CVec_PhantomRouteHintsZ_free(self); } - CVec_PhantomRouteHintsZ& operator=(CVec_PhantomRouteHintsZ&& o) { CVec_PhantomRouteHintsZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PhantomRouteHintsZ)); return *this; } - LDKCVec_PhantomRouteHintsZ* operator &() { return &self; } - LDKCVec_PhantomRouteHintsZ* operator ->() { return &self; } - const LDKCVec_PhantomRouteHintsZ* operator &() const { return &self; } - const LDKCVec_PhantomRouteHintsZ* operator ->() const { return &self; } -}; -class COption_MonitorEventZ { -private: - LDKCOption_MonitorEventZ self; -public: - COption_MonitorEventZ(const COption_MonitorEventZ&) = delete; - COption_MonitorEventZ(COption_MonitorEventZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_MonitorEventZ)); } - COption_MonitorEventZ(LDKCOption_MonitorEventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_MonitorEventZ)); } - operator LDKCOption_MonitorEventZ() && { LDKCOption_MonitorEventZ res = self; memset(&self, 0, sizeof(LDKCOption_MonitorEventZ)); return res; } - ~COption_MonitorEventZ() { COption_MonitorEventZ_free(self); } - COption_MonitorEventZ& operator=(COption_MonitorEventZ&& o) { COption_MonitorEventZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_MonitorEventZ)); return *this; } - LDKCOption_MonitorEventZ* operator &() { return &self; } - LDKCOption_MonitorEventZ* operator ->() { return &self; } - const LDKCOption_MonitorEventZ* operator &() const { return &self; } - const LDKCOption_MonitorEventZ* operator ->() const { return &self; } -}; class C2Tuple_u64u64Z { private: LDKC2Tuple_u64u64Z self; @@ -6912,36 +7559,6 @@ public: const LDKC2Tuple_u64u64Z* operator &() const { return &self; } const LDKC2Tuple_u64u64Z* operator ->() const { return &self; } }; -class COption_TypeZ { -private: - LDKCOption_TypeZ self; -public: - COption_TypeZ(const COption_TypeZ&) = delete; - COption_TypeZ(COption_TypeZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_TypeZ)); } - COption_TypeZ(LDKCOption_TypeZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_TypeZ)); } - operator LDKCOption_TypeZ() && { LDKCOption_TypeZ res = self; memset(&self, 0, sizeof(LDKCOption_TypeZ)); return res; } - ~COption_TypeZ() { COption_TypeZ_free(self); } - COption_TypeZ& operator=(COption_TypeZ&& o) { COption_TypeZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_TypeZ)); return *this; } - LDKCOption_TypeZ* operator &() { return &self; } - LDKCOption_TypeZ* operator ->() { return &self; } - const LDKCOption_TypeZ* operator &() const { return &self; } - const LDKCOption_TypeZ* operator ->() const { return &self; } -}; -class CResult_COption_TypeZDecodeErrorZ { -private: - LDKCResult_COption_TypeZDecodeErrorZ self; -public: - CResult_COption_TypeZDecodeErrorZ(const CResult_COption_TypeZDecodeErrorZ&) = delete; - CResult_COption_TypeZDecodeErrorZ(CResult_COption_TypeZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_TypeZDecodeErrorZ)); } - CResult_COption_TypeZDecodeErrorZ(LDKCResult_COption_TypeZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_TypeZDecodeErrorZ)); } - operator LDKCResult_COption_TypeZDecodeErrorZ() && { LDKCResult_COption_TypeZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_TypeZDecodeErrorZ)); return res; } - ~CResult_COption_TypeZDecodeErrorZ() { CResult_COption_TypeZDecodeErrorZ_free(self); } - CResult_COption_TypeZDecodeErrorZ& operator=(CResult_COption_TypeZDecodeErrorZ&& o) { CResult_COption_TypeZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_TypeZDecodeErrorZ)); return *this; } - LDKCResult_COption_TypeZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_TypeZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_TypeZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_TypeZDecodeErrorZ* operator ->() const { return &self; } -}; class C2Tuple_u32TxOutZ { private: LDKC2Tuple_u32TxOutZ self; @@ -6957,36 +7574,6 @@ public: const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; } const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; } }; -class CResult_UpdateFailHTLCDecodeErrorZ { -private: - LDKCResult_UpdateFailHTLCDecodeErrorZ self; -public: - CResult_UpdateFailHTLCDecodeErrorZ(const CResult_UpdateFailHTLCDecodeErrorZ&) = delete; - CResult_UpdateFailHTLCDecodeErrorZ(CResult_UpdateFailHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFailHTLCDecodeErrorZ)); } - CResult_UpdateFailHTLCDecodeErrorZ(LDKCResult_UpdateFailHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ)); } - operator LDKCResult_UpdateFailHTLCDecodeErrorZ() && { LDKCResult_UpdateFailHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFailHTLCDecodeErrorZ)); return res; } - ~CResult_UpdateFailHTLCDecodeErrorZ() { CResult_UpdateFailHTLCDecodeErrorZ_free(self); } - CResult_UpdateFailHTLCDecodeErrorZ& operator=(CResult_UpdateFailHTLCDecodeErrorZ&& o) { CResult_UpdateFailHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFailHTLCDecodeErrorZ)); return *this; } - LDKCResult_UpdateFailHTLCDecodeErrorZ* operator &() { return &self; } - LDKCResult_UpdateFailHTLCDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateFailHTLCDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_InvoiceParseOrSemanticErrorZ { -private: - LDKCResult_InvoiceParseOrSemanticErrorZ self; -public: - CResult_InvoiceParseOrSemanticErrorZ(const CResult_InvoiceParseOrSemanticErrorZ&) = delete; - CResult_InvoiceParseOrSemanticErrorZ(CResult_InvoiceParseOrSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceParseOrSemanticErrorZ)); } - CResult_InvoiceParseOrSemanticErrorZ(LDKCResult_InvoiceParseOrSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ)); } - operator LDKCResult_InvoiceParseOrSemanticErrorZ() && { LDKCResult_InvoiceParseOrSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceParseOrSemanticErrorZ)); return res; } - ~CResult_InvoiceParseOrSemanticErrorZ() { CResult_InvoiceParseOrSemanticErrorZ_free(self); } - CResult_InvoiceParseOrSemanticErrorZ& operator=(CResult_InvoiceParseOrSemanticErrorZ&& o) { CResult_InvoiceParseOrSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceParseOrSemanticErrorZ)); return *this; } - LDKCResult_InvoiceParseOrSemanticErrorZ* operator &() { return &self; } - LDKCResult_InvoiceParseOrSemanticErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceParseOrSemanticErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceParseOrSemanticErrorZ* operator ->() const { return &self; } -}; class CResult_PaymentSecretNoneZ { private: LDKCResult_PaymentSecretNoneZ self; @@ -7032,50 +7619,20 @@ public: const LDKCVec_PrivateRouteZ* operator &() const { return &self; } const LDKCVec_PrivateRouteZ* operator ->() const { return &self; } }; -class CResult_SpendableOutputDescriptorDecodeErrorZ { -private: - LDKCResult_SpendableOutputDescriptorDecodeErrorZ self; -public: - CResult_SpendableOutputDescriptorDecodeErrorZ(const CResult_SpendableOutputDescriptorDecodeErrorZ&) = delete; - CResult_SpendableOutputDescriptorDecodeErrorZ(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); } - CResult_SpendableOutputDescriptorDecodeErrorZ(LDKCResult_SpendableOutputDescriptorDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); } - operator LDKCResult_SpendableOutputDescriptorDecodeErrorZ() && { LDKCResult_SpendableOutputDescriptorDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SpendableOutputDescriptorDecodeErrorZ)); return res; } - ~CResult_SpendableOutputDescriptorDecodeErrorZ() { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); } - CResult_SpendableOutputDescriptorDecodeErrorZ& operator=(CResult_SpendableOutputDescriptorDecodeErrorZ&& o) { CResult_SpendableOutputDescriptorDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SpendableOutputDescriptorDecodeErrorZ)); return *this; } - LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() { return &self; } - LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_SpendableOutputDescriptorDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_RevokeAndACKDecodeErrorZ { -private: - LDKCResult_RevokeAndACKDecodeErrorZ self; -public: - CResult_RevokeAndACKDecodeErrorZ(const CResult_RevokeAndACKDecodeErrorZ&) = delete; - CResult_RevokeAndACKDecodeErrorZ(CResult_RevokeAndACKDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); } - CResult_RevokeAndACKDecodeErrorZ(LDKCResult_RevokeAndACKDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); } - operator LDKCResult_RevokeAndACKDecodeErrorZ() && { LDKCResult_RevokeAndACKDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RevokeAndACKDecodeErrorZ)); return res; } - ~CResult_RevokeAndACKDecodeErrorZ() { CResult_RevokeAndACKDecodeErrorZ_free(self); } - CResult_RevokeAndACKDecodeErrorZ& operator=(CResult_RevokeAndACKDecodeErrorZ&& o) { CResult_RevokeAndACKDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RevokeAndACKDecodeErrorZ)); return *this; } - LDKCResult_RevokeAndACKDecodeErrorZ* operator &() { return &self; } - LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RevokeAndACKDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RevokeAndACKDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_UnsignedChannelUpdateDecodeErrorZ { +class CResult_BlindedPathNoneZ { private: - LDKCResult_UnsignedChannelUpdateDecodeErrorZ self; + LDKCResult_BlindedPathNoneZ self; public: - CResult_UnsignedChannelUpdateDecodeErrorZ(const CResult_UnsignedChannelUpdateDecodeErrorZ&) = delete; - CResult_UnsignedChannelUpdateDecodeErrorZ(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); } - CResult_UnsignedChannelUpdateDecodeErrorZ(LDKCResult_UnsignedChannelUpdateDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); } - operator LDKCResult_UnsignedChannelUpdateDecodeErrorZ() && { LDKCResult_UnsignedChannelUpdateDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedChannelUpdateDecodeErrorZ)); return res; } - ~CResult_UnsignedChannelUpdateDecodeErrorZ() { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); } - CResult_UnsignedChannelUpdateDecodeErrorZ& operator=(CResult_UnsignedChannelUpdateDecodeErrorZ&& o) { CResult_UnsignedChannelUpdateDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedChannelUpdateDecodeErrorZ)); return *this; } - LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() { return &self; } - LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() const { return &self; } + CResult_BlindedPathNoneZ(const CResult_BlindedPathNoneZ&) = delete; + CResult_BlindedPathNoneZ(CResult_BlindedPathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedPathNoneZ)); } + CResult_BlindedPathNoneZ(LDKCResult_BlindedPathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedPathNoneZ)); } + operator LDKCResult_BlindedPathNoneZ() && { LDKCResult_BlindedPathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedPathNoneZ)); return res; } + ~CResult_BlindedPathNoneZ() { CResult_BlindedPathNoneZ_free(self); } + CResult_BlindedPathNoneZ& operator=(CResult_BlindedPathNoneZ&& o) { CResult_BlindedPathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedPathNoneZ)); return *this; } + LDKCResult_BlindedPathNoneZ* operator &() { return &self; } + LDKCResult_BlindedPathNoneZ* operator ->() { return &self; } + const LDKCResult_BlindedPathNoneZ* operator &() const { return &self; } + const LDKCResult_BlindedPathNoneZ* operator ->() const { return &self; } }; class CResult_ShutdownDecodeErrorZ { private: @@ -7092,36 +7649,6 @@ public: const LDKCResult_ShutdownDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ShutdownDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_EventZ { -private: - LDKCVec_EventZ self; -public: - CVec_EventZ(const CVec_EventZ&) = delete; - CVec_EventZ(CVec_EventZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_EventZ)); } - CVec_EventZ(LDKCVec_EventZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_EventZ)); } - operator LDKCVec_EventZ() && { LDKCVec_EventZ res = self; memset(&self, 0, sizeof(LDKCVec_EventZ)); return res; } - ~CVec_EventZ() { CVec_EventZ_free(self); } - CVec_EventZ& operator=(CVec_EventZ&& o) { CVec_EventZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_EventZ)); return *this; } - LDKCVec_EventZ* operator &() { return &self; } - LDKCVec_EventZ* operator ->() { return &self; } - const LDKCVec_EventZ* operator &() const { return &self; } - const LDKCVec_EventZ* operator ->() const { return &self; } -}; -class CResult_NoneSemanticErrorZ { -private: - LDKCResult_NoneSemanticErrorZ self; -public: - CResult_NoneSemanticErrorZ(const CResult_NoneSemanticErrorZ&) = delete; - CResult_NoneSemanticErrorZ(CResult_NoneSemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneSemanticErrorZ)); } - CResult_NoneSemanticErrorZ(LDKCResult_NoneSemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneSemanticErrorZ)); } - operator LDKCResult_NoneSemanticErrorZ() && { LDKCResult_NoneSemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneSemanticErrorZ)); return res; } - ~CResult_NoneSemanticErrorZ() { CResult_NoneSemanticErrorZ_free(self); } - CResult_NoneSemanticErrorZ& operator=(CResult_NoneSemanticErrorZ&& o) { CResult_NoneSemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneSemanticErrorZ)); return *this; } - LDKCResult_NoneSemanticErrorZ* operator &() { return &self; } - LDKCResult_NoneSemanticErrorZ* operator ->() { return &self; } - const LDKCResult_NoneSemanticErrorZ* operator &() const { return &self; } - const LDKCResult_NoneSemanticErrorZ* operator ->() const { return &self; } -}; class CVec_MonitorEventZ { private: LDKCVec_MonitorEventZ self; @@ -7152,36 +7679,6 @@ public: const LDKCVec_PaymentPreimageZ* operator &() const { return &self; } const LDKCVec_PaymentPreimageZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_u32ScriptZZ { -private: - LDKCVec_C2Tuple_u32ScriptZZ self; -public: - CVec_C2Tuple_u32ScriptZZ(const CVec_C2Tuple_u32ScriptZZ&) = delete; - CVec_C2Tuple_u32ScriptZZ(CVec_C2Tuple_u32ScriptZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_u32ScriptZZ)); } - CVec_C2Tuple_u32ScriptZZ(LDKCVec_C2Tuple_u32ScriptZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_u32ScriptZZ)); } - operator LDKCVec_C2Tuple_u32ScriptZZ() && { LDKCVec_C2Tuple_u32ScriptZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_u32ScriptZZ)); return res; } - ~CVec_C2Tuple_u32ScriptZZ() { CVec_C2Tuple_u32ScriptZZ_free(self); } - CVec_C2Tuple_u32ScriptZZ& operator=(CVec_C2Tuple_u32ScriptZZ&& o) { CVec_C2Tuple_u32ScriptZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_u32ScriptZZ)); return *this; } - LDKCVec_C2Tuple_u32ScriptZZ* operator &() { return &self; } - LDKCVec_C2Tuple_u32ScriptZZ* operator ->() { return &self; } - const LDKCVec_C2Tuple_u32ScriptZZ* operator &() const { return &self; } - const LDKCVec_C2Tuple_u32ScriptZZ* operator ->() const { return &self; } -}; -class CResult_COption_ClosureReasonZDecodeErrorZ { -private: - LDKCResult_COption_ClosureReasonZDecodeErrorZ self; -public: - CResult_COption_ClosureReasonZDecodeErrorZ(const CResult_COption_ClosureReasonZDecodeErrorZ&) = delete; - CResult_COption_ClosureReasonZDecodeErrorZ(CResult_COption_ClosureReasonZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_ClosureReasonZDecodeErrorZ)); } - CResult_COption_ClosureReasonZDecodeErrorZ(LDKCResult_COption_ClosureReasonZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ)); } - operator LDKCResult_COption_ClosureReasonZDecodeErrorZ() && { LDKCResult_COption_ClosureReasonZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_ClosureReasonZDecodeErrorZ)); return res; } - ~CResult_COption_ClosureReasonZDecodeErrorZ() { CResult_COption_ClosureReasonZDecodeErrorZ_free(self); } - CResult_COption_ClosureReasonZDecodeErrorZ& operator=(CResult_COption_ClosureReasonZDecodeErrorZ&& o) { CResult_COption_ClosureReasonZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_ClosureReasonZDecodeErrorZ)); return *this; } - LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_ClosureReasonZDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_PublicKeyErrorZ { private: LDKCResult_PublicKeyErrorZ self; @@ -7212,21 +7709,6 @@ public: const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ* operator &() const { return &self; } const LDKCVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ* operator ->() const { return &self; } }; -class C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { -private: - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ self; -public: - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(const C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&) = delete; - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); } - operator LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() && { LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return res; } - ~C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ() { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); } - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ& operator=(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ&& o) { C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ)); return *this; } - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() { return &self; } - LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() { return &self; } - const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator &() const { return &self; } - const LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* operator ->() const { return &self; } -}; class CResult_NoneNoneZ { private: LDKCResult_NoneNoneZ self; @@ -7242,21 +7724,6 @@ public: const LDKCResult_NoneNoneZ* operator &() const { return &self; } const LDKCResult_NoneNoneZ* operator ->() const { return &self; } }; -class CResult_RouteParametersDecodeErrorZ { -private: - LDKCResult_RouteParametersDecodeErrorZ self; -public: - CResult_RouteParametersDecodeErrorZ(const CResult_RouteParametersDecodeErrorZ&) = delete; - CResult_RouteParametersDecodeErrorZ(CResult_RouteParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); } - CResult_RouteParametersDecodeErrorZ(LDKCResult_RouteParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); } - operator LDKCResult_RouteParametersDecodeErrorZ() && { LDKCResult_RouteParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_RouteParametersDecodeErrorZ)); return res; } - ~CResult_RouteParametersDecodeErrorZ() { CResult_RouteParametersDecodeErrorZ_free(self); } - CResult_RouteParametersDecodeErrorZ& operator=(CResult_RouteParametersDecodeErrorZ&& o) { CResult_RouteParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_RouteParametersDecodeErrorZ)); return *this; } - LDKCResult_RouteParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_RouteParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_RouteParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_RouteParametersDecodeErrorZ* operator ->() const { return &self; } -}; class COption_ClosureReasonZ { private: LDKCOption_ClosureReasonZ self; @@ -7272,20 +7739,20 @@ public: const LDKCOption_ClosureReasonZ* operator &() const { return &self; } const LDKCOption_ClosureReasonZ* operator ->() const { return &self; } }; -class CResult_NodeAliasDecodeErrorZ { +class COption_u128Z { private: - LDKCResult_NodeAliasDecodeErrorZ self; -public: - CResult_NodeAliasDecodeErrorZ(const CResult_NodeAliasDecodeErrorZ&) = delete; - CResult_NodeAliasDecodeErrorZ(CResult_NodeAliasDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); } - CResult_NodeAliasDecodeErrorZ(LDKCResult_NodeAliasDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); } - operator LDKCResult_NodeAliasDecodeErrorZ() && { LDKCResult_NodeAliasDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeAliasDecodeErrorZ)); return res; } - ~CResult_NodeAliasDecodeErrorZ() { CResult_NodeAliasDecodeErrorZ_free(self); } - CResult_NodeAliasDecodeErrorZ& operator=(CResult_NodeAliasDecodeErrorZ&& o) { CResult_NodeAliasDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeAliasDecodeErrorZ)); return *this; } - LDKCResult_NodeAliasDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeAliasDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeAliasDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeAliasDecodeErrorZ* operator ->() const { return &self; } + LDKCOption_u128Z self; +public: + COption_u128Z(const COption_u128Z&) = delete; + COption_u128Z(COption_u128Z&& o) : self(o.self) { memset(&o, 0, sizeof(COption_u128Z)); } + COption_u128Z(LDKCOption_u128Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_u128Z)); } + operator LDKCOption_u128Z() && { LDKCOption_u128Z res = self; memset(&self, 0, sizeof(LDKCOption_u128Z)); return res; } + ~COption_u128Z() { COption_u128Z_free(self); } + COption_u128Z& operator=(COption_u128Z&& o) { COption_u128Z_free(self); self = o.self; memset(&o, 0, sizeof(COption_u128Z)); return *this; } + LDKCOption_u128Z* operator &() { return &self; } + LDKCOption_u128Z* operator ->() { return &self; } + const LDKCOption_u128Z* operator &() const { return &self; } + const LDKCOption_u128Z* operator ->() const { return &self; } }; class CVec_APIErrorZ { private: @@ -7302,21 +7769,6 @@ public: const LDKCVec_APIErrorZ* operator &() const { return &self; } const LDKCVec_APIErrorZ* operator ->() const { return &self; } }; -class CResult_PrivateRouteCreationErrorZ { -private: - LDKCResult_PrivateRouteCreationErrorZ self; -public: - CResult_PrivateRouteCreationErrorZ(const CResult_PrivateRouteCreationErrorZ&) = delete; - CResult_PrivateRouteCreationErrorZ(CResult_PrivateRouteCreationErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); } - CResult_PrivateRouteCreationErrorZ(LDKCResult_PrivateRouteCreationErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); } - operator LDKCResult_PrivateRouteCreationErrorZ() && { LDKCResult_PrivateRouteCreationErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PrivateRouteCreationErrorZ)); return res; } - ~CResult_PrivateRouteCreationErrorZ() { CResult_PrivateRouteCreationErrorZ_free(self); } - CResult_PrivateRouteCreationErrorZ& operator=(CResult_PrivateRouteCreationErrorZ&& o) { CResult_PrivateRouteCreationErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PrivateRouteCreationErrorZ)); return *this; } - LDKCResult_PrivateRouteCreationErrorZ* operator &() { return &self; } - LDKCResult_PrivateRouteCreationErrorZ* operator ->() { return &self; } - const LDKCResult_PrivateRouteCreationErrorZ* operator &() const { return &self; } - const LDKCResult_PrivateRouteCreationErrorZ* operator ->() const { return &self; } -}; class CResult_boolPeerHandleErrorZ { private: LDKCResult_boolPeerHandleErrorZ self; @@ -7332,66 +7784,6 @@ public: const LDKCResult_boolPeerHandleErrorZ* operator &() const { return &self; } const LDKCResult_boolPeerHandleErrorZ* operator ->() const { return &self; } }; -class CVec_UpdateFulfillHTLCZ { -private: - LDKCVec_UpdateFulfillHTLCZ self; -public: - CVec_UpdateFulfillHTLCZ(const CVec_UpdateFulfillHTLCZ&) = delete; - CVec_UpdateFulfillHTLCZ(CVec_UpdateFulfillHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); } - CVec_UpdateFulfillHTLCZ(LDKCVec_UpdateFulfillHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); } - operator LDKCVec_UpdateFulfillHTLCZ() && { LDKCVec_UpdateFulfillHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFulfillHTLCZ)); return res; } - ~CVec_UpdateFulfillHTLCZ() { CVec_UpdateFulfillHTLCZ_free(self); } - CVec_UpdateFulfillHTLCZ& operator=(CVec_UpdateFulfillHTLCZ&& o) { CVec_UpdateFulfillHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFulfillHTLCZ)); return *this; } - LDKCVec_UpdateFulfillHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFulfillHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFulfillHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFulfillHTLCZ* operator ->() const { return &self; } -}; -class CResult_BlindedRouteNoneZ { -private: - LDKCResult_BlindedRouteNoneZ self; -public: - CResult_BlindedRouteNoneZ(const CResult_BlindedRouteNoneZ&) = delete; - CResult_BlindedRouteNoneZ(CResult_BlindedRouteNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedRouteNoneZ)); } - CResult_BlindedRouteNoneZ(LDKCResult_BlindedRouteNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedRouteNoneZ)); } - operator LDKCResult_BlindedRouteNoneZ() && { LDKCResult_BlindedRouteNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedRouteNoneZ)); return res; } - ~CResult_BlindedRouteNoneZ() { CResult_BlindedRouteNoneZ_free(self); } - CResult_BlindedRouteNoneZ& operator=(CResult_BlindedRouteNoneZ&& o) { CResult_BlindedRouteNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedRouteNoneZ)); return *this; } - LDKCResult_BlindedRouteNoneZ* operator &() { return &self; } - LDKCResult_BlindedRouteNoneZ* operator ->() { return &self; } - const LDKCResult_BlindedRouteNoneZ* operator &() const { return &self; } - const LDKCResult_BlindedRouteNoneZ* operator ->() const { return &self; } -}; -class CResult_AnnouncementSignaturesDecodeErrorZ { -private: - LDKCResult_AnnouncementSignaturesDecodeErrorZ self; -public: - CResult_AnnouncementSignaturesDecodeErrorZ(const CResult_AnnouncementSignaturesDecodeErrorZ&) = delete; - CResult_AnnouncementSignaturesDecodeErrorZ(CResult_AnnouncementSignaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AnnouncementSignaturesDecodeErrorZ)); } - CResult_AnnouncementSignaturesDecodeErrorZ(LDKCResult_AnnouncementSignaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ)); } - operator LDKCResult_AnnouncementSignaturesDecodeErrorZ() && { LDKCResult_AnnouncementSignaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AnnouncementSignaturesDecodeErrorZ)); return res; } - ~CResult_AnnouncementSignaturesDecodeErrorZ() { CResult_AnnouncementSignaturesDecodeErrorZ_free(self); } - CResult_AnnouncementSignaturesDecodeErrorZ& operator=(CResult_AnnouncementSignaturesDecodeErrorZ&& o) { CResult_AnnouncementSignaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AnnouncementSignaturesDecodeErrorZ)); return *this; } - LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_AnnouncementSignaturesDecodeErrorZ* operator ->() const { return &self; } -}; -class CResult_UpdateFulfillHTLCDecodeErrorZ { -private: - LDKCResult_UpdateFulfillHTLCDecodeErrorZ self; -public: - CResult_UpdateFulfillHTLCDecodeErrorZ(const CResult_UpdateFulfillHTLCDecodeErrorZ&) = delete; - CResult_UpdateFulfillHTLCDecodeErrorZ(CResult_UpdateFulfillHTLCDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateFulfillHTLCDecodeErrorZ)); } - CResult_UpdateFulfillHTLCDecodeErrorZ(LDKCResult_UpdateFulfillHTLCDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ)); } - operator LDKCResult_UpdateFulfillHTLCDecodeErrorZ() && { LDKCResult_UpdateFulfillHTLCDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateFulfillHTLCDecodeErrorZ)); return res; } - ~CResult_UpdateFulfillHTLCDecodeErrorZ() { CResult_UpdateFulfillHTLCDecodeErrorZ_free(self); } - CResult_UpdateFulfillHTLCDecodeErrorZ& operator=(CResult_UpdateFulfillHTLCDecodeErrorZ&& o) { CResult_UpdateFulfillHTLCDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateFulfillHTLCDecodeErrorZ)); return *this; } - LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator &() { return &self; } - LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UpdateFulfillHTLCDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_ChannelUpdateDecodeErrorZ { private: LDKCResult_ChannelUpdateDecodeErrorZ self; @@ -7407,51 +7799,6 @@ public: const LDKCResult_ChannelUpdateDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelUpdateDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_NodeFeaturesDecodeErrorZ { -private: - LDKCResult_NodeFeaturesDecodeErrorZ self; -public: - CResult_NodeFeaturesDecodeErrorZ(const CResult_NodeFeaturesDecodeErrorZ&) = delete; - CResult_NodeFeaturesDecodeErrorZ(CResult_NodeFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); } - CResult_NodeFeaturesDecodeErrorZ(LDKCResult_NodeFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); } - operator LDKCResult_NodeFeaturesDecodeErrorZ() && { LDKCResult_NodeFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NodeFeaturesDecodeErrorZ)); return res; } - ~CResult_NodeFeaturesDecodeErrorZ() { CResult_NodeFeaturesDecodeErrorZ_free(self); } - CResult_NodeFeaturesDecodeErrorZ& operator=(CResult_NodeFeaturesDecodeErrorZ&& o) { CResult_NodeFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NodeFeaturesDecodeErrorZ)); return *this; } - LDKCResult_NodeFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_NodeFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_NodeFeaturesDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_u5Z { -private: - LDKCVec_u5Z self; -public: - CVec_u5Z(const CVec_u5Z&) = delete; - CVec_u5Z(CVec_u5Z&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_u5Z)); } - CVec_u5Z(LDKCVec_u5Z&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_u5Z)); } - operator LDKCVec_u5Z() && { LDKCVec_u5Z res = self; memset(&self, 0, sizeof(LDKCVec_u5Z)); return res; } - ~CVec_u5Z() { CVec_u5Z_free(self); } - CVec_u5Z& operator=(CVec_u5Z&& o) { CVec_u5Z_free(self); self = o.self; memset(&o, 0, sizeof(CVec_u5Z)); return *this; } - LDKCVec_u5Z* operator &() { return &self; } - LDKCVec_u5Z* operator ->() { return &self; } - const LDKCVec_u5Z* operator &() const { return &self; } - const LDKCVec_u5Z* operator ->() const { return &self; } -}; -class CResult_InMemorySignerDecodeErrorZ { -private: - LDKCResult_InMemorySignerDecodeErrorZ self; -public: - CResult_InMemorySignerDecodeErrorZ(const CResult_InMemorySignerDecodeErrorZ&) = delete; - CResult_InMemorySignerDecodeErrorZ(CResult_InMemorySignerDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InMemorySignerDecodeErrorZ)); } - CResult_InMemorySignerDecodeErrorZ(LDKCResult_InMemorySignerDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InMemorySignerDecodeErrorZ)); } - operator LDKCResult_InMemorySignerDecodeErrorZ() && { LDKCResult_InMemorySignerDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InMemorySignerDecodeErrorZ)); return res; } - ~CResult_InMemorySignerDecodeErrorZ() { CResult_InMemorySignerDecodeErrorZ_free(self); } - CResult_InMemorySignerDecodeErrorZ& operator=(CResult_InMemorySignerDecodeErrorZ&& o) { CResult_InMemorySignerDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InMemorySignerDecodeErrorZ)); return *this; } - LDKCResult_InMemorySignerDecodeErrorZ* operator &() { return &self; } - LDKCResult_InMemorySignerDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_InMemorySignerDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_InMemorySignerDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_PaymentSecretAPIErrorZ { private: LDKCResult_PaymentSecretAPIErrorZ self; @@ -7482,20 +7829,20 @@ public: const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() const { return &self; } }; -class COption_ScalarZ { +class C2Tuple_u32ScriptZ { private: - LDKCOption_ScalarZ self; + LDKC2Tuple_u32ScriptZ self; public: - COption_ScalarZ(const COption_ScalarZ&) = delete; - COption_ScalarZ(COption_ScalarZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_ScalarZ)); } - COption_ScalarZ(LDKCOption_ScalarZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_ScalarZ)); } - operator LDKCOption_ScalarZ() && { LDKCOption_ScalarZ res = self; memset(&self, 0, sizeof(LDKCOption_ScalarZ)); return res; } - ~COption_ScalarZ() { COption_ScalarZ_free(self); } - COption_ScalarZ& operator=(COption_ScalarZ&& o) { COption_ScalarZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_ScalarZ)); return *this; } - LDKCOption_ScalarZ* operator &() { return &self; } - LDKCOption_ScalarZ* operator ->() { return &self; } - const LDKCOption_ScalarZ* operator &() const { return &self; } - const LDKCOption_ScalarZ* operator ->() const { return &self; } + C2Tuple_u32ScriptZ(const C2Tuple_u32ScriptZ&) = delete; + C2Tuple_u32ScriptZ(C2Tuple_u32ScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32ScriptZ)); } + C2Tuple_u32ScriptZ(LDKC2Tuple_u32ScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32ScriptZ)); } + operator LDKC2Tuple_u32ScriptZ() && { LDKC2Tuple_u32ScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32ScriptZ)); return res; } + ~C2Tuple_u32ScriptZ() { C2Tuple_u32ScriptZ_free(self); } + C2Tuple_u32ScriptZ& operator=(C2Tuple_u32ScriptZ&& o) { C2Tuple_u32ScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u32ScriptZ)); return *this; } + LDKC2Tuple_u32ScriptZ* operator &() { return &self; } + LDKC2Tuple_u32ScriptZ* operator ->() { return &self; } + const LDKC2Tuple_u32ScriptZ* operator &() const { return &self; } + const LDKC2Tuple_u32ScriptZ* operator ->() const { return &self; } }; class CResult_SignedRawInvoiceParseErrorZ { private: @@ -7527,21 +7874,6 @@ public: const LDKCResult_RouteDecodeErrorZ* operator &() const { return &self; } const LDKCResult_RouteDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_BuiltCommitmentTransactionDecodeErrorZ { -private: - LDKCResult_BuiltCommitmentTransactionDecodeErrorZ self; -public: - CResult_BuiltCommitmentTransactionDecodeErrorZ(const CResult_BuiltCommitmentTransactionDecodeErrorZ&) = delete; - CResult_BuiltCommitmentTransactionDecodeErrorZ(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); } - CResult_BuiltCommitmentTransactionDecodeErrorZ(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); } - operator LDKCResult_BuiltCommitmentTransactionDecodeErrorZ() && { LDKCResult_BuiltCommitmentTransactionDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BuiltCommitmentTransactionDecodeErrorZ)); return res; } - ~CResult_BuiltCommitmentTransactionDecodeErrorZ() { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); } - CResult_BuiltCommitmentTransactionDecodeErrorZ& operator=(CResult_BuiltCommitmentTransactionDecodeErrorZ&& o) { CResult_BuiltCommitmentTransactionDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BuiltCommitmentTransactionDecodeErrorZ)); return *this; } - LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() { return &self; } - LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } -}; class COption_NoneZ { private: LDKCOption_NoneZ self; @@ -7557,97 +7889,27 @@ public: const LDKCOption_NoneZ* operator &() const { return &self; } const LDKCOption_NoneZ* operator ->() const { return &self; } }; -class CVec_TxOutZ { -private: - LDKCVec_TxOutZ self; -public: - CVec_TxOutZ(const CVec_TxOutZ&) = delete; - CVec_TxOutZ(CVec_TxOutZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_TxOutZ)); } - CVec_TxOutZ(LDKCVec_TxOutZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_TxOutZ)); } - operator LDKCVec_TxOutZ() && { LDKCVec_TxOutZ res = self; memset(&self, 0, sizeof(LDKCVec_TxOutZ)); return res; } - ~CVec_TxOutZ() { CVec_TxOutZ_free(self); } - CVec_TxOutZ& operator=(CVec_TxOutZ&& o) { CVec_TxOutZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_TxOutZ)); return *this; } - LDKCVec_TxOutZ* operator &() { return &self; } - LDKCVec_TxOutZ* operator ->() { return &self; } - const LDKCVec_TxOutZ* operator &() const { return &self; } - const LDKCVec_TxOutZ* operator ->() const { return &self; } -}; -class CResult_ChannelUpdateInfoDecodeErrorZ { -private: - LDKCResult_ChannelUpdateInfoDecodeErrorZ self; -public: - CResult_ChannelUpdateInfoDecodeErrorZ(const CResult_ChannelUpdateInfoDecodeErrorZ&) = delete; - CResult_ChannelUpdateInfoDecodeErrorZ(CResult_ChannelUpdateInfoDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); } - CResult_ChannelUpdateInfoDecodeErrorZ(LDKCResult_ChannelUpdateInfoDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); } - operator LDKCResult_ChannelUpdateInfoDecodeErrorZ() && { LDKCResult_ChannelUpdateInfoDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ChannelUpdateInfoDecodeErrorZ)); return res; } - ~CResult_ChannelUpdateInfoDecodeErrorZ() { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); } - CResult_ChannelUpdateInfoDecodeErrorZ& operator=(CResult_ChannelUpdateInfoDecodeErrorZ&& o) { CResult_ChannelUpdateInfoDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ChannelUpdateInfoDecodeErrorZ)); return *this; } - LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() { return &self; } - LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator ->() const { return &self; } -}; -class C2Tuple_u32ScriptZ { -private: - LDKC2Tuple_u32ScriptZ self; -public: - C2Tuple_u32ScriptZ(const C2Tuple_u32ScriptZ&) = delete; - C2Tuple_u32ScriptZ(C2Tuple_u32ScriptZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_u32ScriptZ)); } - C2Tuple_u32ScriptZ(LDKC2Tuple_u32ScriptZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_u32ScriptZ)); } - operator LDKC2Tuple_u32ScriptZ() && { LDKC2Tuple_u32ScriptZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_u32ScriptZ)); return res; } - ~C2Tuple_u32ScriptZ() { C2Tuple_u32ScriptZ_free(self); } - C2Tuple_u32ScriptZ& operator=(C2Tuple_u32ScriptZ&& o) { C2Tuple_u32ScriptZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_u32ScriptZ)); return *this; } - LDKC2Tuple_u32ScriptZ* operator &() { return &self; } - LDKC2Tuple_u32ScriptZ* operator ->() { return &self; } - const LDKC2Tuple_u32ScriptZ* operator &() const { return &self; } - const LDKC2Tuple_u32ScriptZ* operator ->() const { return &self; } -}; -class CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { -private: - LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ self; -public: - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(const CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&) = delete; - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); } - operator LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() && { LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return res; } - ~CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ() { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); } - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ& operator=(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ&& o) { CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ)); return *this; } - LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() { return &self; } - LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_UpdateFailHTLCZ { -private: - LDKCVec_UpdateFailHTLCZ self; -public: - CVec_UpdateFailHTLCZ(const CVec_UpdateFailHTLCZ&) = delete; - CVec_UpdateFailHTLCZ(CVec_UpdateFailHTLCZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); } - CVec_UpdateFailHTLCZ(LDKCVec_UpdateFailHTLCZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); } - operator LDKCVec_UpdateFailHTLCZ() && { LDKCVec_UpdateFailHTLCZ res = self; memset(&self, 0, sizeof(LDKCVec_UpdateFailHTLCZ)); return res; } - ~CVec_UpdateFailHTLCZ() { CVec_UpdateFailHTLCZ_free(self); } - CVec_UpdateFailHTLCZ& operator=(CVec_UpdateFailHTLCZ&& o) { CVec_UpdateFailHTLCZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_UpdateFailHTLCZ)); return *this; } - LDKCVec_UpdateFailHTLCZ* operator &() { return &self; } - LDKCVec_UpdateFailHTLCZ* operator ->() { return &self; } - const LDKCVec_UpdateFailHTLCZ* operator &() const { return &self; } - const LDKCVec_UpdateFailHTLCZ* operator ->() const { return &self; } -}; -class CResult_ReplyShortChannelIdsEndDecodeErrorZ { -private: - LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ self; -public: - CResult_ReplyShortChannelIdsEndDecodeErrorZ(const CResult_ReplyShortChannelIdsEndDecodeErrorZ&) = delete; - CResult_ReplyShortChannelIdsEndDecodeErrorZ(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); } - CResult_ReplyShortChannelIdsEndDecodeErrorZ(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); } - operator LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ() && { LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ)); return res; } - ~CResult_ReplyShortChannelIdsEndDecodeErrorZ() { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); } - CResult_ReplyShortChannelIdsEndDecodeErrorZ& operator=(CResult_ReplyShortChannelIdsEndDecodeErrorZ&& o) { CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ReplyShortChannelIdsEndDecodeErrorZ)); return *this; } - LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() { return &self; } - LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_ReplyShortChannelIdsEndDecodeErrorZ* operator ->() const { return &self; } -}; +inline LDK::CResult_RouteLightningErrorZ Router::find_route(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs) { + LDK::CResult_RouteLightningErrorZ ret = (self.find_route)(self.this_arg, payer, route_params, first_hops, inflight_htlcs); + return ret; +} +inline LDK::CResult_RouteLightningErrorZ Router::find_route_with_id(struct LDKPublicKey payer, const struct LDKRouteParameters *NONNULL_PTR route_params, struct LDKCVec_ChannelDetailsZ *first_hops, struct LDKInFlightHtlcs inflight_htlcs, struct LDKThirtyTwoBytes _payment_hash, struct LDKThirtyTwoBytes _payment_id) { + LDK::CResult_RouteLightningErrorZ ret = (self.find_route_with_id)(self.this_arg, payer, route_params, first_hops, inflight_htlcs, _payment_hash, _payment_id); + return ret; +} +inline void Router::notify_payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id) { + (self.notify_payment_path_failed)(self.this_arg, path, short_channel_id); +} +inline void Router::notify_payment_path_successful(struct LDKCVec_RouteHopZ path) { + (self.notify_payment_path_successful)(self.this_arg, path); +} +inline void Router::notify_payment_probe_successful(struct LDKCVec_RouteHopZ path) { + (self.notify_payment_probe_successful)(self.this_arg, path); +} +inline void Router::notify_payment_probe_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id) { + (self.notify_payment_probe_failed)(self.this_arg, path, short_channel_id); +} inline void BroadcasterInterface::broadcast_transaction(struct LDKTransaction tx) { (self.broadcast_transaction)(self.this_arg, tx); } @@ -7666,7 +7928,7 @@ inline LDK::OnionMessage OnionMessageProvider::next_onion_message_for_peer(struc inline void EventsProvider::process_pending_events(struct LDKEventHandler handler) { (self.process_pending_events)(self.this_arg, handler); } -inline void EventHandler::handle_event(const struct LDKEvent *NONNULL_PTR event) { +inline void EventHandler::handle_event(struct LDKEvent event) { (self.handle_event)(self.this_arg, event); } inline LDK::CResult_TxOutAccessErrorZ Access::get_utxo(const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) { @@ -7691,8 +7953,8 @@ inline void Confirm::transaction_unconfirmed(const uint8_t (*txid)[32]) { inline void Confirm::best_block_updated(const uint8_t (*header)[80], uint32_t height) { (self.best_block_updated)(self.this_arg, header, height); } -inline LDK::CVec_TxidZ Confirm::get_relevant_txids() { - LDK::CVec_TxidZ ret = (self.get_relevant_txids)(self.this_arg); +inline LDK::CVec_C2Tuple_TxidBlockHashZZ Confirm::get_relevant_txids() { + LDK::CVec_C2Tuple_TxidBlockHashZZ ret = (self.get_relevant_txids)(self.this_arg); return ret; } inline LDK::ChannelMonitorUpdateStatus Watch::watch_channel(struct LDKOutPoint funding_txo, struct LDKChannelMonitor monitor) { @@ -7789,8 +8051,8 @@ inline LDK::CResult_C2Tuple_SignatureSignatureZNoneZ BaseSign::sign_channel_anno LDK::CResult_C2Tuple_SignatureSignatureZNoneZ ret = (self.sign_channel_announcement)(self.this_arg, msg); return ret; } -inline void BaseSign::ready_channel(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters) { - (self.ready_channel)(self.this_arg, channel_parameters); +inline void BaseSign::provide_channel_parameters(const struct LDKChannelTransactionParameters *NONNULL_PTR channel_parameters) { + (self.provide_channel_parameters)(self.this_arg, channel_parameters); } inline LDK::CResult_SecretKeyNoneZ KeysInterface::get_node_secret(enum LDKRecipient recipient) { LDK::CResult_SecretKeyNoneZ ret = (self.get_node_secret)(self.this_arg, recipient); @@ -7812,8 +8074,12 @@ inline LDK::ShutdownScript KeysInterface::get_shutdown_scriptpubkey() { LDK::ShutdownScript ret = (self.get_shutdown_scriptpubkey)(self.this_arg); return ret; } -inline LDK::Sign KeysInterface::get_channel_signer(bool inbound, uint64_t channel_value_satoshis) { - LDK::Sign ret = (self.get_channel_signer)(self.this_arg, inbound, channel_value_satoshis); +inline LDKThirtyTwoBytes KeysInterface::generate_channel_keys_id(bool inbound, uint64_t channel_value_satoshis, struct LDKU128 user_channel_id) { + LDKThirtyTwoBytes ret = (self.generate_channel_keys_id)(self.this_arg, inbound, channel_value_satoshis, user_channel_id); + return ret; +} +inline LDK::Sign KeysInterface::derive_channel_signer(uint64_t channel_value_satoshis, struct LDKThirtyTwoBytes channel_keys_id) { + LDK::Sign ret = (self.derive_channel_signer)(self.this_arg, channel_value_satoshis, channel_keys_id); return ret; } inline LDKThirtyTwoBytes KeysInterface::get_secure_random_bytes() { @@ -7824,7 +8090,7 @@ inline LDK::CResult_SignDecodeErrorZ KeysInterface::read_chan_signer(struct LDKu LDK::CResult_SignDecodeErrorZ ret = (self.read_chan_signer)(self.this_arg, reader); return ret; } -inline LDK::CResult_RecoverableSignatureNoneZ KeysInterface::sign_invoice(struct LDKu8slice hrp_bytes, struct LDKCVec_u5Z invoice_data, enum LDKRecipient receipient) { +inline LDK::CResult_RecoverableSignatureNoneZ KeysInterface::sign_invoice(struct LDKu8slice hrp_bytes, struct LDKCVec_U5Z invoice_data, enum LDKRecipient receipient) { LDK::CResult_RecoverableSignatureNoneZ ret = (self.sign_invoice)(self.this_arg, hrp_bytes, invoice_data, receipient); return ret; } @@ -7852,12 +8118,12 @@ inline LDK::CVec_ChannelDetailsZ Payer::first_hops() { LDK::CVec_ChannelDetailsZ ret = (self.first_hops)(self.this_arg); return ret; } -inline LDK::CResult_PaymentIdPaymentSendFailureZ Payer::send_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret) { - LDK::CResult_PaymentIdPaymentSendFailureZ ret = (self.send_payment)(self.this_arg, route, payment_hash, payment_secret); +inline LDK::CResult_NonePaymentSendFailureZ Payer::send_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_hash, struct LDKThirtyTwoBytes payment_secret, struct LDKThirtyTwoBytes payment_id) { + LDK::CResult_NonePaymentSendFailureZ ret = (self.send_payment)(self.this_arg, route, payment_hash, payment_secret, payment_id); return ret; } -inline LDK::CResult_PaymentIdPaymentSendFailureZ Payer::send_spontaneous_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage) { - LDK::CResult_PaymentIdPaymentSendFailureZ ret = (self.send_spontaneous_payment)(self.this_arg, route, payment_preimage); +inline LDK::CResult_NonePaymentSendFailureZ Payer::send_spontaneous_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_preimage, struct LDKThirtyTwoBytes payment_id) { + LDK::CResult_NonePaymentSendFailureZ ret = (self.send_spontaneous_payment)(self.this_arg, route, payment_preimage, payment_id); return ret; } inline LDK::CResult_NonePaymentSendFailureZ Payer::retry_payment(const struct LDKRoute *NONNULL_PTR route, struct LDKThirtyTwoBytes payment_id) { @@ -7867,22 +8133,10 @@ inline LDK::CResult_NonePaymentSendFailureZ Payer::retry_payment(const struct LD inline void Payer::abandon_payment(struct LDKThirtyTwoBytes payment_id) { (self.abandon_payment)(self.this_arg, payment_id); } -inline LDK::CResult_RouteLightningErrorZ Router::find_route(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) { - LDK::CResult_RouteLightningErrorZ ret = (self.find_route)(self.this_arg, payer, route_params, payment_hash, first_hops, inflight_htlcs); +inline LDK::InFlightHtlcs Payer::inflight_htlcs() { + LDK::InFlightHtlcs ret = (self.inflight_htlcs)(self.this_arg); return ret; } -inline void Router::notify_payment_path_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id) { - (self.notify_payment_path_failed)(self.this_arg, path, short_channel_id); -} -inline void Router::notify_payment_path_successful(struct LDKCVec_RouteHopZ path) { - (self.notify_payment_path_successful)(self.this_arg, path); -} -inline void Router::notify_payment_probe_successful(struct LDKCVec_RouteHopZ path) { - (self.notify_payment_probe_successful)(self.this_arg, path); -} -inline void Router::notify_payment_probe_failed(struct LDKCVec_RouteHopZ path, uint64_t short_channel_id) { - (self.notify_payment_probe_failed)(self.this_arg, path, short_channel_id); -} inline LDK::CResult_NoneLightningErrorZ CustomMessageHandler::handle_custom_message(struct LDKType msg, struct LDKPublicKey sender_node_id) { LDK::CResult_NoneLightningErrorZ ret = (self.handle_custom_message)(self.this_arg, msg, sender_node_id); return ret; diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index 63bab7e..eb681f4 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -8,284 +8,37 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; #[repr(C)] -/// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PublicKeyZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::PublicKey, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PublicKeyZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PublicKeyZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { } -impl Drop for CVec_PublicKeyZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_PublicKeyZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} -#[repr(C)] -/// The contents of CResult_BlindedRouteNoneZ -pub union CResult_BlindedRouteNoneZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::onion_message::blinded_route::BlindedRoute, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, -} -#[repr(C)] -/// 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`. -pub struct CResult_BlindedRouteNoneZ { - /// The contents of this CResult_BlindedRouteNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedRouteNoneZPtr, - /// Whether this CResult_BlindedRouteNoneZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_BlindedRouteNoneZ in the success state. -pub extern "C" fn CResult_BlindedRouteNoneZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedRoute) -> CResult_BlindedRouteNoneZ { - CResult_BlindedRouteNoneZ { - contents: CResult_BlindedRouteNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_BlindedRouteNoneZ in the error state. -pub extern "C" fn CResult_BlindedRouteNoneZ_err() -> CResult_BlindedRouteNoneZ { - CResult_BlindedRouteNoneZ { - contents: CResult_BlindedRouteNoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, - } -} -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_BlindedRouteNoneZ_is_ok(o: &CResult_BlindedRouteNoneZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_BlindedRouteNoneZ. -pub extern "C" fn CResult_BlindedRouteNoneZ_free(_res: CResult_BlindedRouteNoneZ) { } -impl Drop for CResult_BlindedRouteNoneZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - } - } -} -impl From> for CResult_BlindedRouteNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_BlindedRouteNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_BlindedRouteNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -#[repr(C)] -/// The contents of CResult_BlindedRouteDecodeErrorZ -pub union CResult_BlindedRouteDecodeErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::onion_message::blinded_route::BlindedRoute, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, -} -#[repr(C)] -/// 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`. -pub struct CResult_BlindedRouteDecodeErrorZ { - /// The contents of this CResult_BlindedRouteDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedRouteDecodeErrorZPtr, - /// Whether this CResult_BlindedRouteDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_BlindedRouteDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedRoute) -> CResult_BlindedRouteDecodeErrorZ { - CResult_BlindedRouteDecodeErrorZ { - contents: CResult_BlindedRouteDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_BlindedRouteDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedRouteDecodeErrorZ { - CResult_BlindedRouteDecodeErrorZ { - contents: CResult_BlindedRouteDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, - } -} -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_is_ok(o: &CResult_BlindedRouteDecodeErrorZ) -> bool { - o.result_ok +/// An enum which can either contain a crate::lightning::ln::chan_utils::HTLCClaim or not +pub enum COption_HTLCClaimZ { + /// When we're in this state, this COption_HTLCClaimZ contains a crate::lightning::ln::chan_utils::HTLCClaim + Some(crate::lightning::ln::chan_utils::HTLCClaim), + /// When we're in this state, this COption_HTLCClaimZ contains nothing + None } -#[no_mangle] -/// Frees any resources used by the CResult_BlindedRouteDecodeErrorZ. -pub extern "C" fn CResult_BlindedRouteDecodeErrorZ_free(_res: CResult_BlindedRouteDecodeErrorZ) { } -impl Drop for CResult_BlindedRouteDecodeErrorZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } +impl COption_HTLCClaimZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl From> for CResult_BlindedRouteDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_BlindedRouteDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedRouteDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -#[repr(C)] -/// The contents of CResult_BlindedHopDecodeErrorZ -pub union CResult_BlindedHopDecodeErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::onion_message::blinded_route::BlindedHop, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, -} -#[repr(C)] -/// 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`. -pub struct CResult_BlindedHopDecodeErrorZ { - /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedHopDecodeErrorZPtr, - /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_BlindedHopDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_route::BlindedHop) -> CResult_BlindedHopDecodeErrorZ { - CResult_BlindedHopDecodeErrorZ { - contents: CResult_BlindedHopDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::chan_utils::HTLCClaim { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_BlindedHopDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ { - CResult_BlindedHopDecodeErrorZ { - contents: CResult_BlindedHopDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, - } +/// Constructs a new COption_HTLCClaimZ containing a crate::lightning::ln::chan_utils::HTLCClaim +pub extern "C" fn COption_HTLCClaimZ_some(o: crate::lightning::ln::chan_utils::HTLCClaim) -> COption_HTLCClaimZ { + COption_HTLCClaimZ::Some(o) } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool { - o.result_ok +/// Constructs a new COption_HTLCClaimZ containing nothing +pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ { + COption_HTLCClaimZ::None } #[no_mangle] -/// Frees any resources used by the CResult_BlindedHopDecodeErrorZ. -pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { } -impl Drop for CResult_BlindedHopDecodeErrorZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } - } -} -impl From> for CResult_BlindedHopDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_BlindedHopDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedHopDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} +/// Frees any resources associated with the crate::lightning::ln::chan_utils::HTLCClaim, if we are in the Some state +pub extern "C" fn COption_HTLCClaimZ_free(_res: COption_HTLCClaimZ) { } #[repr(C)] /// The contents of CResult_NoneNoneZ pub union CResult_NoneNoneZPtr { @@ -471,41 +224,41 @@ impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SecretKeyErrorZ -pub union CResult_SecretKeyErrorZPtr { +/// The contents of CResult_TxCreationKeysDecodeErrorZ +pub union CResult_TxCreationKeysDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::SecretKey, + pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::c_types::Secp256k1Error, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_SecretKeyErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::SecretKey on success and a crate::c_types::Secp256k1Error on failure. +/// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SecretKeyErrorZ { - /// The contents of this CResult_SecretKeyErrorZ, accessible via either +pub struct CResult_TxCreationKeysDecodeErrorZ { + /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SecretKeyErrorZPtr, - /// Whether this CResult_SecretKeyErrorZ represents a success state. + pub contents: CResult_TxCreationKeysDecodeErrorZPtr, + /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SecretKeyErrorZ in the success state. -pub extern "C" fn CResult_SecretKeyErrorZ_ok(o: crate::c_types::SecretKey) -> CResult_SecretKeyErrorZ { - CResult_SecretKeyErrorZ { - contents: CResult_SecretKeyErrorZPtr { +/// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ { + CResult_TxCreationKeysDecodeErrorZ { + contents: CResult_TxCreationKeysDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SecretKeyErrorZ in the error state. -pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_SecretKeyErrorZ { - CResult_SecretKeyErrorZ { - contents: CResult_SecretKeyErrorZPtr { +/// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ { + CResult_TxCreationKeysDecodeErrorZ { + contents: CResult_TxCreationKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -513,13 +266,13 @@ pub extern "C" fn CResult_SecretKeyErrorZ_err(e: crate::c_types::Secp256k1Error) } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SecretKeyErrorZ_is_ok(o: &CResult_SecretKeyErrorZ) -> bool { +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SecretKeyErrorZ. -pub extern "C" fn CResult_SecretKeyErrorZ_free(_res: CResult_SecretKeyErrorZ) { } -impl Drop for CResult_SecretKeyErrorZ { +/// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { } +impl Drop for CResult_TxCreationKeysDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -532,16 +285,16 @@ impl Drop for CResult_SecretKeyErrorZ { } } } -impl From> for CResult_SecretKeyErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxCreationKeysDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_SecretKeyErrorZPtr { result } + CResult_TxCreationKeysDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SecretKeyErrorZPtr { err } + CResult_TxCreationKeysDecodeErrorZPtr { err } }; Self { contents, @@ -549,59 +302,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SecretKeyErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SecretKeyErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SecretKeyErrorZ which has the same data as `orig` +/// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SecretKeyErrorZ_clone(orig: &CResult_SecretKeyErrorZ) -> CResult_SecretKeyErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PublicKeyErrorZ -pub union CResult_PublicKeyErrorZPtr { +/// The contents of CResult_ChannelPublicKeysDecodeErrorZ +pub union CResult_ChannelPublicKeysDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::PublicKey, + pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::c_types::Secp256k1Error, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_PublicKeyErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. +/// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PublicKeyErrorZ { - /// The contents of this CResult_PublicKeyErrorZ, accessible via either +pub struct CResult_ChannelPublicKeysDecodeErrorZ { + /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PublicKeyErrorZPtr, - /// Whether this CResult_PublicKeyErrorZ represents a success state. + pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr, + /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PublicKeyErrorZ in the success state. -pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ { - CResult_PublicKeyErrorZ { - contents: CResult_PublicKeyErrorZPtr { +/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ { + CResult_ChannelPublicKeysDecodeErrorZ { + contents: CResult_ChannelPublicKeysDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PublicKeyErrorZ in the error state. -pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ { - CResult_PublicKeyErrorZ { - contents: CResult_PublicKeyErrorZPtr { +/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ { + CResult_ChannelPublicKeysDecodeErrorZ { + contents: CResult_ChannelPublicKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -609,13 +362,13 @@ pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool { +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PublicKeyErrorZ. -pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { } -impl Drop for CResult_PublicKeyErrorZ { +/// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { } +impl Drop for CResult_ChannelPublicKeysDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -628,16 +381,16 @@ impl Drop for CResult_PublicKeyErrorZ { } } } -impl From> for CResult_PublicKeyErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelPublicKeysDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PublicKeyErrorZPtr { result } + CResult_ChannelPublicKeysDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PublicKeyErrorZPtr { err } + CResult_ChannelPublicKeysDecodeErrorZPtr { err } }; Self { contents, @@ -645,59 +398,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxCreationKeysDecodeErrorZ -pub union CResult_TxCreationKeysDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a u32 or not +pub enum COption_u32Z { + /// When we're in this state, this COption_u32Z contains a u32 + Some(u32), + /// When we're in this state, this COption_u32Z contains nothing + None +} +impl COption_u32Z { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> u32 { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_u32Z containing a u32 +pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z { + COption_u32Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_u32Z containing nothing +pub extern "C" fn COption_u32Z_none() -> COption_u32Z { + COption_u32Z::None +} +#[no_mangle] +/// Frees any resources associated with the u32, if we are in the Some state +pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { } +#[no_mangle] +/// Creates a new COption_u32Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ +pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys, + pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_TxCreationKeysDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TxCreationKeysDecodeErrorZ { - /// The contents of this CResult_TxCreationKeysDecodeErrorZ, accessible via either +pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ { + /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxCreationKeysDecodeErrorZPtr, - /// Whether this CResult_TxCreationKeysDecodeErrorZ represents a success state. + pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr, + /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxCreationKeysDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysDecodeErrorZ { - CResult_TxCreationKeysDecodeErrorZ { - contents: CResult_TxCreationKeysDecodeErrorZPtr { +/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { + CResult_HTLCOutputInCommitmentDecodeErrorZ { + contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxCreationKeysDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCreationKeysDecodeErrorZ { - CResult_TxCreationKeysDecodeErrorZ { - contents: CResult_TxCreationKeysDecodeErrorZPtr { +/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { + CResult_HTLCOutputInCommitmentDecodeErrorZ { + contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -705,13 +495,13 @@ pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> bool { +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxCreationKeysDecodeErrorZ. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { } -impl Drop for CResult_TxCreationKeysDecodeErrorZ { +/// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { } +impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -724,16 +514,16 @@ impl Drop for CResult_TxCreationKeysDecodeErrorZ { } } } -impl From> for CResult_TxCreationKeysDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HTLCOutputInCommitmentDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_TxCreationKeysDecodeErrorZPtr { result } + CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxCreationKeysDecodeErrorZPtr { err } + CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err } }; Self { contents, @@ -741,59 +531,88 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxCreationKeysDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxCreationKeysDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelPublicKeysDecodeErrorZ -pub union CResult_ChannelPublicKeysDecodeErrorZPtr { +/// An enum which can either contain a or not +pub enum COption_NoneZ { + /// When we're in this state, this COption_NoneZ contains a + Some, + /// When we're in this state, this COption_NoneZ contains nothing + None +} +impl COption_NoneZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } +} +#[no_mangle] +/// Constructs a new COption_NoneZ containing a +pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ { + COption_NoneZ::Some +} +#[no_mangle] +/// Constructs a new COption_NoneZ containing nothing +pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ { + COption_NoneZ::None +} +#[no_mangle] +/// Frees any resources associated with the , if we are in the Some state +pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { } +#[repr(C)] +/// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ +pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::ChannelPublicKeys, + pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_ChannelPublicKeysDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::ChannelPublicKeys on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelPublicKeysDecodeErrorZ { - /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, accessible via either +pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelPublicKeysDecodeErrorZPtr, - /// Whether this CResult_ChannelPublicKeysDecodeErrorZ represents a success state. + pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr, + /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelPublicKeys) -> CResult_ChannelPublicKeysDecodeErrorZ { - CResult_ChannelPublicKeysDecodeErrorZ { - contents: CResult_ChannelPublicKeysDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelPublicKeysDecodeErrorZ { - CResult_ChannelPublicKeysDecodeErrorZ { - contents: CResult_ChannelPublicKeysDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -801,13 +620,13 @@ pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_is_ok(o: &CResult_ChannelPublicKeysDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelPublicKeysDecodeErrorZ. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_free(_res: CResult_ChannelPublicKeysDecodeErrorZ) { } -impl Drop for CResult_ChannelPublicKeysDecodeErrorZ { +/// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { } +impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -820,16 +639,16 @@ impl Drop for CResult_ChannelPublicKeysDecodeErrorZ { } } } -impl From> for CResult_ChannelPublicKeysDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ChannelPublicKeysDecodeErrorZPtr { result } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelPublicKeysDecodeErrorZPtr { err } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err } }; Self { contents, @@ -837,59 +656,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelPublicKeysDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxCreationKeysErrorZ -pub union CResult_TxCreationKeysErrorZPtr { - /// A pointer to the contents in the success state. +/// The contents of CResult_ChannelTransactionParametersDecodeErrorZ +pub union CResult_ChannelTransactionParametersDecodeErrorZPtr { + /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::TxCreationKeys, + pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::c_types::Secp256k1Error, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_TxCreationKeysErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TxCreationKeys on success and a crate::c_types::Secp256k1Error on failure. +/// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TxCreationKeysErrorZ { - /// The contents of this CResult_TxCreationKeysErrorZ, accessible via either +pub struct CResult_ChannelTransactionParametersDecodeErrorZ { + /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxCreationKeysErrorZPtr, - /// Whether this CResult_TxCreationKeysErrorZ represents a success state. + pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr, + /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxCreationKeysErrorZ in the success state. -pub extern "C" fn CResult_TxCreationKeysErrorZ_ok(o: crate::lightning::ln::chan_utils::TxCreationKeys) -> CResult_TxCreationKeysErrorZ { - CResult_TxCreationKeysErrorZ { - contents: CResult_TxCreationKeysErrorZPtr { +/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ { + CResult_ChannelTransactionParametersDecodeErrorZ { + contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxCreationKeysErrorZ in the error state. -pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_TxCreationKeysErrorZ { - CResult_TxCreationKeysErrorZ { - contents: CResult_TxCreationKeysErrorZPtr { +/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ { + CResult_ChannelTransactionParametersDecodeErrorZ { + contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -897,13 +716,13 @@ pub extern "C" fn CResult_TxCreationKeysErrorZ_err(e: crate::c_types::Secp256k1E } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxCreationKeysErrorZ_is_ok(o: &CResult_TxCreationKeysErrorZ) -> bool { +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxCreationKeysErrorZ. -pub extern "C" fn CResult_TxCreationKeysErrorZ_free(_res: CResult_TxCreationKeysErrorZ) { } -impl Drop for CResult_TxCreationKeysErrorZ { +/// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { } +impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -916,16 +735,16 @@ impl Drop for CResult_TxCreationKeysErrorZ { } } } -impl From> for CResult_TxCreationKeysErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelTransactionParametersDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_TxCreationKeysErrorZPtr { result } + CResult_ChannelTransactionParametersDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxCreationKeysErrorZPtr { err } + CResult_ChannelTransactionParametersDecodeErrorZPtr { err } }; Self { contents, @@ -933,96 +752,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxCreationKeysErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxCreationKeysErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxCreationKeysErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxCreationKeysErrorZ_clone(orig: &CResult_TxCreationKeysErrorZ) -> CResult_TxCreationKeysErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a u32 or not -pub enum COption_u32Z { - /// When we're in this state, this COption_u32Z contains a u32 - Some(u32), - /// When we're in this state, this COption_u32Z contains nothing - None +/// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_SignatureZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::Signature, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_u32Z { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl CVec_SignatureZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } - #[allow(unused)] pub(crate) fn take(mut self) -> u32 { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl From> for CVec_SignatureZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } } } #[no_mangle] -/// Constructs a new COption_u32Z containing a u32 -pub extern "C" fn COption_u32Z_some(o: u32) -> COption_u32Z { - COption_u32Z::Some(o) +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { } +impl Drop for CVec_SignatureZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } } -#[no_mangle] -/// Constructs a new COption_u32Z containing nothing -pub extern "C" fn COption_u32Z_none() -> COption_u32Z { - COption_u32Z::None +impl Clone for CVec_SignatureZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } } -#[no_mangle] -/// Frees any resources associated with the u32, if we are in the Some state -pub extern "C" fn COption_u32Z_free(_res: COption_u32Z) { } -#[no_mangle] -/// Creates a new COption_u32Z which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ -pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr { +/// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ +pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::HTLCOutputInCommitment, + pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_HTLCOutputInCommitmentDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::HTLCOutputInCommitment on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_HTLCOutputInCommitmentDecodeErrorZ { - /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, accessible via either +pub struct CResult_HolderCommitmentTransactionDecodeErrorZ { + /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr, - /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ represents a success state. + pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr, + /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the success state. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { - CResult_HTLCOutputInCommitmentDecodeErrorZ { - contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { +/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ { + CResult_HolderCommitmentTransactionDecodeErrorZ { + contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ in the error state. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { - CResult_HTLCOutputInCommitmentDecodeErrorZ { - contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { +/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ { + CResult_HolderCommitmentTransactionDecodeErrorZ { + contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1030,13 +858,13 @@ pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> bool { +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HTLCOutputInCommitmentDecodeErrorZ. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { } -impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ { +/// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { } +impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1049,16 +877,16 @@ impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ { } } } -impl From> for CResult_HTLCOutputInCommitmentDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HolderCommitmentTransactionDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result } + CResult_HolderCommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err } + CResult_HolderCommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -1066,88 +894,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HTLCOutputInCommitmentDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// An enum which can either contain a or not -pub enum COption_NoneZ { - /// When we're in this state, this COption_NoneZ contains a - Some, - /// When we're in this state, this COption_NoneZ contains nothing - None -} -impl COption_NoneZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } -} -#[no_mangle] -/// Constructs a new COption_NoneZ containing a -pub extern "C" fn COption_NoneZ_some() -> COption_NoneZ { - COption_NoneZ::Some -} -#[no_mangle] -/// Constructs a new COption_NoneZ containing nothing -pub extern "C" fn COption_NoneZ_none() -> COption_NoneZ { - COption_NoneZ::None -} -#[no_mangle] -/// Frees any resources associated with the , if we are in the Some state -pub extern "C" fn COption_NoneZ_free(_res: COption_NoneZ) { } +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ -pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +/// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ +pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, + pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - /// The contents of this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ, accessible via either +pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ { + /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr, - /// Whether this CResult_CounterpartyChannelTransactionParametersDecodeErrorZ represents a success state. + pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr, + /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the success state. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { + CResult_BuiltCommitmentTransactionDecodeErrorZ { + contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ in the error state. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { + CResult_BuiltCommitmentTransactionDecodeErrorZ { + contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1155,13 +954,13 @@ pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_e } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CounterpartyChannelTransactionParametersDecodeErrorZ. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(_res: CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) { } -impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { +/// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { } +impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1174,16 +973,16 @@ impl Drop for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { } } } -impl From> for CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BuiltCommitmentTransactionDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result } + CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err } + CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -1191,95 +990,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelTransactionParametersDecodeErrorZ -pub union CResult_ChannelTransactionParametersDecodeErrorZPtr { +/// The contents of CResult_TrustedClosingTransactionNoneZ +pub union CResult_TrustedClosingTransactionNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::ChannelTransactionParameters, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_ChannelTransactionParametersDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::ChannelTransactionParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelTransactionParametersDecodeErrorZ { - /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, accessible via either +pub struct CResult_TrustedClosingTransactionNoneZ { + /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelTransactionParametersDecodeErrorZPtr, - /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ represents a success state. + pub contents: CResult_TrustedClosingTransactionNoneZPtr, + /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::ChannelTransactionParameters) -> CResult_ChannelTransactionParametersDecodeErrorZ { - CResult_ChannelTransactionParametersDecodeErrorZ { - contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { +/// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ { + CResult_TrustedClosingTransactionNoneZ { + contents: CResult_TrustedClosingTransactionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTransactionParametersDecodeErrorZ { - CResult_ChannelTransactionParametersDecodeErrorZ { - contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ { + CResult_TrustedClosingTransactionNoneZ { + contents: CResult_TrustedClosingTransactionNoneZPtr { + err: core::ptr::null_mut(), }, result_ok: false, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_ChannelTransactionParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelTransactionParametersDecodeErrorZ. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_free(_res: CResult_ChannelTransactionParametersDecodeErrorZ) { } -impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ { +/// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. +pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { } +impl Drop for CResult_TrustedClosingTransactionNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.result) }; } } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } } } } -impl From> for CResult_ChannelTransactionParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TrustedClosingTransactionNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ChannelTransactionParametersDecodeErrorZPtr { result } + CResult_TrustedClosingTransactionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelTransactionParametersDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1287,105 +1082,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_ChannelTransactionParametersDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::Signatures of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_SignatureZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::Signature, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_SignatureZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Signature] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_SignatureZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_SignatureZ_free(_res: CVec_SignatureZ) { } -impl Drop for CVec_SignatureZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_SignatureZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} #[repr(C)] -/// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ -pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr { +/// The contents of CResult_CommitmentTransactionDecodeErrorZ +pub union CResult_CommitmentTransactionDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::HolderCommitmentTransaction, + pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_HolderCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::HolderCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_HolderCommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, accessible via either +pub struct CResult_CommitmentTransactionDecodeErrorZ { + /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr, - /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ represents a success state. + pub contents: CResult_CommitmentTransactionDecodeErrorZPtr, + /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the success state. -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> CResult_HolderCommitmentTransactionDecodeErrorZ { - CResult_HolderCommitmentTransactionDecodeErrorZ { - contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ { + CResult_CommitmentTransactionDecodeErrorZ { + contents: CResult_CommitmentTransactionDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ in the error state. -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HolderCommitmentTransactionDecodeErrorZ { - CResult_HolderCommitmentTransactionDecodeErrorZ { - contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ { + CResult_CommitmentTransactionDecodeErrorZ { + contents: CResult_CommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1393,13 +1125,13 @@ pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_err(e: crate:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HolderCommitmentTransactionDecodeErrorZ. -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_free(_res: CResult_HolderCommitmentTransactionDecodeErrorZ) { } -impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ { +/// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { } +impl Drop for CResult_CommitmentTransactionDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1412,16 +1144,16 @@ impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_HolderCommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CommitmentTransactionDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_HolderCommitmentTransactionDecodeErrorZPtr { result } + CResult_CommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HolderCommitmentTransactionDecodeErrorZPtr { err } + CResult_CommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -1429,95 +1161,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HolderCommitmentTransactionDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CommitmentTransactionDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ -pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr { +/// The contents of CResult_TrustedCommitmentTransactionNoneZ +pub union CResult_TrustedCommitmentTransactionNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::BuiltCommitmentTransaction, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_BuiltCommitmentTransactionDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::BuiltCommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BuiltCommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either +pub struct CResult_TrustedCommitmentTransactionNoneZ { + /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr, - /// Whether this CResult_BuiltCommitmentTransactionDecodeErrorZ represents a success state. + pub contents: CResult_TrustedCommitmentTransactionNoneZPtr, + /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the success state. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::BuiltCommitmentTransaction) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { - CResult_BuiltCommitmentTransactionDecodeErrorZ { - contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ { + CResult_TrustedCommitmentTransactionNoneZ { + contents: CResult_TrustedCommitmentTransactionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ in the error state. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { - CResult_BuiltCommitmentTransactionDecodeErrorZ { - contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ { + CResult_TrustedCommitmentTransactionNoneZ { + contents: CResult_TrustedCommitmentTransactionNoneZPtr { + err: core::ptr::null_mut(), }, result_ok: false, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BuiltCommitmentTransactionDecodeErrorZ. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_free(_res: CResult_BuiltCommitmentTransactionDecodeErrorZ) { } -impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ { +/// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. +pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { } +impl Drop for CResult_TrustedCommitmentTransactionNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.result) }; } } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } } } } -impl From> for CResult_BuiltCommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TrustedCommitmentTransactionNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result } + CResult_TrustedCommitmentTransactionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1525,58 +1253,41 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_BuiltCommitmentTransactionDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TrustedClosingTransactionNoneZ -pub union CResult_TrustedClosingTransactionNoneZPtr { +/// The contents of CResult_CVec_SignatureZNoneZ +pub union CResult_CVec_SignatureZNoneZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::TrustedClosingTransaction, + pub result: *mut crate::c_types::derived::CVec_SignatureZ, /// Note that this value is always NULL, as there are no contents in the Err variant pub err: *mut core::ffi::c_void, } #[repr(C)] -/// A CResult_TrustedClosingTransactionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure. +/// A CResult_CVec_SignatureZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_SignatureZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TrustedClosingTransactionNoneZ { - /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either +pub struct CResult_CVec_SignatureZNoneZ { + /// The contents of this CResult_CVec_SignatureZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TrustedClosingTransactionNoneZPtr, - /// Whether this CResult_TrustedClosingTransactionNoneZ represents a success state. + pub contents: CResult_CVec_SignatureZNoneZPtr, + /// Whether this CResult_CVec_SignatureZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TrustedClosingTransactionNoneZ in the success state. -pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedClosingTransaction) -> CResult_TrustedClosingTransactionNoneZ { - CResult_TrustedClosingTransactionNoneZ { - contents: CResult_TrustedClosingTransactionNoneZPtr { +/// Creates a new CResult_CVec_SignatureZNoneZ in the success state. +pub extern "C" fn CResult_CVec_SignatureZNoneZ_ok(o: crate::c_types::derived::CVec_SignatureZ) -> CResult_CVec_SignatureZNoneZ { + CResult_CVec_SignatureZNoneZ { + contents: CResult_CVec_SignatureZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TrustedClosingTransactionNoneZ in the error state. -pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_TrustedClosingTransactionNoneZ { - CResult_TrustedClosingTransactionNoneZ { - contents: CResult_TrustedClosingTransactionNoneZPtr { +/// Creates a new CResult_CVec_SignatureZNoneZ in the error state. +pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ { + CResult_CVec_SignatureZNoneZ { + contents: CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -1584,13 +1295,13 @@ pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_err() -> CResult_Truste } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool { +pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TrustedClosingTransactionNoneZ. -pub extern "C" fn CResult_TrustedClosingTransactionNoneZ_free(_res: CResult_TrustedClosingTransactionNoneZ) { } -impl Drop for CResult_TrustedClosingTransactionNoneZ { +/// Frees any resources used by the CResult_CVec_SignatureZNoneZ. +pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { } +impl Drop for CResult_CVec_SignatureZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1600,16 +1311,16 @@ impl Drop for CResult_TrustedClosingTransactionNoneZ { } } } -impl From> for CResult_TrustedClosingTransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_SignatureZNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_TrustedClosingTransactionNoneZPtr { result } + CResult_CVec_SignatureZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() } + CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1617,42 +1328,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentTransactionDecodeErrorZ -pub union CResult_CommitmentTransactionDecodeErrorZPtr { +/// The contents of CResult_ShutdownScriptDecodeErrorZ +pub union CResult_ShutdownScriptDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::CommitmentTransaction, + pub result: *mut crate::lightning::ln::script::ShutdownScript, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_CommitmentTransactionDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::CommitmentTransaction on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_CommitmentTransactionDecodeErrorZ, accessible via either +pub struct CResult_ShutdownScriptDecodeErrorZ { + /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CommitmentTransactionDecodeErrorZPtr, - /// Whether this CResult_CommitmentTransactionDecodeErrorZ represents a success state. + pub contents: CResult_ShutdownScriptDecodeErrorZPtr, + /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the success state. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CommitmentTransaction) -> CResult_CommitmentTransactionDecodeErrorZ { - CResult_CommitmentTransactionDecodeErrorZ { - contents: CResult_CommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ { + CResult_ShutdownScriptDecodeErrorZ { + contents: CResult_ShutdownScriptDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CommitmentTransactionDecodeErrorZ in the error state. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentTransactionDecodeErrorZ { - CResult_CommitmentTransactionDecodeErrorZ { - contents: CResult_CommitmentTransactionDecodeErrorZPtr { +/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ { + CResult_ShutdownScriptDecodeErrorZ { + contents: CResult_ShutdownScriptDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1660,13 +1388,13 @@ pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CommitmentTransactionDecodeErrorZ. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_free(_res: CResult_CommitmentTransactionDecodeErrorZ) { } -impl Drop for CResult_CommitmentTransactionDecodeErrorZ { +/// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { } +impl Drop for CResult_ShutdownScriptDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1679,16 +1407,16 @@ impl Drop for CResult_CommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_CommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ShutdownScriptDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CommitmentTransactionDecodeErrorZPtr { result } + CResult_ShutdownScriptDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentTransactionDecodeErrorZPtr { err } + CResult_ShutdownScriptDecodeErrorZPtr { err } }; Self { contents, @@ -1696,91 +1424,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CommitmentTransactionDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CommitmentTransactionDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CommitmentTransactionDecodeErrorZ 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. -pub extern "C" fn CResult_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TrustedCommitmentTransactionNoneZ -pub union CResult_TrustedCommitmentTransactionNoneZPtr { +/// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ +pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::chan_utils::TrustedCommitmentTransaction, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, + pub result: *mut crate::lightning::ln::script::ShutdownScript, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::script::InvalidShutdownScript, } #[repr(C)] -/// A CResult_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure. +/// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TrustedCommitmentTransactionNoneZ { - /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either +pub struct CResult_ShutdownScriptInvalidShutdownScriptZ { + /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TrustedCommitmentTransactionNoneZPtr, - /// Whether this CResult_TrustedCommitmentTransactionNoneZ represents a success state. + pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr, + /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the success state. -pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_ok(o: crate::lightning::ln::chan_utils::TrustedCommitmentTransaction) -> CResult_TrustedCommitmentTransactionNoneZ { - CResult_TrustedCommitmentTransactionNoneZ { - contents: CResult_TrustedCommitmentTransactionNoneZPtr { +/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { + CResult_ShutdownScriptInvalidShutdownScriptZ { + contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TrustedCommitmentTransactionNoneZ in the error state. -pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_err() -> CResult_TrustedCommitmentTransactionNoneZ { - CResult_TrustedCommitmentTransactionNoneZ { - contents: CResult_TrustedCommitmentTransactionNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { + CResult_ShutdownScriptInvalidShutdownScriptZ { + contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { + err: Box::into_raw(Box::new(e)), }, result_ok: false, } } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_is_ok(o: &CResult_TrustedCommitmentTransactionNoneZ) -> bool { +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TrustedCommitmentTransactionNoneZ. -pub extern "C" fn CResult_TrustedCommitmentTransactionNoneZ_free(_res: CResult_TrustedCommitmentTransactionNoneZ) { } -impl Drop for CResult_TrustedCommitmentTransactionNoneZ { +/// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { } +impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.result) }; } } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } } } } -impl From> for CResult_TrustedCommitmentTransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ShutdownScriptInvalidShutdownScriptZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_TrustedCommitmentTransactionNoneZPtr { result } + CResult_ShutdownScriptInvalidShutdownScriptZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_TrustedCommitmentTransactionNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ShutdownScriptInvalidShutdownScriptZPtr { err } }; Self { contents, @@ -1788,55 +1520,118 @@ impl From CResult_CVec_SignatureZNoneZ { - CResult_CVec_SignatureZNoneZ { - contents: CResult_CVec_SignatureZNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_CVec_SignatureZNoneZ in the error state. -pub extern "C" fn CResult_CVec_SignatureZNoneZ_err() -> CResult_CVec_SignatureZNoneZ { - CResult_CVec_SignatureZNoneZ { - contents: CResult_CVec_SignatureZNoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, +impl Clone for CResult_ShutdownScriptInvalidShutdownScriptZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_SignatureZNoneZ_is_ok(o: &CResult_CVec_SignatureZNoneZ) -> bool { +/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_PublicKeyZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::PublicKey, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_PublicKeyZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::PublicKey] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_PublicKeyZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_PublicKeyZ_free(_res: CVec_PublicKeyZ) { } +impl Drop for CVec_PublicKeyZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_PublicKeyZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_BlindedPathNoneZ +pub union CResult_BlindedPathNoneZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, +} +#[repr(C)] +/// A CResult_BlindedPathNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_BlindedPathNoneZ { + /// The contents of this CResult_BlindedPathNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_BlindedPathNoneZPtr, + /// Whether this CResult_BlindedPathNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_BlindedPathNoneZ in the success state. +pub extern "C" fn CResult_BlindedPathNoneZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathNoneZ { + CResult_BlindedPathNoneZ { + contents: CResult_BlindedPathNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_BlindedPathNoneZ in the error state. +pub extern "C" fn CResult_BlindedPathNoneZ_err() -> CResult_BlindedPathNoneZ { + CResult_BlindedPathNoneZ { + contents: CResult_BlindedPathNoneZPtr { + err: core::ptr::null_mut(), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_BlindedPathNoneZ_is_ok(o: &CResult_BlindedPathNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_SignatureZNoneZ. -pub extern "C" fn CResult_CVec_SignatureZNoneZ_free(_res: CResult_CVec_SignatureZNoneZ) { } -impl Drop for CResult_CVec_SignatureZNoneZ { +/// Frees any resources used by the CResult_BlindedPathNoneZ. +pub extern "C" fn CResult_BlindedPathNoneZ_free(_res: CResult_BlindedPathNoneZ) { } +impl Drop for CResult_BlindedPathNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1846,16 +1641,16 @@ impl Drop for CResult_CVec_SignatureZNoneZ { } } } -impl From> for CResult_CVec_SignatureZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedPathNoneZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CVec_SignatureZNoneZPtr { result } + CResult_BlindedPathNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_CVec_SignatureZNoneZPtr { err: core::ptr::null_mut() } + CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1863,59 +1658,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_SignatureZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BlindedPathNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_SignatureZNoneZPtr { + Self { result_ok: false, contents: CResult_BlindedPathNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_CVec_SignatureZNoneZ which has the same data as `orig` +/// Creates a new CResult_BlindedPathNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_SignatureZNoneZ_clone(orig: &CResult_CVec_SignatureZNoneZ) -> CResult_CVec_SignatureZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedPathNoneZ_clone(orig: &CResult_BlindedPathNoneZ) -> CResult_BlindedPathNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownScriptDecodeErrorZ -pub union CResult_ShutdownScriptDecodeErrorZPtr { +/// The contents of CResult_BlindedPathDecodeErrorZ +pub union CResult_BlindedPathDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::script::ShutdownScript, + pub result: *mut crate::lightning::onion_message::blinded_path::BlindedPath, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_ShutdownScriptDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BlindedPathDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::blinded_path::BlindedPath on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ShutdownScriptDecodeErrorZ { - /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either +pub struct CResult_BlindedPathDecodeErrorZ { + /// The contents of this CResult_BlindedPathDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ShutdownScriptDecodeErrorZPtr, - /// Whether this CResult_ShutdownScriptDecodeErrorZ represents a success state. + pub contents: CResult_BlindedPathDecodeErrorZPtr, + /// Whether this CResult_BlindedPathDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the success state. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptDecodeErrorZ { - CResult_ShutdownScriptDecodeErrorZ { - contents: CResult_ShutdownScriptDecodeErrorZPtr { +/// Creates a new CResult_BlindedPathDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedPathDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedPath) -> CResult_BlindedPathDecodeErrorZ { + CResult_BlindedPathDecodeErrorZ { + contents: CResult_BlindedPathDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptDecodeErrorZ in the error state. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownScriptDecodeErrorZ { - CResult_ShutdownScriptDecodeErrorZ { - contents: CResult_ShutdownScriptDecodeErrorZPtr { +/// Creates a new CResult_BlindedPathDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedPathDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedPathDecodeErrorZ { + CResult_BlindedPathDecodeErrorZ { + contents: CResult_BlindedPathDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1923,13 +1718,13 @@ pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BlindedPathDecodeErrorZ_is_ok(o: &CResult_BlindedPathDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ShutdownScriptDecodeErrorZ. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_free(_res: CResult_ShutdownScriptDecodeErrorZ) { } -impl Drop for CResult_ShutdownScriptDecodeErrorZ { +/// Frees any resources used by the CResult_BlindedPathDecodeErrorZ. +pub extern "C" fn CResult_BlindedPathDecodeErrorZ_free(_res: CResult_BlindedPathDecodeErrorZ) { } +impl Drop for CResult_BlindedPathDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1942,16 +1737,16 @@ impl Drop for CResult_ShutdownScriptDecodeErrorZ { } } } -impl From> for CResult_ShutdownScriptDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedPathDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ShutdownScriptDecodeErrorZPtr { result } + CResult_BlindedPathDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownScriptDecodeErrorZPtr { err } + CResult_BlindedPathDecodeErrorZPtr { err } }; Self { contents, @@ -1959,59 +1754,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ShutdownScriptDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BlindedPathDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BlindedPathDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_BlindedPathDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedPathDecodeErrorZ_clone(orig: &CResult_BlindedPathDecodeErrorZ) -> CResult_BlindedPathDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ -pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr { +/// The contents of CResult_BlindedHopDecodeErrorZ +pub union CResult_BlindedHopDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::ln::script::ShutdownScript, + pub result: *mut crate::lightning::onion_message::blinded_path::BlindedHop, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::script::InvalidShutdownScript, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_ShutdownScriptInvalidShutdownScriptZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::script::ShutdownScript on success and a crate::lightning::ln::script::InvalidShutdownScript on failure. +/// A CResult_BlindedHopDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::blinded_path::BlindedHop on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ShutdownScriptInvalidShutdownScriptZ { - /// The contents of this CResult_ShutdownScriptInvalidShutdownScriptZ, accessible via either +pub struct CResult_BlindedHopDecodeErrorZ { + /// The contents of this CResult_BlindedHopDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr, - /// Whether this CResult_ShutdownScriptInvalidShutdownScriptZ represents a success state. + pub contents: CResult_BlindedHopDecodeErrorZPtr, + /// Whether this CResult_BlindedHopDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the success state. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { - CResult_ShutdownScriptInvalidShutdownScriptZ { - contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { +/// Creates a new CResult_BlindedHopDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_ok(o: crate::lightning::onion_message::blinded_path::BlindedHop) -> CResult_BlindedHopDecodeErrorZ { + CResult_BlindedHopDecodeErrorZ { + contents: CResult_BlindedHopDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ in the error state. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lightning::ln::script::InvalidShutdownScript) -> CResult_ShutdownScriptInvalidShutdownScriptZ { - CResult_ShutdownScriptInvalidShutdownScriptZ { - contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { +/// Creates a new CResult_BlindedHopDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopDecodeErrorZ { + CResult_BlindedHopDecodeErrorZ { + contents: CResult_BlindedHopDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -2019,13 +1814,13 @@ pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_err(e: crate::lig } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> bool { +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_is_ok(o: &CResult_BlindedHopDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ShutdownScriptInvalidShutdownScriptZ. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_free(_res: CResult_ShutdownScriptInvalidShutdownScriptZ) { } -impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ { +/// Frees any resources used by the CResult_BlindedHopDecodeErrorZ. +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_free(_res: CResult_BlindedHopDecodeErrorZ) { } +impl Drop for CResult_BlindedHopDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2038,16 +1833,16 @@ impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ { } } } -impl From> for CResult_ShutdownScriptInvalidShutdownScriptZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedHopDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ShutdownScriptInvalidShutdownScriptZPtr { result } + CResult_BlindedHopDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownScriptInvalidShutdownScriptZPtr { err } + CResult_BlindedHopDecodeErrorZPtr { err } }; Self { contents, @@ -2055,23 +1850,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BlindedHopDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_BlindedHopDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptInvalidShutdownScriptZ which has the same data as `orig` +/// Creates a new CResult_BlindedHopDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ShutdownScriptInvalidShutdownScriptZ_clone(orig: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> CResult_ShutdownScriptInvalidShutdownScriptZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedHopDecodeErrorZ_clone(orig: &CResult_BlindedHopDecodeErrorZ) -> CResult_BlindedHopDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not pub enum COption_WriteableScoreZ { @@ -2197,41 +1992,87 @@ impl Clone for CResult_NoneErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_NoneErrorZ_clone(orig: &CResult_NoneErrorZ) -> CResult_NoneErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RouteHopDecodeErrorZ -pub union CResult_RouteHopDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ChannelDetailsZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_ChannelDetailsZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_ChannelDetailsZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { } +impl Drop for CVec_ChannelDetailsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_ChannelDetailsZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// The contents of CResult_RouteLightningErrorZ +pub union CResult_RouteLightningErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::routing::router::RouteHop, + pub result: *mut crate::lightning::routing::router::Route, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning::ln::msgs::LightningError, } #[repr(C)] -/// 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. +/// A CResult_RouteLightningErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_RouteHopDecodeErrorZ { - /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either +pub struct CResult_RouteLightningErrorZ { + /// The contents of this CResult_RouteLightningErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RouteHopDecodeErrorZPtr, - /// Whether this CResult_RouteHopDecodeErrorZ represents a success state. + pub contents: CResult_RouteLightningErrorZPtr, + /// Whether this CResult_RouteLightningErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RouteHopDecodeErrorZ in the success state. -pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ { - CResult_RouteHopDecodeErrorZ { - contents: CResult_RouteHopDecodeErrorZPtr { +/// Creates a new CResult_RouteLightningErrorZ in the success state. +pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ { + CResult_RouteLightningErrorZ { + contents: CResult_RouteLightningErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RouteHopDecodeErrorZ in the error state. -pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ { - CResult_RouteHopDecodeErrorZ { - contents: CResult_RouteHopDecodeErrorZPtr { +/// Creates a new CResult_RouteLightningErrorZ in the error state. +pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ { + CResult_RouteLightningErrorZ { + contents: CResult_RouteLightningErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -2239,13 +2080,13 @@ pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RouteHopDecodeErrorZ. -pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { } -impl Drop for CResult_RouteHopDecodeErrorZ { +/// Frees any resources used by the CResult_RouteLightningErrorZ. +pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { } +impl Drop for CResult_RouteLightningErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2258,16 +2099,16 @@ impl Drop for CResult_RouteHopDecodeErrorZ { } } } -impl From> for CResult_RouteHopDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RouteLightningErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_RouteHopDecodeErrorZPtr { result } + CResult_RouteLightningErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteHopDecodeErrorZPtr { err } + CResult_RouteLightningErrorZPtr { err } }; Self { contents, @@ -2275,23 +2116,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) } #[repr(C)] /// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. /// This corresponds to std::vector in C++ @@ -2327,7 +2168,7 @@ pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { } impl Drop for CVec_RouteHopZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_RouteHopZ { @@ -2339,6 +2180,235 @@ impl Clone for CVec_RouteHopZ { } } #[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a u64 or not +pub enum COption_u64Z { + /// When we're in this state, this COption_u64Z contains a u64 + Some(u64), + /// When we're in this state, this COption_u64Z contains nothing + None +} +impl COption_u64Z { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> u64 { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_u64Z containing a u64 +pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z { + COption_u64Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_u64Z containing nothing +pub extern "C" fn COption_u64Z_none() -> COption_u64Z { + COption_u64Z::None +} +#[no_mangle] +/// Frees any resources associated with the u64, if we are in the Some state +pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { } +#[no_mangle] +/// Creates a new COption_u64Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_InFlightHtlcsDecodeErrorZ +pub union CResult_InFlightHtlcsDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::routing::router::InFlightHtlcs, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_InFlightHtlcsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::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`. +pub struct CResult_InFlightHtlcsDecodeErrorZ { + /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_InFlightHtlcsDecodeErrorZPtr, + /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. +pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning::routing::router::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ { + CResult_InFlightHtlcsDecodeErrorZ { + contents: CResult_InFlightHtlcsDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. +pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ { + CResult_InFlightHtlcsDecodeErrorZ { + contents: CResult_InFlightHtlcsDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. +pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { } +impl Drop for CResult_InFlightHtlcsDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_InFlightHtlcsDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_InFlightHtlcsDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_InFlightHtlcsDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_InFlightHtlcsDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_RouteHopDecodeErrorZ +pub union CResult_RouteHopDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::routing::router::RouteHop, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// 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`. +pub struct CResult_RouteHopDecodeErrorZ { + /// The contents of this CResult_RouteHopDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_RouteHopDecodeErrorZPtr, + /// Whether this CResult_RouteHopDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_RouteHopDecodeErrorZ in the success state. +pub extern "C" fn CResult_RouteHopDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteHop) -> CResult_RouteHopDecodeErrorZ { + CResult_RouteHopDecodeErrorZ { + contents: CResult_RouteHopDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_RouteHopDecodeErrorZ in the error state. +pub extern "C" fn CResult_RouteHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHopDecodeErrorZ { + CResult_RouteHopDecodeErrorZ { + contents: CResult_RouteHopDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_RouteHopDecodeErrorZ. +pub extern "C" fn CResult_RouteHopDecodeErrorZ_free(_res: CResult_RouteHopDecodeErrorZ) { } +impl Drop for CResult_RouteHopDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_RouteHopDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_RouteHopDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_RouteHopDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_RouteHopDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_RouteHopDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] /// A dynamically-allocated array of crate::c_types::derived::CVec_RouteHopZs of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_CVec_RouteHopZZ { @@ -2373,7 +2443,7 @@ pub extern "C" fn CVec_CVec_RouteHopZZ_free(_res: CVec_CVec_RouteHopZZ) { } impl Drop for CVec_CVec_RouteHopZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_CVec_RouteHopZZ { @@ -2611,7 +2681,7 @@ pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { } impl Drop for CVec_RouteHintZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_RouteHintZ { @@ -2623,43 +2693,6 @@ impl Clone for CVec_RouteHintZ { } } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a u64 or not -pub enum COption_u64Z { - /// When we're in this state, this COption_u64Z contains a u64 - Some(u64), - /// When we're in this state, this COption_u64Z contains nothing - None -} -impl COption_u64Z { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> u64 { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_u64Z containing a u64 -pub extern "C" fn COption_u64Z_some(o: u64) -> COption_u64Z { - COption_u64Z::Some(o) -} -#[no_mangle] -/// Constructs a new COption_u64Z containing nothing -pub extern "C" fn COption_u64Z_none() -> COption_u64Z { - COption_u64Z::None -} -#[no_mangle] -/// Frees any resources associated with the u64, if we are in the Some state -pub extern "C" fn COption_u64Z_free(_res: COption_u64Z) { } -#[no_mangle] -/// Creates a new COption_u64Z which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_u64Z_clone(orig: &COption_u64Z) -> COption_u64Z { Clone::clone(&orig) } -#[repr(C)] /// A dynamically-allocated array of u64s of arbitrary size. /// This corresponds to std::vector in C++ pub struct CVec_u64Z { @@ -2694,7 +2727,7 @@ pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { } impl Drop for CVec_u64Z { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_u64Z { @@ -2836,7 +2869,7 @@ pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { } impl Drop for CVec_RouteHintHopZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_RouteHintHopZ { @@ -3040,148 +3073,6 @@ impl Clone for CResult_RouteHintHopDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channelmanager::ChannelDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ChannelDetailsZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::lightning::ln::channelmanager::ChannelDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_ChannelDetailsZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::ChannelDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_ChannelDetailsZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_ChannelDetailsZ_free(_res: CVec_ChannelDetailsZ) { } -impl Drop for CVec_ChannelDetailsZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_ChannelDetailsZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} -#[repr(C)] -/// The contents of CResult_RouteLightningErrorZ -pub union CResult_RouteLightningErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::routing::router::Route, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::LightningError, -} -#[repr(C)] -/// A CResult_RouteLightningErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::router::Route on success and a crate::lightning::ln::msgs::LightningError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_RouteLightningErrorZ { - /// The contents of this CResult_RouteLightningErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RouteLightningErrorZPtr, - /// Whether this CResult_RouteLightningErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_RouteLightningErrorZ in the success state. -pub extern "C" fn CResult_RouteLightningErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteLightningErrorZ { - CResult_RouteLightningErrorZ { - contents: CResult_RouteLightningErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_RouteLightningErrorZ in the error state. -pub extern "C" fn CResult_RouteLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_RouteLightningErrorZ { - CResult_RouteLightningErrorZ { - contents: CResult_RouteLightningErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, - } -} -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_RouteLightningErrorZ. -pub extern "C" fn CResult_RouteLightningErrorZ_free(_res: CResult_RouteLightningErrorZ) { } -impl Drop for CResult_RouteLightningErrorZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } - } -} -impl From> for CResult_RouteLightningErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_RouteLightningErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteLightningErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_RouteLightningErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_RouteLightningErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RouteLightningErrorZ_clone(orig: &CResult_RouteLightningErrorZ) -> CResult_RouteLightningErrorZ { Clone::clone(&orig) } -#[repr(C)] /// The contents of CResult_PaymentPurposeDecodeErrorZ pub union CResult_PaymentPurposeDecodeErrorZPtr { /// A pointer to the contents in the success state. @@ -3545,6 +3436,43 @@ impl Clone for CResult_COption_HTLCDestinationZDecodeErrorZ { pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] +/// An enum which can either contain a crate::c_types::U128 or not +pub enum COption_u128Z { + /// When we're in this state, this COption_u128Z contains a crate::c_types::U128 + Some(crate::c_types::U128), + /// When we're in this state, this COption_u128Z contains nothing + None +} +impl COption_u128Z { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::U128 { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_u128Z containing a crate::c_types::U128 +pub extern "C" fn COption_u128Z_some(o: crate::c_types::U128) -> COption_u128Z { + COption_u128Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_u128Z containing nothing +pub extern "C" fn COption_u128Z_none() -> COption_u128Z { + COption_u128Z::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::U128, if we are in the Some state +pub extern "C" fn COption_u128Z_free(_res: COption_u128Z) { } +#[no_mangle] +/// Creates a new COption_u128Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_u128Z_clone(orig: &COption_u128Z) -> COption_u128Z { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] /// An enum which can either contain a crate::lightning::routing::gossip::NetworkUpdate or not pub enum COption_NetworkUpdateZ { /// When we're in this state, this COption_NetworkUpdateZ contains a crate::lightning::routing::gossip::NetworkUpdate @@ -3615,7 +3543,7 @@ pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutpu impl Drop for CVec_SpendableOutputDescriptorZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_SpendableOutputDescriptorZ { @@ -3794,7 +3722,7 @@ pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { } impl Drop for CVec_MessageSendEventZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_MessageSendEventZ { @@ -3978,7 +3906,7 @@ pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeT impl Drop for CVec_C2Tuple_usizeTransactionZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_C2Tuple_usizeTransactionZZ { @@ -3990,29 +3918,71 @@ impl Clone for CVec_C2Tuple_usizeTransactionZZ { } } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_TxidBlockHashZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::ThirtyTwoBytes, +} +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_TxidBlockHashZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_TxidBlockHashZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_TxidBlockHashZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_TxidBlockHashZ_clone(orig: &C2Tuple_TxidBlockHashZ) -> C2Tuple_TxidBlockHashZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_TxidBlockHashZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_TxidBlockHashZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_TxidBlockHashZ { + C2Tuple_TxidBlockHashZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_TxidBlockHashZ. +pub extern "C" fn C2Tuple_TxidBlockHashZ_free(_res: C2Tuple_TxidBlockHashZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidBlockHashZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_TxidZ { +pub struct CVec_C2Tuple_TxidBlockHashZZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::ThirtyTwoBytes, + pub data: *mut crate::c_types::derived::C2Tuple_TxidBlockHashZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_TxidZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_TxidBlockHashZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ThirtyTwoBytes] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidBlockHashZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_TxidZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_TxidBlockHashZZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -4020,14 +3990,14 @@ impl From> for CVec_TxidZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_TxidZ_free(_res: CVec_TxidZ) { } -impl Drop for CVec_TxidZ { +pub extern "C" fn CVec_C2Tuple_TxidBlockHashZZ_free(_res: CVec_C2Tuple_TxidBlockHashZZ) { } +impl Drop for CVec_C2Tuple_TxidBlockHashZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_TxidZ { +impl Clone for CVec_C2Tuple_TxidBlockHashZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -4070,7 +4040,7 @@ pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { } impl Drop for CVec_MonitorEventZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_MonitorEventZ { @@ -4162,7 +4132,7 @@ pub extern "C" fn CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ_free(_res: impl Drop for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_C3Tuple_OutPointCVec_MonitorEventZPublicKeyZZ { @@ -4383,7 +4353,7 @@ pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { } impl Drop for CVec_NodeIdZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_NodeIdZ { @@ -4954,41 +4924,41 @@ impl Clone for CResult_ChannelTypeFeaturesDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeIdDecodeErrorZ -pub union CResult_NodeIdDecodeErrorZPtr { +/// The contents of CResult_OfferFeaturesDecodeErrorZ +pub union CResult_OfferFeaturesDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::routing::gossip::NodeId, + pub result: *mut crate::lightning::ln::features::OfferFeatures, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// A CResult_OfferFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::features::OfferFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeIdDecodeErrorZ { - /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either +pub struct CResult_OfferFeaturesDecodeErrorZ { + /// The contents of this CResult_OfferFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeIdDecodeErrorZPtr, - /// Whether this CResult_NodeIdDecodeErrorZ represents a success state. + pub contents: CResult_OfferFeaturesDecodeErrorZPtr, + /// Whether this CResult_OfferFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeIdDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ { - CResult_NodeIdDecodeErrorZ { - contents: CResult_NodeIdDecodeErrorZPtr { +/// Creates a new CResult_OfferFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::OfferFeatures) -> CResult_OfferFeaturesDecodeErrorZ { + CResult_OfferFeaturesDecodeErrorZ { + contents: CResult_OfferFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeIdDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ { - CResult_NodeIdDecodeErrorZ { - contents: CResult_NodeIdDecodeErrorZPtr { +/// Creates a new CResult_OfferFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferFeaturesDecodeErrorZ { + CResult_OfferFeaturesDecodeErrorZ { + contents: CResult_OfferFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -4996,13 +4966,13 @@ pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_is_ok(o: &CResult_OfferFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeIdDecodeErrorZ. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { } -impl Drop for CResult_NodeIdDecodeErrorZ { +/// Frees any resources used by the CResult_OfferFeaturesDecodeErrorZ. +pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_free(_res: CResult_OfferFeaturesDecodeErrorZ) { } +impl Drop for CResult_OfferFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -5015,16 +4985,16 @@ impl Drop for CResult_NodeIdDecodeErrorZ { } } } -impl From> for CResult_NodeIdDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OfferFeaturesDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_NodeIdDecodeErrorZPtr { result } + CResult_OfferFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeIdDecodeErrorZPtr { err } + CResult_OfferFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -5032,25 +5002,217 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OfferFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OfferFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OfferFeaturesDecodeErrorZ_clone(orig: &CResult_OfferFeaturesDecodeErrorZ) -> CResult_OfferFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ +/// The contents of CResult_InvoiceRequestFeaturesDecodeErrorZ +pub union CResult_InvoiceRequestFeaturesDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::ln::features::InvoiceRequestFeatures, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// A CResult_InvoiceRequestFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::features::InvoiceRequestFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_InvoiceRequestFeaturesDecodeErrorZ { + /// The contents of this CResult_InvoiceRequestFeaturesDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr, + /// Whether this CResult_InvoiceRequestFeaturesDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_ok(o: crate::lightning::ln::features::InvoiceRequestFeatures) -> CResult_InvoiceRequestFeaturesDecodeErrorZ { + CResult_InvoiceRequestFeaturesDecodeErrorZ { + contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFeaturesDecodeErrorZ { + CResult_InvoiceRequestFeaturesDecodeErrorZ { + contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFeaturesDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_InvoiceRequestFeaturesDecodeErrorZ. +pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_free(_res: CResult_InvoiceRequestFeaturesDecodeErrorZ) { } +impl Drop for CResult_InvoiceRequestFeaturesDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_InvoiceRequestFeaturesDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_InvoiceRequestFeaturesDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_InvoiceRequestFeaturesDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_InvoiceRequestFeaturesDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_InvoiceRequestFeaturesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_InvoiceRequestFeaturesDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_InvoiceRequestFeaturesDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFeaturesDecodeErrorZ) -> CResult_InvoiceRequestFeaturesDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_NodeIdDecodeErrorZ +pub union CResult_NodeIdDecodeErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning::routing::gossip::NodeId, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::msgs::DecodeError, +} +#[repr(C)] +/// 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`. +pub struct CResult_NodeIdDecodeErrorZ { + /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NodeIdDecodeErrorZPtr, + /// Whether this CResult_NodeIdDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NodeIdDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeIdDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeId) -> CResult_NodeIdDecodeErrorZ { + CResult_NodeIdDecodeErrorZ { + contents: CResult_NodeIdDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_NodeIdDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeIdDecodeErrorZ { + CResult_NodeIdDecodeErrorZ { + contents: CResult_NodeIdDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NodeIdDecodeErrorZ. +pub extern "C" fn CResult_NodeIdDecodeErrorZ_free(_res: CResult_NodeIdDecodeErrorZ) { } +impl Drop for CResult_NodeIdDecodeErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_NodeIdDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_NodeIdDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NodeIdDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NodeIdDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NodeIdDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_NodeIdDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NodeIdDecodeErrorZ_clone(orig: &CResult_NodeIdDecodeErrorZ) -> CResult_NodeIdDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. @@ -5771,7 +5933,7 @@ pub extern "C" fn CVec_NetAddressZ_free(_res: CVec_NetAddressZ) { } impl Drop for CVec_NetAddressZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_NetAddressZ { @@ -6509,7 +6671,7 @@ pub extern "C" fn CVec_PaymentPreimageZ_free(_res: CVec_PaymentPreimageZ) { } impl Drop for CVec_PaymentPreimageZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_PaymentPreimageZ { @@ -7267,47 +7429,30 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_SignDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_SignDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_SignDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SignDecodeErrorZ_clone(orig: &CResult_SignDecodeErrorZ) -> CResult_SignDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::u5s of arbitrary size. +/// A dynamically-allocated array of crate::c_types::U5s of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_u5Z { +pub struct CVec_U5Z { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::u5, + pub data: *mut crate::c_types::U5, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_u5Z { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_U5Z { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::u5] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::U5] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_u5Z { - fn from(v: Vec) -> Self { +impl From> for CVec_U5Z { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -7315,14 +7460,14 @@ impl From> for CVec_u5Z { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_u5Z_free(_res: CVec_u5Z) { } -impl Drop for CVec_u5Z { +pub extern "C" fn CVec_U5Z_free(_res: CVec_U5Z) { } +impl Drop for CVec_U5Z { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CVec_u5Z { +impl Clone for CVec_U5Z { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -7457,7 +7602,7 @@ pub extern "C" fn CVec_u8Z_free(_res: CVec_u8Z) { } impl Drop for CVec_u8Z { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_u8Z { @@ -7503,7 +7648,7 @@ pub extern "C" fn CVec_CVec_u8ZZ_free(_res: CVec_CVec_u8ZZ) { } impl Drop for CVec_CVec_u8ZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_CVec_u8ZZ { @@ -7737,7 +7882,7 @@ pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { } impl Drop for CVec_TxOutZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_TxOutZ { @@ -7905,7 +8050,7 @@ pub extern "C" fn CVec_C2Tuple_BlockHashChannelMonitorZZ_free(_res: CVec_C2Tuple impl Drop for CVec_C2Tuple_BlockHashChannelMonitorZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } #[repr(C)] @@ -8151,7 +8296,7 @@ pub extern "C" fn CVec_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErr impl Drop for CVec_CResult_NoneAPIErrorZZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_CResult_NoneAPIErrorZZ { @@ -8197,7 +8342,7 @@ pub extern "C" fn CVec_APIErrorZ_free(_res: CVec_APIErrorZ) { } impl Drop for CVec_APIErrorZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_APIErrorZ { @@ -8305,102 +8450,6 @@ impl Clone for CResult__u832APIErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult__u832APIErrorZ_clone(orig: &CResult__u832APIErrorZ) -> CResult__u832APIErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentIdPaymentSendFailureZ -pub union CResult_PaymentIdPaymentSendFailureZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::ThirtyTwoBytes, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure, -} -#[repr(C)] -/// 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`. -pub struct CResult_PaymentIdPaymentSendFailureZ { - /// The contents of this CResult_PaymentIdPaymentSendFailureZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentIdPaymentSendFailureZPtr, - /// Whether this CResult_PaymentIdPaymentSendFailureZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_PaymentIdPaymentSendFailureZ in the success state. -pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentIdPaymentSendFailureZ { - CResult_PaymentIdPaymentSendFailureZ { - contents: CResult_PaymentIdPaymentSendFailureZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_PaymentIdPaymentSendFailureZ in the error state. -pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentIdPaymentSendFailureZ { - CResult_PaymentIdPaymentSendFailureZ { - contents: CResult_PaymentIdPaymentSendFailureZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, - } -} -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_is_ok(o: &CResult_PaymentIdPaymentSendFailureZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_PaymentIdPaymentSendFailureZ. -pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_free(_res: CResult_PaymentIdPaymentSendFailureZ) { } -impl Drop for CResult_PaymentIdPaymentSendFailureZ { - fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } - } -} -impl From> for CResult_PaymentIdPaymentSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PaymentIdPaymentSendFailureZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentIdPaymentSendFailureZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_PaymentIdPaymentSendFailureZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentIdPaymentSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PaymentIdPaymentSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_PaymentIdPaymentSendFailureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentIdPaymentSendFailureZ_clone(orig: &CResult_PaymentIdPaymentSendFailureZ) -> CResult_PaymentIdPaymentSendFailureZ { Clone::clone(&orig) } -#[repr(C)] /// The contents of CResult_NonePaymentSendFailureZ pub union CResult_NonePaymentSendFailureZPtr { /// Note that this value is always NULL, as there are no contents in the OK variant @@ -8493,15 +8542,111 @@ impl Clone for CResult_NonePaymentSendFailureZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_NonePaymentSendFailureZ_clone(orig: &CResult_NonePaymentSendFailureZ) -> CResult_NonePaymentSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_PaymentHashPaymentIdZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::c_types::ThirtyTwoBytes, +/// The contents of CResult_PaymentHashPaymentSendFailureZ +pub union CResult_PaymentHashPaymentSendFailureZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::c_types::ThirtyTwoBytes, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::ln::channelmanager::PaymentSendFailure, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { +#[repr(C)] +/// A CResult_PaymentHashPaymentSendFailureZ 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`. +pub struct CResult_PaymentHashPaymentSendFailureZ { + /// The contents of this CResult_PaymentHashPaymentSendFailureZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_PaymentHashPaymentSendFailureZPtr, + /// Whether this CResult_PaymentHashPaymentSendFailureZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_PaymentHashPaymentSendFailureZ in the success state. +pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_PaymentHashPaymentSendFailureZ { + CResult_PaymentHashPaymentSendFailureZ { + contents: CResult_PaymentHashPaymentSendFailureZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_PaymentHashPaymentSendFailureZ in the error state. +pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_err(e: crate::lightning::ln::channelmanager::PaymentSendFailure) -> CResult_PaymentHashPaymentSendFailureZ { + CResult_PaymentHashPaymentSendFailureZ { + contents: CResult_PaymentHashPaymentSendFailureZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, + } +} +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_is_ok(o: &CResult_PaymentHashPaymentSendFailureZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_PaymentHashPaymentSendFailureZ. +pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_free(_res: CResult_PaymentHashPaymentSendFailureZ) { } +impl Drop for CResult_PaymentHashPaymentSendFailureZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_PaymentHashPaymentSendFailureZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_PaymentHashPaymentSendFailureZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_PaymentHashPaymentSendFailureZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_PaymentHashPaymentSendFailureZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PaymentHashPaymentSendFailureZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PaymentHashPaymentSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_PaymentHashPaymentSendFailureZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PaymentHashPaymentSendFailureZ_clone(orig: &CResult_PaymentHashPaymentSendFailureZ) -> CResult_PaymentHashPaymentSendFailureZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_PaymentHashPaymentIdZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::ThirtyTwoBytes, +} +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_PaymentHashPaymentIdZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { Self { a: tup.0, b: tup.1, @@ -8665,7 +8810,7 @@ pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { } impl Drop for CVec_ThirtyTwoBytesZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_ThirtyTwoBytesZ { @@ -9609,7 +9754,7 @@ pub extern "C" fn CVec_ChannelMonitorZ_free(_res: CVec_ChannelMonitorZ) { } impl Drop for CVec_ChannelMonitorZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } #[repr(C)] @@ -10121,41 +10266,40 @@ impl Clone for CResult_PaymentIdPaymentErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_PaymentIdPaymentErrorZ_clone(orig: &CResult_PaymentIdPaymentErrorZ) -> CResult_PaymentIdPaymentErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InFlightHtlcsDecodeErrorZ -pub union CResult_InFlightHtlcsDecodeErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::payment::InFlightHtlcs, +/// The contents of CResult_NonePaymentErrorZ +pub union CResult_NonePaymentErrorZPtr { + /// Note that this value is always NULL, as there are no contents in the OK variant + pub result: *mut core::ffi::c_void, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning_invoice::payment::PaymentError, } #[repr(C)] -/// 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. +/// A CResult_NonePaymentErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning_invoice::payment::PaymentError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_InFlightHtlcsDecodeErrorZ { - /// The contents of this CResult_InFlightHtlcsDecodeErrorZ, accessible via either +pub struct CResult_NonePaymentErrorZ { + /// The contents of this CResult_NonePaymentErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InFlightHtlcsDecodeErrorZPtr, - /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. + pub contents: CResult_NonePaymentErrorZPtr, + /// Whether this CResult_NonePaymentErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. -pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_ok(o: crate::lightning_invoice::payment::InFlightHtlcs) -> CResult_InFlightHtlcsDecodeErrorZ { - CResult_InFlightHtlcsDecodeErrorZ { - contents: CResult_InFlightHtlcsDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NonePaymentErrorZ in the success state. +pub extern "C" fn CResult_NonePaymentErrorZ_ok() -> CResult_NonePaymentErrorZ { + CResult_NonePaymentErrorZ { + contents: CResult_NonePaymentErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InFlightHtlcsDecodeErrorZ in the error state. -pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InFlightHtlcsDecodeErrorZ { - CResult_InFlightHtlcsDecodeErrorZ { - contents: CResult_InFlightHtlcsDecodeErrorZPtr { +/// Creates a new CResult_NonePaymentErrorZ in the error state. +pub extern "C" fn CResult_NonePaymentErrorZ_err(e: crate::lightning_invoice::payment::PaymentError) -> CResult_NonePaymentErrorZ { + CResult_NonePaymentErrorZ { + contents: CResult_NonePaymentErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10163,18 +10307,15 @@ pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NonePaymentErrorZ_is_ok(o: &CResult_NonePaymentErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InFlightHtlcsDecodeErrorZ. -pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_free(_res: CResult_InFlightHtlcsDecodeErrorZ) { } -impl Drop for CResult_InFlightHtlcsDecodeErrorZ { +/// Frees any resources used by the CResult_NonePaymentErrorZ. +pub extern "C" fn CResult_NonePaymentErrorZ_free(_res: CResult_NonePaymentErrorZ) { } +impl Drop for CResult_NonePaymentErrorZ { fn drop(&mut self) { if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } } else { if unsafe { !(self.contents.err as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.err) }; @@ -10182,16 +10323,16 @@ impl Drop for CResult_InFlightHtlcsDecodeErrorZ { } } } -impl From> for CResult_InFlightHtlcsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NonePaymentErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::payment::PaymentError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_InFlightHtlcsDecodeErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NonePaymentErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InFlightHtlcsDecodeErrorZPtr { err } + CResult_NonePaymentErrorZPtr { err } }; Self { contents, @@ -10199,42 +10340,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NonePaymentErrorZPtr { + result: core::ptr::null_mut() + } } + } else { + Self { result_ok: false, contents: CResult_NonePaymentErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_NonePaymentErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NonePaymentErrorZ_clone(orig: &CResult_NonePaymentErrorZ) -> CResult_NonePaymentErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SiPrefixParseErrorZ -pub union CResult_SiPrefixParseErrorZPtr { +/// The contents of CResult_StringErrorZ +pub union CResult_StringErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::SiPrefix, + pub result: *mut crate::c_types::Str, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::ParseError, + pub err: *mut crate::c_types::Secp256k1Error, } #[repr(C)] -/// 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_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`. -pub struct CResult_SiPrefixParseErrorZ { - /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either +pub struct CResult_StringErrorZ { + /// The contents of this CResult_StringErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SiPrefixParseErrorZPtr, - /// Whether this CResult_SiPrefixParseErrorZ represents a success state. + pub contents: CResult_StringErrorZPtr, + /// Whether this CResult_StringErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SiPrefixParseErrorZ in the success state. -pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ { - CResult_SiPrefixParseErrorZ { - contents: CResult_SiPrefixParseErrorZPtr { +/// Creates a new CResult_StringErrorZ in the success state. +pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ { + CResult_StringErrorZ { + contents: CResult_StringErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SiPrefixParseErrorZ in the error state. -pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ { - CResult_SiPrefixParseErrorZ { - contents: CResult_SiPrefixParseErrorZPtr { +/// Creates a new CResult_StringErrorZ in the error state. +pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ { + CResult_StringErrorZ { + contents: CResult_StringErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10242,13 +10400,13 @@ pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::P } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool { +pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SiPrefixParseErrorZ. -pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { } -impl Drop for CResult_SiPrefixParseErrorZ { +/// Frees any resources used by the CResult_StringErrorZ. +pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { } +impl Drop for CResult_StringErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10261,16 +10419,16 @@ impl Drop for CResult_SiPrefixParseErrorZ { } } } -impl From> for CResult_SiPrefixParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StringErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_SiPrefixParseErrorZPtr { result } + CResult_StringErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SiPrefixParseErrorZPtr { err } + CResult_StringErrorZPtr { err } }; Self { contents, @@ -10278,59 +10436,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_StringErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_StringErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` +/// Creates a new CResult_StringErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceParseOrSemanticErrorZ -pub union CResult_InvoiceParseOrSemanticErrorZPtr { +/// The contents of CResult_PublicKeyErrorZ +pub union CResult_PublicKeyErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::Invoice, + pub result: *mut crate::c_types::PublicKey, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::ParseOrSemanticError, + pub err: *mut crate::c_types::Secp256k1Error, } #[repr(C)] -/// 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_PublicKeyErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::PublicKey on success and a crate::c_types::Secp256k1Error on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_InvoiceParseOrSemanticErrorZ { - /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either +pub struct CResult_PublicKeyErrorZ { + /// The contents of this CResult_PublicKeyErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceParseOrSemanticErrorZPtr, - /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. + pub contents: CResult_PublicKeyErrorZPtr, + /// Whether this CResult_PublicKeyErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ { - CResult_InvoiceParseOrSemanticErrorZ { - contents: CResult_InvoiceParseOrSemanticErrorZPtr { +/// Creates a new CResult_PublicKeyErrorZ in the success state. +pub extern "C" fn CResult_PublicKeyErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyErrorZ { + CResult_PublicKeyErrorZ { + contents: CResult_PublicKeyErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ { - CResult_InvoiceParseOrSemanticErrorZ { - contents: CResult_InvoiceParseOrSemanticErrorZPtr { +/// Creates a new CResult_PublicKeyErrorZ in the error state. +pub extern "C" fn CResult_PublicKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeyErrorZ { + CResult_PublicKeyErrorZ { + contents: CResult_PublicKeyErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10338,13 +10496,13 @@ pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_i } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool { +pub extern "C" fn CResult_PublicKeyErrorZ_is_ok(o: &CResult_PublicKeyErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. -pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { } -impl Drop for CResult_InvoiceParseOrSemanticErrorZ { +/// Frees any resources used by the CResult_PublicKeyErrorZ. +pub extern "C" fn CResult_PublicKeyErrorZ_free(_res: CResult_PublicKeyErrorZ) { } +impl Drop for CResult_PublicKeyErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10357,16 +10515,16 @@ impl Drop for CResult_InvoiceParseOrSemanticErrorZ { } } } -impl From> for CResult_InvoiceParseOrSemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PublicKeyErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_InvoiceParseOrSemanticErrorZPtr { result } + CResult_PublicKeyErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceParseOrSemanticErrorZPtr { err } + CResult_PublicKeyErrorZPtr { err } }; Self { contents, @@ -10374,59 +10532,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PublicKeyErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PublicKeyErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InvoiceParseOrSemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_PublicKeyErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PublicKeyErrorZ_clone(orig: &CResult_PublicKeyErrorZ) -> CResult_PublicKeyErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SignedRawInvoiceParseErrorZ -pub union CResult_SignedRawInvoiceParseErrorZPtr { +/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ +pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::SignedRawInvoice, + pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::ParseError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(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. +/// 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`. -pub struct CResult_SignedRawInvoiceParseErrorZ { - /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either +pub struct CResult_ChannelMonitorUpdateDecodeErrorZ { + /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SignedRawInvoiceParseErrorZPtr, - /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. + pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr, + /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. -pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ { - CResult_SignedRawInvoiceParseErrorZ { - contents: CResult_SignedRawInvoiceParseErrorZPtr { +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ { + CResult_ChannelMonitorUpdateDecodeErrorZ { + contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. -pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ { - CResult_SignedRawInvoiceParseErrorZ { - contents: CResult_SignedRawInvoiceParseErrorZPtr { +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ { + CResult_ChannelMonitorUpdateDecodeErrorZ { + contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10434,13 +10592,13 @@ pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_in } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool { +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. -pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { } -impl Drop for CResult_SignedRawInvoiceParseErrorZ { +/// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { } +impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10453,16 +10611,16 @@ impl Drop for CResult_SignedRawInvoiceParseErrorZ { } } } -impl From> for CResult_SignedRawInvoiceParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelMonitorUpdateDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_SignedRawInvoiceParseErrorZPtr { result } + CResult_ChannelMonitorUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SignedRawInvoiceParseErrorZPtr { err } + CResult_ChannelMonitorUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -10470,105 +10628,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ { - /// The element at position 0 - pub a: crate::lightning_invoice::RawInvoice, - /// The element at position 1 - pub b: crate::c_types::ThirtyTwoBytes, - /// The element at position 2 - pub c: crate::lightning_invoice::InvoiceSignature, +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not +pub enum COption_MonitorEventZ { + /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent + Some(crate::lightning::chain::channelmonitor::MonitorEvent), + /// When we're in this state, this COption_MonitorEventZ contains nothing + None } -impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ { - fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } +impl COption_MonitorEventZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl C3Tuple_RawInvoice_u832InvoiceSignatureZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) { - (self.a, self.b, self.c) + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new tuple which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. +/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent +pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ { + COption_MonitorEventZ::Some(o) +} #[no_mangle] -pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { - C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, } +/// Constructs a new COption_MonitorEventZ containing nothing +pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ { + COption_MonitorEventZ::None } - #[no_mangle] -/// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. -pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { } +/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state +pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { } +#[no_mangle] +/// Creates a new COption_MonitorEventZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PayeePubKeyErrorZ -pub union CResult_PayeePubKeyErrorZPtr { +/// The contents of CResult_COption_MonitorEventZDecodeErrorZ +pub union CResult_COption_MonitorEventZDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::PayeePubKey, + pub result: *mut crate::c_types::derived::COption_MonitorEventZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::c_types::Secp256k1Error, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// 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`. -pub struct CResult_PayeePubKeyErrorZ { - /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either +pub struct CResult_COption_MonitorEventZDecodeErrorZ { + /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PayeePubKeyErrorZPtr, - /// Whether this CResult_PayeePubKeyErrorZ represents a success state. + pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr, + /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PayeePubKeyErrorZ in the success state. -pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ { - CResult_PayeePubKeyErrorZ { - contents: CResult_PayeePubKeyErrorZPtr { +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ { + CResult_COption_MonitorEventZDecodeErrorZ { + contents: CResult_COption_MonitorEventZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PayeePubKeyErrorZ in the error state. -pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ { - CResult_PayeePubKeyErrorZ { - contents: CResult_PayeePubKeyErrorZPtr { +/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ { + CResult_COption_MonitorEventZDecodeErrorZ { + contents: CResult_COption_MonitorEventZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10576,13 +10725,13 @@ pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Erro } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool { +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PayeePubKeyErrorZ. -pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { } -impl Drop for CResult_PayeePubKeyErrorZ { +/// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { } +impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10595,16 +10744,16 @@ impl Drop for CResult_PayeePubKeyErrorZ { } } } -impl From> for CResult_PayeePubKeyErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_MonitorEventZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PayeePubKeyErrorZPtr { result } + CResult_COption_MonitorEventZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PayeePubKeyErrorZPtr { err } + CResult_COption_MonitorEventZDecodeErrorZPtr { err } }; Self { contents, @@ -10612,105 +10761,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PayeePubKeyErrorZ 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. -pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PrivateRouteZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::lightning_invoice::PrivateRoute, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PrivateRouteZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PrivateRouteZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { } -impl Drop for CVec_PrivateRouteZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_PrivateRouteZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} +pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PositiveTimestampCreationErrorZ -pub union CResult_PositiveTimestampCreationErrorZPtr { +/// The contents of CResult_HTLCUpdateDecodeErrorZ +pub union CResult_HTLCUpdateDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::PositiveTimestamp, + pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::CreationError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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. +/// 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`. -pub struct CResult_PositiveTimestampCreationErrorZ { - /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either +pub struct CResult_HTLCUpdateDecodeErrorZ { + /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PositiveTimestampCreationErrorZPtr, - /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. + pub contents: CResult_HTLCUpdateDecodeErrorZPtr, + /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ { - CResult_PositiveTimestampCreationErrorZ { - contents: CResult_PositiveTimestampCreationErrorZPtr { +/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ { + CResult_HTLCUpdateDecodeErrorZ { + contents: CResult_HTLCUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ { - CResult_PositiveTimestampCreationErrorZ { - contents: CResult_PositiveTimestampCreationErrorZPtr { +/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ { + CResult_HTLCUpdateDecodeErrorZ { + contents: CResult_HTLCUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10718,13 +10821,13 @@ pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool { +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { } -impl Drop for CResult_PositiveTimestampCreationErrorZ { +/// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { } +impl Drop for CResult_HTLCUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10737,16 +10840,16 @@ impl Drop for CResult_PositiveTimestampCreationErrorZ { } } } -impl From> for CResult_PositiveTimestampCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HTLCUpdateDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PositiveTimestampCreationErrorZPtr { result } + CResult_HTLCUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PositiveTimestampCreationErrorZPtr { err } + CResult_HTLCUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -10754,247 +10857,591 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PositiveTimestampCreationErrorZ 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. -pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneSemanticErrorZ -pub union CResult_NoneSemanticErrorZPtr { - /// Note that this value is always NULL, as there are no contents in the OK variant - pub result: *mut core::ffi::c_void, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::SemanticError, +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OutPointScriptZ { + /// The element at position 0 + pub a: crate::lightning::chain::transaction::OutPoint, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_u8Z, } -#[repr(C)] -/// 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`. -pub struct CResult_NoneSemanticErrorZ { - /// The contents of this CResult_NoneSemanticErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneSemanticErrorZPtr, - /// Whether this CResult_NoneSemanticErrorZ represents a success state. - pub result_ok: bool, +impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ { + fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } } -#[no_mangle] -/// Creates a new CResult_NoneSemanticErrorZ in the success state. -pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ { - CResult_NoneSemanticErrorZ { - contents: CResult_NoneSemanticErrorZPtr { - result: core::ptr::null_mut(), - }, - result_ok: true, +impl C2Tuple_OutPointScriptZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) { + (self.a, self.b) } } -#[no_mangle] -/// Creates a new CResult_NoneSemanticErrorZ in the error state. -pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ { - CResult_NoneSemanticErrorZ { - contents: CResult_NoneSemanticErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +impl Clone for C2Tuple_OutPointScriptZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool { - o.result_ok +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OutPointScriptZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ { + C2Tuple_OutPointScriptZ { a, b, } } + #[no_mangle] -/// Frees any resources used by the CResult_NoneSemanticErrorZ. -pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { } -impl Drop for CResult_NoneSemanticErrorZ { - fn drop(&mut self) { - if self.result_ok { - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } - } +/// Frees any resources used by the C2Tuple_OutPointScriptZ. +pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u32ScriptZ { + /// The element at position 0 + pub a: u32, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_u8Z, } -impl From> for CResult_NoneSemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self { - let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneSemanticErrorZPtr { err } - }; +impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ { + fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self { Self { - contents, - result_ok: o.result_ok, + a: tup.0, + b: tup.1, } } } -impl Clone for CResult_NoneSemanticErrorZ { +impl C2Tuple_u32ScriptZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_u32ScriptZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr { - result: core::ptr::null_mut() - } } - } else { - Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), } } } #[no_mangle] -/// Creates a new CResult_NoneSemanticErrorZ 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. -pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_InvoiceSemanticErrorZ -pub union CResult_InvoiceSemanticErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::Invoice, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::SemanticError, +pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u32ScriptZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ { + C2Tuple_u32ScriptZ { a, b, } } + +#[no_mangle] +/// Frees any resources used by the C2Tuple_u32ScriptZ. +pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { } #[repr(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`. -pub struct CResult_InvoiceSemanticErrorZ { - /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceSemanticErrorZPtr, - /// Whether this CResult_InvoiceSemanticErrorZ represents a success state. - pub result_ok: bool, +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_u32ScriptZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[no_mangle] -/// Creates a new CResult_InvoiceSemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ { - CResult_InvoiceSemanticErrorZ { - contents: CResult_InvoiceSemanticErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl CVec_C2Tuple_u32ScriptZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } -} -#[no_mangle] -/// Creates a new CResult_InvoiceSemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ { - CResult_InvoiceSemanticErrorZ { - contents: CResult_InvoiceSemanticErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool { - o.result_ok +impl From> for CVec_C2Tuple_u32ScriptZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceSemanticErrorZ. -pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { } -impl Drop for CResult_InvoiceSemanticErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { } +impl Drop for CVec_C2Tuple_u32ScriptZZ { fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl From> for CResult_InvoiceSemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_InvoiceSemanticErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceSemanticErrorZPtr { err } - }; +impl Clone for CVec_C2Tuple_u32ScriptZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ, +} +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self { Self { - contents, - result_ok: o.result_ok, + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), } } } -impl Clone for CResult_InvoiceSemanticErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { + C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. +pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { } +impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_EventZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::lightning::util::events::Event, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_EventZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_EventZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { } +impl Drop for CVec_EventZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_EventZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_TransactionZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::Transaction, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_TransactionZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_TransactionZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { } +impl Drop for CVec_TransactionZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_TransactionZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u32TxOutZ { + /// The element at position 0 + pub a: u32, + /// The element at position 1 + pub b: crate::c_types::TxOut, +} +impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ { + fn from (tup: (u32, crate::c_types::TxOut)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_u32TxOutZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_u32TxOutZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_u32TxOutZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ { + C2Tuple_u32TxOutZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_u32TxOutZ. +pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_u32TxOutZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_u32TxOutZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_u32TxOutZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { } +impl Drop for CVec_C2Tuple_u32TxOutZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_u32TxOutZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ, +} +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { + C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. +pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_TransactionOutputsZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_TransactionOutputsZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_TransactionOutputsZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { } +impl Drop for CVec_TransactionOutputsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_TransactionOutputsZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_BalanceZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::lightning::chain::channelmonitor::Balance, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_BalanceZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_BalanceZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } } } #[no_mangle] -/// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) } +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { } +impl Drop for CVec_BalanceZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_BalanceZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} #[repr(C)] -/// The contents of CResult_DescriptionCreationErrorZ -pub union CResult_DescriptionCreationErrorZPtr { +/// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ +pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::Description, + pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::CreationError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// 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_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`. -pub struct CResult_DescriptionCreationErrorZ { - /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either +pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_DescriptionCreationErrorZPtr, - /// Whether this CResult_DescriptionCreationErrorZ represents a success state. + pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_DescriptionCreationErrorZ in the success state. -pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ { - CResult_DescriptionCreationErrorZ { - contents: CResult_DescriptionCreationErrorZPtr { +/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_DescriptionCreationErrorZ in the error state. -pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ { - CResult_DescriptionCreationErrorZ { - contents: CResult_DescriptionCreationErrorZPtr { +/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11002,13 +11449,13 @@ pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invo } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool { +pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_DescriptionCreationErrorZ. -pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { } -impl Drop for CResult_DescriptionCreationErrorZ { +/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. +pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { } +impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11021,16 +11468,16 @@ impl Drop for CResult_DescriptionCreationErrorZ { } } } -impl From> for CResult_DescriptionCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_DescriptionCreationErrorZPtr { result } + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_DescriptionCreationErrorZPtr { err } + CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err } }; Self { contents, @@ -11038,155 +11485,142 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_PublicKeyTypeZ { + /// The element at position 0 + pub a: crate::c_types::PublicKey, + /// The element at position 1 + pub b: crate::lightning::ln::wire::Type, +} +impl From<(crate::c_types::PublicKey, crate::lightning::ln::wire::Type)> for C2Tuple_PublicKeyTypeZ { + fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self { + Self { + a: tup.0, + b: tup.1, } } } +impl C2Tuple_PublicKeyTypeZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) { + (self.a, self.b) + } +} +/// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. #[no_mangle] -/// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_PrivateRouteCreationErrorZ -pub union CResult_PrivateRouteCreationErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning_invoice::PrivateRoute, - /// A pointer to the contents in the error state. - /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning_invoice::CreationError, +pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ { + C2Tuple_PublicKeyTypeZ { a, b, } } + +#[no_mangle] +/// Frees any resources used by the C2Tuple_PublicKeyTypeZ. +pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { } #[repr(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`. -pub struct CResult_PrivateRouteCreationErrorZ { - /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PrivateRouteCreationErrorZPtr, - /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state. - pub result_ok: bool, +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_PublicKeyTypeZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[no_mangle] -/// Creates a new CResult_PrivateRouteCreationErrorZ in the success state. -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ { - CResult_PrivateRouteCreationErrorZ { - contents: CResult_PrivateRouteCreationErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl CVec_C2Tuple_PublicKeyTypeZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret } -} -#[no_mangle] -/// Creates a new CResult_PrivateRouteCreationErrorZ in the error state. -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ { - CResult_PrivateRouteCreationErrorZ { - contents: CResult_PrivateRouteCreationErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool { - o.result_ok +impl From> for CVec_C2Tuple_PublicKeyTypeZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } } #[no_mangle] -/// Frees any resources used by the CResult_PrivateRouteCreationErrorZ. -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { } -impl Drop for CResult_PrivateRouteCreationErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { } +impl Drop for CVec_C2Tuple_PublicKeyTypeZZ { fn drop(&mut self) { - if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } - } else { - if unsafe { !(self.contents.err as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.err) }; - } - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl From> for CResult_PrivateRouteCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { - let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_PrivateRouteCreationErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PrivateRouteCreationErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } +#[repr(C)] +/// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not +pub enum COption_CustomOnionMessageContentsZ { + /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents + Some(crate::lightning::onion_message::packet::CustomOnionMessageContents), + /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing + None } -impl Clone for CResult_PrivateRouteCreationErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +impl COption_CustomOnionMessageContentsZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) } +/// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents +pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ { + COption_CustomOnionMessageContentsZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_CustomOnionMessageContentsZ containing nothing +pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ { + COption_CustomOnionMessageContentsZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state +pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { } #[repr(C)] -/// The contents of CResult_StringErrorZ -pub union CResult_StringErrorZPtr { +/// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ +pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::Str, + pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::c_types::Secp256k1Error, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(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. +/// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_StringErrorZ { - /// The contents of this CResult_StringErrorZ, accessible via either +pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { + /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_StringErrorZPtr, - /// Whether this CResult_StringErrorZ represents a success state. + pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr, + /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_StringErrorZ in the success state. -pub extern "C" fn CResult_StringErrorZ_ok(o: crate::c_types::Str) -> CResult_StringErrorZ { - CResult_StringErrorZ { - contents: CResult_StringErrorZPtr { +/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { + contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_StringErrorZ in the error state. -pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_StringErrorZ { - CResult_StringErrorZ { - contents: CResult_StringErrorZPtr { +/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { + CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { + contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11194,13 +11628,13 @@ pub extern "C" fn CResult_StringErrorZ_err(e: crate::c_types::Secp256k1Error) -> } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_StringErrorZ_is_ok(o: &CResult_StringErrorZ) -> bool { +pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_StringErrorZ. -pub extern "C" fn CResult_StringErrorZ_free(_res: CResult_StringErrorZ) { } -impl Drop for CResult_StringErrorZ { +/// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. +pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { } +impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11213,16 +11647,16 @@ impl Drop for CResult_StringErrorZ { } } } -impl From> for CResult_StringErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_StringErrorZPtr { result } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_StringErrorZPtr { err } + CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err } }; Self { contents, @@ -11230,59 +11664,79 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_StringErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_StringErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::msgs::NetAddress or not +pub enum COption_NetAddressZ { + /// When we're in this state, this COption_NetAddressZ contains a crate::lightning::ln::msgs::NetAddress + Some(crate::lightning::ln::msgs::NetAddress), + /// When we're in this state, this COption_NetAddressZ contains nothing + None +} +impl COption_NetAddressZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } + } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_StringErrorZ which has the same data as `orig` +/// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress +pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ { + COption_NetAddressZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_NetAddressZ containing nothing +pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ { + COption_NetAddressZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state +pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { } +#[no_mangle] +/// Creates a new COption_NetAddressZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_StringErrorZ_clone(orig: &CResult_StringErrorZ) -> CResult_StringErrorZ { Clone::clone(&orig) } +pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelMonitorUpdateDecodeErrorZ -pub union CResult_ChannelMonitorUpdateDecodeErrorZPtr { +/// The contents of CResult_CVec_u8ZPeerHandleErrorZ +pub union CResult_CVec_u8ZPeerHandleErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::chain::channelmonitor::ChannelMonitorUpdate, + pub result: *mut crate::c_types::derived::CVec_u8Z, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, } #[repr(C)] -/// 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_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`. -pub struct CResult_ChannelMonitorUpdateDecodeErrorZ { - /// The contents of this CResult_ChannelMonitorUpdateDecodeErrorZ, accessible via either +pub struct CResult_CVec_u8ZPeerHandleErrorZ { + /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr, - /// Whether this CResult_ChannelMonitorUpdateDecodeErrorZ represents a success state. + pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr, + /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> CResult_ChannelMonitorUpdateDecodeErrorZ { - CResult_ChannelMonitorUpdateDecodeErrorZ { - contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { +/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ { + CResult_CVec_u8ZPeerHandleErrorZ { + contents: CResult_CVec_u8ZPeerHandleErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelMonitorUpdateDecodeErrorZ { - CResult_ChannelMonitorUpdateDecodeErrorZ { - contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { +/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ { + CResult_CVec_u8ZPeerHandleErrorZ { + contents: CResult_CVec_u8ZPeerHandleErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11290,13 +11744,13 @@ pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelMonitorUpdateDecodeErrorZ. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_free(_res: CResult_ChannelMonitorUpdateDecodeErrorZ) { } -impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { } +impl Drop for CResult_CVec_u8ZPeerHandleErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11309,16 +11763,16 @@ impl Drop for CResult_ChannelMonitorUpdateDecodeErrorZ { } } } -impl From> for CResult_ChannelMonitorUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_u8ZPeerHandleErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_ChannelMonitorUpdateDecodeErrorZPtr { result } + CResult_CVec_u8ZPeerHandleErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelMonitorUpdateDecodeErrorZPtr { err } + CResult_CVec_u8ZPeerHandleErrorZPtr { err } }; Self { contents, @@ -11326,96 +11780,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelMonitorUpdateDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelMonitorUpdateDecodeErrorZ_clone(orig: &CResult_ChannelMonitorUpdateDecodeErrorZ) -> CResult_ChannelMonitorUpdateDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::chain::channelmonitor::MonitorEvent or not -pub enum COption_MonitorEventZ { - /// When we're in this state, this COption_MonitorEventZ contains a crate::lightning::chain::channelmonitor::MonitorEvent - Some(crate::lightning::chain::channelmonitor::MonitorEvent), - /// When we're in this state, this COption_MonitorEventZ contains nothing - None -} -impl COption_MonitorEventZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::chain::channelmonitor::MonitorEvent { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_MonitorEventZ containing a crate::lightning::chain::channelmonitor::MonitorEvent -pub extern "C" fn COption_MonitorEventZ_some(o: crate::lightning::chain::channelmonitor::MonitorEvent) -> COption_MonitorEventZ { - COption_MonitorEventZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_MonitorEventZ containing nothing -pub extern "C" fn COption_MonitorEventZ_none() -> COption_MonitorEventZ { - COption_MonitorEventZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::chain::channelmonitor::MonitorEvent, if we are in the Some state -pub extern "C" fn COption_MonitorEventZ_free(_res: COption_MonitorEventZ) { } -#[no_mangle] -/// Creates a new COption_MonitorEventZ 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. -pub extern "C" fn COption_MonitorEventZ_clone(orig: &COption_MonitorEventZ) -> COption_MonitorEventZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_MonitorEventZDecodeErrorZ -pub union CResult_COption_MonitorEventZDecodeErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::COption_MonitorEventZ, +/// The contents of CResult_NonePeerHandleErrorZ +pub union CResult_NonePeerHandleErrorZPtr { + /// Note that this value is always NULL, as there are no contents in the OK variant + pub result: *mut core::ffi::c_void, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, } #[repr(C)] -/// 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_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`. -pub struct CResult_COption_MonitorEventZDecodeErrorZ { - /// The contents of this CResult_COption_MonitorEventZDecodeErrorZ, accessible via either +pub struct CResult_NonePeerHandleErrorZ { + /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_MonitorEventZDecodeErrorZPtr, - /// Whether this CResult_COption_MonitorEventZDecodeErrorZ represents a success state. + pub contents: CResult_NonePeerHandleErrorZPtr, + /// Whether this CResult_NonePeerHandleErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_MonitorEventZ) -> CResult_COption_MonitorEventZDecodeErrorZ { - CResult_COption_MonitorEventZDecodeErrorZ { - contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NonePeerHandleErrorZ in the success state. +pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ { + CResult_NonePeerHandleErrorZ { + contents: CResult_NonePeerHandleErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_MonitorEventZDecodeErrorZ { - CResult_COption_MonitorEventZDecodeErrorZ { - contents: CResult_COption_MonitorEventZDecodeErrorZPtr { +/// Creates a new CResult_NonePeerHandleErrorZ in the error state. +pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ { + CResult_NonePeerHandleErrorZ { + contents: CResult_NonePeerHandleErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11423,18 +11839,15 @@ pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_is_ok(o: &CResult_COption_MonitorEventZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_MonitorEventZDecodeErrorZ. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_free(_res: CResult_COption_MonitorEventZDecodeErrorZ) { } -impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { +/// Frees any resources used by the CResult_NonePeerHandleErrorZ. +pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { } +impl Drop for CResult_NonePeerHandleErrorZ { fn drop(&mut self) { if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } } else { if unsafe { !(self.contents.err as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.err) }; @@ -11442,16 +11855,16 @@ impl Drop for CResult_COption_MonitorEventZDecodeErrorZ { } } } -impl From> for CResult_COption_MonitorEventZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NonePeerHandleErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_COption_MonitorEventZDecodeErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_MonitorEventZDecodeErrorZPtr { err } + CResult_NonePeerHandleErrorZPtr { err } }; Self { contents, @@ -11459,59 +11872,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_COption_MonitorEventZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_MonitorEventZDecodeErrorZ 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. -pub extern "C" fn CResult_COption_MonitorEventZDecodeErrorZ_clone(orig: &CResult_COption_MonitorEventZDecodeErrorZ) -> CResult_COption_MonitorEventZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HTLCUpdateDecodeErrorZ -pub union CResult_HTLCUpdateDecodeErrorZPtr { +/// The contents of CResult_boolPeerHandleErrorZ +pub union CResult_boolPeerHandleErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::lightning::chain::channelmonitor::HTLCUpdate, + pub result: *mut bool, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, } #[repr(C)] -/// 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_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`. -pub struct CResult_HTLCUpdateDecodeErrorZ { - /// The contents of this CResult_HTLCUpdateDecodeErrorZ, accessible via either +pub struct CResult_boolPeerHandleErrorZ { + /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_HTLCUpdateDecodeErrorZPtr, - /// Whether this CResult_HTLCUpdateDecodeErrorZ represents a success state. + pub contents: CResult_boolPeerHandleErrorZPtr, + /// Whether this CResult_boolPeerHandleErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_ok(o: crate::lightning::chain::channelmonitor::HTLCUpdate) -> CResult_HTLCUpdateDecodeErrorZ { - CResult_HTLCUpdateDecodeErrorZ { - contents: CResult_HTLCUpdateDecodeErrorZPtr { +/// Creates a new CResult_boolPeerHandleErrorZ in the success state. +pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ { + CResult_boolPeerHandleErrorZ { + contents: CResult_boolPeerHandleErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_HTLCUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCUpdateDecodeErrorZ { - CResult_HTLCUpdateDecodeErrorZ { - contents: CResult_HTLCUpdateDecodeErrorZPtr { +/// Creates a new CResult_boolPeerHandleErrorZ in the error state. +pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ { + CResult_boolPeerHandleErrorZ { + contents: CResult_boolPeerHandleErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -11519,13 +11932,13 @@ pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_is_ok(o: &CResult_HTLCUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HTLCUpdateDecodeErrorZ. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_free(_res: CResult_HTLCUpdateDecodeErrorZ) { } -impl Drop for CResult_HTLCUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_boolPeerHandleErrorZ. +pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { } +impl Drop for CResult_boolPeerHandleErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -11538,608 +11951,485 @@ impl Drop for CResult_HTLCUpdateDecodeErrorZ { } } } -impl From> for CResult_HTLCUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_boolPeerHandleErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_HTLCUpdateDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HTLCUpdateDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_HTLCUpdateDecodeErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_HTLCUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_HTLCUpdateDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_HTLCUpdateDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HTLCUpdateDecodeErrorZ_clone(orig: &CResult_HTLCUpdateDecodeErrorZ) -> CResult_HTLCUpdateDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OutPointScriptZ { - /// The element at position 0 - pub a: crate::lightning::chain::transaction::OutPoint, - /// The element at position 1 - pub b: crate::c_types::derived::CVec_u8Z, -} -impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)> for C2Tuple_OutPointScriptZ { - fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_OutPointScriptZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_u8Z) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_OutPointScriptZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } - } -} -#[no_mangle] -/// Creates a new tuple which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_OutPointScriptZ_clone(orig: &C2Tuple_OutPointScriptZ) -> C2Tuple_OutPointScriptZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OutPointScriptZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_OutPointScriptZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_OutPointScriptZ { - C2Tuple_OutPointScriptZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_OutPointScriptZ. -pub extern "C" fn C2Tuple_OutPointScriptZ_free(_res: C2Tuple_OutPointScriptZ) { } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_u32ScriptZ { - /// The element at position 0 - pub a: u32, - /// The element at position 1 - pub b: crate::c_types::derived::CVec_u8Z, -} -impl From<(u32, crate::c_types::derived::CVec_u8Z)> for C2Tuple_u32ScriptZ { - fn from (tup: (u32, crate::c_types::derived::CVec_u8Z)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_u32ScriptZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::derived::CVec_u8Z) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_u32ScriptZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } - } -} -#[no_mangle] -/// Creates a new tuple which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_u32ScriptZ_clone(orig: &C2Tuple_u32ScriptZ) -> C2Tuple_u32ScriptZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_u32ScriptZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_u32ScriptZ_new(a: u32, b: crate::c_types::derived::CVec_u8Z) -> C2Tuple_u32ScriptZ { - C2Tuple_u32ScriptZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_u32ScriptZ. -pub extern "C" fn C2Tuple_u32ScriptZ_free(_res: C2Tuple_u32ScriptZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32ScriptZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_u32ScriptZZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_u32ScriptZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C2Tuple_u32ScriptZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32ScriptZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_C2Tuple_u32ScriptZZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_u32ScriptZZ_free(_res: CVec_C2Tuple_u32ScriptZZ) { } -impl Drop for CVec_C2Tuple_u32ScriptZZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_C2Tuple_u32ScriptZZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ, -} -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)> for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ)) -> Self { + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_boolPeerHandleErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_boolPeerHandleErrorZPtr { err } + }; Self { - a: tup.0, - b: tup.1, + contents, + result_ok: o.result_ok, } } } -impl C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { +impl Clone for CResult_boolPeerHandleErrorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), + if self.result_ok { + Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } } } } #[no_mangle] -/// Creates a new tuple 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. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32ScriptZZ) -> C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { - C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ { a, b, } +pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_NoneSendErrorZ +pub union CResult_NoneSendErrorZPtr { + /// Note that this value is always NULL, as there are no contents in the OK variant + pub result: *mut core::ffi::c_void, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning::onion_message::messenger::SendError, } - -#[no_mangle] -/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// 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`. +pub struct CResult_NoneSendErrorZ { + /// The contents of this CResult_NoneSendErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NoneSendErrorZPtr, + /// Whether this CResult_NoneSendErrorZ represents a success state. + pub result_ok: bool, } -impl CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[no_mangle] +/// Creates a new CResult_NoneSendErrorZ in the success state. +pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ { + CResult_NoneSendErrorZ { + contents: CResult_NoneSendErrorZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, } } -impl From> for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } +#[no_mangle] +/// Creates a new CResult_NoneSendErrorZ in the error state. +pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ { + CResult_NoneSendErrorZ { + contents: CResult_NoneSendErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ_free(_res: CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ) { } -impl Drop for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { +pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NoneSendErrorZ. +pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { } +impl Drop for CResult_NoneSendErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + if self.result_ok { + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } } } -impl Clone for CVec_C2Tuple_TxidCVec_C2Tuple_u32ScriptZZZZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) +impl From> for CResult_NoneSendErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneSendErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::util::events::Events of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_EventZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::lightning::util::events::Event, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// The contents of CResult_SiPrefixParseErrorZ +pub union CResult_SiPrefixParseErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning_invoice::SiPrefix, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning_invoice::ParseError, } -impl CVec_EventZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::events::Event] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[repr(C)] +/// 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`. +pub struct CResult_SiPrefixParseErrorZ { + /// The contents of this CResult_SiPrefixParseErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_SiPrefixParseErrorZPtr, + /// Whether this CResult_SiPrefixParseErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_SiPrefixParseErrorZ in the success state. +pub extern "C" fn CResult_SiPrefixParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixParseErrorZ { + CResult_SiPrefixParseErrorZ { + contents: CResult_SiPrefixParseErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl From> for CVec_EventZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } +#[no_mangle] +/// Creates a new CResult_SiPrefixParseErrorZ in the error state. +pub extern "C" fn CResult_SiPrefixParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SiPrefixParseErrorZ { + CResult_SiPrefixParseErrorZ { + contents: CResult_SiPrefixParseErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_EventZ_free(_res: CVec_EventZ) { } -impl Drop for CVec_EventZ { +pub extern "C" fn CResult_SiPrefixParseErrorZ_is_ok(o: &CResult_SiPrefixParseErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_SiPrefixParseErrorZ. +pub extern "C" fn CResult_SiPrefixParseErrorZ_free(_res: CResult_SiPrefixParseErrorZ) { } +impl Drop for CResult_SiPrefixParseErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } } } -impl Clone for CVec_EventZ { +impl From> for CResult_SiPrefixParseErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_SiPrefixParseErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_SiPrefixParseErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_SiPrefixParseErrorZ { fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) + if self.result_ok { + Self { result_ok: true, contents: CResult_SiPrefixParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_SiPrefixParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_SiPrefixParseErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_SiPrefixParseErrorZ_clone(orig: &CResult_SiPrefixParseErrorZ) -> CResult_SiPrefixParseErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_InvoiceParseOrSemanticErrorZ +pub union CResult_InvoiceParseOrSemanticErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning_invoice::Invoice, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning_invoice::ParseOrSemanticError, +} #[repr(C)] -/// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_TransactionZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::Transaction, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// 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`. +pub struct CResult_InvoiceParseOrSemanticErrorZ { + /// The contents of this CResult_InvoiceParseOrSemanticErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_InvoiceParseOrSemanticErrorZPtr, + /// Whether this CResult_InvoiceParseOrSemanticErrorZ represents a success state. + pub result_ok: bool, } -impl CVec_TransactionZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Transaction] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[no_mangle] +/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceParseOrSemanticErrorZ { + CResult_InvoiceParseOrSemanticErrorZ { + contents: CResult_InvoiceParseOrSemanticErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl From> for CVec_TransactionZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } +#[no_mangle] +/// Creates a new CResult_InvoiceParseOrSemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_InvoiceParseOrSemanticErrorZ { + CResult_InvoiceParseOrSemanticErrorZ { + contents: CResult_InvoiceParseOrSemanticErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_TransactionZ_free(_res: CVec_TransactionZ) { } -impl Drop for CVec_TransactionZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } +pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_InvoiceParseOrSemanticErrorZ) -> bool { + o.result_ok } -impl Clone for CVec_TransactionZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) +#[no_mangle] +/// Frees any resources used by the CResult_InvoiceParseOrSemanticErrorZ. +pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_free(_res: CResult_InvoiceParseOrSemanticErrorZ) { } +impl Drop for CResult_InvoiceParseOrSemanticErrorZ { + fn drop(&mut self) { + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } } } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_u32TxOutZ { - /// The element at position 0 - pub a: u32, - /// The element at position 1 - pub b: crate::c_types::TxOut, -} -impl From<(u32, crate::c_types::TxOut)> for C2Tuple_u32TxOutZ { - fn from (tup: (u32, crate::c_types::TxOut)) -> Self { +impl From> for CResult_InvoiceParseOrSemanticErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_InvoiceParseOrSemanticErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_InvoiceParseOrSemanticErrorZPtr { err } + }; Self { - a: tup.0, - b: tup.1, + contents, + result_ok: o.result_ok, } } } -impl C2Tuple_u32TxOutZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u32, crate::c_types::TxOut) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_u32TxOutZ { +impl Clone for CResult_InvoiceParseOrSemanticErrorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), + if self.result_ok { + Self { result_ok: true, contents: CResult_InvoiceParseOrSemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_InvoiceParseOrSemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } } } } #[no_mangle] -/// Creates a new tuple 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. -pub extern "C" fn C2Tuple_u32TxOutZ_clone(orig: &C2Tuple_u32TxOutZ) -> C2Tuple_u32TxOutZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_u32TxOutZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_u32TxOutZ_new(a: u32, b: crate::c_types::TxOut) -> C2Tuple_u32TxOutZ { - C2Tuple_u32TxOutZ { a, b, } +pub extern "C" fn CResult_InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_InvoiceParseOrSemanticErrorZ) -> CResult_InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_SignedRawInvoiceParseErrorZ +pub union CResult_SignedRawInvoiceParseErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning_invoice::SignedRawInvoice, + /// A pointer to the contents in the error state. + /// Reading from this pointer when `result_ok` is set is undefined. + pub err: *mut crate::lightning_invoice::ParseError, } - -#[no_mangle] -/// Frees any resources used by the C2Tuple_u32TxOutZ. -pub extern "C" fn C2Tuple_u32TxOutZ_free(_res: C2Tuple_u32TxOutZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_u32TxOutZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_u32TxOutZZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_u32TxOutZ, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// 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`. +pub struct CResult_SignedRawInvoiceParseErrorZ { + /// The contents of this CResult_SignedRawInvoiceParseErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_SignedRawInvoiceParseErrorZPtr, + /// Whether this CResult_SignedRawInvoiceParseErrorZ represents a success state. + pub result_ok: bool, } -impl CVec_C2Tuple_u32TxOutZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_u32TxOutZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[no_mangle] +/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the success state. +pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_ok(o: crate::lightning_invoice::SignedRawInvoice) -> CResult_SignedRawInvoiceParseErrorZ { + CResult_SignedRawInvoiceParseErrorZ { + contents: CResult_SignedRawInvoiceParseErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl From> for CVec_C2Tuple_u32TxOutZZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } +#[no_mangle] +/// Creates a new CResult_SignedRawInvoiceParseErrorZ in the error state. +pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_err(e: crate::lightning_invoice::ParseError) -> CResult_SignedRawInvoiceParseErrorZ { + CResult_SignedRawInvoiceParseErrorZ { + contents: CResult_SignedRawInvoiceParseErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_u32TxOutZZ_free(_res: CVec_C2Tuple_u32TxOutZZ) { } -impl Drop for CVec_C2Tuple_u32TxOutZZ { +pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_is_ok(o: &CResult_SignedRawInvoiceParseErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_SignedRawInvoiceParseErrorZ. +pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_free(_res: CResult_SignedRawInvoiceParseErrorZ) { } +impl Drop for CResult_SignedRawInvoiceParseErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } + } else { + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } } } -impl Clone for CVec_C2Tuple_u32TxOutZZ { +impl From> for CResult_SignedRawInvoiceParseErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { + let contents = if o.result_ok { + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_SignedRawInvoiceParseErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_SignedRawInvoiceParseErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_SignedRawInvoiceParseErrorZ { fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) + if self.result_ok { + Self { result_ok: true, contents: CResult_SignedRawInvoiceParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_SignedRawInvoiceParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_SignedRawInvoiceParseErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_SignedRawInvoiceParseErrorZ_clone(orig: &CResult_SignedRawInvoiceParseErrorZ) -> CResult_SignedRawInvoiceParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_RawInvoice_u832InvoiceSignatureZ { /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, + pub a: crate::lightning_invoice::RawInvoice, /// The element at position 1 - pub b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ, + pub b: crate::c_types::ThirtyTwoBytes, + /// The element at position 2 + pub c: crate::lightning_invoice::InvoiceSignature, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)> for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ)) -> Self { +impl From<(crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)> for C3Tuple_RawInvoice_u832InvoiceSignatureZ { + fn from (tup: (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature)) -> Self { Self { a: tup.0, b: tup.1, + c: tup.2, } } } -impl C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) { - (self.a, self.b) +impl C3Tuple_RawInvoice_u832InvoiceSignatureZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawInvoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::InvoiceSignature) { + (self.a, self.b, self.c) } } -impl Clone for C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { +impl Clone for C3Tuple_RawInvoice_u832InvoiceSignatureZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), b: Clone::clone(&self.b), + c: Clone::clone(&self.c), } } } #[no_mangle] /// Creates a new tuple which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_clone(orig: &C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ from the contained elements. +pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_clone(orig: &C3Tuple_RawInvoice_u832InvoiceSignatureZ) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_RawInvoice_u832InvoiceSignatureZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::derived::CVec_C2Tuple_u32TxOutZZ) -> C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { - C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ { a, b, } +pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_new(a: crate::lightning_invoice::RawInvoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::InvoiceSignature) -> C3Tuple_RawInvoice_u832InvoiceSignatureZ { + C3Tuple_RawInvoice_u832InvoiceSignatureZ { a, b, c, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ. -pub extern "C" fn C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ_free(_res: C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_TransactionOutputsZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_TransactionOutputsZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_TxidCVec_C2Tuple_u32TxOutZZZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_TransactionOutputsZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_TransactionOutputsZ_free(_res: CVec_TransactionOutputsZ) { } -impl Drop for CVec_TransactionOutputsZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_TransactionOutputsZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::Balances of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_BalanceZ { - /// The elements in the array. - /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::lightning::chain::channelmonitor::Balance, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_BalanceZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { - if self.datalen == 0 { return Vec::new(); } - let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); - self.data = core::ptr::null_mut(); - self.datalen = 0; - ret - } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::Balance] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_BalanceZ { - fn from(v: Vec) -> Self { - let datalen = v.len(); - let data = Box::into_raw(v.into_boxed_slice()); - Self { datalen, data: unsafe { (*data).as_mut_ptr() } } - } -} -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_BalanceZ_free(_res: CVec_BalanceZ) { } -impl Drop for CVec_BalanceZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -impl Clone for CVec_BalanceZ { - fn clone(&self) -> Self { - let mut res = Vec::new(); - if self.datalen == 0 { return Self::from(res); } - res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); - Self::from(res) - } -} +/// Frees any resources used by the C3Tuple_RawInvoice_u832InvoiceSignatureZ. +pub extern "C" fn C3Tuple_RawInvoice_u832InvoiceSignatureZ_free(_res: C3Tuple_RawInvoice_u832InvoiceSignatureZ) { } #[repr(C)] -/// The contents of CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ -pub union CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +/// The contents of CResult_PayeePubKeyErrorZ +pub union CResult_PayeePubKeyErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ, + pub result: *mut crate::lightning_invoice::PayeePubKey, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::c_types::Secp256k1Error, } #[repr(C)] -/// 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_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`. -pub struct CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ, accessible via either +pub struct CResult_PayeePubKeyErrorZ { + /// The contents of this CResult_PayeePubKeyErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ represents a success state. + pub contents: CResult_PayeePubKeyErrorZPtr, + /// Whether this CResult_PayeePubKeyErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the success state. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_BlockHashChannelMonitorZ) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +/// Creates a new CResult_PayeePubKeyErrorZ in the success state. +pub extern "C" fn CResult_PayeePubKeyErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeyErrorZ { + CResult_PayeePubKeyErrorZ { + contents: CResult_PayeePubKeyErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ in the error state. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - contents: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { +/// Creates a new CResult_PayeePubKeyErrorZ in the error state. +pub extern "C" fn CResult_PayeePubKeyErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeyErrorZ { + CResult_PayeePubKeyErrorZ { + contents: CResult_PayeePubKeyErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12147,13 +12437,13 @@ pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_err(e: cr } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PayeePubKeyErrorZ_is_ok(o: &CResult_PayeePubKeyErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ. -pub extern "C" fn CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ) { } -impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { +/// Frees any resources used by the CResult_PayeePubKeyErrorZ. +pub extern "C" fn CResult_PayeePubKeyErrorZ_free(_res: CResult_PayeePubKeyErrorZ) { } +impl Drop for CResult_PayeePubKeyErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12166,16 +12456,16 @@ impl Drop for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PayeePubKeyErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { result } + CResult_PayeePubKeyErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_BlockHashChannelMonitorZDecodeErrorZPtr { err } + CResult_PayeePubKeyErrorZPtr { err } }; Self { contents, @@ -12183,60 +12473,47 @@ impl From for C2Tuple_PublicKeyTypeZ { - fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::wire::Type)) -> Self { - Self { - a: tup.0, - b: tup.1, +impl Clone for CResult_PayeePubKeyErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PayeePubKeyErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PayeePubKeyErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } } } } -impl C2Tuple_PublicKeyTypeZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::wire::Type) { - (self.a, self.b) - } -} -/// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_PublicKeyTypeZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::wire::Type) -> C2Tuple_PublicKeyTypeZ { - C2Tuple_PublicKeyTypeZ { a, b, } -} - #[no_mangle] -/// Frees any resources used by the C2Tuple_PublicKeyTypeZ. -pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { } +/// Creates a new CResult_PayeePubKeyErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PayeePubKeyErrorZ_clone(orig: &CResult_PayeePubKeyErrorZ) -> CResult_PayeePubKeyErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. +/// A dynamically-allocated array of crate::lightning_invoice::PrivateRoutes of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_PublicKeyTypeZZ { +pub struct CVec_PrivateRouteZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut crate::c_types::derived::C2Tuple_PublicKeyTypeZ, + pub data: *mut crate::lightning_invoice::PrivateRoute, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_PublicKeyTypeZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_PrivateRouteZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { if self.datalen == 0 { return Vec::new(); } let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); self.data = core::ptr::null_mut(); self.datalen = 0; ret } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_PublicKeyTypeZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_invoice::PrivateRoute] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_PublicKeyTypeZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_PrivateRouteZ { + fn from(v: Vec) -> Self { let datalen = v.len(); let data = Box::into_raw(v.into_boxed_slice()); Self { datalen, data: unsafe { (*data).as_mut_ptr() } } @@ -12244,81 +12521,57 @@ impl From> for CVec_C2Tuple } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_PublicKeyTypeZZ_free(_res: CVec_C2Tuple_PublicKeyTypeZZ) { } -impl Drop for CVec_C2Tuple_PublicKeyTypeZZ { +pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { } +impl Drop for CVec_PrivateRouteZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} -#[repr(C)] -/// An enum which can either contain a crate::lightning::onion_message::packet::CustomOnionMessageContents or not -pub enum COption_CustomOnionMessageContentsZ { - /// When we're in this state, this COption_CustomOnionMessageContentsZ contains a crate::lightning::onion_message::packet::CustomOnionMessageContents - Some(crate::lightning::onion_message::packet::CustomOnionMessageContents), - /// When we're in this state, this COption_CustomOnionMessageContentsZ contains nothing - None -} -impl COption_CustomOnionMessageContentsZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::onion_message::packet::CustomOnionMessageContents { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_CustomOnionMessageContentsZ containing a crate::lightning::onion_message::packet::CustomOnionMessageContents -pub extern "C" fn COption_CustomOnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> COption_CustomOnionMessageContentsZ { - COption_CustomOnionMessageContentsZ::Some(o) } -#[no_mangle] -/// Constructs a new COption_CustomOnionMessageContentsZ containing nothing -pub extern "C" fn COption_CustomOnionMessageContentsZ_none() -> COption_CustomOnionMessageContentsZ { - COption_CustomOnionMessageContentsZ::None +impl Clone for CVec_PrivateRouteZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } } -#[no_mangle] -/// Frees any resources associated with the crate::lightning::onion_message::packet::CustomOnionMessageContents, if we are in the Some state -pub extern "C" fn COption_CustomOnionMessageContentsZ_free(_res: COption_CustomOnionMessageContentsZ) { } #[repr(C)] -/// The contents of CResult_COption_CustomOnionMessageContentsZDecodeErrorZ -pub union CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { +/// The contents of CResult_PositiveTimestampCreationErrorZ +pub union CResult_PositiveTimestampCreationErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::COption_CustomOnionMessageContentsZ, + pub result: *mut crate::lightning_invoice::PositiveTimestamp, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::msgs::DecodeError, + pub err: *mut crate::lightning_invoice::CreationError, } #[repr(C)] -/// A CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_CustomOnionMessageContentsZ 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`. -pub struct CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { - /// The contents of this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ, accessible via either +pub struct CResult_PositiveTimestampCreationErrorZ { + /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr, - /// Whether this CResult_COption_CustomOnionMessageContentsZDecodeErrorZ represents a success state. + pub contents: CResult_PositiveTimestampCreationErrorZPtr, + /// Whether this CResult_PositiveTimestampCreationErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_CustomOnionMessageContentsZ) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { - contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { +/// Creates a new CResult_PositiveTimestampCreationErrorZ in the success state. +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_ok(o: crate::lightning_invoice::PositiveTimestamp) -> CResult_PositiveTimestampCreationErrorZ { + CResult_PositiveTimestampCreationErrorZ { + contents: CResult_PositiveTimestampCreationErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_CustomOnionMessageContentsZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { - CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { - contents: CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { +/// Creates a new CResult_PositiveTimestampCreationErrorZ in the error state. +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PositiveTimestampCreationErrorZ { + CResult_PositiveTimestampCreationErrorZ { + contents: CResult_PositiveTimestampCreationErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12326,13 +12579,13 @@ pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_err(e: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_is_ok(o: &CResult_PositiveTimestampCreationErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_CustomOnionMessageContentsZDecodeErrorZ. -pub extern "C" fn CResult_COption_CustomOnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_CustomOnionMessageContentsZDecodeErrorZ) { } -impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { +/// Frees any resources used by the CResult_PositiveTimestampCreationErrorZ. +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_free(_res: CResult_PositiveTimestampCreationErrorZ) { } +impl Drop for CResult_PositiveTimestampCreationErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12345,16 +12598,16 @@ impl Drop for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { } } } -impl From> for CResult_COption_CustomOnionMessageContentsZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PositiveTimestampCreationErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { result } + CResult_PositiveTimestampCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_CustomOnionMessageContentsZDecodeErrorZPtr { err } + CResult_PositiveTimestampCreationErrorZPtr { err } }; Self { contents, @@ -12362,79 +12615,58 @@ impl From bool { - if let Self::None = self { false } else { true } - } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() - } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::msgs::NetAddress { - if let Self::Some(v) = self { v } else { unreachable!() } +impl Clone for CResult_PositiveTimestampCreationErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PositiveTimestampCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } #[no_mangle] -/// Constructs a new COption_NetAddressZ containing a crate::lightning::ln::msgs::NetAddress -pub extern "C" fn COption_NetAddressZ_some(o: crate::lightning::ln::msgs::NetAddress) -> COption_NetAddressZ { - COption_NetAddressZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_NetAddressZ containing nothing -pub extern "C" fn COption_NetAddressZ_none() -> COption_NetAddressZ { - COption_NetAddressZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::msgs::NetAddress, if we are in the Some state -pub extern "C" fn COption_NetAddressZ_free(_res: COption_NetAddressZ) { } -#[no_mangle] -/// Creates a new COption_NetAddressZ which has the same data as `orig` +/// Creates a new CResult_PositiveTimestampCreationErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_NetAddressZ_clone(orig: &COption_NetAddressZ) -> COption_NetAddressZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_u8ZPeerHandleErrorZ -pub union CResult_CVec_u8ZPeerHandleErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut crate::c_types::derived::CVec_u8Z, +/// The contents of CResult_NoneSemanticErrorZ +pub union CResult_NoneSemanticErrorZPtr { + /// Note that this value is always NULL, as there are no contents in the OK variant + pub result: *mut core::ffi::c_void, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, + pub err: *mut crate::lightning_invoice::SemanticError, } #[repr(C)] -/// 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. +/// 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`. -pub struct CResult_CVec_u8ZPeerHandleErrorZ { - /// The contents of this CResult_CVec_u8ZPeerHandleErrorZ, accessible via either +pub struct CResult_NoneSemanticErrorZ { + /// The contents of this CResult_NoneSemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_u8ZPeerHandleErrorZPtr, - /// Whether this CResult_CVec_u8ZPeerHandleErrorZ represents a success state. + pub contents: CResult_NoneSemanticErrorZPtr, + /// Whether this CResult_NoneSemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the success state. -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZPeerHandleErrorZ { - CResult_CVec_u8ZPeerHandleErrorZ { - contents: CResult_CVec_u8ZPeerHandleErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneSemanticErrorZ in the success state. +pub extern "C" fn CResult_NoneSemanticErrorZ_ok() -> CResult_NoneSemanticErrorZ { + CResult_NoneSemanticErrorZ { + contents: CResult_NoneSemanticErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ in the error state. -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_CVec_u8ZPeerHandleErrorZ { - CResult_CVec_u8ZPeerHandleErrorZ { - contents: CResult_CVec_u8ZPeerHandleErrorZPtr { +/// Creates a new CResult_NoneSemanticErrorZ in the error state. +pub extern "C" fn CResult_NoneSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_NoneSemanticErrorZ { + CResult_NoneSemanticErrorZ { + contents: CResult_NoneSemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12442,18 +12674,15 @@ pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> bool { +pub extern "C" fn CResult_NoneSemanticErrorZ_is_ok(o: &CResult_NoneSemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_u8ZPeerHandleErrorZ. -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_free(_res: CResult_CVec_u8ZPeerHandleErrorZ) { } -impl Drop for CResult_CVec_u8ZPeerHandleErrorZ { +/// Frees any resources used by the CResult_NoneSemanticErrorZ. +pub extern "C" fn CResult_NoneSemanticErrorZ_free(_res: CResult_NoneSemanticErrorZ) { } +impl Drop for CResult_NoneSemanticErrorZ { fn drop(&mut self) { if self.result_ok { - if unsafe { !(self.contents.result as *mut ()).is_null() } { - let _ = unsafe { Box::from_raw(self.contents.result) }; - } } else { if unsafe { !(self.contents.err as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.err) }; @@ -12461,16 +12690,16 @@ impl Drop for CResult_CVec_u8ZPeerHandleErrorZ { } } } -impl From> for CResult_CVec_u8ZPeerHandleErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneSemanticErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::SemanticError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CVec_u8ZPeerHandleErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneSemanticErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_u8ZPeerHandleErrorZPtr { err } + CResult_NoneSemanticErrorZPtr { err } }; Self { contents, @@ -12478,58 +12707,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_u8ZPeerHandleErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneSemanticErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_CVec_u8ZPeerHandleErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneSemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZPeerHandleErrorZ which has the same data as `orig` +/// Creates a new CResult_NoneSemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_u8ZPeerHandleErrorZ_clone(orig: &CResult_CVec_u8ZPeerHandleErrorZ) -> CResult_CVec_u8ZPeerHandleErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneSemanticErrorZ_clone(orig: &CResult_NoneSemanticErrorZ) -> CResult_NoneSemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NonePeerHandleErrorZ -pub union CResult_NonePeerHandleErrorZPtr { - /// Note that this value is always NULL, as there are no contents in the OK variant - pub result: *mut core::ffi::c_void, +/// The contents of CResult_InvoiceSemanticErrorZ +pub union CResult_InvoiceSemanticErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning_invoice::Invoice, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, + pub err: *mut crate::lightning_invoice::SemanticError, } #[repr(C)] -/// 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_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`. -pub struct CResult_NonePeerHandleErrorZ { - /// The contents of this CResult_NonePeerHandleErrorZ, accessible via either +pub struct CResult_InvoiceSemanticErrorZ { + /// The contents of this CResult_InvoiceSemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NonePeerHandleErrorZPtr, - /// Whether this CResult_NonePeerHandleErrorZ represents a success state. + pub contents: CResult_InvoiceSemanticErrorZPtr, + /// Whether this CResult_InvoiceSemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NonePeerHandleErrorZ in the success state. -pub extern "C" fn CResult_NonePeerHandleErrorZ_ok() -> CResult_NonePeerHandleErrorZ { - CResult_NonePeerHandleErrorZ { - contents: CResult_NonePeerHandleErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_InvoiceSemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceSemanticErrorZ_ok(o: crate::lightning_invoice::Invoice) -> CResult_InvoiceSemanticErrorZ { + CResult_InvoiceSemanticErrorZ { + contents: CResult_InvoiceSemanticErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NonePeerHandleErrorZ in the error state. -pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_NonePeerHandleErrorZ { - CResult_NonePeerHandleErrorZ { - contents: CResult_NonePeerHandleErrorZPtr { +/// Creates a new CResult_InvoiceSemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceSemanticErrorZ_err(e: crate::lightning_invoice::SemanticError) -> CResult_InvoiceSemanticErrorZ { + CResult_InvoiceSemanticErrorZ { + contents: CResult_InvoiceSemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12537,15 +12767,18 @@ pub extern "C" fn CResult_NonePeerHandleErrorZ_err(e: crate::lightning::ln::peer } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceSemanticErrorZ_is_ok(o: &CResult_InvoiceSemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NonePeerHandleErrorZ. -pub extern "C" fn CResult_NonePeerHandleErrorZ_free(_res: CResult_NonePeerHandleErrorZ) { } -impl Drop for CResult_NonePeerHandleErrorZ { +/// Frees any resources used by the CResult_InvoiceSemanticErrorZ. +pub extern "C" fn CResult_InvoiceSemanticErrorZ_free(_res: CResult_InvoiceSemanticErrorZ) { } +impl Drop for CResult_InvoiceSemanticErrorZ { fn drop(&mut self) { if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } } else { if unsafe { !(self.contents.err as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.err) }; @@ -12553,16 +12786,16 @@ impl Drop for CResult_NonePeerHandleErrorZ { } } } -impl From> for CResult_NonePeerHandleErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::peer_handler::PeerHandleError>) -> Self { +impl From> for CResult_InvoiceSemanticErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NonePeerHandleErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_InvoiceSemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NonePeerHandleErrorZPtr { err } + CResult_InvoiceSemanticErrorZPtr { err } }; Self { contents, @@ -12570,59 +12803,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_InvoiceSemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_InvoiceSemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NonePeerHandleErrorZ which has the same data as `orig` +/// Creates a new CResult_InvoiceSemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InvoiceSemanticErrorZ_clone(orig: &CResult_InvoiceSemanticErrorZ) -> CResult_InvoiceSemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_boolPeerHandleErrorZ -pub union CResult_boolPeerHandleErrorZPtr { +/// The contents of CResult_DescriptionCreationErrorZ +pub union CResult_DescriptionCreationErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut bool, + pub result: *mut crate::lightning_invoice::Description, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::ln::peer_handler::PeerHandleError, + pub err: *mut crate::lightning_invoice::CreationError, } #[repr(C)] -/// 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_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`. -pub struct CResult_boolPeerHandleErrorZ { - /// The contents of this CResult_boolPeerHandleErrorZ, accessible via either +pub struct CResult_DescriptionCreationErrorZ { + /// The contents of this CResult_DescriptionCreationErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_boolPeerHandleErrorZPtr, - /// Whether this CResult_boolPeerHandleErrorZ represents a success state. + pub contents: CResult_DescriptionCreationErrorZPtr, + /// Whether this CResult_DescriptionCreationErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_boolPeerHandleErrorZ in the success state. -pub extern "C" fn CResult_boolPeerHandleErrorZ_ok(o: bool) -> CResult_boolPeerHandleErrorZ { - CResult_boolPeerHandleErrorZ { - contents: CResult_boolPeerHandleErrorZPtr { +/// Creates a new CResult_DescriptionCreationErrorZ in the success state. +pub extern "C" fn CResult_DescriptionCreationErrorZ_ok(o: crate::lightning_invoice::Description) -> CResult_DescriptionCreationErrorZ { + CResult_DescriptionCreationErrorZ { + contents: CResult_DescriptionCreationErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_boolPeerHandleErrorZ in the error state. -pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer_handler::PeerHandleError) -> CResult_boolPeerHandleErrorZ { - CResult_boolPeerHandleErrorZ { - contents: CResult_boolPeerHandleErrorZPtr { +/// Creates a new CResult_DescriptionCreationErrorZ in the error state. +pub extern "C" fn CResult_DescriptionCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_DescriptionCreationErrorZ { + CResult_DescriptionCreationErrorZ { + contents: CResult_DescriptionCreationErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12630,13 +12863,13 @@ pub extern "C" fn CResult_boolPeerHandleErrorZ_err(e: crate::lightning::ln::peer } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> bool { +pub extern "C" fn CResult_DescriptionCreationErrorZ_is_ok(o: &CResult_DescriptionCreationErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_boolPeerHandleErrorZ. -pub extern "C" fn CResult_boolPeerHandleErrorZ_free(_res: CResult_boolPeerHandleErrorZ) { } -impl Drop for CResult_boolPeerHandleErrorZ { +/// Frees any resources used by the CResult_DescriptionCreationErrorZ. +pub extern "C" fn CResult_DescriptionCreationErrorZ_free(_res: CResult_DescriptionCreationErrorZ) { } +impl Drop for CResult_DescriptionCreationErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -12649,16 +12882,16 @@ impl Drop for CResult_boolPeerHandleErrorZ { } } } -impl From> for CResult_boolPeerHandleErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_DescriptionCreationErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { let result = unsafe { o.contents.result }; unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_boolPeerHandleErrorZPtr { result } + CResult_DescriptionCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_boolPeerHandleErrorZPtr { err } + CResult_DescriptionCreationErrorZPtr { err } }; Self { contents, @@ -12666,58 +12899,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_boolPeerHandleErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_DescriptionCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_boolPeerHandleErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_DescriptionCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_boolPeerHandleErrorZ which has the same data as `orig` +/// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_boolPeerHandleErrorZ_clone(orig: &CResult_boolPeerHandleErrorZ) -> CResult_boolPeerHandleErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneSendErrorZ -pub union CResult_NoneSendErrorZPtr { - /// Note that this value is always NULL, as there are no contents in the OK variant - pub result: *mut core::ffi::c_void, +/// The contents of CResult_PrivateRouteCreationErrorZ +pub union CResult_PrivateRouteCreationErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut crate::lightning_invoice::PrivateRoute, /// A pointer to the contents in the error state. /// Reading from this pointer when `result_ok` is set is undefined. - pub err: *mut crate::lightning::onion_message::messenger::SendError, + pub err: *mut crate::lightning_invoice::CreationError, } #[repr(C)] -/// A CResult_NoneSendErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::onion_message::messenger::SendError on failure. +/// 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`. -pub struct CResult_NoneSendErrorZ { - /// The contents of this CResult_NoneSendErrorZ, accessible via either +pub struct CResult_PrivateRouteCreationErrorZ { + /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneSendErrorZPtr, - /// Whether this CResult_NoneSendErrorZ represents a success state. + pub contents: CResult_PrivateRouteCreationErrorZPtr, + /// Whether this CResult_PrivateRouteCreationErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneSendErrorZ in the success state. -pub extern "C" fn CResult_NoneSendErrorZ_ok() -> CResult_NoneSendErrorZ { - CResult_NoneSendErrorZ { - contents: CResult_NoneSendErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_PrivateRouteCreationErrorZ in the success state. +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_ok(o: crate::lightning_invoice::PrivateRoute) -> CResult_PrivateRouteCreationErrorZ { + CResult_PrivateRouteCreationErrorZ { + contents: CResult_PrivateRouteCreationErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneSendErrorZ in the error state. -pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message::messenger::SendError) -> CResult_NoneSendErrorZ { - CResult_NoneSendErrorZ { - contents: CResult_NoneSendErrorZPtr { +/// Creates a new CResult_PrivateRouteCreationErrorZ in the error state. +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_invoice::CreationError) -> CResult_PrivateRouteCreationErrorZ { + CResult_PrivateRouteCreationErrorZ { + contents: CResult_PrivateRouteCreationErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -12725,15 +12959,18 @@ pub extern "C" fn CResult_NoneSendErrorZ_err(e: crate::lightning::onion_message: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneSendErrorZ_is_ok(o: &CResult_NoneSendErrorZ) -> bool { +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_is_ok(o: &CResult_PrivateRouteCreationErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneSendErrorZ. -pub extern "C" fn CResult_NoneSendErrorZ_free(_res: CResult_NoneSendErrorZ) { } -impl Drop for CResult_NoneSendErrorZ { +/// Frees any resources used by the CResult_PrivateRouteCreationErrorZ. +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_free(_res: CResult_PrivateRouteCreationErrorZ) { } +impl Drop for CResult_PrivateRouteCreationErrorZ { fn drop(&mut self) { if self.result_ok { + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } } else { if unsafe { !(self.contents.err as *mut ()).is_null() } { let _ = unsafe { Box::from_raw(self.contents.err) }; @@ -12741,16 +12978,16 @@ impl Drop for CResult_NoneSendErrorZ { } } } -impl From> for CResult_NoneSendErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::onion_message::messenger::SendError>) -> Self { +impl From> for CResult_PrivateRouteCreationErrorZ { + fn from(mut o: crate::c_types::CResultTempl) -> Self { let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NoneSendErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_PrivateRouteCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneSendErrorZPtr { err } + CResult_PrivateRouteCreationErrorZPtr { err } }; Self { contents, @@ -12758,6 +12995,23 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PrivateRouteCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_u32GraphSyncErrorZ pub union CResult_u32GraphSyncErrorZPtr { @@ -12968,7 +13222,7 @@ pub extern "C" fn CVec_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { } impl Drop for CVec_UpdateAddHTLCZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_UpdateAddHTLCZ { @@ -13014,7 +13268,7 @@ pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { impl Drop for CVec_UpdateFulfillHTLCZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_UpdateFulfillHTLCZ { @@ -13060,7 +13314,7 @@ pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { } impl Drop for CVec_UpdateFailHTLCZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_UpdateFailHTLCZ { @@ -13106,7 +13360,7 @@ pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalfor impl Drop for CVec_UpdateFailMalformedHTLCZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_UpdateFailMalformedHTLCZ { @@ -16416,7 +16670,7 @@ pub extern "C" fn CVec_PhantomRouteHintsZ_free(_res: CVec_PhantomRouteHintsZ) { impl Drop for CVec_PhantomRouteHintsZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_PhantomRouteHintsZ { @@ -16665,7 +16919,7 @@ pub extern "C" fn CVec_OutPointZ_free(_res: CVec_OutPointZ) { } impl Drop for CVec_OutPointZ { fn drop(&mut self) { if self.datalen == 0 { return; } - unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } impl Clone for CVec_OutPointZ { @@ -16676,3 +16930,137 @@ impl Clone for CVec_OutPointZ { Self::from(res) } } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::chain::chainmonitor::MonitorUpdateIds of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_MonitorUpdateIdZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::lightning::chain::chainmonitor::MonitorUpdateId, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_MonitorUpdateIdZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::chainmonitor::MonitorUpdateId] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_MonitorUpdateIdZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_MonitorUpdateIdZ_free(_res: CVec_MonitorUpdateIdZ) { } +impl Drop for CVec_MonitorUpdateIdZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_MonitorUpdateIdZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OutPointCVec_MonitorUpdateIdZZ { + /// The element at position 0 + pub a: crate::lightning::chain::transaction::OutPoint, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_MonitorUpdateIdZ, +} +impl From<(crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)> for C2Tuple_OutPointCVec_MonitorUpdateIdZZ { + fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OutPointCVec_MonitorUpdateIdZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::c_types::derived::CVec_MonitorUpdateIdZ) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OutPointCVec_MonitorUpdateIdZZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } + } +} +#[no_mangle] +/// Creates a new tuple which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_clone(orig: &C2Tuple_OutPointCVec_MonitorUpdateIdZZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OutPointCVec_MonitorUpdateIdZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::c_types::derived::CVec_MonitorUpdateIdZ) -> C2Tuple_OutPointCVec_MonitorUpdateIdZZ { + C2Tuple_OutPointCVec_MonitorUpdateIdZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OutPointCVec_MonitorUpdateIdZZ. +pub extern "C" fn C2Tuple_OutPointCVec_MonitorUpdateIdZZ_free(_res: C2Tuple_OutPointCVec_MonitorUpdateIdZZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { + if self.datalen == 0 { return Vec::new(); } + let ret = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }.into(); + self.data = core::ptr::null_mut(); + self.datalen = 0; + ret + } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_OutPointCVec_MonitorUpdateIdZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + fn from(v: Vec) -> Self { + let datalen = v.len(); + let data = Box::into_raw(v.into_boxed_slice()); + Self { datalen, data: unsafe { (*data).as_mut_ptr() } } + } +} +#[no_mangle] +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ_free(_res: CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ) { } +impl Drop for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + fn clone(&self) -> Self { + let mut res = Vec::new(); + if self.datalen == 0 { return Self::from(res); } + res.extend_from_slice(unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) }); + Self::from(res) + } +} diff --git a/lightning-c-bindings/src/lightning/chain/chaininterface.rs b/lightning-c-bindings/src/lightning/chain/chaininterface.rs index 2c1d281..4c22d56 100644 --- a/lightning-c-bindings/src/lightning/chain/chaininterface.rs +++ b/lightning-c-bindings/src/lightning/chain/chaininterface.rs @@ -136,6 +136,15 @@ pub extern "C" fn ConfirmationTarget_normal() -> ConfirmationTarget { pub extern "C" fn ConfirmationTarget_high_priority() -> ConfirmationTarget { ConfirmationTarget::HighPriority} /// Checks if two ConfirmationTargets contain equal inner contents. +#[no_mangle] +pub extern "C" fn ConfirmationTarget_hash(o: &ConfirmationTarget) -> u64 { + // Note that we'd love to use alloc::collections::hash_map::DefaultHasher but it's not in core + #[allow(deprecated)] + let mut hasher = core::hash::SipHasher::new(); + core::hash::Hash::hash(&o.to_native(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} +/// Checks if two ConfirmationTargets contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] pub extern "C" fn ConfirmationTarget_eq(a: &ConfirmationTarget, b: &ConfirmationTarget) -> bool { diff --git a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs index 4955ca0..9faddad 100644 --- a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs @@ -63,7 +63,7 @@ pub extern "C" fn MonitorUpdateId_free(this_obj: MonitorUpdateId) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn MonitorUpdateId_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMonitorUpdateId); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMonitorUpdateId) }; } #[allow(unused)] impl MonitorUpdateId { @@ -281,7 +281,7 @@ pub extern "C" fn LockedChannelMonitor_free(this_obj: LockedChannelMonitor) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn LockedChannelMonitor_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLockedChannelMonitor); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLockedChannelMonitor) }; } #[allow(unused)] impl LockedChannelMonitor { @@ -340,7 +340,7 @@ pub extern "C" fn ChainMonitor_free(this_obj: ChainMonitor) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChainMonitor_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainMonitor); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChainMonitor) }; } #[allow(unused)] impl ChainMonitor { @@ -416,6 +416,15 @@ pub extern "C" fn ChainMonitor_list_monitors(this_arg: &crate::lightning::chain: local_ret.into() } +/// Lists the pending updates for each [`ChannelMonitor`] (by `OutPoint` being monitored). +#[must_use] +#[no_mangle] +pub extern "C" fn ChainMonitor_list_pending_monitor_updates(this_arg: &crate::lightning::chain::chainmonitor::ChainMonitor) -> crate::c_types::derived::CVec_C2Tuple_OutPointCVec_MonitorUpdateIdZZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.list_pending_monitor_updates(); + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::lightning::chain::chainmonitor::MonitorUpdateId { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; let mut local_ret_0 = (crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, local_orig_ret_0_1.into()).into(); local_ret_0 }); }; + local_ret.into() +} + /// Indicates the persistence of a [`ChannelMonitor`] has completed after /// [`ChannelMonitorUpdateStatus::InProgress`] was returned from an update operation. /// @@ -506,9 +515,9 @@ extern "C" fn ChainMonitor_Confirm_best_block_updated(this_arg: *const c_void, h >::best_block_updated(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) } #[must_use] -extern "C" fn ChainMonitor_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_TxidZ { +extern "C" fn ChainMonitor_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_TxidBlockHashZZ { let mut ret = >::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeChainMonitor) }, ); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); }; + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = if orig_ret_0_1.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (orig_ret_0_1.unwrap()).into_inner() } } }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; local_ret.into() } diff --git a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs index bfa8087..0d27aa5 100644 --- a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs @@ -66,7 +66,7 @@ pub extern "C" fn ChannelMonitorUpdate_free(this_obj: ChannelMonitorUpdate) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelMonitorUpdate_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitorUpdate); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelMonitorUpdate) }; } #[allow(unused)] impl ChannelMonitorUpdate { @@ -204,27 +204,27 @@ impl MonitorEvent { pub(crate) fn to_native(&self) -> nativeMonitorEvent { match self { MonitorEvent::HTLCEvent (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeMonitorEvent::HTLCEvent ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, MonitorEvent::CommitmentTxConfirmed (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeMonitorEvent::CommitmentTxConfirmed ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, MonitorEvent::Completed {ref funding_txo, ref monitor_update_id, } => { - let mut funding_txo_nonref = (*funding_txo).clone(); - let mut monitor_update_id_nonref = (*monitor_update_id).clone(); + let mut funding_txo_nonref = Clone::clone(funding_txo); + let mut monitor_update_id_nonref = Clone::clone(monitor_update_id); nativeMonitorEvent::Completed { funding_txo: *unsafe { Box::from_raw(funding_txo_nonref.take_inner()) }, monitor_update_id: monitor_update_id_nonref, } }, MonitorEvent::UpdateFailed (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeMonitorEvent::UpdateFailed ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) @@ -261,27 +261,27 @@ impl MonitorEvent { pub(crate) fn from_native(native: &nativeMonitorEvent) -> Self { match native { nativeMonitorEvent::HTLCEvent (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); MonitorEvent::HTLCEvent ( crate::lightning::chain::channelmonitor::HTLCUpdate { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, nativeMonitorEvent::CommitmentTxConfirmed (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); MonitorEvent::CommitmentTxConfirmed ( crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, nativeMonitorEvent::Completed {ref funding_txo, ref monitor_update_id, } => { - let mut funding_txo_nonref = (*funding_txo).clone(); - let mut monitor_update_id_nonref = (*monitor_update_id).clone(); + let mut funding_txo_nonref = Clone::clone(funding_txo); + let mut monitor_update_id_nonref = Clone::clone(monitor_update_id); MonitorEvent::Completed { funding_txo: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(funding_txo_nonref), is_owned: true }, monitor_update_id: monitor_update_id_nonref, } }, nativeMonitorEvent::UpdateFailed (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); MonitorEvent::UpdateFailed ( crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) @@ -399,7 +399,7 @@ pub extern "C" fn HTLCUpdate_free(this_obj: HTLCUpdate) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HTLCUpdate_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHTLCUpdate); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHTLCUpdate) }; } #[allow(unused)] impl HTLCUpdate { @@ -555,45 +555,45 @@ impl Balance { pub(crate) fn to_native(&self) -> nativeBalance { match self { Balance::ClaimableOnChannelClose {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); nativeBalance::ClaimableOnChannelClose { claimable_amount_satoshis: claimable_amount_satoshis_nonref, } }, Balance::ClaimableAwaitingConfirmations {ref claimable_amount_satoshis, ref confirmation_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut confirmation_height_nonref = (*confirmation_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut confirmation_height_nonref = Clone::clone(confirmation_height); nativeBalance::ClaimableAwaitingConfirmations { claimable_amount_satoshis: claimable_amount_satoshis_nonref, confirmation_height: confirmation_height_nonref, } }, Balance::ContentiousClaimable {ref claimable_amount_satoshis, ref timeout_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut timeout_height_nonref = (*timeout_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut timeout_height_nonref = Clone::clone(timeout_height); nativeBalance::ContentiousClaimable { claimable_amount_satoshis: claimable_amount_satoshis_nonref, timeout_height: timeout_height_nonref, } }, Balance::MaybeTimeoutClaimableHTLC {ref claimable_amount_satoshis, ref claimable_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut claimable_height_nonref = (*claimable_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut claimable_height_nonref = Clone::clone(claimable_height); nativeBalance::MaybeTimeoutClaimableHTLC { claimable_amount_satoshis: claimable_amount_satoshis_nonref, claimable_height: claimable_height_nonref, } }, Balance::MaybePreimageClaimableHTLC {ref claimable_amount_satoshis, ref expiry_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut expiry_height_nonref = (*expiry_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut expiry_height_nonref = Clone::clone(expiry_height); nativeBalance::MaybePreimageClaimableHTLC { claimable_amount_satoshis: claimable_amount_satoshis_nonref, expiry_height: expiry_height_nonref, } }, Balance::CounterpartyRevokedOutputClaimable {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); nativeBalance::CounterpartyRevokedOutputClaimable { claimable_amount_satoshis: claimable_amount_satoshis_nonref, } @@ -643,45 +643,45 @@ impl Balance { pub(crate) fn from_native(native: &nativeBalance) -> Self { match native { nativeBalance::ClaimableOnChannelClose {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); Balance::ClaimableOnChannelClose { claimable_amount_satoshis: claimable_amount_satoshis_nonref, } }, nativeBalance::ClaimableAwaitingConfirmations {ref claimable_amount_satoshis, ref confirmation_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut confirmation_height_nonref = (*confirmation_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut confirmation_height_nonref = Clone::clone(confirmation_height); Balance::ClaimableAwaitingConfirmations { claimable_amount_satoshis: claimable_amount_satoshis_nonref, confirmation_height: confirmation_height_nonref, } }, nativeBalance::ContentiousClaimable {ref claimable_amount_satoshis, ref timeout_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut timeout_height_nonref = (*timeout_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut timeout_height_nonref = Clone::clone(timeout_height); Balance::ContentiousClaimable { claimable_amount_satoshis: claimable_amount_satoshis_nonref, timeout_height: timeout_height_nonref, } }, nativeBalance::MaybeTimeoutClaimableHTLC {ref claimable_amount_satoshis, ref claimable_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut claimable_height_nonref = (*claimable_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut claimable_height_nonref = Clone::clone(claimable_height); Balance::MaybeTimeoutClaimableHTLC { claimable_amount_satoshis: claimable_amount_satoshis_nonref, claimable_height: claimable_height_nonref, } }, nativeBalance::MaybePreimageClaimableHTLC {ref claimable_amount_satoshis, ref expiry_height, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); - let mut expiry_height_nonref = (*expiry_height).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); + let mut expiry_height_nonref = Clone::clone(expiry_height); Balance::MaybePreimageClaimableHTLC { claimable_amount_satoshis: claimable_amount_satoshis_nonref, expiry_height: expiry_height_nonref, } }, nativeBalance::CounterpartyRevokedOutputClaimable {ref claimable_amount_satoshis, } => { - let mut claimable_amount_satoshis_nonref = (*claimable_amount_satoshis).clone(); + let mut claimable_amount_satoshis_nonref = Clone::clone(claimable_amount_satoshis); Balance::CounterpartyRevokedOutputClaimable { claimable_amount_satoshis: claimable_amount_satoshis_nonref, } @@ -836,7 +836,7 @@ pub extern "C" fn ChannelMonitor_free(this_obj: ChannelMonitor) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelMonitor_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelMonitor); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelMonitor) }; } #[allow(unused)] impl ChannelMonitor { @@ -924,9 +924,11 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: /// Gets the list of pending events which were generated by previous actions, clearing the list /// in the process. /// -/// This is called by ChainMonitor::get_and_clear_pending_events() and is equivalent to -/// EventsProvider::get_and_clear_pending_events() except that it requires &mut self as we do -/// no internal locking in ChannelMonitors. +/// This is called by the [`EventsProvider::process_pending_events`] implementation for +/// [`ChainMonitor`]. +/// +/// [`EventsProvider::process_pending_events`]: crate::util::events::EventsProvider::process_pending_events +/// [`ChainMonitor`]: crate::chain::chainmonitor::ChainMonitor #[must_use] #[no_mangle] pub extern "C" fn ChannelMonitor_get_and_clear_pending_events(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_EventZ { @@ -1044,9 +1046,9 @@ pub extern "C" fn ChannelMonitor_best_block_updated(this_arg: &crate::lightning: /// Returns the set of txids that should be monitored for re-organization out of the chain. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_TxidZ { +pub extern "C" fn ChannelMonitor_get_relevant_txids(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> crate::c_types::derived::CVec_C2Tuple_TxidBlockHashZZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_relevant_txids(); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); }; + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = if orig_ret_0_1.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (orig_ret_0_1.unwrap()).into_inner() } } }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; local_ret.into() } diff --git a/lightning-c-bindings/src/lightning/chain/keysinterface.rs b/lightning-c-bindings/src/lightning/chain/keysinterface.rs index f2c7993..999300f 100644 --- a/lightning-c-bindings/src/lightning/chain/keysinterface.rs +++ b/lightning-c-bindings/src/lightning/chain/keysinterface.rs @@ -6,9 +6,10 @@ // license as that which applies to the original source files from which this // source was automatically generated. -//! keysinterface provides keys into rust-lightning and defines some useful enums which describe -//! spendable on-chain outputs which the user owns and is responsible for using just as any other -//! on-chain output which is theirs. +//! Provides keys to LDK and defines some useful objects describing spendable on-chain outputs. +//! +//! The provided output descriptors follow a custom LDK data format and are currently not fully +//! compatible with Bitcoin Core output descriptors. use alloc::str::FromStr; use core::ffi::c_void; @@ -22,8 +23,9 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::chain::keysinterface::DelayedPaymentOutputDescriptor as nativeDelayedPaymentOutputDescriptorImport; pub(crate) type nativeDelayedPaymentOutputDescriptor = nativeDelayedPaymentOutputDescriptorImport; -/// Information about a spendable output to a P2WSH script. See -/// SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this. +/// Information about a spendable output to a P2WSH script. +/// +/// See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this. #[must_use] #[repr(C)] pub struct DelayedPaymentOutputDescriptor { @@ -52,7 +54,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_free(this_obj: DelayedPaymentOu #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DelayedPaymentOutputDescriptor_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDelayedPaymentOutputDescriptor); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDelayedPaymentOutputDescriptor) }; } #[allow(unused)] impl DelayedPaymentOutputDescriptor { @@ -70,42 +72,42 @@ impl DelayedPaymentOutputDescriptor { ret } } -/// The outpoint which is spendable +/// The outpoint which is spendable. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_outpoint(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint { let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false } } -/// The outpoint which is spendable +/// The outpoint which is spendable. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_set_outpoint(this_ptr: &mut DelayedPaymentOutputDescriptor, mut val: crate::lightning::chain::transaction::OutPoint) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outpoint = *unsafe { Box::from_raw(val.take_inner()) }; } -/// Per commitment point to derive delayed_payment_key by key holder +/// Per commitment point to derive the delayed payment key by key holder. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_per_commitment_point(this_ptr: &DelayedPaymentOutputDescriptor) -> crate::c_types::PublicKey { let mut inner_val = &mut this_ptr.get_native_mut_ref().per_commitment_point; crate::c_types::PublicKey::from_rust(&inner_val) } -/// Per commitment point to derive delayed_payment_key by key holder +/// Per commitment point to derive the delayed payment key by key holder. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_set_per_commitment_point(this_ptr: &mut DelayedPaymentOutputDescriptor, mut val: crate::c_types::PublicKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.per_commitment_point = val.into_rust(); } -/// The nSequence value which must be set in the spending input to satisfy the OP_CSV in +/// The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in /// the witness_script. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_to_self_delay(this_ptr: &DelayedPaymentOutputDescriptor) -> u16 { let mut inner_val = &mut this_ptr.get_native_mut_ref().to_self_delay; *inner_val } -/// The nSequence value which must be set in the spending input to satisfy the OP_CSV in +/// The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in /// the witness_script. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_set_to_self_delay(this_ptr: &mut DelayedPaymentOutputDescriptor, mut val: u16) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.to_self_delay = val; } -/// The output which is referenced by the given outpoint +/// The output which is referenced by the given outpoint. /// /// Returns a copy of the field. #[no_mangle] @@ -113,7 +115,7 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_get_output(this_ptr: &DelayedPa let mut inner_val = this_ptr.get_native_mut_ref().output.clone(); crate::c_types::TxOut::from_rust(inner_val) } -/// The output which is referenced by the given outpoint +/// The output which is referenced by the given outpoint. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_set_output(this_ptr: &mut DelayedPaymentOutputDescriptor, mut val: crate::c_types::TxOut) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.output = val.into_rust(); @@ -131,17 +133,15 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_get_revocation_pubkey(this_ptr: pub extern "C" fn DelayedPaymentOutputDescriptor_set_revocation_pubkey(this_ptr: &mut DelayedPaymentOutputDescriptor, mut val: crate::c_types::PublicKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_pubkey = val.into_rust(); } -/// Arbitrary identification information returned by a call to -/// `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in -/// the channel to spend the output. +/// Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. +/// This may be useful in re-deriving keys used in the channel to spend the output. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_get_channel_keys_id(this_ptr: &DelayedPaymentOutputDescriptor) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_keys_id; inner_val } -/// Arbitrary identification information returned by a call to -/// `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in -/// the channel to spend the output. +/// Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. +/// This may be useful in re-deriving keys used in the channel to spend the output. #[no_mangle] pub extern "C" fn DelayedPaymentOutputDescriptor_set_channel_keys_id(this_ptr: &mut DelayedPaymentOutputDescriptor, mut val: crate::c_types::ThirtyTwoBytes) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_keys_id = val.data; @@ -219,8 +219,9 @@ pub extern "C" fn DelayedPaymentOutputDescriptor_read(ser: crate::c_types::u8sli use lightning::chain::keysinterface::StaticPaymentOutputDescriptor as nativeStaticPaymentOutputDescriptorImport; pub(crate) type nativeStaticPaymentOutputDescriptor = nativeStaticPaymentOutputDescriptorImport; -/// Information about a spendable output to our \"payment key\". See -/// SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this. +/// Information about a spendable output to our \"payment key\". +/// +/// See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this. #[must_use] #[repr(C)] pub struct StaticPaymentOutputDescriptor { @@ -249,7 +250,7 @@ pub extern "C" fn StaticPaymentOutputDescriptor_free(this_obj: StaticPaymentOutp #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn StaticPaymentOutputDescriptor_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeStaticPaymentOutputDescriptor); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeStaticPaymentOutputDescriptor) }; } #[allow(unused)] impl StaticPaymentOutputDescriptor { @@ -267,18 +268,18 @@ impl StaticPaymentOutputDescriptor { ret } } -/// The outpoint which is spendable +/// The outpoint which is spendable. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_get_outpoint(this_ptr: &StaticPaymentOutputDescriptor) -> crate::lightning::chain::transaction::OutPoint { let mut inner_val = &mut this_ptr.get_native_mut_ref().outpoint; crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false } } -/// The outpoint which is spendable +/// The outpoint which is spendable. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_set_outpoint(this_ptr: &mut StaticPaymentOutputDescriptor, mut val: crate::lightning::chain::transaction::OutPoint) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.outpoint = *unsafe { Box::from_raw(val.take_inner()) }; } -/// The output which is referenced by the given outpoint +/// The output which is referenced by the given outpoint. /// /// Returns a copy of the field. #[no_mangle] @@ -286,22 +287,20 @@ pub extern "C" fn StaticPaymentOutputDescriptor_get_output(this_ptr: &StaticPaym let mut inner_val = this_ptr.get_native_mut_ref().output.clone(); crate::c_types::TxOut::from_rust(inner_val) } -/// The output which is referenced by the given outpoint +/// The output which is referenced by the given outpoint. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_set_output(this_ptr: &mut StaticPaymentOutputDescriptor, mut val: crate::c_types::TxOut) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.output = val.into_rust(); } -/// Arbitrary identification information returned by a call to -/// `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in -/// the channel to spend the output. +/// Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. +/// This may be useful in re-deriving keys used in the channel to spend the output. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_get_channel_keys_id(this_ptr: &StaticPaymentOutputDescriptor) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().channel_keys_id; inner_val } -/// Arbitrary identification information returned by a call to -/// `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in -/// the channel to spend the output. +/// Arbitrary identification information returned by a call to [`BaseSign::channel_keys_id`]. +/// This may be useful in re-deriving keys used in the channel to spend the output. #[no_mangle] pub extern "C" fn StaticPaymentOutputDescriptor_set_channel_keys_id(this_ptr: &mut StaticPaymentOutputDescriptor, mut val: crate::c_types::ThirtyTwoBytes) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.channel_keys_id = val.data; @@ -372,60 +371,79 @@ pub extern "C" fn StaticPaymentOutputDescriptor_read(ser: crate::c_types::u8slic let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } -/// When on-chain outputs are created by rust-lightning (which our counterparty is not able to -/// claim at any point in the future) an event is generated which you must track and be able to -/// spend on-chain. The information needed to do this is provided in this enum, including the -/// outpoint describing which txid and output index is available, the full output which exists at -/// that txid/index, and any keys or other information required to sign. +/// Describes the necessary information to spend a spendable output. +/// +/// When on-chain outputs are created by LDK (which our counterparty is not able to claim at any +/// point in the future) a [`SpendableOutputs`] event is generated which you must track and be able +/// to spend on-chain. The information needed to do this is provided in this enum, including the +/// outpoint describing which `txid` and output `index` is available, the full output which exists +/// at that `txid`/`index`, and any keys or other information required to sign. +/// +/// [`SpendableOutputs`]: crate::util::events::Event::SpendableOutputs #[derive(Clone)] #[must_use] #[repr(C)] pub enum SpendableOutputDescriptor { - /// An output to a script which was provided via KeysInterface directly, either from - /// `get_destination_script()` or `get_shutdown_scriptpubkey()`, thus you should already know - /// how to spend it. No secret keys are provided as rust-lightning was never given any key. + /// An output to a script which was provided via [`KeysInterface`] directly, either from + /// [`get_destination_script`] or [`get_shutdown_scriptpubkey`], thus you should already + /// know how to spend it. No secret keys are provided as LDK was never given any key. /// These may include outputs from a transaction punishing our counterparty or claiming an HTLC /// on-chain using the payment preimage or after it has timed out. + /// + /// [`get_shutdown_scriptpubkey`]: KeysInterface::get_shutdown_scriptpubkey + /// [`get_destination_script`]: KeysInterface::get_shutdown_scriptpubkey StaticOutput { - /// The outpoint which is spendable + /// The outpoint which is spendable. outpoint: crate::lightning::chain::transaction::OutPoint, /// The output which is referenced by the given outpoint. output: crate::c_types::TxOut, }, - /// An output to a P2WSH script which can be spent with a single signature after a CSV delay. + /// An output to a P2WSH script which can be spent with a single signature after an `OP_CSV` + /// delay. /// /// The witness in the spending input should be: + /// ```bitcoin /// (MINIMALIF standard rule) + /// ``` /// - /// Note that the nSequence field in the spending input must be set to to_self_delay - /// (which means the transaction is not broadcastable until at least to_self_delay - /// blocks after the outpoint confirms). + /// Note that the `nSequence` field in the spending input must be set to + /// [`DelayedPaymentOutputDescriptor::to_self_delay`] (which means the transaction is not + /// broadcastable until at least [`DelayedPaymentOutputDescriptor::to_self_delay`] blocks after + /// the outpoint confirms, see [BIP + /// 68](https://github.com/bitcoin/bips/blob/master/bip-0068.mediawiki)). Also note that LDK + /// won't generate a [`SpendableOutputDescriptor`] until the corresponding block height + /// is reached. /// /// These are generally the result of a \"revocable\" output to us, spendable only by us unless /// it is an output from an old state which we broadcast (which should never happen). /// - /// To derive the delayed_payment key which is used to sign for this input, you must pass the - /// holder delayed_payment_base_key (ie the private key which corresponds to the pubkey in - /// Sign::pubkeys().delayed_payment_basepoint) and the provided per_commitment_point to - /// chan_utils::derive_private_key. The public key can be generated without the secret key - /// using chan_utils::derive_public_key and only the delayed_payment_basepoint which appears in - /// Sign::pubkeys(). + /// To derive the delayed payment key which is used to sign this input, you must pass the + /// holder [`InMemorySigner::delayed_payment_base_key`] (i.e., the private key which corresponds to the + /// [`ChannelPublicKeys::delayed_payment_basepoint`] in [`BaseSign::pubkeys`]) and the provided + /// [`DelayedPaymentOutputDescriptor::per_commitment_point`] to [`chan_utils::derive_private_key`]. The public key can be + /// generated without the secret key using [`chan_utils::derive_public_key`] and only the + /// [`ChannelPublicKeys::delayed_payment_basepoint`] which appears in [`BaseSign::pubkeys`]. /// - /// To derive the revocation_pubkey provided here (which is used in the witness - /// script generation), you must pass the counterparty revocation_basepoint (which appears in the - /// call to Sign::ready_channel) and the provided per_commitment point - /// to chan_utils::derive_public_revocation_key. + /// To derive the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] provided here (which is + /// used in the witness script generation), you must pass the counterparty + /// [`ChannelPublicKeys::revocation_basepoint`] (which appears in the call to + /// [`BaseSign::provide_channel_parameters`]) and the provided + /// [`DelayedPaymentOutputDescriptor::per_commitment_point`] to + /// [`chan_utils::derive_public_revocation_key`]. /// - /// The witness script which is hashed and included in the output script_pubkey may be - /// regenerated by passing the revocation_pubkey (derived as above), our delayed_payment pubkey - /// (derived as above), and the to_self_delay contained here to - /// chan_utils::get_revokeable_redeemscript. + /// The witness script which is hashed and included in the output `script_pubkey` may be + /// regenerated by passing the [`DelayedPaymentOutputDescriptor::revocation_pubkey`] (derived + /// as explained above), our delayed payment pubkey (derived as explained above), and the + /// [`DelayedPaymentOutputDescriptor::to_self_delay`] contained here to + /// [`chan_utils::get_revokeable_redeemscript`]. DelayedPaymentOutput( crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor), - /// An output to a P2WPKH, spendable exclusively by our payment key (ie the private key which - /// corresponds to the public key in Sign::pubkeys().payment_point). - /// The witness in the spending input, is, thus, simply: + /// An output to a P2WPKH, spendable exclusively by our payment key (i.e., the private key + /// which corresponds to the `payment_point` in [`BaseSign::pubkeys`]). The witness + /// in the spending input is, thus, simply: + /// ```bitcoin /// + /// ``` /// /// These are generally the result of our counterparty having broadcast the current state, /// allowing us to claim the non-HTLC-encumbered outputs immediately. @@ -440,21 +458,21 @@ impl SpendableOutputDescriptor { pub(crate) fn to_native(&self) -> nativeSpendableOutputDescriptor { match self { SpendableOutputDescriptor::StaticOutput {ref outpoint, ref output, } => { - let mut outpoint_nonref = (*outpoint).clone(); - let mut output_nonref = (*output).clone(); + let mut outpoint_nonref = Clone::clone(outpoint); + let mut output_nonref = Clone::clone(output); nativeSpendableOutputDescriptor::StaticOutput { outpoint: *unsafe { Box::from_raw(outpoint_nonref.take_inner()) }, output: output_nonref.into_rust(), } }, SpendableOutputDescriptor::DelayedPaymentOutput (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeSpendableOutputDescriptor::DelayedPaymentOutput ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, SpendableOutputDescriptor::StaticPaymentOutput (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeSpendableOutputDescriptor::StaticPaymentOutput ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) @@ -486,21 +504,21 @@ impl SpendableOutputDescriptor { pub(crate) fn from_native(native: &nativeSpendableOutputDescriptor) -> Self { match native { nativeSpendableOutputDescriptor::StaticOutput {ref outpoint, ref output, } => { - let mut outpoint_nonref = (*outpoint).clone(); - let mut output_nonref = (*output).clone(); + let mut outpoint_nonref = Clone::clone(outpoint); + let mut output_nonref = Clone::clone(output); SpendableOutputDescriptor::StaticOutput { outpoint: crate::lightning::chain::transaction::OutPoint { inner: ObjOps::heap_alloc(outpoint_nonref), is_owned: true }, output: crate::c_types::TxOut::from_rust(output_nonref), } }, nativeSpendableOutputDescriptor::DelayedPaymentOutput (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); SpendableOutputDescriptor::DelayedPaymentOutput ( crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, nativeSpendableOutputDescriptor::StaticPaymentOutput (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); SpendableOutputDescriptor::StaticPaymentOutput ( crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) @@ -573,23 +591,13 @@ pub extern "C" fn SpendableOutputDescriptor_read(ser: crate::c_types::u8slice) - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::chain::keysinterface::SpendableOutputDescriptor::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } -/// 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 trait to sign Lightning channel transactions as described in +/// [BOLT 3](https://github.com/lightning/bolts/blob/master/03-transactions.md). /// -/// 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. +/// Signing services could be implemented on a hardware wallet and should implement signing +/// policies in order to be secure. Please refer to the [VLS Policy +/// Controls](https://gitlab.com/lightning-signer/validating-lightning-signer/-/blob/main/docs/policy-controls.md) +/// for an example of such policies. #[repr(C)] pub struct BaseSign { /// An opaque pointer which is passed to your function implementations as an argument. @@ -597,7 +605,7 @@ pub struct BaseSign { pub this_arg: *mut c_void, /// Gets the per-commitment point for a specific commitment number /// - /// Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + /// Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. #[must_use] pub get_per_commitment_point: extern "C" fn (this_arg: *const c_void, idx: u64) -> crate::c_types::PublicKey, /// Gets the commitment secret for a specific commitment number as part of the revocation process @@ -607,7 +615,7 @@ pub struct BaseSign { /// /// May be called more than once for the same index. /// - /// Note that the commitment number starts at (1 << 48) - 1 and counts backwards. + /// Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. #[must_use] pub release_commitment_secret: extern "C" fn (this_arg: *const c_void, idx: u64) -> crate::c_types::ThirtyTwoBytes, /// Validate the counterparty's signatures on the holder commitment transaction and HTLCs. @@ -621,19 +629,19 @@ pub struct BaseSign { /// 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 + /// Note that all the relevant preimages will be provided, but there may also be additional /// irrelevant or duplicate preimages. #[must_use] pub validate_holder_commitment: extern "C" fn (this_arg: *const c_void, holder_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction, preimages: crate::c_types::derived::CVec_PaymentPreimageZ) -> crate::c_types::derived::CResult_NoneNoneZ, - /// Gets the holder's channel public keys and basepoints + /// Returns the holder's channel public keys and basepoints. pub pubkeys: crate::lightning::ln::chan_utils::ChannelPublicKeys, /// 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. pub set_pubkeys: Option, - /// 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. + /// Returns 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 + /// [`BaseSign`] object uniquely and lookup or re-derive its keys. #[must_use] pub channel_keys_id: extern "C" fn (this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes, /// Create a signature for a counterparty's commitment transaction and associated HTLC transactions. @@ -647,7 +655,7 @@ pub struct BaseSign { /// 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 + /// Note that all the relevant preimages will be provided, but there may also be additional /// irrelevant or duplicate preimages. #[must_use] pub sign_counterparty_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, preimages: crate::c_types::derived::CVec_PaymentPreimageZ) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, @@ -657,17 +665,21 @@ pub struct BaseSign { /// forward and it is safe to sign the next counterparty commitment. #[must_use] pub validate_counterparty_revocation: extern "C" fn (this_arg: *const c_void, idx: u64, secret: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneNoneZ, - /// 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. + /// Creates a signature for a holder's commitment transaction and its claiming HTLC transactions. + /// + /// This will be called + /// - with a non-revoked `commitment_tx`. + /// - with the latest `commitment_tx` when we initiate a force-close. + /// - with the previous `commitment_tx`, just to get claiming HTLC + /// signatures, if we are reacting to a [`ChannelMonitor`] + /// [replica](https://github.com/lightningdevkit/rust-lightning/blob/main/GLOSSARY.md#monitor-replicas) + /// that decided to broadcast before it had been updated to the latest `commitment_tx`. + /// /// 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. + /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor #[must_use] pub sign_holder_commitment_and_htlcs: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ, /// Create a signature for the given input in a transaction spending an HTLC transaction output @@ -680,9 +692,9 @@ pub struct BaseSign { /// /// 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 + /// `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 + /// not allow the spending of any funds by itself (you need our holder `revocation_secret` to do /// so). #[must_use] pub sign_justice_revoked_output: extern "C" fn (this_arg: *const c_void, justice_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_key: *const [u8; 32]) -> crate::c_types::derived::CResult_SignatureNoneZ, @@ -694,14 +706,15 @@ pub struct BaseSign { /// 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. + /// `amount` is the 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 + /// `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 + /// `htlc` holds HTLC elements (hash, timelock), thus changing the format of the witness script /// (which is committed to in the BIP 143 signatures). #[must_use] pub sign_justice_revoked_htlc: extern "C" fn (this_arg: *const c_void, justice_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_key: *const [u8; 32], htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_SignatureNoneZ, @@ -713,12 +726,12 @@ pub struct BaseSign { /// 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 + /// `witness_script` is either an 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. + /// `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 + /// `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. @@ -746,16 +759,12 @@ pub struct BaseSign { #[must_use] pub sign_channel_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_C2Tuple_SignatureSignatureZNoneZ, /// 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. + /// `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. Since these + /// are static channel data, they MUST NOT be allowed to change to different values once set, + /// as LDK may call this method more than once. /// /// 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. - pub ready_channel: extern "C" fn (this_arg: *mut c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters), + pub provide_channel_parameters: extern "C" fn (this_arg: *mut c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters), /// 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. pub free: Option, @@ -781,7 +790,7 @@ pub(crate) extern "C" fn BaseSign_clone_fields(orig: &BaseSign) -> BaseSign { sign_closing_transaction: Clone::clone(&orig.sign_closing_transaction), sign_holder_anchor_input: Clone::clone(&orig.sign_holder_anchor_input), sign_channel_announcement: Clone::clone(&orig.sign_channel_announcement), - ready_channel: Clone::clone(&orig.ready_channel), + provide_channel_parameters: Clone::clone(&orig.provide_channel_parameters), free: Clone::clone(&orig.free), } } @@ -858,8 +867,8 @@ impl rustBaseSign for BaseSign { let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1.into_rust()); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn ready_channel(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { - (self.ready_channel)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) + fn provide_channel_parameters(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { + (self.provide_channel_parameters)(self.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) } } @@ -881,11 +890,13 @@ impl Drop for BaseSign { } } } -/// A cloneable signer. +/// A writeable 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. +/// There will always be two instances of a signer per channel, one occupied by the +/// [`ChannelManager`] and another by the channel's [`ChannelMonitor`]. +/// +/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager +/// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor #[repr(C)] pub struct Sign { /// An opaque pointer which is passed to your function implementations as an argument. @@ -895,10 +906,6 @@ pub struct Sign { pub BaseSign: crate::lightning::chain::keysinterface::BaseSign, /// Serialize the object into a byte array pub write: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_u8Z, - /// 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. - pub cloned: Option, /// 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. pub free: Option, @@ -911,7 +918,6 @@ pub(crate) extern "C" fn Sign_clone_fields(orig: &Sign) -> Sign { this_arg: orig.this_arg, BaseSign: crate::lightning::chain::keysinterface::BaseSign_clone_fields(&orig.BaseSign), write: Clone::clone(&orig.write), - cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), } } @@ -986,8 +992,8 @@ impl lightning::chain::keysinterface::BaseSign for Sign { let mut local_ret = match ret.result_ok { true => Ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).to_rust(); let mut local_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1.into_rust()); local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn ready_channel(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { - (self.BaseSign.ready_channel)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) + fn provide_channel_parameters(&mut self, mut channel_parameters: &lightning::ln::chan_utils::ChannelTransactionParameters) { + (self.BaseSign.provide_channel_parameters)(self.BaseSign.this_arg, &crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_parameters as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false }) } } impl lightning::util::ser::Writeable for Sign { @@ -996,18 +1002,6 @@ impl lightning::util::ser::Writeable for Sign { w.write_all(vec.as_slice()) } } -#[no_mangle] -/// Creates a copy of a Sign -pub extern "C" fn Sign_clone(orig: &Sign) -> Sign { - let mut res = Sign_clone_fields(orig); - if let Some(f) = orig.cloned { (f)(&mut res) }; - res -} -impl Clone for Sign { - fn clone(&self) -> Self { - Sign_clone(self) - } -} use lightning::chain::keysinterface::Sign as rustSign; impl rustSign for Sign { @@ -1031,8 +1025,10 @@ impl Drop for Sign { } } } -/// Specifies the recipient of an invoice, to indicate to [`KeysInterface::sign_invoice`] what node -/// secret key should be used to sign the invoice. +/// Specifies the recipient of an invoice. +/// +/// This indicates to [`KeysInterface::sign_invoice`] what node secret key should be used to sign +/// the invoice. #[derive(Clone)] #[must_use] #[repr(C)] @@ -1099,30 +1095,30 @@ pub struct KeysInterface { pub this_arg: *mut c_void, /// Get node secret key based on the provided [`Recipient`]. /// - /// The node_id/network_key is the public key that corresponds to this secret key. + /// 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` + /// This method must return the same value each time it is called with a given [`Recipient`] /// parameter. /// - /// Errors if the `Recipient` variant is not supported by the implementation. + /// Errors if the [`Recipient`] variant is not supported by the implementation. #[must_use] pub get_node_secret: extern "C" fn (this_arg: *const c_void, recipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_SecretKeyNoneZ, /// Get node id based on the provided [`Recipient`]. This public key corresponds to the secret in /// [`get_node_secret`]. /// - /// This method must return the same value each time it is called with a given `Recipient` + /// This method must return the same value each time it is called with a given [`Recipient`] /// parameter. /// - /// Errors if the `Recipient` variant is not supported by the implementation. + /// Errors if the [`Recipient`] variant is not supported by the implementation. /// - /// [`get_node_secret`]: KeysInterface::get_node_secret + /// [`get_node_secret`]: Self::get_node_secret #[must_use] pub get_node_id: extern "C" fn (this_arg: *const c_void, recipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ, /// 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. /// - /// Errors if the `Recipient` variant is not supported by the implementation. + /// Errors if the [`Recipient`] variant is not supported by the implementation. /// /// [`node secret`]: Self::get_node_secret #[must_use] @@ -1139,12 +1135,20 @@ pub struct KeysInterface { /// on-chain funds across channels as controlled to the same user. #[must_use] pub get_shutdown_scriptpubkey: extern "C" fn (this_arg: *const c_void) -> crate::lightning::ln::script::ShutdownScript, - /// Get a new set of Sign for per-channel secrets. These MUST be unique even if you + /// 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. #[must_use] - pub get_channel_signer: extern "C" fn (this_arg: *const c_void, inbound: bool, channel_value_satoshis: u64) -> crate::lightning::chain::keysinterface::Sign, + pub generate_channel_keys_id: extern "C" fn (this_arg: *const c_void, inbound: bool, channel_value_satoshis: u64, user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes, + /// Derives the private key material backing a `Signer`. + /// + /// To derive a new `Signer`, a fresh `channel_keys_id` should be obtained through + /// [`KeysInterface::generate_channel_keys_id`]. Otherwise, an existing `Signer` can be + /// re-derived from its `channel_keys_id`, which can be obtained through its trait method + /// [`BaseSign::channel_keys_id`]. + #[must_use] + pub derive_channel_signer: extern "C" fn (this_arg: *const c_void, channel_value_satoshis: u64, channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::chain::keysinterface::Sign, /// 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. @@ -1152,25 +1156,32 @@ pub struct KeysInterface { /// This method must return a different value each time it is called. #[must_use] pub get_secure_random_bytes: extern "C" fn (this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes, - /// Reads a `Signer` for this `KeysInterface` from the given input stream. + /// 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). + /// [`Sign`]-implementing objects (i.e., [`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. + /// + /// This method is slowly being phased out -- it will only be called when reading objects + /// written by LDK versions prior to 0.0.113. + /// + /// [`Signer`]: Self::Signer + /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor + /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager #[must_use] pub read_chan_signer: extern "C" fn (this_arg: *const c_void, reader: crate::c_types::u8slice) -> crate::c_types::derived::CResult_SignDecodeErrorZ, /// 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 `hrp` is ASCII bytes, while the invoice data is base32-encoded. /// /// The secret key used to sign the invoice is dependent on the [`Recipient`]. /// - /// Errors if the `Recipient` variant is not supported by the implementation. + /// Errors if the [`Recipient`] variant is not supported by the implementation. #[must_use] - pub sign_invoice: extern "C" fn (this_arg: *const c_void, hrp_bytes: crate::c_types::u8slice, invoice_data: crate::c_types::derived::CVec_u5Z, receipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ, + pub sign_invoice: extern "C" fn (this_arg: *const c_void, hrp_bytes: crate::c_types::u8slice, invoice_data: crate::c_types::derived::CVec_U5Z, receipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ, /// 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 @@ -1197,7 +1208,8 @@ pub(crate) extern "C" fn KeysInterface_clone_fields(orig: &KeysInterface) -> Key ecdh: Clone::clone(&orig.ecdh), get_destination_script: Clone::clone(&orig.get_destination_script), get_shutdown_scriptpubkey: Clone::clone(&orig.get_shutdown_scriptpubkey), - get_channel_signer: Clone::clone(&orig.get_channel_signer), + generate_channel_keys_id: Clone::clone(&orig.generate_channel_keys_id), + derive_channel_signer: Clone::clone(&orig.derive_channel_signer), get_secure_random_bytes: Clone::clone(&orig.get_secure_random_bytes), read_chan_signer: Clone::clone(&orig.read_chan_signer), sign_invoice: Clone::clone(&orig.sign_invoice), @@ -1233,8 +1245,12 @@ impl rustKeysInterface for KeysInterface { let mut ret = (self.get_shutdown_scriptpubkey)(self.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn get_channel_signer(&self, mut inbound: bool, mut channel_value_satoshis: u64) -> crate::lightning::chain::keysinterface::Sign { - let mut ret = (self.get_channel_signer)(self.this_arg, inbound, channel_value_satoshis); + fn generate_channel_keys_id(&self, mut inbound: bool, mut channel_value_satoshis: u64, mut user_channel_id: u128) -> [u8; 32] { + let mut ret = (self.generate_channel_keys_id)(self.this_arg, inbound, channel_value_satoshis, user_channel_id.into()); + ret.data + } + fn derive_channel_signer(&self, mut channel_value_satoshis: u64, mut channel_keys_id: [u8; 32]) -> crate::lightning::chain::keysinterface::Sign { + let mut ret = (self.derive_channel_signer)(self.this_arg, channel_value_satoshis, crate::c_types::ThirtyTwoBytes { data: channel_keys_id }); ret } fn get_secure_random_bytes(&self) -> [u8; 32] { @@ -1282,7 +1298,7 @@ impl Drop for KeysInterface { use lightning::chain::keysinterface::InMemorySigner as nativeInMemorySignerImport; pub(crate) type nativeInMemorySigner = nativeInMemorySignerImport; -/// A simple implementation of Sign that just keeps the private keys in memory. +/// 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. @@ -1314,7 +1330,7 @@ pub extern "C" fn InMemorySigner_free(this_obj: InMemorySigner) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InMemorySigner_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInMemorySigner); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInMemorySigner) }; } #[allow(unused)] impl InMemorySigner { @@ -1332,68 +1348,70 @@ impl InMemorySigner { ret } } -/// Private key of anchor tx +/// Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the +/// holder's anchor output in a commitment transaction, if one is present. #[no_mangle] pub extern "C" fn InMemorySigner_get_funding_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().funding_key; inner_val.as_ref() } -/// Private key of anchor tx +/// Holder secret key in the 2-of-2 multisig script of a channel. This key also backs the +/// holder's anchor output in a commitment transaction, if one is present. #[no_mangle] pub extern "C" fn InMemorySigner_set_funding_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.funding_key = val.into_rust(); } -/// Holder secret key for blinded revocation pubkey +/// Holder secret key for blinded revocation pubkey. #[no_mangle] pub extern "C" fn InMemorySigner_get_revocation_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().revocation_base_key; inner_val.as_ref() } -/// Holder secret key for blinded revocation pubkey +/// Holder secret key for blinded revocation pubkey. #[no_mangle] pub extern "C" fn InMemorySigner_set_revocation_base_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.revocation_base_key = val.into_rust(); } -/// Holder secret key used for our balance in counterparty-broadcasted commitment transactions +/// Holder secret key used for our balance in counterparty-broadcasted commitment transactions. #[no_mangle] pub extern "C" fn InMemorySigner_get_payment_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_key; inner_val.as_ref() } -/// Holder secret key used for our balance in counterparty-broadcasted commitment transactions +/// Holder secret key used for our balance in counterparty-broadcasted commitment transactions. #[no_mangle] pub extern "C" fn InMemorySigner_set_payment_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_key = val.into_rust(); } -/// Holder secret key used in HTLC tx +/// Holder secret key used in an HTLC transaction. #[no_mangle] pub extern "C" fn InMemorySigner_get_delayed_payment_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().delayed_payment_base_key; inner_val.as_ref() } -/// Holder secret key used in HTLC tx +/// Holder secret key used in an HTLC transaction. #[no_mangle] pub extern "C" fn InMemorySigner_set_delayed_payment_base_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.delayed_payment_base_key = val.into_rust(); } -/// Holder htlc secret key used in commitment tx htlc outputs +/// Holder HTLC secret key used in commitment transaction HTLC outputs. #[no_mangle] pub extern "C" fn InMemorySigner_get_htlc_base_key(this_ptr: &InMemorySigner) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().htlc_base_key; inner_val.as_ref() } -/// Holder htlc secret key used in commitment tx htlc outputs +/// Holder HTLC secret key used in commitment transaction HTLC outputs. #[no_mangle] pub extern "C" fn InMemorySigner_set_htlc_base_key(this_ptr: &mut InMemorySigner, mut val: crate::c_types::SecretKey) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.htlc_base_key = val.into_rust(); } -/// Commitment seed +/// Commitment seed. #[no_mangle] pub extern "C" fn InMemorySigner_get_commitment_seed(this_ptr: &InMemorySigner) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().commitment_seed; inner_val } -/// Commitment seed +/// Commitment seed. #[no_mangle] pub extern "C" fn InMemorySigner_set_commitment_seed(this_ptr: &mut InMemorySigner, mut val: crate::c_types::ThirtyTwoBytes) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.commitment_seed = val.data; @@ -1417,7 +1435,7 @@ pub(crate) extern "C" fn InMemorySigner_clone_void(this_ptr: *const c_void) -> * pub extern "C" fn InMemorySigner_clone(orig: &InMemorySigner) -> InMemorySigner { orig.clone() } -/// Create a new InMemorySigner +/// Creates a new [`InMemorySigner`]. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_new(mut node_secret: crate::c_types::SecretKey, mut funding_key: crate::c_types::SecretKey, mut revocation_base_key: crate::c_types::SecretKey, mut payment_key: crate::c_types::SecretKey, mut delayed_payment_base_key: crate::c_types::SecretKey, mut htlc_base_key: crate::c_types::SecretKey, mut commitment_seed: crate::c_types::ThirtyTwoBytes, mut channel_value_satoshis: u64, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::chain::keysinterface::InMemorySigner { @@ -1425,8 +1443,9 @@ pub extern "C" fn InMemorySigner_new(mut node_secret: crate::c_types::SecretKey, crate::lightning::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true } } -/// Counterparty pubkeys. -/// Will panic if ready_channel wasn't called. +/// Returns the counterparty's pubkeys. +/// +/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_counterparty_pubkeys(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelPublicKeys { @@ -1434,10 +1453,11 @@ pub extern "C" fn InMemorySigner_counterparty_pubkeys(this_arg: &crate::lightnin crate::lightning::ln::chan_utils::ChannelPublicKeys { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelPublicKeys<>) as *mut _) }, is_owned: false } } -/// The contest_delay value specified by our counterparty and applied on holder-broadcastable -/// transactions, ie the amount of time that we have to wait to recover our funds if we +/// Returns the `contest_delay` value specified by our counterparty and applied on holder-broadcastable +/// transactions, i.e., the amount of time that we have to wait to recover our funds if we /// broadcast a transaction. -/// Will panic if ready_channel wasn't called. +/// +/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_counterparty_selected_contest_delay(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> u16 { @@ -1445,10 +1465,11 @@ pub extern "C" fn InMemorySigner_counterparty_selected_contest_delay(this_arg: & ret } -/// The contest_delay value specified by us and applied on transactions broadcastable -/// by our counterparty, ie the amount of time that they have to wait to recover their funds +/// Returns the `contest_delay` value specified by us and applied on transactions broadcastable +/// by our counterparty, i.e., the amount of time that they have to wait to recover their funds /// if they broadcast a transaction. -/// Will panic if ready_channel wasn't called. +/// +/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_holder_selected_contest_delay(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> u16 { @@ -1456,8 +1477,9 @@ pub extern "C" fn InMemorySigner_holder_selected_contest_delay(this_arg: &crate: ret } -/// Whether the holder is the initiator -/// Will panic if ready_channel wasn't called. +/// Returns whether the holder is the initiator. +/// +/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_is_outbound(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> bool { @@ -1466,7 +1488,8 @@ pub extern "C" fn InMemorySigner_is_outbound(this_arg: &crate::lightning::chain: } /// Funding outpoint -/// Will panic if ready_channel wasn't called. +/// +/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_funding_outpoint(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> crate::lightning::chain::transaction::OutPoint { @@ -1474,10 +1497,10 @@ pub extern "C" fn InMemorySigner_funding_outpoint(this_arg: &crate::lightning::c crate::lightning::chain::transaction::OutPoint { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::chain::transaction::OutPoint<>) as *mut _) }, is_owned: false } } -/// Obtain a ChannelTransactionParameters for this channel, to be used when verifying or +/// Returns a [`ChannelTransactionParameters`] for this channel, to be used when verifying or /// building transactions. /// -/// Will panic if ready_channel wasn't called. +/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_get_channel_parameters(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> crate::lightning::ln::chan_utils::ChannelTransactionParameters { @@ -1485,8 +1508,9 @@ pub extern "C" fn InMemorySigner_get_channel_parameters(this_arg: &crate::lightn crate::lightning::ln::chan_utils::ChannelTransactionParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::chan_utils::ChannelTransactionParameters<>) as *mut _) }, is_owned: false } } -/// Whether anchors should be used. -/// Will panic if ready_channel wasn't called. +/// Returns whether anchors should be used. +/// +/// Will panic if [`BaseSign::provide_channel_parameters`] has not been called before. #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_opt_anchors(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner) -> bool { @@ -1494,12 +1518,14 @@ pub extern "C" fn InMemorySigner_opt_anchors(this_arg: &crate::lightning::chain: ret } -/// Sign the single input of spend_tx at index `input_idx` which spends the output -/// described by descriptor, returning the witness stack for the input. +/// Sign the single input of `spend_tx` at index `input_idx`, which spends the output described +/// by `descriptor`, returning the witness stack for the input. /// -/// Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, -/// is not spending the outpoint described by `descriptor.outpoint`, -/// or if an output descriptor script_pubkey does not match the one we can spend. +/// Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, +/// is not spending the outpoint described by [`descriptor.outpoint`], +/// or if an output descriptor `script_pubkey` does not match the one we can spend. +/// +/// [`descriptor.outpoint`]: StaticPaymentOutputDescriptor::outpoint #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_sign_counterparty_payment_input(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::StaticPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ { @@ -1508,13 +1534,16 @@ pub extern "C" fn InMemorySigner_sign_counterparty_payment_input(this_arg: &crat local_ret } -/// Sign the single input of spend_tx at index `input_idx` which spends the output -/// described by descriptor, returning the witness stack for the input. +/// Sign the single input of `spend_tx` at index `input_idx` which spends the output +/// described by `descriptor`, returning the witness stack for the input. +/// +/// Returns an error if the input at `input_idx` does not exist, has a non-empty `script_sig`, +/// is not spending the outpoint described by [`descriptor.outpoint`], does not have a +/// sequence set to [`descriptor.to_self_delay`], or if an output descriptor +/// `script_pubkey` does not match the one we can spend. /// -/// Returns an Err if the input at input_idx does not exist, has a non-empty script_sig, -/// is not spending the outpoint described by `descriptor.outpoint`, does not have a -/// sequence set to `descriptor.to_self_delay`, or if an output descriptor -/// script_pubkey does not match the one we can spend. +/// [`descriptor.outpoint`]: DelayedPaymentOutputDescriptor::outpoint +/// [`descriptor.to_self_delay`]: DelayedPaymentOutputDescriptor::to_self_delay #[must_use] #[no_mangle] pub extern "C" fn InMemorySigner_sign_dynamic_p2wsh_input(this_arg: &crate::lightning::chain::keysinterface::InMemorySigner, mut spend_tx: crate::c_types::Transaction, mut input_idx: usize, descriptor: &crate::lightning::chain::keysinterface::DelayedPaymentOutputDescriptor) -> crate::c_types::derived::CResult_CVec_CVec_u8ZZNoneZ { @@ -1556,7 +1585,7 @@ pub extern "C" fn InMemorySigner_as_BaseSign(this_arg: &InMemorySigner) -> crate sign_closing_transaction: InMemorySigner_BaseSign_sign_closing_transaction, sign_holder_anchor_input: InMemorySigner_BaseSign_sign_holder_anchor_input, sign_channel_announcement: InMemorySigner_BaseSign_sign_channel_announcement, - ready_channel: InMemorySigner_BaseSign_ready_channel, + provide_channel_parameters: InMemorySigner_BaseSign_provide_channel_parameters, } } @@ -1649,8 +1678,8 @@ extern "C" fn InMemorySigner_BaseSign_sign_channel_announcement(this_arg: *const let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::Signature::from_rust(&orig_ret_0_0), crate::c_types::Signature::from_rust(&orig_ret_0_1)).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } -extern "C" fn InMemorySigner_BaseSign_ready_channel(this_arg: *mut c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) { - >::ready_channel(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, channel_parameters.get_native_ref()) +extern "C" fn InMemorySigner_BaseSign_provide_channel_parameters(this_arg: *mut c_void, channel_parameters: &crate::lightning::ln::chan_utils::ChannelTransactionParameters) { + >::provide_channel_parameters(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, channel_parameters.get_native_ref()) } impl From for crate::lightning::chain::keysinterface::Sign { @@ -1689,19 +1718,12 @@ pub extern "C" fn InMemorySigner_as_Sign(this_arg: &InMemorySigner) -> crate::li sign_closing_transaction: InMemorySigner_BaseSign_sign_closing_transaction, sign_holder_anchor_input: InMemorySigner_BaseSign_sign_holder_anchor_input, sign_channel_announcement: InMemorySigner_BaseSign_sign_channel_announcement, - ready_channel: InMemorySigner_BaseSign_ready_channel, + provide_channel_parameters: InMemorySigner_BaseSign_provide_channel_parameters, }, write: InMemorySigner_write_void, - cloned: Some(Sign_InMemorySigner_cloned), } } -extern "C" fn Sign_InMemorySigner_cloned(new_obj: &mut crate::lightning::chain::keysinterface::Sign) { - new_obj.this_arg = InMemorySigner_clone_void(new_obj.this_arg); - new_obj.free = Some(InMemorySigner_free_void); - new_obj.BaseSign.this_arg = new_obj.this_arg; - new_obj.BaseSign.free = None; -} #[no_mangle] /// Serialize the InMemorySigner object into a byte array which can be read by InMemorySigner_read @@ -1724,12 +1746,12 @@ pub extern "C" fn InMemorySigner_read(ser: crate::c_types::u8slice, arg: crate:: use lightning::chain::keysinterface::KeysManager as nativeKeysManagerImport; pub(crate) type nativeKeysManager = nativeKeysManagerImport; -/// Simple KeysInterface implementor that takes a 32-byte seed for use as a BIP 32 extended key -/// and derives keys from that. +/// Simple [`KeysInterface`] implementation that takes a 32-byte seed for use as a BIP 32 extended +/// key and derives keys from that. /// -/// Your node_id is seed/0' -/// ChannelMonitor closes may use seed/1' -/// Cooperative closes may use seed/2' +/// Your `node_id` is seed/0'. +/// Unilateral closes may use seed/1'. +/// Cooperative closes may use seed/2'. /// The two close keys may be needed to claim on-chain funds! /// /// This struct cannot be used for nodes that wish to support receiving phantom payments; @@ -1765,7 +1787,7 @@ pub extern "C" fn KeysManager_free(this_obj: KeysManager) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn KeysManager_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeKeysManager); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeKeysManager) }; } #[allow(unused)] impl KeysManager { @@ -1783,25 +1805,23 @@ impl KeysManager { ret } } -/// Constructs a KeysManager from a 32-byte seed. If the seed is in some way biased (eg your -/// CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). -/// starting_time isn't strictly required to actually be a time, but it must absolutely, +/// Constructs a [`KeysManager`] from a 32-byte seed. If the seed is in some way biased (e.g., +/// your CSRNG is busted) this may panic (but more importantly, you will possibly lose funds). +/// `starting_time` isn't strictly required to actually be a time, but it must absolutely, /// without a doubt, be unique to this instance. ie if you start multiple times with the same -/// seed, starting_time must be unique to each run. Thus, the easiest way to achieve this is to -/// simply use the current time (with very high precision). +/// `seed`, `starting_time` must be unique to each run. Thus, the easiest way to achieve this +/// is to simply use the current time (with very high precision). /// -/// The seed MUST be backed up safely prior to use so that the keys can be re-created, however, -/// obviously, starting_time should be unique every time you reload the library - it is only +/// The `seed` MUST be backed up safely prior to use so that the keys can be re-created, however, +/// obviously, `starting_time` should be unique every time you reload the library - it is only /// used to generate new ephemeral key data (which will be stored by the individual channel if /// necessary). /// /// Note that the seed is required to recover certain on-chain funds independent of -/// ChannelMonitor data, though a current copy of ChannelMonitor data is also required for any -/// channel, and some on-chain during-closing funds. +/// [`ChannelMonitor`] data, though a current copy of [`ChannelMonitor`] data is also required +/// for any channel, and some on-chain during-closing funds. /// -/// Note that until the 0.1 release there is no guarantee of backward compatibility between -/// versions. Once the library is more fully supported, the docs will be updated to include a -/// detailed description of the guarantee. +/// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor #[must_use] #[no_mangle] pub extern "C" fn KeysManager_new(seed: *const [u8; 32], mut starting_time_secs: u64, mut starting_time_nanos: u32) -> crate::lightning::chain::keysinterface::KeysManager { @@ -1809,11 +1829,7 @@ pub extern "C" fn KeysManager_new(seed: *const [u8; 32], mut starting_time_secs: crate::lightning::chain::keysinterface::KeysManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } -/// Derive an old Sign containing per-channel secrets based on a key derivation parameters. -/// -/// Key derivation parameters are accessible through a per-channel secrets -/// Sign::channel_keys_id and is provided inside DynamicOuputP2WSH in case of -/// onchain output detection for which a corresponding delayed_payment_key must be derived. +/// Derive an old [`Sign`] containing per-channel secrets based on a key derivation parameters. #[must_use] #[no_mangle] pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &crate::lightning::chain::keysinterface::KeysManager, mut channel_value_satoshis: u64, params: *const [u8; 32]) -> crate::lightning::chain::keysinterface::InMemorySigner { @@ -1821,7 +1837,7 @@ pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &crate::lightning::c crate::lightning::chain::keysinterface::InMemorySigner { inner: ObjOps::heap_alloc(ret), is_owned: true } } -/// Creates a Transaction which spends the given descriptors to the given outputs, plus an +/// Creates a [`Transaction`] which spends the given descriptors to the given outputs, plus an /// output to the given change destination (if sufficient change value remains). The /// transaction will have a feerate, at least, of the given value. /// @@ -1831,8 +1847,8 @@ pub extern "C" fn KeysManager_derive_channel_keys(this_arg: &crate::lightning::c /// /// We do not enforce that outputs meet the dust limit or that any output scripts are standard. /// -/// May panic if the `SpendableOutputDescriptor`s were not generated by Channels which used -/// this KeysManager or one of the `InMemorySigner` created by this KeysManager. +/// May panic if the [`SpendableOutputDescriptor`]s were not generated by channels which used +/// this [`KeysManager`] or one of the [`InMemorySigner`] created by this [`KeysManager`]. #[must_use] #[no_mangle] pub extern "C" fn KeysManager_spend_spendable_outputs(this_arg: &crate::lightning::chain::keysinterface::KeysManager, mut descriptors: crate::c_types::derived::CVec_SpendableOutputDescriptorZ, mut outputs: crate::c_types::derived::CVec_TxOutZ, mut change_destination_script: crate::c_types::derived::CVec_u8Z, mut feerate_sat_per_1000_weight: u32) -> crate::c_types::derived::CResult_TransactionNoneZ { @@ -1865,7 +1881,8 @@ pub extern "C" fn KeysManager_as_KeysInterface(this_arg: &KeysManager) -> crate: ecdh: KeysManager_KeysInterface_ecdh, get_destination_script: KeysManager_KeysInterface_get_destination_script, get_shutdown_scriptpubkey: KeysManager_KeysInterface_get_shutdown_scriptpubkey, - get_channel_signer: KeysManager_KeysInterface_get_channel_signer, + generate_channel_keys_id: KeysManager_KeysInterface_generate_channel_keys_id, + derive_channel_signer: KeysManager_KeysInterface_derive_channel_signer, get_secure_random_bytes: KeysManager_KeysInterface_get_secure_random_bytes, read_chan_signer: KeysManager_KeysInterface_read_chan_signer, sign_invoice: KeysManager_KeysInterface_sign_invoice, @@ -1903,8 +1920,13 @@ extern "C" fn KeysManager_KeysInterface_get_shutdown_scriptpubkey(this_arg: *con crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] -extern "C" fn KeysManager_KeysInterface_get_channel_signer(this_arg: *const c_void, mut inbound: bool, mut channel_value_satoshis: u64) -> crate::lightning::chain::keysinterface::Sign { - let mut ret = >::get_channel_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, inbound, channel_value_satoshis); +extern "C" fn KeysManager_KeysInterface_generate_channel_keys_id(this_arg: *const c_void, mut inbound: bool, mut channel_value_satoshis: u64, mut user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes { + let mut ret = >::generate_channel_keys_id(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, inbound, channel_value_satoshis, user_channel_id.into()); + crate::c_types::ThirtyTwoBytes { data: ret } +} +#[must_use] +extern "C" fn KeysManager_KeysInterface_derive_channel_signer(this_arg: *const c_void, mut channel_value_satoshis: u64, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::chain::keysinterface::Sign { + let mut ret = >::derive_channel_signer(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, channel_value_satoshis, channel_keys_id.data); Into::into(ret) } #[must_use] @@ -1919,7 +1941,7 @@ extern "C" fn KeysManager_KeysInterface_read_chan_signer(this_arg: *const c_void local_ret } #[must_use] -extern "C" fn KeysManager_KeysInterface_sign_invoice(this_arg: *const c_void, mut hrp_bytes: crate::c_types::u8slice, mut invoice_data: crate::c_types::derived::CVec_u5Z, mut receipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ { +extern "C" fn KeysManager_KeysInterface_sign_invoice(this_arg: *const c_void, mut hrp_bytes: crate::c_types::u8slice, mut invoice_data: crate::c_types::derived::CVec_U5Z, mut receipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ { let mut local_invoice_data = Vec::new(); for mut item in invoice_data.into_rust().drain(..) { local_invoice_data.push( { item.into() }); }; let mut ret = >::sign_invoice(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, hrp_bytes.to_slice(), &local_invoice_data[..], receipient.into_native()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::RecoverableSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -1978,7 +2000,7 @@ pub extern "C" fn PhantomKeysManager_free(this_obj: PhantomKeysManager) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PhantomKeysManager_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePhantomKeysManager); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePhantomKeysManager) }; } #[allow(unused)] impl PhantomKeysManager { @@ -2018,7 +2040,8 @@ pub extern "C" fn PhantomKeysManager_as_KeysInterface(this_arg: &PhantomKeysMana ecdh: PhantomKeysManager_KeysInterface_ecdh, get_destination_script: PhantomKeysManager_KeysInterface_get_destination_script, get_shutdown_scriptpubkey: PhantomKeysManager_KeysInterface_get_shutdown_scriptpubkey, - get_channel_signer: PhantomKeysManager_KeysInterface_get_channel_signer, + generate_channel_keys_id: PhantomKeysManager_KeysInterface_generate_channel_keys_id, + derive_channel_signer: PhantomKeysManager_KeysInterface_derive_channel_signer, get_secure_random_bytes: PhantomKeysManager_KeysInterface_get_secure_random_bytes, read_chan_signer: PhantomKeysManager_KeysInterface_read_chan_signer, sign_invoice: PhantomKeysManager_KeysInterface_sign_invoice, @@ -2056,8 +2079,13 @@ extern "C" fn PhantomKeysManager_KeysInterface_get_shutdown_scriptpubkey(this_ar crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] -extern "C" fn PhantomKeysManager_KeysInterface_get_channel_signer(this_arg: *const c_void, mut inbound: bool, mut channel_value_satoshis: u64) -> crate::lightning::chain::keysinterface::Sign { - let mut ret = >::get_channel_signer(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, inbound, channel_value_satoshis); +extern "C" fn PhantomKeysManager_KeysInterface_generate_channel_keys_id(this_arg: *const c_void, mut inbound: bool, mut channel_value_satoshis: u64, mut user_channel_id: crate::c_types::U128) -> crate::c_types::ThirtyTwoBytes { + let mut ret = >::generate_channel_keys_id(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, inbound, channel_value_satoshis, user_channel_id.into()); + crate::c_types::ThirtyTwoBytes { data: ret } +} +#[must_use] +extern "C" fn PhantomKeysManager_KeysInterface_derive_channel_signer(this_arg: *const c_void, mut channel_value_satoshis: u64, mut channel_keys_id: crate::c_types::ThirtyTwoBytes) -> crate::lightning::chain::keysinterface::Sign { + let mut ret = >::derive_channel_signer(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, channel_value_satoshis, channel_keys_id.data); Into::into(ret) } #[must_use] @@ -2072,7 +2100,7 @@ extern "C" fn PhantomKeysManager_KeysInterface_read_chan_signer(this_arg: *const local_ret } #[must_use] -extern "C" fn PhantomKeysManager_KeysInterface_sign_invoice(this_arg: *const c_void, mut hrp_bytes: crate::c_types::u8slice, mut invoice_data: crate::c_types::derived::CVec_u5Z, mut receipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ { +extern "C" fn PhantomKeysManager_KeysInterface_sign_invoice(this_arg: *const c_void, mut hrp_bytes: crate::c_types::u8slice, mut invoice_data: crate::c_types::derived::CVec_U5Z, mut receipient: crate::lightning::chain::keysinterface::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ { let mut local_invoice_data = Vec::new(); for mut item in invoice_data.into_rust().drain(..) { local_invoice_data.push( { item.into() }); }; let mut ret = >::sign_invoice(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, hrp_bytes.to_slice(), &local_invoice_data[..], receipient.into_native()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::RecoverableSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -2084,8 +2112,9 @@ extern "C" fn PhantomKeysManager_KeysInterface_get_inbound_payment_key_material( crate::c_types::ThirtyTwoBytes { data: ret.0 } } -/// Constructs a `PhantomKeysManager` given a 32-byte seed and an additional `cross_node_seed` -/// that is shared across all nodes that intend to participate in [phantom node payments] together. +/// Constructs a [`PhantomKeysManager`] given a 32-byte seed and an additional `cross_node_seed` +/// that is shared across all nodes that intend to participate in [phantom node payments] +/// together. /// /// See [`KeysManager::new`] for more information on `seed`, `starting_time_secs`, and /// `starting_time_nanos`. diff --git a/lightning-c-bindings/src/lightning/chain/mod.rs b/lightning-c-bindings/src/lightning/chain/mod.rs index fb9794f..1561f74 100644 --- a/lightning-c-bindings/src/lightning/chain/mod.rs +++ b/lightning-c-bindings/src/lightning/chain/mod.rs @@ -76,7 +76,7 @@ pub extern "C" fn BestBlock_free(this_obj: BestBlock) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BestBlock_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBestBlock); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBestBlock) }; } #[allow(unused)] impl BestBlock { @@ -342,31 +342,35 @@ impl Drop for Listen { } } } -/// The `Confirm` trait is used to notify when transactions have been confirmed on chain or -/// unconfirmed during a chain reorganization. +/// The `Confirm` trait is used to notify LDK when relevant transactions have been confirmed on +/// chain or unconfirmed during a chain reorganization. /// /// Clients sourcing chain data using a transaction-oriented API should prefer this interface over -/// [`Listen`]. For instance, an Electrum client may implement [`Filter`] by subscribing to activity -/// related to registered transactions and outputs. Upon notification, it would pass along the -/// matching transactions using this interface. +/// [`Listen`]. For instance, an Electrum-based transaction sync implementation may implement +/// [`Filter`] to subscribe to relevant transactions and unspent outputs it should monitor for +/// on-chain activity. Then, it needs to notify LDK via this interface upon observing any changes +/// with reference to the confirmation status of the monitored objects. /// /// # Use -/// /// The intended use is as follows: -/// - Call [`transactions_confirmed`] to process any on-chain activity of interest. -/// - Call [`transaction_unconfirmed`] to process any transaction returned by [`get_relevant_txids`] -/// that has been reorganized out of the chain. -/// - Call [`best_block_updated`] whenever a new chain tip becomes available. +/// - Call [`transactions_confirmed`] to notify LDK whenever any of the registered transactions or +/// outputs are, respectively, confirmed or spent on chain. +/// - Call [`transaction_unconfirmed`] to notify LDK whenever any transaction returned by +/// [`get_relevant_txids`] is no longer confirmed in the block with the given block hash. +/// - Call [`best_block_updated`] to notify LDK whenever a new chain tip becomes available. /// /// # Order /// /// Clients must call these methods in chain order. Specifically: -/// - Transactions confirmed in a block must be given before transactions confirmed in a later -/// block. +/// - Transactions which are confirmed in a particular block must be given before transactions +/// confirmed in a later block. /// - Dependent transactions within the same block must be given in topological order, possibly in /// separate calls. -/// - Unconfirmed transactions must be given after the original confirmations and before any -/// reconfirmation. +/// - All unconfirmed transactions must be given after the original confirmations and before *any* +/// reconfirmations, i.e., [`transactions_confirmed`] and [`transaction_unconfirmed`] calls should +/// never be interleaved, but always conduced *en bloc*. +/// - Any reconfirmed transactions need to be explicitly unconfirmed before they are reconfirmed +/// in regard to the new block. /// /// See individual method documentation for further details. /// @@ -379,9 +383,9 @@ pub struct Confirm { /// 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. pub this_arg: *mut c_void, - /// Processes transactions confirmed in a block with a given header and height. + /// Notifies LDK of transactions confirmed in a block with a given header and height. /// - /// Should be called for any transactions registered by [`Filter::register_tx`] or any + /// Must be called for any transactions registered by [`Filter::register_tx`] or any /// transactions spending an output registered by [`Filter::register_output`]. Such transactions /// appearing in the same block do not need to be included in the same call; instead, multiple /// calls with additional transactions may be made so long as they are made in [chain order]. @@ -393,35 +397,41 @@ pub struct Confirm { /// [chain order]: Confirm#order /// [`best_block_updated`]: Self::best_block_updated pub transactions_confirmed: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], txdata: crate::c_types::derived::CVec_C2Tuple_usizeTransactionZZ, height: u32), - /// Processes a transaction that is no longer confirmed as result of a chain reorganization. + /// Notifies LDK of 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 will not be returned + /// Must be called for any transaction returned by [`get_relevant_txids`] if it has been + /// reorganized out of the best chain or if it is no longer confirmed in the block with the + /// given block hash. 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 pub transaction_unconfirmed: extern "C" fn (this_arg: *const c_void, txid: *const [u8; 32]), - /// Processes an update to the best header connected at the given height. + /// Notifies LDK of an update to the best header connected at the given height. /// - /// Should be called when a new header is available but may be skipped for intermediary blocks - /// if they become available at the same time. + /// Must be called whenever a new chain tip becomes available. May be skipped for intermediary + /// blocks. pub best_block_updated: extern "C" fn (this_arg: *const c_void, header: *const [u8; 80], height: u32), - /// Returns transactions that should be monitored for reorganization out of the chain. + /// Returns transactions that must be monitored for reorganization out of the chain along + /// with the hash of the block as part of which it had been previously confirmed. /// /// 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 + /// Must be called to determine the subset of transactions that must be monitored for /// reorganization. Will be idempotent between calls but may change as a result of calls to the - /// other interface methods. Thus, this is useful to determine which transactions may need to be + /// other interface methods. Thus, this is useful to determine which transactions must be /// given to [`transaction_unconfirmed`]. /// + /// If any of the returned transactions are confirmed in a block other than the one with the + /// given hash, they need to be unconfirmed and reconfirmed via [`transaction_unconfirmed`] and + /// [`transactions_confirmed`], respectively. + /// /// [`transactions_confirmed`]: Self::transactions_confirmed /// [`transaction_unconfirmed`]: Self::transaction_unconfirmed #[must_use] - pub get_relevant_txids: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_TxidZ, + pub get_relevant_txids: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_TxidBlockHashZZ, /// 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. pub free: Option, @@ -454,9 +464,9 @@ impl rustConfirm for Confirm { let mut local_header = { let mut s = [0u8; 80]; s[..].copy_from_slice(&::bitcoin::consensus::encode::serialize(header)); s }; (self.best_block_updated)(self.this_arg, &local_header, height) } - fn get_relevant_txids(&self) -> Vec { + fn get_relevant_txids(&self) -> Vec<(bitcoin::hash_types::Txid, Option)> { let mut ret = (self.get_relevant_txids)(self.this_arg); - let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { ::bitcoin::hash_types::Txid::from_slice(&item.data[..]).unwrap() }); }; + let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item.to_rust(); let mut local_orig_ret_0_1 = if orig_ret_0_1.data == [0; 32] { None } else { Some( { ::bitcoin::hash_types::BlockHash::from_slice(&orig_ret_0_1.data[..]).unwrap() }) }; let mut local_ret_0 = (::bitcoin::hash_types::Txid::from_slice(&orig_ret_0_0.data[..]).unwrap(), local_orig_ret_0_1); local_ret_0 }); }; local_ret } } @@ -849,7 +859,7 @@ pub extern "C" fn WatchedOutput_free(this_obj: WatchedOutput) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn WatchedOutput_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeWatchedOutput); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeWatchedOutput) }; } #[allow(unused)] impl WatchedOutput { diff --git a/lightning-c-bindings/src/lightning/chain/transaction.rs b/lightning-c-bindings/src/lightning/chain/transaction.rs index f425bcb..203b755 100644 --- a/lightning-c-bindings/src/lightning/chain/transaction.rs +++ b/lightning-c-bindings/src/lightning/chain/transaction.rs @@ -52,7 +52,7 @@ pub extern "C" fn OutPoint_free(this_obj: OutPoint) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OutPoint_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOutPoint); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOutPoint) }; } #[allow(unused)] impl OutPoint { diff --git a/lightning-c-bindings/src/lightning/ln/chan_utils.rs b/lightning-c-bindings/src/lightning/ln/chan_utils.rs index 08abca5..0b0c8b2 100644 --- a/lightning-c-bindings/src/lightning/ln/chan_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/chan_utils.rs @@ -17,6 +17,24 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +/// Maximum number of one-way in-flight HTLC (protocol-level value). + +#[no_mangle] +pub static MAX_HTLCS: u16 = lightning::ln::chan_utils::MAX_HTLCS; +/// The weight of a BIP141 witnessScript for a BOLT3's \"offered HTLC output\" on a commitment transaction, non-anchor variant. + +#[no_mangle] +pub static OFFERED_HTLC_SCRIPT_WEIGHT: usize = lightning::ln::chan_utils::OFFERED_HTLC_SCRIPT_WEIGHT; +/// The weight of a BIP141 witnessScript for a BOLT3's \"offered HTLC output\" on a commitment transaction, anchor variant. + +#[no_mangle] +pub static OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS: usize = lightning::ln::chan_utils::OFFERED_HTLC_SCRIPT_WEIGHT_ANCHORS; +/// The weight of a BIP141 witnessScript for a BOLT3's \"received HTLC output\" can vary in function of its CLTV argument value. +/// We define a range that encompasses both its non-anchors and anchors variants. +/// This is the maximum post-anchor value. + +#[no_mangle] +pub static MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT: usize = lightning::ln::chan_utils::MAX_ACCEPTED_HTLC_SCRIPT_WEIGHT; /// Gets the weight for an HTLC-Success transaction. #[no_mangle] pub extern "C" fn htlc_success_tx_weight(mut opt_anchors: bool) -> u64 { @@ -31,6 +49,107 @@ pub extern "C" fn htlc_timeout_tx_weight(mut opt_anchors: bool) -> u64 { ret } +/// Describes the type of HTLC claim as determined by analyzing the witness. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum HTLCClaim { + /// Claims an offered output on a commitment transaction through the timeout path. + OfferedTimeout, + /// Claims an offered output on a commitment transaction through the success path. + OfferedPreimage, + /// Claims an accepted output on a commitment transaction through the timeout path. + AcceptedTimeout, + /// Claims an accepted output on a commitment transaction through the success path. + AcceptedPreimage, + /// Claims an offered/accepted output on a commitment transaction through the revocation path. + Revocation, +} +use lightning::ln::chan_utils::HTLCClaim as HTLCClaimImport; +pub(crate) type nativeHTLCClaim = HTLCClaimImport; + +impl HTLCClaim { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeHTLCClaim { + match self { + HTLCClaim::OfferedTimeout => nativeHTLCClaim::OfferedTimeout, + HTLCClaim::OfferedPreimage => nativeHTLCClaim::OfferedPreimage, + HTLCClaim::AcceptedTimeout => nativeHTLCClaim::AcceptedTimeout, + HTLCClaim::AcceptedPreimage => nativeHTLCClaim::AcceptedPreimage, + HTLCClaim::Revocation => nativeHTLCClaim::Revocation, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeHTLCClaim { + match self { + HTLCClaim::OfferedTimeout => nativeHTLCClaim::OfferedTimeout, + HTLCClaim::OfferedPreimage => nativeHTLCClaim::OfferedPreimage, + HTLCClaim::AcceptedTimeout => nativeHTLCClaim::AcceptedTimeout, + HTLCClaim::AcceptedPreimage => nativeHTLCClaim::AcceptedPreimage, + HTLCClaim::Revocation => nativeHTLCClaim::Revocation, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &nativeHTLCClaim) -> Self { + match native { + nativeHTLCClaim::OfferedTimeout => HTLCClaim::OfferedTimeout, + nativeHTLCClaim::OfferedPreimage => HTLCClaim::OfferedPreimage, + nativeHTLCClaim::AcceptedTimeout => HTLCClaim::AcceptedTimeout, + nativeHTLCClaim::AcceptedPreimage => HTLCClaim::AcceptedPreimage, + nativeHTLCClaim::Revocation => HTLCClaim::Revocation, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeHTLCClaim) -> Self { + match native { + nativeHTLCClaim::OfferedTimeout => HTLCClaim::OfferedTimeout, + nativeHTLCClaim::OfferedPreimage => HTLCClaim::OfferedPreimage, + nativeHTLCClaim::AcceptedTimeout => HTLCClaim::AcceptedTimeout, + nativeHTLCClaim::AcceptedPreimage => HTLCClaim::AcceptedPreimage, + nativeHTLCClaim::Revocation => HTLCClaim::Revocation, + } + } +} +/// Creates a copy of the HTLCClaim +#[no_mangle] +pub extern "C" fn HTLCClaim_clone(orig: &HTLCClaim) -> HTLCClaim { + orig.clone() +} +#[no_mangle] +/// Utility method to constructs a new OfferedTimeout-variant HTLCClaim +pub extern "C" fn HTLCClaim_offered_timeout() -> HTLCClaim { + HTLCClaim::OfferedTimeout} +#[no_mangle] +/// Utility method to constructs a new OfferedPreimage-variant HTLCClaim +pub extern "C" fn HTLCClaim_offered_preimage() -> HTLCClaim { + HTLCClaim::OfferedPreimage} +#[no_mangle] +/// Utility method to constructs a new AcceptedTimeout-variant HTLCClaim +pub extern "C" fn HTLCClaim_accepted_timeout() -> HTLCClaim { + HTLCClaim::AcceptedTimeout} +#[no_mangle] +/// Utility method to constructs a new AcceptedPreimage-variant HTLCClaim +pub extern "C" fn HTLCClaim_accepted_preimage() -> HTLCClaim { + HTLCClaim::AcceptedPreimage} +#[no_mangle] +/// Utility method to constructs a new Revocation-variant HTLCClaim +pub extern "C" fn HTLCClaim_revocation() -> HTLCClaim { + HTLCClaim::Revocation} +/// Checks if two HTLCClaims contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn HTLCClaim_eq(a: &HTLCClaim, b: &HTLCClaim) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +/// Check if a given input witness attempts to claim a HTLC. +#[must_use] +#[no_mangle] +pub extern "C" fn HTLCClaim_from_witness(mut witness: crate::c_types::Witness) -> crate::c_types::derived::COption_HTLCClaimZ { + let mut ret = lightning::ln::chan_utils::HTLCClaim::from_witness(&witness.into_bitcoin()); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_HTLCClaimZ::None } else { crate::c_types::derived::COption_HTLCClaimZ::Some( { crate::lightning::ln::chan_utils::HTLCClaim::native_into(ret.unwrap()) }) }; + local_ret +} + /// Build the commitment secret from the seed and the commitment number #[no_mangle] pub extern "C" fn build_commitment_secret(commitment_seed: *const [u8; 32], mut idx: u64) -> crate::c_types::ThirtyTwoBytes { @@ -82,7 +201,7 @@ pub extern "C" fn CounterpartyCommitmentSecrets_free(this_obj: CounterpartyCommi #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CounterpartyCommitmentSecrets_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCounterpartyCommitmentSecrets); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCounterpartyCommitmentSecrets) }; } #[allow(unused)] impl CounterpartyCommitmentSecrets { @@ -176,27 +295,19 @@ pub extern "C" fn CounterpartyCommitmentSecrets_read(ser: crate::c_types::u8slic } /// Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key) /// from the base secret and the per_commitment_point. -/// -/// Note that this is infallible iff we trust that at least one of the two input keys are randomly -/// generated (ie our own). #[no_mangle] -pub extern "C" fn derive_private_key(mut per_commitment_point: crate::c_types::PublicKey, base_secret: *const [u8; 32]) -> crate::c_types::derived::CResult_SecretKeyErrorZ { +pub extern "C" fn derive_private_key(mut per_commitment_point: crate::c_types::PublicKey, base_secret: *const [u8; 32]) -> crate::c_types::SecretKey { let mut ret = lightning::ln::chan_utils::derive_private_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *base_secret}[..]).unwrap()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SecretKey::from_rust(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; - local_ret + crate::c_types::SecretKey::from_rust(ret) } /// Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key) /// from the base point and the per_commitment_key. This is the public equivalent of /// derive_private_key - using only public keys to derive a public key instead of private keys. -/// -/// Note that this is infallible iff we trust that at least one of the two input keys are randomly -/// generated (ie our own). #[no_mangle] -pub extern "C" fn derive_public_key(mut per_commitment_point: crate::c_types::PublicKey, mut base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeyErrorZ { +pub extern "C" fn derive_public_key(mut per_commitment_point: crate::c_types::PublicKey, mut base_point: crate::c_types::PublicKey) -> crate::c_types::PublicKey { let mut ret = lightning::ln::chan_utils::derive_public_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &base_point.into_rust()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; - local_ret + crate::c_types::PublicKey::from_rust(&ret) } /// Derives a per-commitment-transaction revocation key from its constituent parts. @@ -205,14 +316,10 @@ pub extern "C" fn derive_public_key(mut per_commitment_point: crate::c_types::Pu /// commitment transaction, thus per_commitment_secret always come from cheater /// and revocation_base_secret always come from punisher, which is the broadcaster /// of the transaction spending with this key knowledge. -/// -/// Note that this is infallible iff we trust that at least one of the two input keys are randomly -/// generated (ie our own). #[no_mangle] -pub extern "C" fn derive_private_revocation_key(per_commitment_secret: *const [u8; 32], countersignatory_revocation_base_secret: *const [u8; 32]) -> crate::c_types::derived::CResult_SecretKeyErrorZ { +pub extern "C" fn derive_private_revocation_key(per_commitment_secret: *const [u8; 32], countersignatory_revocation_base_secret: *const [u8; 32]) -> crate::c_types::SecretKey { let mut ret = lightning::ln::chan_utils::derive_private_revocation_key(secp256k1::global::SECP256K1, &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *per_commitment_secret}[..]).unwrap(), &::bitcoin::secp256k1::SecretKey::from_slice(&unsafe { *countersignatory_revocation_base_secret}[..]).unwrap()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SecretKey::from_rust(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; - local_ret + crate::c_types::SecretKey::from_rust(ret) } /// Derives a per-commitment-transaction revocation public key from its constituent parts. This is @@ -227,10 +334,9 @@ pub extern "C" fn derive_private_revocation_key(per_commitment_secret: *const [u /// Note that this is infallible iff we trust that at least one of the two input keys are randomly /// generated (ie our own). #[no_mangle] -pub extern "C" fn derive_public_revocation_key(mut per_commitment_point: crate::c_types::PublicKey, mut countersignatory_revocation_base_point: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_PublicKeyErrorZ { +pub extern "C" fn derive_public_revocation_key(mut per_commitment_point: crate::c_types::PublicKey, mut countersignatory_revocation_base_point: crate::c_types::PublicKey) -> crate::c_types::PublicKey { let mut ret = lightning::ln::chan_utils::derive_public_revocation_key(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &countersignatory_revocation_base_point.into_rust()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::PublicKey::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; - local_ret + crate::c_types::PublicKey::from_rust(&ret) } @@ -276,7 +382,7 @@ pub extern "C" fn TxCreationKeys_free(this_obj: TxCreationKeys) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TxCreationKeys_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeTxCreationKeys); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTxCreationKeys) }; } #[allow(unused)] impl TxCreationKeys { @@ -442,7 +548,7 @@ pub extern "C" fn ChannelPublicKeys_free(this_obj: ChannelPublicKeys) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelPublicKeys_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelPublicKeys); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelPublicKeys) }; } #[allow(unused)] impl ChannelPublicKeys { @@ -593,20 +699,18 @@ pub extern "C" fn ChannelPublicKeys_read(ser: crate::c_types::u8slice) -> crate: /// Key set is asymmetric and can't be used as part of counter-signatory set of transactions. #[must_use] #[no_mangle] -pub extern "C" fn TxCreationKeys_derive_new(mut per_commitment_point: crate::c_types::PublicKey, mut broadcaster_delayed_payment_base: crate::c_types::PublicKey, mut broadcaster_htlc_base: crate::c_types::PublicKey, mut countersignatory_revocation_base: crate::c_types::PublicKey, mut countersignatory_htlc_base: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_TxCreationKeysErrorZ { +pub extern "C" fn TxCreationKeys_derive_new(mut per_commitment_point: crate::c_types::PublicKey, mut broadcaster_delayed_payment_base: crate::c_types::PublicKey, mut broadcaster_htlc_base: crate::c_types::PublicKey, mut countersignatory_revocation_base: crate::c_types::PublicKey, mut countersignatory_htlc_base: crate::c_types::PublicKey) -> crate::lightning::ln::chan_utils::TxCreationKeys { let mut ret = lightning::ln::chan_utils::TxCreationKeys::derive_new(secp256k1::global::SECP256K1, &per_commitment_point.into_rust(), &broadcaster_delayed_payment_base.into_rust(), &broadcaster_htlc_base.into_rust(), &countersignatory_revocation_base.into_rust(), &countersignatory_htlc_base.into_rust()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; - local_ret + crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Generate per-state keys from channel static keys. /// Key set is asymmetric and can't be used as part of counter-signatory set of transactions. #[must_use] #[no_mangle] -pub extern "C" fn TxCreationKeys_from_channel_static_keys(mut per_commitment_point: crate::c_types::PublicKey, broadcaster_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys, countersignatory_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::c_types::derived::CResult_TxCreationKeysErrorZ { +pub extern "C" fn TxCreationKeys_from_channel_static_keys(mut per_commitment_point: crate::c_types::PublicKey, broadcaster_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys, countersignatory_keys: &crate::lightning::ln::chan_utils::ChannelPublicKeys) -> crate::lightning::ln::chan_utils::TxCreationKeys { let mut ret = lightning::ln::chan_utils::TxCreationKeys::from_channel_static_keys(&per_commitment_point.into_rust(), broadcaster_keys.get_native_ref(), countersignatory_keys.get_native_ref(), secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::Secp256k1Error::from_rust(e) }).into() }; - local_ret + crate::lightning::ln::chan_utils::TxCreationKeys { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// The maximum length of a script returned by get_revokeable_redeemscript. @@ -655,7 +759,7 @@ pub extern "C" fn HTLCOutputInCommitment_free(this_obj: HTLCOutputInCommitment) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HTLCOutputInCommitment_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHTLCOutputInCommitment); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHTLCOutputInCommitment) }; } #[allow(unused)] impl HTLCOutputInCommitment { @@ -823,11 +927,28 @@ pub extern "C" fn make_funding_redeemscript(mut broadcaster: crate::c_types::Pub /// Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the /// commitment transaction). #[no_mangle] -pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, mut opt_anchors: bool, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey, mut revocation_key: crate::c_types::PublicKey) -> crate::c_types::Transaction { - let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*commitment_txid }[..]).unwrap(), feerate_per_kw, contest_delay, htlc.get_native_ref(), opt_anchors, &broadcaster_delayed_payment_key.into_rust(), &revocation_key.into_rust()); +pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut feerate_per_kw: u32, mut contest_delay: u16, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment, mut opt_anchors: bool, mut use_non_zero_fee_anchors: bool, mut broadcaster_delayed_payment_key: crate::c_types::PublicKey, mut revocation_key: crate::c_types::PublicKey) -> crate::c_types::Transaction { + let mut ret = lightning::ln::chan_utils::build_htlc_transaction(&::bitcoin::hash_types::Txid::from_slice(&unsafe { &*commitment_txid }[..]).unwrap(), feerate_per_kw, contest_delay, htlc.get_native_ref(), opt_anchors, use_non_zero_fee_anchors, &broadcaster_delayed_payment_key.into_rust(), &revocation_key.into_rust()); crate::c_types::Transaction::from_bitcoin(&ret) } +/// Returns the witness required to satisfy and spend a HTLC input. +/// +/// Note that preimage (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::Signature, mut remote_sig: crate::c_types::Signature, mut preimage: crate::c_types::ThirtyTwoBytes, mut redeem_script: crate::c_types::u8slice, mut opt_anchors: bool) -> crate::c_types::Witness { + let mut local_preimage = if preimage.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentPreimage(preimage.data) }) }; + let mut ret = lightning::ln::chan_utils::build_htlc_input_witness(&local_sig.into_rust(), &remote_sig.into_rust(), &local_preimage, &::bitcoin::blockdata::script::Script::from(Vec::from(redeem_script.to_slice())), opt_anchors); + crate::c_types::Witness::from_bitcoin(&ret) +} + +/// Gets the witnessScript for the to_remote output when anchors are enabled. +#[no_mangle] +pub extern "C" fn get_to_countersignatory_with_anchors_redeemscript(mut payment_point: crate::c_types::PublicKey) -> crate::c_types::derived::CVec_u8Z { + let mut ret = lightning::ln::chan_utils::get_to_countersignatory_with_anchors_redeemscript(&payment_point.into_rust()); + ret.into_bytes().into() +} + /// Gets the witnessScript for an anchor output from the funding public key. /// The witness in the spending input must be: /// @@ -840,6 +961,13 @@ pub extern "C" fn get_anchor_redeemscript(mut funding_pubkey: crate::c_types::Pu ret.into_bytes().into() } +/// Returns the witness required to satisfy and spend an anchor input. +#[no_mangle] +pub extern "C" fn build_anchor_input_witness(mut funding_key: crate::c_types::PublicKey, mut funding_sig: crate::c_types::Signature) -> crate::c_types::Witness { + let mut ret = lightning::ln::chan_utils::build_anchor_input_witness(&funding_key.into_rust(), &funding_sig.into_rust()); + crate::c_types::Witness::from_bitcoin(&ret) +} + use lightning::ln::chan_utils::ChannelTransactionParameters as nativeChannelTransactionParametersImport; pub(crate) type nativeChannelTransactionParameters = nativeChannelTransactionParametersImport; @@ -877,7 +1005,7 @@ pub extern "C" fn ChannelTransactionParameters_free(this_obj: ChannelTransaction #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelTransactionParameters_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelTransactionParameters); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelTransactionParameters) }; } #[allow(unused)] impl ChannelTransactionParameters { @@ -981,13 +1109,31 @@ pub extern "C" fn ChannelTransactionParameters_set_opt_anchors(this_ptr: &mut Ch let mut local_val = if val.is_some() { Some( { () /*val.take()*/ }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.opt_anchors = local_val; } +/// Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors) +/// It is intended merely for backwards compatibility with signers that need it. +/// There is no support for this feature in LDK channel negotiation. +#[no_mangle] +pub extern "C" fn ChannelTransactionParameters_get_opt_non_zero_fee_anchors(this_ptr: &ChannelTransactionParameters) -> crate::c_types::derived::COption_NoneZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().opt_non_zero_fee_anchors; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_NoneZ::None } else { crate::c_types::derived::COption_NoneZ::Some /* { () /**/ } */ }; + local_inner_val +} +/// Are non-zero-fee anchors are enabled (used in conjuction with opt_anchors) +/// It is intended merely for backwards compatibility with signers that need it. +/// There is no support for this feature in LDK channel negotiation. +#[no_mangle] +pub extern "C" fn ChannelTransactionParameters_set_opt_non_zero_fee_anchors(this_ptr: &mut ChannelTransactionParameters, mut val: crate::c_types::derived::COption_NoneZ) { + let mut local_val = if val.is_some() { Some( { () /*val.take()*/ }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.opt_non_zero_fee_anchors = local_val; +} /// Constructs a new ChannelTransactionParameters given each field #[must_use] #[no_mangle] -pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::lightning::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut opt_anchors_arg: crate::c_types::derived::COption_NoneZ) -> ChannelTransactionParameters { +pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate::lightning::ln::chan_utils::ChannelPublicKeys, mut holder_selected_contest_delay_arg: u16, mut is_outbound_from_holder_arg: bool, mut counterparty_parameters_arg: crate::lightning::ln::chan_utils::CounterpartyChannelTransactionParameters, mut funding_outpoint_arg: crate::lightning::chain::transaction::OutPoint, mut opt_anchors_arg: crate::c_types::derived::COption_NoneZ, mut opt_non_zero_fee_anchors_arg: crate::c_types::derived::COption_NoneZ) -> ChannelTransactionParameters { let mut local_counterparty_parameters_arg = if counterparty_parameters_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(counterparty_parameters_arg.take_inner()) } }) }; let mut local_funding_outpoint_arg = if funding_outpoint_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_outpoint_arg.take_inner()) } }) }; let mut local_opt_anchors_arg = if opt_anchors_arg.is_some() { Some( { () /*opt_anchors_arg.take()*/ }) } else { None }; + let mut local_opt_non_zero_fee_anchors_arg = if opt_non_zero_fee_anchors_arg.is_some() { Some( { () /*opt_non_zero_fee_anchors_arg.take()*/ }) } else { None }; ChannelTransactionParameters { inner: ObjOps::heap_alloc(nativeChannelTransactionParameters { holder_pubkeys: *unsafe { Box::from_raw(holder_pubkeys_arg.take_inner()) }, holder_selected_contest_delay: holder_selected_contest_delay_arg, @@ -995,6 +1141,7 @@ pub extern "C" fn ChannelTransactionParameters_new(mut holder_pubkeys_arg: crate counterparty_parameters: local_counterparty_parameters_arg, funding_outpoint: local_funding_outpoint_arg, opt_anchors: local_opt_anchors_arg, + opt_non_zero_fee_anchors: local_opt_non_zero_fee_anchors_arg, }), is_owned: true } } impl Clone for ChannelTransactionParameters { @@ -1049,7 +1196,7 @@ pub extern "C" fn CounterpartyChannelTransactionParameters_free(this_obj: Counte #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CounterpartyChannelTransactionParameters_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCounterpartyChannelTransactionParameters); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCounterpartyChannelTransactionParameters) }; } #[allow(unused)] impl CounterpartyChannelTransactionParameters { @@ -1216,7 +1363,7 @@ pub extern "C" fn DirectedChannelTransactionParameters_free(this_obj: DirectedCh #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DirectedChannelTransactionParameters_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectedChannelTransactionParameters); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDirectedChannelTransactionParameters) }; } #[allow(unused)] impl DirectedChannelTransactionParameters { @@ -1321,7 +1468,7 @@ pub extern "C" fn HolderCommitmentTransaction_free(this_obj: HolderCommitmentTra #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn HolderCommitmentTransaction_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHolderCommitmentTransaction); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHolderCommitmentTransaction) }; } #[allow(unused)] impl HolderCommitmentTransaction { @@ -1443,7 +1590,7 @@ pub extern "C" fn BuiltCommitmentTransaction_free(this_obj: BuiltCommitmentTrans #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BuiltCommitmentTransaction_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBuiltCommitmentTransaction); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBuiltCommitmentTransaction) }; } #[allow(unused)] impl BuiltCommitmentTransaction { @@ -1589,7 +1736,7 @@ pub extern "C" fn ClosingTransaction_free(this_obj: ClosingTransaction) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ClosingTransaction_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingTransaction); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeClosingTransaction) }; } #[allow(unused)] impl ClosingTransaction { @@ -1750,7 +1897,7 @@ pub extern "C" fn TrustedClosingTransaction_free(this_obj: TrustedClosingTransac #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TrustedClosingTransaction_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeTrustedClosingTransaction); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTrustedClosingTransaction) }; } #[allow(unused)] impl TrustedClosingTransaction { @@ -1833,7 +1980,7 @@ pub extern "C" fn CommitmentTransaction_free(this_obj: CommitmentTransaction) { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CommitmentTransaction_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentTransaction); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentTransaction) }; } #[allow(unused)] impl CommitmentTransaction { @@ -1983,7 +2130,7 @@ pub extern "C" fn TrustedCommitmentTransaction_free(this_obj: TrustedCommitmentT #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn TrustedCommitmentTransaction_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeTrustedCommitmentTransaction); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeTrustedCommitmentTransaction) }; } #[allow(unused)] impl TrustedCommitmentTransaction { diff --git a/lightning-c-bindings/src/lightning/ln/channelmanager.rs b/lightning-c-bindings/src/lightning/ln/channelmanager.rs index 2c04328..78db7d8 100644 --- a/lightning-c-bindings/src/lightning/ln/channelmanager.rs +++ b/lightning-c-bindings/src/lightning/ln/channelmanager.rs @@ -28,7 +28,7 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::ln::channelmanager::ChannelManager as nativeChannelManagerImport; -pub(crate) type nativeChannelManager = nativeChannelManagerImport; +pub(crate) type nativeChannelManager = nativeChannelManagerImport; /// 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. @@ -94,7 +94,7 @@ pub extern "C" fn ChannelManager_free(this_obj: ChannelManager) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelManager_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelManager); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelManager) }; } #[allow(unused)] impl ChannelManager { @@ -149,7 +149,7 @@ pub extern "C" fn ChainParameters_free(this_obj: ChainParameters) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChainParameters_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChainParameters); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChainParameters) }; } #[allow(unused)] impl ChainParameters { @@ -278,7 +278,7 @@ pub extern "C" fn CounterpartyForwardingInfo_free(this_obj: CounterpartyForwardi #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CounterpartyForwardingInfo_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCounterpartyForwardingInfo); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCounterpartyForwardingInfo) }; } #[allow(unused)] impl CounterpartyForwardingInfo { @@ -396,7 +396,7 @@ pub extern "C" fn ChannelCounterparty_free(this_obj: ChannelCounterparty) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelCounterparty_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelCounterparty); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelCounterparty) }; } #[allow(unused)] impl ChannelCounterparty { @@ -580,7 +580,7 @@ pub extern "C" fn ChannelDetails_free(this_obj: ChannelDetails) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelDetails_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelDetails); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelDetails) }; } #[allow(unused)] impl ChannelDetails { @@ -809,16 +809,20 @@ pub extern "C" fn ChannelDetails_set_unspendable_punishment_reserve(this_ptr: &m let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.unspendable_punishment_reserve = local_val; } -/// The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. +/// The `user_channel_id` passed in to create_channel, or a random value if the channel was +/// inbound. This may be zero for inbound channels serialized with LDK versions prior to +/// 0.0.113. #[no_mangle] -pub extern "C" fn ChannelDetails_get_user_channel_id(this_ptr: &ChannelDetails) -> u64 { +pub extern "C" fn ChannelDetails_get_user_channel_id(this_ptr: &ChannelDetails) -> crate::c_types::U128 { let mut inner_val = &mut this_ptr.get_native_mut_ref().user_channel_id; - *inner_val + inner_val.into() } -/// The `user_channel_id` passed in to create_channel, or 0 if the channel was inbound. +/// The `user_channel_id` passed in to create_channel, or a random value if the channel was +/// inbound. This may be zero for inbound channels serialized with LDK versions prior to +/// 0.0.113. #[no_mangle] -pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetails, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val; +pub extern "C" fn ChannelDetails_set_user_channel_id(this_ptr: &mut ChannelDetails, mut val: crate::c_types::U128) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.user_channel_id = val.into(); } /// Our total balance. This is the amount we would get if we close the channel. /// This value is not exact. Due to various in-flight changes and feerate changes, exactly this @@ -959,6 +963,23 @@ pub extern "C" fn ChannelDetails_set_confirmations_required(this_ptr: &mut Chann let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations_required = local_val; } +/// The current number of confirmations on the funding transaction. +/// +/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113. +#[no_mangle] +pub extern "C" fn ChannelDetails_get_confirmations(this_ptr: &ChannelDetails) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().confirmations; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// The current number of confirmations on the funding transaction. +/// +/// This value will be `None` for objects serialized with LDK versions prior to 0.0.113. +#[no_mangle] +pub extern "C" fn ChannelDetails_set_confirmations(this_ptr: &mut ChannelDetails, mut val: crate::c_types::derived::COption_u32Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.confirmations = local_val; +} /// The number of blocks (after our commitment transaction confirms) that we will need to wait /// until we can claim our funds after we force-close the channel. During this time our /// counterparty is allowed to punish us if we broadcasted a stale state. If our counterparty @@ -1098,7 +1119,7 @@ pub extern "C" fn ChannelDetails_set_config(this_ptr: &mut ChannelDetails, mut v /// Constructs a new ChannelDetails given each field #[must_use] #[no_mangle] -pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut counterparty_arg: crate::lightning::ln::channelmanager::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut outbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut inbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: u64, mut balance_msat_arg: u64, mut outbound_capacity_msat_arg: u64, mut next_outbound_htlc_limit_msat_arg: u64, mut inbound_capacity_msat_arg: u64, mut confirmations_required_arg: crate::c_types::derived::COption_u32Z, mut force_close_spend_delay_arg: crate::c_types::derived::COption_u16Z, mut is_outbound_arg: bool, mut is_channel_ready_arg: bool, mut is_usable_arg: bool, mut is_public_arg: bool, mut inbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut inbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut config_arg: crate::lightning::util::config::ChannelConfig) -> ChannelDetails { +pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyTwoBytes, mut counterparty_arg: crate::lightning::ln::channelmanager::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning::ln::features::ChannelTypeFeatures, mut short_channel_id_arg: crate::c_types::derived::COption_u64Z, mut outbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut inbound_scid_alias_arg: crate::c_types::derived::COption_u64Z, mut channel_value_satoshis_arg: u64, mut unspendable_punishment_reserve_arg: crate::c_types::derived::COption_u64Z, mut user_channel_id_arg: crate::c_types::U128, mut balance_msat_arg: u64, mut outbound_capacity_msat_arg: u64, mut next_outbound_htlc_limit_msat_arg: u64, mut inbound_capacity_msat_arg: u64, mut confirmations_required_arg: crate::c_types::derived::COption_u32Z, mut confirmations_arg: crate::c_types::derived::COption_u32Z, mut force_close_spend_delay_arg: crate::c_types::derived::COption_u16Z, mut is_outbound_arg: bool, mut is_channel_ready_arg: bool, mut is_usable_arg: bool, mut is_public_arg: bool, mut inbound_htlc_minimum_msat_arg: crate::c_types::derived::COption_u64Z, mut inbound_htlc_maximum_msat_arg: crate::c_types::derived::COption_u64Z, mut config_arg: crate::lightning::util::config::ChannelConfig) -> ChannelDetails { let mut local_funding_txo_arg = if funding_txo_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(funding_txo_arg.take_inner()) } }) }; let mut local_channel_type_arg = if channel_type_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_type_arg.take_inner()) } }) }; let mut local_short_channel_id_arg = if short_channel_id_arg.is_some() { Some( { short_channel_id_arg.take() }) } else { None }; @@ -1106,6 +1127,7 @@ pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyT let mut local_inbound_scid_alias_arg = if inbound_scid_alias_arg.is_some() { Some( { inbound_scid_alias_arg.take() }) } else { None }; let mut local_unspendable_punishment_reserve_arg = if unspendable_punishment_reserve_arg.is_some() { Some( { unspendable_punishment_reserve_arg.take() }) } else { None }; let mut local_confirmations_required_arg = if confirmations_required_arg.is_some() { Some( { confirmations_required_arg.take() }) } else { None }; + let mut local_confirmations_arg = if confirmations_arg.is_some() { Some( { confirmations_arg.take() }) } else { None }; let mut local_force_close_spend_delay_arg = if force_close_spend_delay_arg.is_some() { Some( { force_close_spend_delay_arg.take() }) } else { None }; let mut local_inbound_htlc_minimum_msat_arg = if inbound_htlc_minimum_msat_arg.is_some() { Some( { inbound_htlc_minimum_msat_arg.take() }) } else { None }; let mut local_inbound_htlc_maximum_msat_arg = if inbound_htlc_maximum_msat_arg.is_some() { Some( { inbound_htlc_maximum_msat_arg.take() }) } else { None }; @@ -1120,12 +1142,13 @@ pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::c_types::ThirtyT inbound_scid_alias: local_inbound_scid_alias_arg, channel_value_satoshis: channel_value_satoshis_arg, unspendable_punishment_reserve: local_unspendable_punishment_reserve_arg, - user_channel_id: user_channel_id_arg, + user_channel_id: user_channel_id_arg.into(), balance_msat: balance_msat_arg, outbound_capacity_msat: outbound_capacity_msat_arg, next_outbound_htlc_limit_msat: next_outbound_htlc_limit_msat_arg, inbound_capacity_msat: inbound_capacity_msat_arg, confirmations_required: local_confirmations_required_arg, + confirmations: local_confirmations_arg, force_close_spend_delay: local_force_close_spend_delay_arg, is_outbound: is_outbound_arg, is_channel_ready: is_channel_ready_arg, @@ -1191,24 +1214,43 @@ pub extern "C" fn ChannelDetails_get_outbound_payment_scid(this_arg: &crate::lig #[repr(C)] pub enum PaymentSendFailure { /// 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. + /// send the payment at all. + /// + /// You can freely resend the payment in full (with the parameter error fixed). + /// + /// Because the payment failed outright, no payment tracking is done, you do not need to call + /// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work + /// for this payment. ParameterError( crate::lightning::util::errors::APIError), /// 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. + /// from attempting to send the payment at all. + /// + /// You can freely resend the payment in full (with the parameter error fixed). /// /// The results here are ordered the same as the paths in the route object which was passed to /// send_payment. + /// + /// Because the payment failed outright, no payment tracking is done, you do not need to call + /// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work + /// for this payment. PathParameterError( crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ), /// 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 + /// You can freely resend the payment in full (though you probably want to do so over different /// paths than the ones selected). - AllFailedRetrySafe( + /// + /// Because the payment failed outright, no payment tracking is done, you do not need to call + /// [`ChannelManager::abandon_payment`] and [`ChannelManager::retry_payment`] will *not* work + /// for this payment. + AllFailedResendSafe( crate::c_types::derived::CVec_APIErrorZ), + /// Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not + /// yet completed (i.e. generated an [`Event::PaymentSent`]) or been abandoned (via + /// [`ChannelManager::abandon_payment`]). + /// + /// [`Event::PaymentSent`]: events::Event::PaymentSent + DuplicatePayment, /// 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. @@ -1242,31 +1284,32 @@ impl PaymentSendFailure { pub(crate) fn to_native(&self) -> nativePaymentSendFailure { match self { PaymentSendFailure::ParameterError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativePaymentSendFailure::ParameterError ( a_nonref.into_native(), ) }, PaymentSendFailure::PathParameterError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); let mut local_a_nonref = Vec::new(); for mut item in a_nonref.into_rust().drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.err)) }).into_native() })}; local_a_nonref_0 }); }; nativePaymentSendFailure::PathParameterError ( local_a_nonref, ) }, - PaymentSendFailure::AllFailedRetrySafe (ref a, ) => { - let mut a_nonref = (*a).clone(); + PaymentSendFailure::AllFailedResendSafe (ref a, ) => { + let mut a_nonref = Clone::clone(a); let mut local_a_nonref = Vec::new(); for mut item in a_nonref.into_rust().drain(..) { local_a_nonref.push( { item.into_native() }); }; - nativePaymentSendFailure::AllFailedRetrySafe ( + nativePaymentSendFailure::AllFailedResendSafe ( local_a_nonref, ) }, + PaymentSendFailure::DuplicatePayment => nativePaymentSendFailure::DuplicatePayment, PaymentSendFailure::PartialFailure {ref results, ref failed_paths_retry, ref payment_id, } => { - let mut results_nonref = (*results).clone(); + let mut results_nonref = Clone::clone(results); let mut local_results_nonref = Vec::new(); for mut item in results_nonref.into_rust().drain(..) { local_results_nonref.push( { let mut local_results_nonref_0 = match item.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.err)) }).into_native() })}; local_results_nonref_0 }); }; - let mut failed_paths_retry_nonref = (*failed_paths_retry).clone(); + let mut failed_paths_retry_nonref = Clone::clone(failed_paths_retry); let mut local_failed_paths_retry_nonref = if failed_paths_retry_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(failed_paths_retry_nonref.take_inner()) } }) }; - let mut payment_id_nonref = (*payment_id).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); nativePaymentSendFailure::PartialFailure { results: local_results_nonref, failed_paths_retry: local_failed_paths_retry_nonref, @@ -1289,12 +1332,13 @@ impl PaymentSendFailure { local_a, ) }, - PaymentSendFailure::AllFailedRetrySafe (mut a, ) => { + PaymentSendFailure::AllFailedResendSafe (mut a, ) => { let mut local_a = Vec::new(); for mut item in a.into_rust().drain(..) { local_a.push( { item.into_native() }); }; - nativePaymentSendFailure::AllFailedRetrySafe ( + nativePaymentSendFailure::AllFailedResendSafe ( local_a, ) }, + PaymentSendFailure::DuplicatePayment => nativePaymentSendFailure::DuplicatePayment, PaymentSendFailure::PartialFailure {mut results, mut failed_paths_retry, mut payment_id, } => { let mut local_results = Vec::new(); for mut item in results.into_rust().drain(..) { local_results.push( { let mut local_results_0 = match item.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut item.contents.err)) }).into_native() })}; local_results_0 }); }; let mut local_failed_paths_retry = if failed_paths_retry.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(failed_paths_retry.take_inner()) } }) }; @@ -1310,31 +1354,32 @@ impl PaymentSendFailure { pub(crate) fn from_native(native: &nativePaymentSendFailure) -> Self { match native { nativePaymentSendFailure::ParameterError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); PaymentSendFailure::ParameterError ( crate::lightning::util::errors::APIError::native_into(a_nonref), ) }, nativePaymentSendFailure::PathParameterError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); let mut local_a_nonref = Vec::new(); for mut item in a_nonref.drain(..) { local_a_nonref.push( { let mut local_a_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_a_nonref_0 }); }; PaymentSendFailure::PathParameterError ( local_a_nonref.into(), ) }, - nativePaymentSendFailure::AllFailedRetrySafe (ref a, ) => { - let mut a_nonref = (*a).clone(); + nativePaymentSendFailure::AllFailedResendSafe (ref a, ) => { + let mut a_nonref = Clone::clone(a); let mut local_a_nonref = Vec::new(); for mut item in a_nonref.drain(..) { local_a_nonref.push( { crate::lightning::util::errors::APIError::native_into(item) }); }; - PaymentSendFailure::AllFailedRetrySafe ( + PaymentSendFailure::AllFailedResendSafe ( local_a_nonref.into(), ) }, + nativePaymentSendFailure::DuplicatePayment => PaymentSendFailure::DuplicatePayment, nativePaymentSendFailure::PartialFailure {ref results, ref failed_paths_retry, ref payment_id, } => { - let mut results_nonref = (*results).clone(); + let mut results_nonref = Clone::clone(results); let mut local_results_nonref = Vec::new(); for mut item in results_nonref.drain(..) { local_results_nonref.push( { let mut local_results_nonref_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_results_nonref_0 }); }; - let mut failed_paths_retry_nonref = (*failed_paths_retry).clone(); + let mut failed_paths_retry_nonref = Clone::clone(failed_paths_retry); let mut local_failed_paths_retry_nonref = crate::lightning::routing::router::RouteParameters { inner: if failed_paths_retry_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((failed_paths_retry_nonref.unwrap())) } }, is_owned: true }; - let mut payment_id_nonref = (*payment_id).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); PaymentSendFailure::PartialFailure { results: local_results_nonref.into(), failed_paths_retry: local_failed_paths_retry_nonref, @@ -1357,12 +1402,13 @@ impl PaymentSendFailure { local_a.into(), ) }, - nativePaymentSendFailure::AllFailedRetrySafe (mut a, ) => { + nativePaymentSendFailure::AllFailedResendSafe (mut a, ) => { let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { crate::lightning::util::errors::APIError::native_into(item) }); }; - PaymentSendFailure::AllFailedRetrySafe ( + PaymentSendFailure::AllFailedResendSafe ( local_a.into(), ) }, + nativePaymentSendFailure::DuplicatePayment => PaymentSendFailure::DuplicatePayment, nativePaymentSendFailure::PartialFailure {mut results, mut failed_paths_retry, mut payment_id, } => { let mut local_results = Vec::new(); for mut item in results.drain(..) { local_results.push( { let mut local_results_0 = match item { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_results_0 }); }; let mut local_failed_paths_retry = crate::lightning::routing::router::RouteParameters { inner: if failed_paths_retry.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((failed_paths_retry.unwrap())) } }, is_owned: true }; @@ -1394,11 +1440,15 @@ pub extern "C" fn PaymentSendFailure_path_parameter_error(a: crate::c_types::der PaymentSendFailure::PathParameterError(a, ) } #[no_mangle] -/// Utility method to constructs a new AllFailedRetrySafe-variant PaymentSendFailure -pub extern "C" fn PaymentSendFailure_all_failed_retry_safe(a: crate::c_types::derived::CVec_APIErrorZ) -> PaymentSendFailure { - PaymentSendFailure::AllFailedRetrySafe(a, ) +/// Utility method to constructs a new AllFailedResendSafe-variant PaymentSendFailure +pub extern "C" fn PaymentSendFailure_all_failed_resend_safe(a: crate::c_types::derived::CVec_APIErrorZ) -> PaymentSendFailure { + PaymentSendFailure::AllFailedResendSafe(a, ) } #[no_mangle] +/// Utility method to constructs a new DuplicatePayment-variant PaymentSendFailure +pub extern "C" fn PaymentSendFailure_duplicate_payment() -> PaymentSendFailure { + PaymentSendFailure::DuplicatePayment} +#[no_mangle] /// Utility method to constructs a new PartialFailure-variant PaymentSendFailure pub extern "C" fn PaymentSendFailure_partial_failure(results: crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ, failed_paths_retry: crate::lightning::routing::router::RouteParameters, payment_id: crate::c_types::ThirtyTwoBytes) -> PaymentSendFailure { PaymentSendFailure::PartialFailure { @@ -1442,7 +1492,7 @@ pub extern "C" fn PhantomRouteHints_free(this_obj: PhantomRouteHints) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PhantomRouteHints_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePhantomRouteHints); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePhantomRouteHints) }; } #[allow(unused)] impl PhantomRouteHints { @@ -1556,10 +1606,9 @@ pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &cr /// /// `user_channel_id` will be provided back as in /// [`Event::FundingGenerationReady::user_channel_id`] to allow tracking of which events -/// correspond with which `create_channel` call. Note that the `user_channel_id` defaults to 0 -/// for inbound channels, so you may wish to avoid using 0 for `user_channel_id` here. -/// `user_channel_id` has no meaning inside of LDK, it is simply copied to events and otherwise -/// ignored. +/// correspond with which `create_channel` call. Note that the `user_channel_id` defaults to a +/// randomized value for inbound channels. `user_channel_id` has no meaning inside of LDK, it +/// is simply copied to events and otherwise ignored. /// /// Raises [`APIError::APIMisuseError`] when `channel_value_satoshis` > 2**24 or `push_msat` is /// greater than `channel_value_satoshis * 1k` or `channel_value_satoshis < 1000`. @@ -1582,9 +1631,9 @@ pub extern "C" fn ChannelManager_get_current_default_configuration(this_arg: &cr /// Note that override_config (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_create_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut their_network_key: crate::c_types::PublicKey, mut channel_value_satoshis: u64, mut push_msat: u64, mut user_channel_id: u64, mut override_config: crate::lightning::util::config::UserConfig) -> crate::c_types::derived::CResult__u832APIErrorZ { +pub extern "C" fn ChannelManager_create_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut their_network_key: crate::c_types::PublicKey, mut channel_value_satoshis: u64, mut push_msat: u64, mut user_channel_id: crate::c_types::U128, mut override_config: crate::lightning::util::config::UserConfig) -> crate::c_types::derived::CResult__u832APIErrorZ { let mut local_override_config = if override_config.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(override_config.take_inner()) } }) }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_channel(their_network_key.into_rust(), channel_value_satoshis, push_msat, user_channel_id, local_override_config); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_channel(their_network_key.into_rust(), channel_value_satoshis, push_msat, user_channel_id.into(), local_override_config); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret } @@ -1712,21 +1761,27 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t /// Value parameters are provided via the last hop in route, see documentation for RouteHop /// fields for more info. /// -/// Note that if the payment_hash already exists elsewhere (eg you're sending a duplicative -/// payment), we don't do anything to stop you! We always try to ensure that if the provided -/// next hop knows the preimage to payment_hash they can claim an additional amount as -/// specified in the last hop in the route! Thus, you should probably do your own -/// payment_preimage tracking (which you should already be doing as they represent \"proof of -/// payment\") and prevent double-sends yourself. +/// If a pending payment is currently in-flight with the same [`PaymentId`] provided, this +/// method will error with an [`APIError::InvalidRoute`]. Note, however, that once a payment +/// is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of an +/// [`Event::PaymentSent`]) LDK will not stop you from sending a second payment with the same +/// [`PaymentId`]. /// -/// May generate SendHTLCs message(s) event on success, which should be relayed. +/// Thus, in order to ensure duplicate payments are not sent, you should implement your own +/// tracking of payments, including state to indicate once a payment has completed. Because you +/// should also ensure that [`PaymentHash`]es are not re-used, for simplicity, you should +/// consider using the [`PaymentHash`] as the key for tracking payments. In that case, the +/// [`PaymentId`] should be a copy of the [`PaymentHash`] bytes. +/// +/// May generate SendHTLCs message(s) event on success, which should be relayed (e.g. via +/// [`PeerManager::process_events`]). /// /// Each path may have a different return value, and PaymentSendValue may return a Vec with /// each entry matching the corresponding-index entry in the route paths, see /// PaymentSendFailure for more info. /// /// In general, a path may raise: -/// * [`APIError::RouteError`] when an invalid route or forwarding parameter (cltv_delta, fee, +/// * [`APIError::InvalidRoute`] when an invalid route or forwarding parameter (cltv_delta, fee, /// node public key) is specified. /// * [`APIError::ChannelUnavailable`] if the next-hop channel is not available for updates /// (including due to previous monitor update failure or new permanent monitor update @@ -1743,17 +1798,21 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t /// newer nodes, it will be provided to you in the invoice. If you do not have one, the Route /// must not contain multiple paths as multi-path payments require a recipient-provided /// payment_secret. +/// /// If a payment_secret *is* provided, we assume that the invoice had the payment_secret feature /// bit set (either as required or as available). If multiple paths are present in the Route, /// we assume the invoice had the basic_mpp feature set. /// +/// [`Event::PaymentSent`]: events::Event::PaymentSent +/// [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events +/// /// Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ { +pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ { let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentSecret(payment_secret.data) }) }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment(route.get_native_ref(), ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment(route.get_native_ref(), ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; local_ret } @@ -1777,15 +1836,21 @@ pub extern "C" fn ChannelManager_retry_payment(this_arg: &crate::lightning::ln:: /// Signals that no further retries for the given payment will occur. /// -/// After this method returns, any future calls to [`retry_payment`] for the given `payment_id` -/// will fail with [`PaymentSendFailure::ParameterError`]. If no such event has been generated, -/// an [`Event::PaymentFailed`] event will be generated as soon as there are no remaining -/// pending HTLCs for this payment. +/// After this method returns, no future calls to [`retry_payment`] for the given `payment_id` +/// are allowed. If no [`Event::PaymentFailed`] event had been generated before, one will be +/// generated as soon as there are no remaining pending HTLCs for this payment. /// /// Note that calling this method does *not* prevent a payment from succeeding. You must still /// wait until you receive either a [`Event::PaymentFailed`] or [`Event::PaymentSent`] event to /// determine the ultimate status of a payment. /// +/// If an [`Event::PaymentFailed`] event is generated and we restart without this +/// [`ChannelManager`] having been persisted, the payment may still be in the pending state +/// upon restart. This allows further calls to [`retry_payment`] (and requiring a second call +/// to [`abandon_payment`] to mark the payment as failed again). Otherwise, future calls to +/// [`retry_payment`] will fail with [`PaymentSendFailure::ParameterError`]. +/// +/// [`abandon_payment`]: Self::abandon_payment /// [`retry_payment`]: Self::retry_payment /// [`Event::PaymentFailed`]: events::Event::PaymentFailed /// [`Event::PaymentSent`]: events::Event::PaymentSent @@ -1800,7 +1865,8 @@ pub extern "C" fn ChannelManager_abandon_payment(this_arg: &crate::lightning::ln /// would be able to guess -- otherwise, an intermediate node may claim the payment and it will /// never reach the recipient. /// -/// See [`send_payment`] documentation for more details on the return value of this function. +/// See [`send_payment`] documentation for more details on the return value of this function +/// and idempotency guarantees provided by the [`PaymentId`] key. /// /// Similar to regular payments, you MUST NOT reuse a `payment_preimage` value. See /// [`send_payment`] for more information about the risks of duplicate preimage usage. @@ -1812,10 +1878,10 @@ pub extern "C" fn ChannelManager_abandon_payment(this_arg: &crate::lightning::ln /// Note that payment_preimage (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentIdZPaymentSendFailureZ { +pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentHashPaymentSendFailureZ { let mut local_payment_preimage = if payment_preimage.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentPreimage(payment_preimage.data) }) }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment(route.get_native_ref(), local_payment_preimage); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment(route.get_native_ref(), local_payment_preimage, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; local_ret } @@ -1900,6 +1966,49 @@ pub extern "C" fn ChannelManager_update_channel_config(this_arg: &crate::lightni local_ret } +/// Attempts to forward an intercepted HTLC over the provided channel id and with the provided +/// amount to forward. Should only be called in response to an [`HTLCIntercepted`] event. +/// +/// Intercepted HTLCs can be useful for Lightning Service Providers (LSPs) to open a just-in-time +/// channel to a receiving node if the node lacks sufficient inbound liquidity. +/// +/// To make use of intercepted HTLCs, set [`UserConfig::accept_intercept_htlcs`] and use +/// [`ChannelManager::get_intercept_scid`] to generate short channel id(s) to put in the +/// receiver's invoice route hints. These route hints will signal to LDK to generate an +/// [`HTLCIntercepted`] event when it receives the forwarded HTLC, and this method or +/// [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to the event. +/// +/// Note that LDK does not enforce fee requirements in `amt_to_forward_msat`, and will not stop +/// you from forwarding more than you received. +/// +/// Errors if the event was not handled in time, in which case the HTLC was automatically failed +/// backwards. +/// +/// [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs +/// [`HTLCIntercepted`]: events::Event::HTLCIntercepted +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_forward_intercepted_htlc(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut intercept_id: crate::c_types::ThirtyTwoBytes, next_hop_channel_id: *const [u8; 32], mut _next_node_id: crate::c_types::PublicKey, mut amt_to_forward_msat: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.forward_intercepted_htlc(::lightning::ln::channelmanager::InterceptId(intercept_id.data), unsafe { &*next_hop_channel_id}, _next_node_id.into_rust(), amt_to_forward_msat); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; + local_ret +} + +/// Fails the intercepted HTLC indicated by intercept_id. Should only be called in response to +/// an [`HTLCIntercepted`] event. See [`ChannelManager::forward_intercepted_htlc`]. +/// +/// Errors if the event was not handled in time, in which case the HTLC was automatically failed +/// backwards. +/// +/// [`HTLCIntercepted`]: events::Event::HTLCIntercepted +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_fail_intercepted_htlc(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut intercept_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_intercepted_htlc(::lightning::ln::channelmanager::InterceptId(intercept_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; + local_ret +} + /// Processes HTLCs which are pending waiting on random forward delay. /// /// Should only really ever be called in response to a PendingHTLCsForwardable event. @@ -1927,12 +2036,12 @@ pub extern "C" fn ChannelManager_timer_tick_occurred(this_arg: &crate::lightning } /// 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 +/// after a PaymentClaimable event, failing the HTLC back to its origin and freeing resources /// along the path (including in our own channel on which we received it). /// /// 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 +/// second copy of) the [`events::Event::PaymentClaimable`] 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 @@ -1944,7 +2053,7 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &crate::lightning unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards(&::lightning::ln::PaymentHash(unsafe { *payment_hash })) } -/// Provides a payment preimage in response to [`Event::PaymentReceived`], generating any +/// Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any /// [`MessageSendEvent`]s needed to claim the payment. /// /// Note that calling this method does *not* guarantee that the payment has been claimed. You @@ -1952,16 +2061,15 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &crate::lightning /// 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` +/// [`create_inbound_payment_for_hash`] you must check that the amount in the `PaymentClaimable` /// event matches your expectation. If you fail to do so and call this method, you may provide /// the sender \"proof-of-payment\" when they did not fulfill the full expected payment. /// -/// [`Event::PaymentReceived`]: crate::util::events::Event::PaymentReceived +/// [`Event::PaymentClaimable`]: crate::util::events::Event::PaymentClaimable /// [`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 #[no_mangle] pub extern "C" fn ChannelManager_claim_funds(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds(::lightning::ln::PaymentPreimage(payment_preimage.data)) @@ -1993,8 +2101,8 @@ pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &crate::lightning::ln /// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id); +pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: crate::c_types::U128) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id.into()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret } @@ -2019,8 +2127,8 @@ pub extern "C" fn ChannelManager_accept_inbound_channel(this_arg: &crate::lightn /// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: u64) -> crate::c_types::derived::CResult_NoneAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel_from_trusted_peer_0conf(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id); +pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, temporary_channel_id: *const [u8; 32], mut counterparty_node_id: crate::c_types::PublicKey, mut user_channel_id: crate::c_types::U128) -> crate::c_types::derived::CResult_NoneAPIErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.accept_inbound_channel_from_trusted_peer_0conf(unsafe { &*temporary_channel_id}, &counterparty_node_id.into_rust(), user_channel_id.into()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::util::errors::APIError::native_into(e) }).into() }; local_ret } @@ -2031,8 +2139,8 @@ pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf( /// This differs from [`create_inbound_payment_for_hash`] only in that it generates the /// [`PaymentHash`] and [`PaymentPreimage`] for you. /// -/// The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentReceived`], which -/// will have the [`PaymentReceived::payment_preimage`] field filled in. That should then be +/// The [`PaymentPreimage`] will ultimately be returned to you in the [`PaymentClaimable`], which +/// will have the [`PaymentClaimable::payment_preimage`] field filled in. That should then be /// passed directly to [`claim_funds`]. /// /// See [`create_inbound_payment_for_hash`] for detailed documentation on behavior and requirements. @@ -2048,8 +2156,8 @@ pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf( /// Errors if `min_value_msat` is greater than total bitcoin supply. /// /// [`claim_funds`]: Self::claim_funds -/// [`PaymentReceived`]: events::Event::PaymentReceived -/// [`PaymentReceived::payment_preimage`]: events::Event::PaymentReceived::payment_preimage +/// [`PaymentClaimable`]: events::Event::PaymentClaimable +/// [`PaymentClaimable::payment_preimage`]: events::Event::PaymentClaimable::payment_preimage /// [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash #[must_use] #[no_mangle] @@ -2081,7 +2189,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &crate: /// Gets a [`PaymentSecret`] for a given [`PaymentHash`], for which the payment preimage is /// stored external to LDK. /// -/// A [`PaymentReceived`] event will only be generated if the [`PaymentSecret`] matches a +/// A [`PaymentClaimable`] event will only be generated if the [`PaymentSecret`] matches a /// payment secret fetched via this method or [`create_inbound_payment`], and which is at least /// the `min_value_msat` provided here, if one is provided. /// @@ -2091,7 +2199,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &crate: /// /// `min_value_msat` should be set if the invoice being generated contains a value. Any payment /// received for the returned [`PaymentHash`] will be required to be at least `min_value_msat` -/// before a [`PaymentReceived`] event will be generated, ensuring that we do not provide the +/// before a [`PaymentClaimable`] event will be generated, ensuring that we do not provide the /// sender \"proof-of-payment\" unless they have paid the required amount. /// /// `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for @@ -2102,9 +2210,9 @@ pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &crate: /// /// Note that we use block header time to time-out pending inbound payments (with some margin /// to compensate for the inaccuracy of block header timestamps). Thus, in practice we will -/// accept a payment and generate a [`PaymentReceived`] event for some time after the expiry. +/// accept a payment and generate a [`PaymentClaimable`] event for some time after the expiry. /// If you need exact expiry semantics, you should enforce them upon receipt of -/// [`PaymentReceived`]. +/// [`PaymentClaimable`]. /// /// Note that invoices generated for inbound payments should have their `min_final_cltv_expiry` /// set to at least [`MIN_FINAL_CLTV_EXPIRY`]. @@ -2120,7 +2228,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_legacy(this_arg: &crate: /// Errors if `min_value_msat` is greater than total bitcoin supply. /// /// [`create_inbound_payment`]: Self::create_inbound_payment -/// [`PaymentReceived`]: events::Event::PaymentReceived +/// [`PaymentClaimable`]: events::Event::PaymentClaimable #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_PaymentSecretNoneZ { @@ -2181,6 +2289,28 @@ pub extern "C" fn ChannelManager_get_phantom_route_hints(this_arg: &crate::light crate::lightning::ln::channelmanager::PhantomRouteHints { inner: ObjOps::heap_alloc(ret), is_owned: true } } +/// Gets a fake short channel id for use in receiving intercepted payments. These fake scids are +/// used when constructing the route hints for HTLCs intended to be intercepted. See +/// [`ChannelManager::forward_intercepted_htlc`]. +/// +/// Note that this method is not guaranteed to return unique values, you may need to call it a few +/// times to get a unique scid. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_get_intercept_scid(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> u64 { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_intercept_scid(); + ret +} + +/// Gets inflight HTLC information by processing pending outbound payments that are in +/// our channels. May be used during pathfinding to account for in-use channel liquidity. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_compute_inflight_htlcs(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) -> crate::lightning::routing::router::InFlightHtlcs { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.compute_inflight_htlcs(); + crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + impl From for crate::lightning::util::events::MessageSendEventsProvider { fn from(obj: nativeChannelManager) -> Self { let mut rust_obj = ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -2303,18 +2433,22 @@ extern "C" fn ChannelManager_Confirm_best_block_updated(this_arg: *const c_void, >::best_block_updated(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &::bitcoin::consensus::encode::deserialize(unsafe { &*header }).unwrap(), height) } #[must_use] -extern "C" fn ChannelManager_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_TxidZ { +extern "C" fn ChannelManager_Confirm_get_relevant_txids(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_TxidBlockHashZZ { let mut ret = >::get_relevant_txids(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); - let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.into_inner() } }); }; + let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { let (mut orig_ret_0_0, mut orig_ret_0_1) = item; let mut local_orig_ret_0_1 = if orig_ret_0_1.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (orig_ret_0_1.unwrap()).into_inner() } } }; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.into_inner() }, local_orig_ret_0_1).into(); local_ret_0 }); }; local_ret.into() } /// Blocks until ChannelManager needs to be persisted or a timeout is reached. It returns a bool /// indicating whether persistence is necessary. Only one listener on -/// `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken -/// up. +/// [`await_persistable_update`], [`await_persistable_update_timeout`], or a future returned by +/// [`get_persistable_update_future`] is guaranteed to be woken up. /// /// Note that this method is not available with the `no-std` feature. +/// +/// [`await_persistable_update`]: Self::await_persistable_update +/// [`await_persistable_update_timeout`]: Self::await_persistable_update_timeout +/// [`get_persistable_update_future`]: Self::get_persistable_update_future #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_await_persistable_update_timeout(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut max_wait: u64) -> bool { @@ -2323,8 +2457,11 @@ pub extern "C" fn ChannelManager_await_persistable_update_timeout(this_arg: &cra } /// Blocks until ChannelManager needs to be persisted. Only one listener on -/// `await_persistable_update` or `await_persistable_update_timeout` is guaranteed to be woken -/// up. +/// [`await_persistable_update`], `await_persistable_update_timeout`, or a future returned by +/// [`get_persistable_update_future`] is guaranteed to be woken up. +/// +/// [`await_persistable_update`]: Self::await_persistable_update +/// [`get_persistable_update_future`]: Self::get_persistable_update_future #[no_mangle] pub extern "C" fn ChannelManager_await_persistable_update(this_arg: &crate::lightning::ln::channelmanager::ChannelManager) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.await_persistable_update() @@ -2569,7 +2706,7 @@ pub(crate) extern "C" fn ChannelManager_write_void(obj: *const c_void) -> crate: } use lightning::ln::channelmanager::ChannelManagerReadArgs as nativeChannelManagerReadArgsImport; -pub(crate) type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>; +pub(crate) type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger>; /// Arguments for the creation of a ChannelManager that are not deserialized. /// @@ -2631,7 +2768,7 @@ pub extern "C" fn ChannelManagerReadArgs_free(this_obj: ChannelManagerReadArgs) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelManagerReadArgs_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelManagerReadArgs); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelManagerReadArgs) }; } #[allow(unused)] impl ChannelManagerReadArgs { @@ -2754,7 +2891,7 @@ pub extern "C" fn ChannelManagerReadArgs_new(mut keys_manager: crate::lightning: /// Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write pub extern "C" fn C2Tuple_BlockHashChannelManagerZ_read(ser: crate::c_types::u8slice, arg: crate::lightning::ln::channelmanager::ChannelManagerReadArgs) -> crate::c_types::derived::CResult_C2Tuple_BlockHashChannelManagerZDecodeErrorZ { let arg_conv = *unsafe { Box::from_raw(arg.take_inner()) }; - let res: Result<(bitcoin::hash_types::BlockHash, lightning::ln::channelmanager::ChannelManager), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv); + let res: Result<(bitcoin::hash_types::BlockHash, lightning::ln::channelmanager::ChannelManager), lightning::ln::msgs::DecodeError> = crate::c_types::deserialize_obj_arg(ser, arg_conv); let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_res_0_0, mut orig_res_0_1) = o; let mut local_res_0 = (crate::c_types::ThirtyTwoBytes { data: orig_res_0_0.into_inner() }, crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(orig_res_0_1), is_owned: true }).into(); local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } diff --git a/lightning-c-bindings/src/lightning/ln/features.rs b/lightning-c-bindings/src/lightning/ln/features.rs index 4b41c11..44fa8d3 100644 --- a/lightning-c-bindings/src/lightning/ln/features.rs +++ b/lightning-c-bindings/src/lightning/ln/features.rs @@ -1054,6 +1054,24 @@ pub extern "C" fn InvoiceFeatures_eq(a: &InvoiceFeatures, b: &InvoiceFeatures) - if a.inner.is_null() || b.inner.is_null() { return false; } if a.get_native_ref() == b.get_native_ref() { true } else { false } } +/// Checks if two OfferFeaturess 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. +#[no_mangle] +pub extern "C" fn OfferFeatures_eq(a: &OfferFeatures, b: &OfferFeatures) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if a.get_native_ref() == b.get_native_ref() { true } else { false } +} +/// Checks if two InvoiceRequestFeaturess 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. +#[no_mangle] +pub extern "C" fn InvoiceRequestFeatures_eq(a: &InvoiceRequestFeatures, b: &InvoiceRequestFeatures) -> bool { + if a.inner == b.inner { return true; } + if a.inner.is_null() || b.inner.is_null() { return false; } + if a.get_native_ref() == b.get_native_ref() { true } else { false } +} /// Checks if two ChannelTypeFeaturess 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. @@ -1139,6 +1157,44 @@ pub(crate) extern "C" fn InvoiceFeatures_clone_void(this_ptr: *const c_void) -> pub extern "C" fn InvoiceFeatures_clone(orig: &InvoiceFeatures) -> InvoiceFeatures { orig.clone() } +impl Clone for OfferFeatures { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeOfferFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OfferFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeOfferFeatures)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the OfferFeatures +pub extern "C" fn OfferFeatures_clone(orig: &OfferFeatures) -> OfferFeatures { + orig.clone() +} +impl Clone for InvoiceRequestFeatures { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeInvoiceRequestFeatures>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InvoiceRequestFeatures_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInvoiceRequestFeatures)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the InvoiceRequestFeatures +pub extern "C" fn InvoiceRequestFeatures_clone(orig: &InvoiceRequestFeatures) -> InvoiceRequestFeatures { + orig.clone() +} impl Clone for ChannelTypeFeatures { fn clone(&self) -> Self { Self { @@ -1191,7 +1247,7 @@ pub extern "C" fn InitFeatures_free(this_obj: InitFeatures) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InitFeatures_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInitFeatures); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInitFeatures) }; } #[allow(unused)] impl InitFeatures { @@ -1242,7 +1298,7 @@ pub extern "C" fn NodeFeatures_free(this_obj: NodeFeatures) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeFeatures_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeFeatures); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeFeatures) }; } #[allow(unused)] impl NodeFeatures { @@ -1293,7 +1349,7 @@ pub extern "C" fn ChannelFeatures_free(this_obj: ChannelFeatures) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelFeatures_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelFeatures); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelFeatures) }; } #[allow(unused)] impl ChannelFeatures { @@ -1344,7 +1400,7 @@ pub extern "C" fn InvoiceFeatures_free(this_obj: InvoiceFeatures) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoiceFeatures_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoiceFeatures); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoiceFeatures) }; } #[allow(unused)] impl InvoiceFeatures { @@ -1363,6 +1419,108 @@ impl InvoiceFeatures { } } +use lightning::ln::features::OfferFeatures as nativeOfferFeaturesImport; +pub(crate) type nativeOfferFeatures = nativeOfferFeaturesImport; + +/// Features used within an `offer`. +#[must_use] +#[repr(C)] +pub struct OfferFeatures { + /// 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. + pub inner: *mut nativeOfferFeatures, + /// 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. + pub is_owned: bool, +} + +impl Drop for OfferFeatures { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOfferFeatures>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OfferFeatures, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OfferFeatures_free(this_obj: OfferFeatures) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OfferFeatures_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOfferFeatures) }; +} +#[allow(unused)] +impl OfferFeatures { + pub(crate) fn get_native_ref(&self) -> &'static nativeOfferFeatures { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOfferFeatures { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeOfferFeatures { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} + +use lightning::ln::features::InvoiceRequestFeatures as nativeInvoiceRequestFeaturesImport; +pub(crate) type nativeInvoiceRequestFeatures = nativeInvoiceRequestFeaturesImport; + +/// Features used within an `invoice_request`. +#[must_use] +#[repr(C)] +pub struct InvoiceRequestFeatures { + /// 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. + pub inner: *mut nativeInvoiceRequestFeatures, + /// 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. + pub is_owned: bool, +} + +impl Drop for InvoiceRequestFeatures { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeInvoiceRequestFeatures>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the InvoiceRequestFeatures, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn InvoiceRequestFeatures_free(this_obj: InvoiceRequestFeatures) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InvoiceRequestFeatures_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoiceRequestFeatures) }; +} +#[allow(unused)] +impl InvoiceRequestFeatures { + pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceRequestFeatures { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceRequestFeatures { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeInvoiceRequestFeatures { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} + use lightning::ln::features::ChannelTypeFeatures as nativeChannelTypeFeaturesImport; pub(crate) type nativeChannelTypeFeatures = nativeChannelTypeFeaturesImport; @@ -1404,7 +1562,7 @@ pub extern "C" fn ChannelTypeFeatures_free(this_obj: ChannelTypeFeatures) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelTypeFeatures_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelTypeFeatures); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelTypeFeatures) }; } #[allow(unused)] impl ChannelTypeFeatures { @@ -1490,6 +1648,40 @@ pub extern "C" fn InvoiceFeatures_requires_unknown_bits(this_arg: &crate::lightn ret } +/// Create a blank Features with no features set +#[must_use] +#[no_mangle] +pub extern "C" fn OfferFeatures_empty() -> crate::lightning::ln::features::OfferFeatures { + let mut ret = lightning::ln::features::OfferFeatures::empty(); + crate::lightning::ln::features::OfferFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Returns true if this `Features` object contains unknown feature flags which are set as +/// \"required\". +#[must_use] +#[no_mangle] +pub extern "C" fn OfferFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::OfferFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits(); + ret +} + +/// Create a blank Features with no features set +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequestFeatures_empty() -> crate::lightning::ln::features::InvoiceRequestFeatures { + let mut ret = lightning::ln::features::InvoiceRequestFeatures::empty(); + crate::lightning::ln::features::InvoiceRequestFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Returns true if this `Features` object contains unknown feature flags which are set as +/// \"required\". +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequestFeatures_requires_unknown_bits(this_arg: &crate::lightning::ln::features::InvoiceRequestFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_unknown_bits(); + ret +} + /// Create a blank Features with no features set #[must_use] #[no_mangle] @@ -1587,3 +1779,35 @@ pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crat let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } +#[no_mangle] +/// Serialize the OfferFeatures object into a byte array which can be read by OfferFeatures_read +pub extern "C" fn OfferFeatures_write(obj: &crate::lightning::ln::features::OfferFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn OfferFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeOfferFeatures) }) +} +#[no_mangle] +/// Read a OfferFeatures from a byte array, created by OfferFeatures_write +pub extern "C" fn OfferFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_OfferFeaturesDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::OfferFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} +#[no_mangle] +/// Serialize the InvoiceRequestFeatures object into a byte array which can be read by InvoiceRequestFeatures_read +pub extern "C" fn InvoiceRequestFeatures_write(obj: &crate::lightning::ln::features::InvoiceRequestFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn InvoiceRequestFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceRequestFeatures) }) +} +#[no_mangle] +/// Read a InvoiceRequestFeatures from a byte array, created by InvoiceRequestFeatures_write +pub extern "C" fn InvoiceRequestFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InvoiceRequestFeaturesDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::features::InvoiceRequestFeatures { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} diff --git a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs index 339cc2b..766cd24 100644 --- a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs @@ -52,7 +52,7 @@ pub extern "C" fn ExpandedKey_free(this_obj: ExpandedKey) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ExpandedKey_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeExpandedKey); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeExpandedKey) }; } #[allow(unused)] impl ExpandedKey { @@ -94,7 +94,7 @@ pub extern "C" fn ExpandedKey_new(key_material: *const [u8; 32]) -> crate::light #[no_mangle] pub extern "C" fn create(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut invoice_expiry_delta_secs: u32, keys_manager: &crate::lightning::chain::keysinterface::KeysInterface, mut current_time: u64) -> crate::c_types::derived::CResult_C2Tuple_PaymentHashPaymentSecretZNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; - let mut ret = lightning::ln::inbound_payment::create::(keys.get_native_ref(), local_min_value_msat, invoice_expiry_delta_secs, keys_manager, current_time); + let mut ret = lightning::ln::inbound_payment::create::(keys.get_native_ref(), local_min_value_msat, invoice_expiry_delta_secs, keys_manager, current_time); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let (mut orig_ret_0_0, mut orig_ret_0_1) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::c_types::ThirtyTwoBytes { data: orig_ret_0_1.0 }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index efe7b92..a14c617 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -68,7 +68,7 @@ impl DecodeError { DecodeError::ShortRead => nativeDecodeError::ShortRead, DecodeError::BadLengthDescriptor => nativeDecodeError::BadLengthDescriptor, DecodeError::Io (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeDecodeError::Io ( a_nonref.to_rust_kind(), ) @@ -101,7 +101,7 @@ impl DecodeError { nativeDecodeError::ShortRead => DecodeError::ShortRead, nativeDecodeError::BadLengthDescriptor => DecodeError::BadLengthDescriptor, nativeDecodeError::Io (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); DecodeError::Io ( crate::c_types::IOError::from_rust_kind(a_nonref), ) @@ -202,7 +202,7 @@ pub extern "C" fn Init_free(this_obj: Init) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Init_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInit); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInit) }; } #[allow(unused)] impl Init { @@ -321,7 +321,7 @@ pub extern "C" fn ErrorMessage_free(this_obj: ErrorMessage) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ErrorMessage_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErrorMessage); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeErrorMessage) }; } #[allow(unused)] impl ErrorMessage { @@ -443,7 +443,7 @@ pub extern "C" fn WarningMessage_free(this_obj: WarningMessage) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn WarningMessage_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeWarningMessage); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeWarningMessage) }; } #[allow(unused)] impl WarningMessage { @@ -563,7 +563,7 @@ pub extern "C" fn Ping_free(this_obj: Ping) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Ping_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePing); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePing) }; } #[allow(unused)] impl Ping { @@ -675,7 +675,7 @@ pub extern "C" fn Pong_free(this_obj: Pong) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Pong_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePong); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePong) }; } #[allow(unused)] impl Pong { @@ -775,7 +775,7 @@ pub extern "C" fn OpenChannel_free(this_obj: OpenChannel) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OpenChannel_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOpenChannel); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOpenChannel) }; } #[allow(unused)] impl OpenChannel { @@ -1073,7 +1073,7 @@ pub extern "C" fn AcceptChannel_free(this_obj: AcceptChannel) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn AcceptChannel_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAcceptChannel); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAcceptChannel) }; } #[allow(unused)] impl AcceptChannel { @@ -1331,7 +1331,7 @@ pub extern "C" fn FundingCreated_free(this_obj: FundingCreated) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FundingCreated_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingCreated); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFundingCreated) }; } #[allow(unused)] impl FundingCreated { @@ -1465,7 +1465,7 @@ pub extern "C" fn FundingSigned_free(this_obj: FundingSigned) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FundingSigned_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFundingSigned); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFundingSigned) }; } #[allow(unused)] impl FundingSigned { @@ -1575,7 +1575,7 @@ pub extern "C" fn ChannelReady_free(this_obj: ChannelReady) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelReady_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReady); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelReady) }; } #[allow(unused)] impl ChannelReady { @@ -1702,7 +1702,7 @@ pub extern "C" fn Shutdown_free(this_obj: Shutdown) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Shutdown_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdown); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeShutdown) }; } #[allow(unused)] impl Shutdown { @@ -1816,7 +1816,7 @@ pub extern "C" fn ClosingSignedFeeRange_free(this_obj: ClosingSignedFeeRange) { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ClosingSignedFeeRange_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSignedFeeRange); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeClosingSignedFeeRange) }; } #[allow(unused)] impl ClosingSignedFeeRange { @@ -1930,7 +1930,7 @@ pub extern "C" fn ClosingSigned_free(this_obj: ClosingSigned) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ClosingSigned_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeClosingSigned); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeClosingSigned) }; } #[allow(unused)] impl ClosingSigned { @@ -2073,7 +2073,7 @@ pub extern "C" fn UpdateAddHTLC_free(this_obj: UpdateAddHTLC) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UpdateAddHTLC_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateAddHTLC) }; } #[allow(unused)] impl UpdateAddHTLC { @@ -2207,7 +2207,7 @@ pub extern "C" fn OnionMessage_free(this_obj: OnionMessage) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OnionMessage_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOnionMessage); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOnionMessage) }; } #[allow(unused)] impl OnionMessage { @@ -2297,7 +2297,7 @@ pub extern "C" fn UpdateFulfillHTLC_free(this_obj: UpdateFulfillHTLC) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UpdateFulfillHTLC_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFulfillHTLC) }; } #[allow(unused)] impl UpdateFulfillHTLC { @@ -2419,7 +2419,7 @@ pub extern "C" fn UpdateFailHTLC_free(this_obj: UpdateFailHTLC) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UpdateFailHTLC_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFailHTLC) }; } #[allow(unused)] impl UpdateFailHTLC { @@ -2520,7 +2520,7 @@ pub extern "C" fn UpdateFailMalformedHTLC_free(this_obj: UpdateFailMalformedHTLC #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UpdateFailMalformedHTLC_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFailMalformedHTLC) }; } #[allow(unused)] impl UpdateFailMalformedHTLC { @@ -2632,7 +2632,7 @@ pub extern "C" fn CommitmentSigned_free(this_obj: CommitmentSigned) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CommitmentSigned_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentSigned); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentSigned) }; } #[allow(unused)] impl CommitmentSigned { @@ -2759,7 +2759,7 @@ pub extern "C" fn RevokeAndACK_free(this_obj: RevokeAndACK) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RevokeAndACK_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRevokeAndACK); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRevokeAndACK) }; } #[allow(unused)] impl RevokeAndACK { @@ -2881,7 +2881,7 @@ pub extern "C" fn UpdateFee_free(this_obj: UpdateFee) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UpdateFee_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUpdateFee); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateFee) }; } #[allow(unused)] impl UpdateFee { @@ -2994,7 +2994,7 @@ pub extern "C" fn DataLossProtect_free(this_obj: DataLossProtect) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DataLossProtect_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDataLossProtect); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDataLossProtect) }; } #[allow(unused)] impl DataLossProtect { @@ -3106,7 +3106,7 @@ pub extern "C" fn ChannelReestablish_free(this_obj: ChannelReestablish) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelReestablish_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelReestablish); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelReestablish) }; } #[allow(unused)] impl ChannelReestablish { @@ -3218,7 +3218,7 @@ pub extern "C" fn AnnouncementSignatures_free(this_obj: AnnouncementSignatures) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn AnnouncementSignatures_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeAnnouncementSignatures) }; } #[allow(unused)] impl AnnouncementSignatures { @@ -3373,32 +3373,32 @@ impl NetAddress { pub(crate) fn to_native(&self) -> nativeNetAddress { match self { NetAddress::IPv4 {ref addr, ref port, } => { - let mut addr_nonref = (*addr).clone(); - let mut port_nonref = (*port).clone(); + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); nativeNetAddress::IPv4 { addr: addr_nonref.data, port: port_nonref, } }, NetAddress::IPv6 {ref addr, ref port, } => { - let mut addr_nonref = (*addr).clone(); - let mut port_nonref = (*port).clone(); + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); nativeNetAddress::IPv6 { addr: addr_nonref.data, port: port_nonref, } }, NetAddress::OnionV2 (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeNetAddress::OnionV2 ( a_nonref.data, ) }, NetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => { - let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone(); - let mut checksum_nonref = (*checksum).clone(); - let mut version_nonref = (*version).clone(); - let mut port_nonref = (*port).clone(); + let mut ed25519_pubkey_nonref = Clone::clone(ed25519_pubkey); + let mut checksum_nonref = Clone::clone(checksum); + let mut version_nonref = Clone::clone(version); + let mut port_nonref = Clone::clone(port); nativeNetAddress::OnionV3 { ed25519_pubkey: ed25519_pubkey_nonref.data, checksum: checksum_nonref, @@ -3407,8 +3407,8 @@ impl NetAddress { } }, NetAddress::Hostname {ref hostname, ref port, } => { - let mut hostname_nonref = (*hostname).clone(); - let mut port_nonref = (*port).clone(); + let mut hostname_nonref = Clone::clone(hostname); + let mut port_nonref = Clone::clone(port); nativeNetAddress::Hostname { hostname: *unsafe { Box::from_raw(hostname_nonref.take_inner()) }, port: port_nonref, @@ -3456,32 +3456,32 @@ impl NetAddress { pub(crate) fn from_native(native: &nativeNetAddress) -> Self { match native { nativeNetAddress::IPv4 {ref addr, ref port, } => { - let mut addr_nonref = (*addr).clone(); - let mut port_nonref = (*port).clone(); + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); NetAddress::IPv4 { addr: crate::c_types::FourBytes { data: addr_nonref }, port: port_nonref, } }, nativeNetAddress::IPv6 {ref addr, ref port, } => { - let mut addr_nonref = (*addr).clone(); - let mut port_nonref = (*port).clone(); + let mut addr_nonref = Clone::clone(addr); + let mut port_nonref = Clone::clone(port); NetAddress::IPv6 { addr: crate::c_types::SixteenBytes { data: addr_nonref }, port: port_nonref, } }, nativeNetAddress::OnionV2 (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); NetAddress::OnionV2 ( crate::c_types::TwelveBytes { data: a_nonref }, ) }, nativeNetAddress::OnionV3 {ref ed25519_pubkey, ref checksum, ref version, ref port, } => { - let mut ed25519_pubkey_nonref = (*ed25519_pubkey).clone(); - let mut checksum_nonref = (*checksum).clone(); - let mut version_nonref = (*version).clone(); - let mut port_nonref = (*port).clone(); + let mut ed25519_pubkey_nonref = Clone::clone(ed25519_pubkey); + let mut checksum_nonref = Clone::clone(checksum); + let mut version_nonref = Clone::clone(version); + let mut port_nonref = Clone::clone(port); NetAddress::OnionV3 { ed25519_pubkey: crate::c_types::ThirtyTwoBytes { data: ed25519_pubkey_nonref }, checksum: checksum_nonref, @@ -3490,8 +3490,8 @@ impl NetAddress { } }, nativeNetAddress::Hostname {ref hostname, ref port, } => { - let mut hostname_nonref = (*hostname).clone(); - let mut port_nonref = (*port).clone(); + let mut hostname_nonref = Clone::clone(hostname); + let mut port_nonref = Clone::clone(port); NetAddress::Hostname { hostname: crate::lightning::util::ser::Hostname { inner: ObjOps::heap_alloc(hostname_nonref), is_owned: true }, port: port_nonref, @@ -3634,7 +3634,7 @@ pub extern "C" fn UnsignedNodeAnnouncement_free(this_obj: UnsignedNodeAnnounceme #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UnsignedNodeAnnouncement_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedNodeAnnouncement) }; } #[allow(unused)] impl UnsignedNodeAnnouncement { @@ -3787,7 +3787,7 @@ pub extern "C" fn NodeAnnouncement_free(this_obj: NodeAnnouncement) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeAnnouncement_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncement); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeAnnouncement) }; } #[allow(unused)] impl NodeAnnouncement { @@ -3897,7 +3897,7 @@ pub extern "C" fn UnsignedChannelAnnouncement_free(this_obj: UnsignedChannelAnno #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UnsignedChannelAnnouncement_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedChannelAnnouncement) }; } #[allow(unused)] impl UnsignedChannelAnnouncement { @@ -4053,7 +4053,7 @@ pub extern "C" fn ChannelAnnouncement_free(this_obj: ChannelAnnouncement) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelAnnouncement_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelAnnouncement); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelAnnouncement) }; } #[allow(unused)] impl ChannelAnnouncement { @@ -4199,7 +4199,7 @@ pub extern "C" fn UnsignedChannelUpdate_free(this_obj: UnsignedChannelUpdate) { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UnsignedChannelUpdate_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedChannelUpdate) }; } #[allow(unused)] impl UnsignedChannelUpdate { @@ -4428,7 +4428,7 @@ pub extern "C" fn ChannelUpdate_free(this_obj: ChannelUpdate) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelUpdate_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdate); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelUpdate) }; } #[allow(unused)] impl ChannelUpdate { @@ -4541,7 +4541,7 @@ pub extern "C" fn QueryChannelRange_free(this_obj: QueryChannelRange) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn QueryChannelRange_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryChannelRange); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeQueryChannelRange) }; } #[allow(unused)] impl QueryChannelRange { @@ -4669,7 +4669,7 @@ pub extern "C" fn ReplyChannelRange_free(this_obj: ReplyChannelRange) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ReplyChannelRange_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyChannelRange); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReplyChannelRange) }; } #[allow(unused)] impl ReplyChannelRange { @@ -4827,7 +4827,7 @@ pub extern "C" fn QueryShortChannelIds_free(this_obj: QueryShortChannelIds) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn QueryShortChannelIds_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeQueryShortChannelIds) }; } #[allow(unused)] impl QueryShortChannelIds { @@ -4945,7 +4945,7 @@ pub extern "C" fn ReplyShortChannelIdsEnd_free(this_obj: ReplyShortChannelIdsEnd #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ReplyShortChannelIdsEnd_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReplyShortChannelIdsEnd) }; } #[allow(unused)] impl ReplyShortChannelIdsEnd { @@ -5059,7 +5059,7 @@ pub extern "C" fn GossipTimestampFilter_free(this_obj: GossipTimestampFilter) { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn GossipTimestampFilter_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeGossipTimestampFilter) }; } #[allow(unused)] impl GossipTimestampFilter { @@ -5193,7 +5193,7 @@ impl ErrorAction { pub(crate) fn to_native(&self) -> nativeErrorAction { match self { ErrorAction::DisconnectPeer {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); let mut local_msg_nonref = if msg_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(msg_nonref.take_inner()) } }) }; nativeErrorAction::DisconnectPeer { msg: local_msg_nonref, @@ -5201,21 +5201,21 @@ impl ErrorAction { }, ErrorAction::IgnoreError => nativeErrorAction::IgnoreError, ErrorAction::IgnoreAndLog (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeErrorAction::IgnoreAndLog ( a_nonref.into_native(), ) }, ErrorAction::IgnoreDuplicateGossip => nativeErrorAction::IgnoreDuplicateGossip, ErrorAction::SendErrorMessage {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); nativeErrorAction::SendErrorMessage { msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, ErrorAction::SendWarningMessage {ref msg, ref log_level, } => { - let mut msg_nonref = (*msg).clone(); - let mut log_level_nonref = (*log_level).clone(); + let mut msg_nonref = Clone::clone(msg); + let mut log_level_nonref = Clone::clone(log_level); nativeErrorAction::SendWarningMessage { msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, log_level: log_level_nonref.into_native(), @@ -5256,7 +5256,7 @@ impl ErrorAction { pub(crate) fn from_native(native: &nativeErrorAction) -> Self { match native { nativeErrorAction::DisconnectPeer {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); let mut local_msg_nonref = crate::lightning::ln::msgs::ErrorMessage { inner: if msg_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((msg_nonref.unwrap())) } }, is_owned: true }; ErrorAction::DisconnectPeer { msg: local_msg_nonref, @@ -5264,21 +5264,21 @@ impl ErrorAction { }, nativeErrorAction::IgnoreError => ErrorAction::IgnoreError, nativeErrorAction::IgnoreAndLog (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ErrorAction::IgnoreAndLog ( crate::lightning::util::logger::Level::native_into(a_nonref), ) }, nativeErrorAction::IgnoreDuplicateGossip => ErrorAction::IgnoreDuplicateGossip, nativeErrorAction::SendErrorMessage {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); ErrorAction::SendErrorMessage { msg: crate::lightning::ln::msgs::ErrorMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeErrorAction::SendWarningMessage {ref msg, ref log_level, } => { - let mut msg_nonref = (*msg).clone(); - let mut log_level_nonref = (*log_level).clone(); + let mut msg_nonref = Clone::clone(msg); + let mut log_level_nonref = Clone::clone(log_level); ErrorAction::SendWarningMessage { msg: crate::lightning::ln::msgs::WarningMessage { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, log_level: crate::lightning::util::logger::Level::native_into(log_level_nonref), @@ -5392,7 +5392,7 @@ pub extern "C" fn LightningError_free(this_obj: LightningError) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn LightningError_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeLightningError); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeLightningError) }; } #[allow(unused)] impl LightningError { @@ -5494,7 +5494,7 @@ pub extern "C" fn CommitmentUpdate_free(this_obj: CommitmentUpdate) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn CommitmentUpdate_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeCommitmentUpdate); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeCommitmentUpdate) }; } #[allow(unused)] impl CommitmentUpdate { diff --git a/lightning-c-bindings/src/lightning/ln/peer_handler.rs b/lightning-c-bindings/src/lightning/ln/peer_handler.rs index 5a877e2..5417667 100644 --- a/lightning-c-bindings/src/lightning/ln/peer_handler.rs +++ b/lightning-c-bindings/src/lightning/ln/peer_handler.rs @@ -131,7 +131,7 @@ pub extern "C" fn IgnoringMessageHandler_free(this_obj: IgnoringMessageHandler) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn IgnoringMessageHandler_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeIgnoringMessageHandler); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeIgnoringMessageHandler) }; } #[allow(unused)] impl IgnoringMessageHandler { @@ -516,7 +516,7 @@ pub extern "C" fn ErroringMessageHandler_free(this_obj: ErroringMessageHandler) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ErroringMessageHandler_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeErroringMessageHandler); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeErroringMessageHandler) }; } #[allow(unused)] impl ErroringMessageHandler { @@ -724,7 +724,7 @@ pub extern "C" fn MessageHandler_free(this_obj: MessageHandler) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn MessageHandler_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMessageHandler); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMessageHandler) }; } #[allow(unused)] impl MessageHandler { @@ -952,7 +952,7 @@ pub extern "C" fn PeerHandleError_free(this_obj: PeerHandleError) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PeerHandleError_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePeerHandleError); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePeerHandleError) }; } #[allow(unused)] impl PeerHandleError { @@ -1071,7 +1071,7 @@ pub extern "C" fn PeerManager_free(this_obj: PeerManager) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PeerManager_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePeerManager); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePeerManager) }; } #[allow(unused)] impl PeerManager { diff --git a/lightning-c-bindings/src/lightning/ln/script.rs b/lightning-c-bindings/src/lightning/ln/script.rs index e808b16..b051357 100644 --- a/lightning-c-bindings/src/lightning/ln/script.rs +++ b/lightning-c-bindings/src/lightning/ln/script.rs @@ -51,7 +51,7 @@ pub extern "C" fn ShutdownScript_free(this_obj: ShutdownScript) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ShutdownScript_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeShutdownScript); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeShutdownScript) }; } #[allow(unused)] impl ShutdownScript { @@ -130,7 +130,7 @@ pub extern "C" fn InvalidShutdownScript_free(this_obj: InvalidShutdownScript) { #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvalidShutdownScript_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvalidShutdownScript); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvalidShutdownScript) }; } #[allow(unused)] impl InvalidShutdownScript { diff --git a/lightning-c-bindings/src/lightning/mod.rs b/lightning-c-bindings/src/lightning/mod.rs index 59ca209..240ef3f 100644 --- a/lightning-c-bindings/src/lightning/mod.rs +++ b/lightning-c-bindings/src/lightning/mod.rs @@ -48,6 +48,72 @@ pub mod chain; pub mod ln; pub mod routing; pub mod onion_message; +mod offers { + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +mod invoice_request { + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} +mod merkle { + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} +mod offer { + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} +mod parse { + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} +mod payer { + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + +} +} mod io_extras { use alloc::str::FromStr; diff --git a/lightning-c-bindings/src/lightning/onion_message/blinded_path.rs b/lightning-c-bindings/src/lightning/onion_message/blinded_path.rs new file mode 100644 index 0000000..883db0a --- /dev/null +++ b/lightning-c-bindings/src/lightning/onion_message/blinded_path.rs @@ -0,0 +1,205 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + +//! Creating blinded paths and related utilities live here. + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + + +use lightning::onion_message::blinded_path::BlindedPath as nativeBlindedPathImport; +pub(crate) type nativeBlindedPath = nativeBlindedPathImport; + +/// Onion messages can be sent and received to blinded paths, which serve to hide the identity of +/// the recipient. +#[must_use] +#[repr(C)] +pub struct BlindedPath { + /// 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. + pub inner: *mut nativeBlindedPath, + /// 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. + pub is_owned: bool, +} + +impl Drop for BlindedPath { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeBlindedPath>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the BlindedPath, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn BlindedPath_free(this_obj: BlindedPath) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn BlindedPath_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBlindedPath) }; +} +#[allow(unused)] +impl BlindedPath { + pub(crate) fn get_native_ref(&self) -> &'static nativeBlindedPath { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBlindedPath { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeBlindedPath { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +impl Clone for BlindedPath { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeBlindedPath>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn BlindedPath_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedPath)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the BlindedPath +pub extern "C" fn BlindedPath_clone(orig: &BlindedPath) -> BlindedPath { + orig.clone() +} + +use lightning::onion_message::blinded_path::BlindedHop as nativeBlindedHopImport; +pub(crate) type nativeBlindedHop = nativeBlindedHopImport; + +/// Used to construct the blinded hops portion of a blinded path. These hops cannot be identified +/// by outside observers and thus can be used to hide the identity of the recipient. +#[must_use] +#[repr(C)] +pub struct BlindedHop { + /// 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. + pub inner: *mut nativeBlindedHop, + /// 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. + pub is_owned: bool, +} + +impl Drop for BlindedHop { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeBlindedHop>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn BlindedHop_free(this_obj: BlindedHop) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn BlindedHop_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBlindedHop) }; +} +#[allow(unused)] +impl BlindedHop { + pub(crate) fn get_native_ref(&self) -> &'static nativeBlindedHop { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBlindedHop { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeBlindedHop { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +impl Clone for BlindedHop { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeBlindedHop>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn BlindedHop_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBlindedHop)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the BlindedHop +pub extern "C" fn BlindedHop_clone(orig: &BlindedHop) -> BlindedHop { + orig.clone() +} +/// Create a blinded path 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] +#[no_mangle] +pub extern "C" fn BlindedPath_new(mut node_pks: crate::c_types::derived::CVec_PublicKeyZ, keys_manager: &crate::lightning::chain::keysinterface::KeysInterface) -> crate::c_types::derived::CResult_BlindedPathNoneZ { + let mut local_node_pks = Vec::new(); for mut item in node_pks.into_rust().drain(..) { local_node_pks.push( { item.into_rust() }); }; + let mut ret = lightning::onion_message::blinded_path::BlindedPath::new(&local_node_pks[..], keys_manager, secp256k1::global::SECP256K1); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +#[no_mangle] +/// Serialize the BlindedPath object into a byte array which can be read by BlindedPath_read +pub extern "C" fn BlindedPath_write(obj: &crate::lightning::onion_message::blinded_path::BlindedPath) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn BlindedPath_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedPath) }) +} +#[no_mangle] +/// Read a BlindedPath from a byte array, created by BlindedPath_write +pub extern "C" fn BlindedPath_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedPathDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} +#[no_mangle] +/// Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read +pub extern "C" fn BlindedHop_write(obj: &crate::lightning::onion_message::blinded_path::BlindedHop) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn BlindedHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedHop) }) +} +#[no_mangle] +/// Read a BlindedHop from a byte array, created by BlindedHop_write +pub extern "C" fn BlindedHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedHopDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_path::BlindedHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} diff --git a/lightning-c-bindings/src/lightning/onion_message/blinded_route.rs b/lightning-c-bindings/src/lightning/onion_message/blinded_route.rs deleted file mode 100644 index 701dad8..0000000 --- a/lightning-c-bindings/src/lightning/onion_message/blinded_route.rs +++ /dev/null @@ -1,167 +0,0 @@ -// This file is Copyright its original authors, visible in version control -// history and in the source files from which this was generated. -// -// This file is licensed under the license available in the LICENSE or LICENSE.md -// file in the root of this repository or, if no such file exists, the same -// license as that which applies to the original source files from which this -// source was automatically generated. - -//! Creating blinded routes and related utilities live here. - -use alloc::str::FromStr; -use core::ffi::c_void; -use core::convert::Infallible; -use bitcoin::hashes::Hash; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - - -use lightning::onion_message::blinded_route::BlindedRoute as nativeBlindedRouteImport; -pub(crate) type nativeBlindedRoute = nativeBlindedRouteImport; - -/// Onion messages can be sent and received to blinded routes, which serve to hide the identity of -/// the recipient. -#[must_use] -#[repr(C)] -pub struct BlindedRoute { - /// 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. - pub inner: *mut nativeBlindedRoute, - /// 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. - pub is_owned: bool, -} - -impl Drop for BlindedRoute { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeBlindedRoute>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the BlindedRoute, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn BlindedRoute_free(this_obj: BlindedRoute) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn BlindedRoute_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBlindedRoute); } -} -#[allow(unused)] -impl BlindedRoute { - pub(crate) fn get_native_ref(&self) -> &'static nativeBlindedRoute { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBlindedRoute { - unsafe { &mut *ObjOps::untweak_ptr(self.inner) } - } - /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy - pub(crate) fn take_inner(mut self) -> *mut nativeBlindedRoute { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} - -use lightning::onion_message::blinded_route::BlindedHop as nativeBlindedHopImport; -pub(crate) type nativeBlindedHop = nativeBlindedHopImport; - -/// 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. -#[must_use] -#[repr(C)] -pub struct BlindedHop { - /// 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. - pub inner: *mut nativeBlindedHop, - /// 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. - pub is_owned: bool, -} - -impl Drop for BlindedHop { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeBlindedHop>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the BlindedHop, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn BlindedHop_free(this_obj: BlindedHop) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn BlindedHop_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBlindedHop); } -} -#[allow(unused)] -impl BlindedHop { - pub(crate) fn get_native_ref(&self) -> &'static nativeBlindedHop { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBlindedHop { - unsafe { &mut *ObjOps::untweak_ptr(self.inner) } - } - /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy - pub(crate) fn take_inner(mut self) -> *mut nativeBlindedHop { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} -/// 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] -#[no_mangle] -pub extern "C" fn BlindedRoute_new(mut node_pks: crate::c_types::derived::CVec_PublicKeyZ, keys_manager: &crate::lightning::chain::keysinterface::KeysInterface) -> crate::c_types::derived::CResult_BlindedRouteNoneZ { - let mut local_node_pks = Vec::new(); for mut item in node_pks.into_rust().drain(..) { local_node_pks.push( { item.into_rust() }); }; - let mut ret = lightning::onion_message::blinded_route::BlindedRoute::new(&local_node_pks[..], keys_manager, secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_route::BlindedRoute { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} - -#[no_mangle] -/// Serialize the BlindedRoute object into a byte array which can be read by BlindedRoute_read -pub extern "C" fn BlindedRoute_write(obj: &crate::lightning::onion_message::blinded_route::BlindedRoute) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[no_mangle] -pub(crate) extern "C" fn BlindedRoute_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedRoute) }) -} -#[no_mangle] -/// Read a BlindedRoute from a byte array, created by BlindedRoute_write -pub extern "C" fn BlindedRoute_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedRouteDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_route::BlindedRoute { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; - local_res -} -#[no_mangle] -/// Serialize the BlindedHop object into a byte array which can be read by BlindedHop_read -pub extern "C" fn BlindedHop_write(obj: &crate::lightning::onion_message::blinded_route::BlindedHop) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[no_mangle] -pub(crate) extern "C" fn BlindedHop_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeBlindedHop) }) -} -#[no_mangle] -/// Read a BlindedHop from a byte array, created by BlindedHop_write -pub extern "C" fn BlindedHop_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedHopDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::blinded_route::BlindedHop { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; - local_res -} diff --git a/lightning-c-bindings/src/lightning/onion_message/messenger.rs b/lightning-c-bindings/src/lightning/onion_message/messenger.rs index 66555a3..e9ac8b3 100644 --- a/lightning-c-bindings/src/lightning/onion_message/messenger.rs +++ b/lightning-c-bindings/src/lightning/onion_message/messenger.rs @@ -19,7 +19,7 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::onion_message::messenger::OnionMessenger as nativeOnionMessengerImport; -pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport; +pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport; /// 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 @@ -34,9 +34,8 @@ pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport @@ -120,7 +121,7 @@ pub extern "C" fn OnionMessenger_free(this_obj: OnionMessenger) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn OnionMessenger_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeOnionMessenger); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOnionMessenger) }; } #[allow(unused)] impl OnionMessenger { @@ -139,20 +140,38 @@ impl OnionMessenger { } } /// The destination of an onion message. +#[derive(Clone)] #[must_use] #[repr(C)] pub enum Destination { /// We're sending this onion message to a node. Node( crate::c_types::PublicKey), - /// We're sending this onion message to a blinded route. - BlindedRoute( - crate::lightning::onion_message::blinded_route::BlindedRoute), + /// We're sending this onion message to a blinded path. + BlindedPath( + crate::lightning::onion_message::blinded_path::BlindedPath), } use lightning::onion_message::messenger::Destination as DestinationImport; pub(crate) type nativeDestination = DestinationImport; impl Destination { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeDestination { + match self { + Destination::Node (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeDestination::Node ( + a_nonref.into_rust(), + ) + }, + Destination::BlindedPath (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeDestination::BlindedPath ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + } + } #[allow(unused)] pub(crate) fn into_native(self) -> nativeDestination { match self { @@ -161,14 +180,31 @@ impl Destination { a.into_rust(), ) }, - Destination::BlindedRoute (mut a, ) => { - nativeDestination::BlindedRoute ( + Destination::BlindedPath (mut a, ) => { + nativeDestination::BlindedPath ( *unsafe { Box::from_raw(a.take_inner()) }, ) }, } } #[allow(unused)] + pub(crate) fn from_native(native: &nativeDestination) -> Self { + match native { + nativeDestination::Node (ref a, ) => { + let mut a_nonref = Clone::clone(a); + Destination::Node ( + crate::c_types::PublicKey::from_rust(&a_nonref), + ) + }, + nativeDestination::BlindedPath (ref a, ) => { + let mut a_nonref = Clone::clone(a); + Destination::BlindedPath ( + crate::lightning::onion_message::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + } + } + #[allow(unused)] pub(crate) fn native_into(native: nativeDestination) -> Self { match native { nativeDestination::Node (mut a, ) => { @@ -176,9 +212,9 @@ impl Destination { crate::c_types::PublicKey::from_rust(&a), ) }, - nativeDestination::BlindedRoute (mut a, ) => { - Destination::BlindedRoute ( - crate::lightning::onion_message::blinded_route::BlindedRoute { inner: ObjOps::heap_alloc(a), is_owned: true }, + nativeDestination::BlindedPath (mut a, ) => { + Destination::BlindedPath ( + crate::lightning::onion_message::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(a), is_owned: true }, ) }, } @@ -187,19 +223,24 @@ impl Destination { /// Frees any resources used by the Destination #[no_mangle] pub extern "C" fn Destination_free(this_ptr: Destination) { } +/// Creates a copy of the Destination +#[no_mangle] +pub extern "C" fn Destination_clone(orig: &Destination) -> Destination { + orig.clone() +} #[no_mangle] /// Utility method to constructs a new Node-variant Destination pub extern "C" fn Destination_node(a: crate::c_types::PublicKey) -> Destination { Destination::Node(a, ) } #[no_mangle] -/// Utility method to constructs a new BlindedRoute-variant Destination -pub extern "C" fn Destination_blinded_route(a: crate::lightning::onion_message::blinded_route::BlindedRoute) -> Destination { - Destination::BlindedRoute(a, ) +/// Utility method to constructs a new BlindedPath-variant Destination +pub extern "C" fn Destination_blinded_path(a: crate::lightning::onion_message::blinded_path::BlindedPath) -> Destination { + Destination::BlindedPath(a, ) } /// Errors that may occur when [sending an onion message]. /// -/// [sending an onion message]: OnionMessenger::send_custom_onion_message +/// [sending an onion message]: OnionMessenger::send_onion_message #[derive(Clone)] #[must_use] #[repr(C)] @@ -210,7 +251,7 @@ pub enum SendError { /// 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. TooBigPacket, - /// The provided [`Destination`] was an invalid [`BlindedRoute`], due to having fewer than two + /// The provided [`Destination`] was an invalid [`BlindedPath`], due to having fewer than two /// blinded hops. TooFewBlindedHops, /// Our next-hop peer was offline or does not support onion message forwarding. @@ -219,6 +260,15 @@ pub enum SendError { InvalidMessage, /// Our next-hop peer's buffer was full or our total outbound buffer was full. BufferFull, + /// Failed to retrieve our node id from the provided [`KeysInterface`]. + /// + /// [`KeysInterface`]: crate::chain::keysinterface::KeysInterface + GetNodeIdFailed, + /// We attempted to send to a blinded path where we are the introduction node, and failed to + /// advance the blinded path to make the second hop the new introduction node. Either + /// [`KeysInterface::ecdh`] failed, we failed to tweak the current blinding point to get the + /// new blinding point, or we were attempting to send to ourselves. + BlindedPathAdvanceFailed, } use lightning::onion_message::messenger::SendError as SendErrorImport; pub(crate) type nativeSendError = SendErrorImport; @@ -228,7 +278,7 @@ impl SendError { pub(crate) fn to_native(&self) -> nativeSendError { match self { SendError::Secp256k1 (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeSendError::Secp256k1 ( a_nonref.into_rust(), ) @@ -238,6 +288,8 @@ impl SendError { SendError::InvalidFirstHop => nativeSendError::InvalidFirstHop, SendError::InvalidMessage => nativeSendError::InvalidMessage, SendError::BufferFull => nativeSendError::BufferFull, + SendError::GetNodeIdFailed => nativeSendError::GetNodeIdFailed, + SendError::BlindedPathAdvanceFailed => nativeSendError::BlindedPathAdvanceFailed, } } #[allow(unused)] @@ -253,13 +305,15 @@ impl SendError { SendError::InvalidFirstHop => nativeSendError::InvalidFirstHop, SendError::InvalidMessage => nativeSendError::InvalidMessage, SendError::BufferFull => nativeSendError::BufferFull, + SendError::GetNodeIdFailed => nativeSendError::GetNodeIdFailed, + SendError::BlindedPathAdvanceFailed => nativeSendError::BlindedPathAdvanceFailed, } } #[allow(unused)] pub(crate) fn from_native(native: &nativeSendError) -> Self { match native { nativeSendError::Secp256k1 (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); SendError::Secp256k1 ( crate::c_types::Secp256k1Error::from_rust(a_nonref), ) @@ -269,6 +323,8 @@ impl SendError { nativeSendError::InvalidFirstHop => SendError::InvalidFirstHop, nativeSendError::InvalidMessage => SendError::InvalidMessage, nativeSendError::BufferFull => SendError::BufferFull, + nativeSendError::GetNodeIdFailed => SendError::GetNodeIdFailed, + nativeSendError::BlindedPathAdvanceFailed => SendError::BlindedPathAdvanceFailed, } } #[allow(unused)] @@ -284,6 +340,8 @@ impl SendError { nativeSendError::InvalidFirstHop => SendError::InvalidFirstHop, nativeSendError::InvalidMessage => SendError::InvalidMessage, nativeSendError::BufferFull => SendError::BufferFull, + nativeSendError::GetNodeIdFailed => SendError::GetNodeIdFailed, + nativeSendError::BlindedPathAdvanceFailed => SendError::BlindedPathAdvanceFailed, } } } @@ -320,6 +378,14 @@ pub extern "C" fn SendError_invalid_message() -> SendError { /// Utility method to constructs a new BufferFull-variant SendError pub extern "C" fn SendError_buffer_full() -> SendError { SendError::BufferFull} +#[no_mangle] +/// Utility method to constructs a new GetNodeIdFailed-variant SendError +pub extern "C" fn SendError_get_node_id_failed() -> SendError { + SendError::GetNodeIdFailed} +#[no_mangle] +/// Utility method to constructs a new BlindedPathAdvanceFailed-variant SendError +pub extern "C" fn SendError_blinded_path_advance_failed() -> SendError { + SendError::BlindedPathAdvanceFailed} /// Checks if two SendErrors contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields. #[no_mangle] @@ -409,10 +475,10 @@ pub extern "C" fn OnionMessenger_new(mut keys_manager: crate::lightning::chain:: /// Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn OnionMessenger_send_custom_onion_message(this_arg: &crate::lightning::onion_message::messenger::OnionMessenger, mut intermediate_nodes: crate::c_types::derived::CVec_PublicKeyZ, mut destination: crate::lightning::onion_message::messenger::Destination, mut msg: crate::lightning::onion_message::packet::CustomOnionMessageContents, mut reply_path: crate::lightning::onion_message::blinded_route::BlindedRoute) -> crate::c_types::derived::CResult_NoneSendErrorZ { +pub extern "C" fn OnionMessenger_send_onion_message(this_arg: &crate::lightning::onion_message::messenger::OnionMessenger, mut intermediate_nodes: crate::c_types::derived::CVec_PublicKeyZ, mut destination: crate::lightning::onion_message::messenger::Destination, mut message: crate::lightning::onion_message::packet::OnionMessageContents, mut reply_path: crate::lightning::onion_message::blinded_path::BlindedPath) -> crate::c_types::derived::CResult_NoneSendErrorZ { let mut local_intermediate_nodes = Vec::new(); for mut item in intermediate_nodes.into_rust().drain(..) { local_intermediate_nodes.push( { item.into_rust() }); }; let mut local_reply_path = if reply_path.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(reply_path.take_inner()) } }) }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_custom_onion_message(&local_intermediate_nodes[..], destination.into_native(), msg, local_reply_path); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_onion_message(&local_intermediate_nodes[..], destination.into_native(), message.into_native(), local_reply_path); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::onion_message::messenger::SendError::native_into(e) }).into() }; local_ret } diff --git a/lightning-c-bindings/src/lightning/onion_message/mod.rs b/lightning-c-bindings/src/lightning/onion_message/mod.rs index e312f02..8df06b2 100644 --- a/lightning-c-bindings/src/lightning/onion_message/mod.rs +++ b/lightning-c-bindings/src/lightning/onion_message/mod.rs @@ -11,14 +11,13 @@ //! Onion messages are multi-purpose messages sent between peers over the lightning network. In the //! near future, they will be used to communicate invoices for [offers], unlocking use cases such as //! static invoices, refunds and proof of payer. Further, you will be able to accept payments -//! without revealing your node id through the use of [blinded routes]. +//! without revealing your node id through the use of [blinded paths]. //! //! LDK sends and receives onion messages via the [`OnionMessenger`]. See its documentation for more //! information on its usage. //! //! [offers]: -//! [blinded routes]: crate::onion_message::blinded_route::BlindedRoute -//! [`OnionMessenger`]: crate::onion_message::messenger::OnionMessenger +//! [blinded paths]: crate::onion_message::BlindedPath use alloc::str::FromStr; use core::ffi::c_void; @@ -28,7 +27,7 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -pub mod blinded_route; +pub mod blinded_path; pub mod messenger; pub mod packet; mod utils { diff --git a/lightning-c-bindings/src/lightning/onion_message/packet.rs b/lightning-c-bindings/src/lightning/onion_message/packet.rs index 90c0238..9ca9037 100644 --- a/lightning-c-bindings/src/lightning/onion_message/packet.rs +++ b/lightning-c-bindings/src/lightning/onion_message/packet.rs @@ -16,6 +16,48 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +/// The contents of an onion message. In the context of offers, this would be the invoice, invoice +/// request, or invoice error. +#[must_use] +#[repr(C)] +pub enum OnionMessageContents { + /// A custom onion message specified by the user. + Custom( + crate::lightning::onion_message::packet::CustomOnionMessageContents), +} +use lightning::onion_message::packet::OnionMessageContents as OnionMessageContentsImport; +pub(crate) type nativeOnionMessageContents = OnionMessageContentsImport; + +impl OnionMessageContents { + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeOnionMessageContents { + match self { + OnionMessageContents::Custom (mut a, ) => { + nativeOnionMessageContents::Custom ( + a, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeOnionMessageContents) -> Self { + match native { + nativeOnionMessageContents::Custom (mut a, ) => { + OnionMessageContents::Custom ( + Into::into(a), + ) + }, + } + } +} +/// Frees any resources used by the OnionMessageContents +#[no_mangle] +pub extern "C" fn OnionMessageContents_free(this_ptr: OnionMessageContents) { } +#[no_mangle] +/// Utility method to constructs a new Custom-variant OnionMessageContents +pub extern "C" fn OnionMessageContents_custom(a: crate::lightning::onion_message::packet::CustomOnionMessageContents) -> OnionMessageContents { + OnionMessageContents::Custom(a, ) +} /// The contents of a custom onion message. #[repr(C)] pub struct CustomOnionMessageContents { diff --git a/lightning-c-bindings/src/lightning/routing/gossip.rs b/lightning-c-bindings/src/lightning/routing/gossip.rs index 3a7943b..a035af6 100644 --- a/lightning-c-bindings/src/lightning/routing/gossip.rs +++ b/lightning-c-bindings/src/lightning/routing/gossip.rs @@ -49,7 +49,7 @@ pub extern "C" fn NodeId_free(this_obj: NodeId) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeId_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeId); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeId) }; } #[allow(unused)] impl NodeId { @@ -162,7 +162,7 @@ pub extern "C" fn NetworkGraph_free(this_obj: NetworkGraph) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NetworkGraph_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNetworkGraph); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNetworkGraph) }; } #[allow(unused)] impl NetworkGraph { @@ -213,7 +213,7 @@ pub extern "C" fn ReadOnlyNetworkGraph_free(this_obj: ReadOnlyNetworkGraph) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ReadOnlyNetworkGraph_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeReadOnlyNetworkGraph); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeReadOnlyNetworkGraph) }; } #[allow(unused)] impl ReadOnlyNetworkGraph { @@ -272,22 +272,22 @@ impl NetworkUpdate { pub(crate) fn to_native(&self) -> nativeNetworkUpdate { match self { NetworkUpdate::ChannelUpdateMessage {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); nativeNetworkUpdate::ChannelUpdateMessage { msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, NetworkUpdate::ChannelFailure {ref short_channel_id, ref is_permanent, } => { - let mut short_channel_id_nonref = (*short_channel_id).clone(); - let mut is_permanent_nonref = (*is_permanent).clone(); + let mut short_channel_id_nonref = Clone::clone(short_channel_id); + let mut is_permanent_nonref = Clone::clone(is_permanent); nativeNetworkUpdate::ChannelFailure { short_channel_id: short_channel_id_nonref, is_permanent: is_permanent_nonref, } }, NetworkUpdate::NodeFailure {ref node_id, ref is_permanent, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut is_permanent_nonref = (*is_permanent).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut is_permanent_nonref = Clone::clone(is_permanent); nativeNetworkUpdate::NodeFailure { node_id: node_id_nonref.into_rust(), is_permanent: is_permanent_nonref, @@ -321,22 +321,22 @@ impl NetworkUpdate { pub(crate) fn from_native(native: &nativeNetworkUpdate) -> Self { match native { nativeNetworkUpdate::ChannelUpdateMessage {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); NetworkUpdate::ChannelUpdateMessage { msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeNetworkUpdate::ChannelFailure {ref short_channel_id, ref is_permanent, } => { - let mut short_channel_id_nonref = (*short_channel_id).clone(); - let mut is_permanent_nonref = (*is_permanent).clone(); + let mut short_channel_id_nonref = Clone::clone(short_channel_id); + let mut is_permanent_nonref = Clone::clone(is_permanent); NetworkUpdate::ChannelFailure { short_channel_id: short_channel_id_nonref, is_permanent: is_permanent_nonref, } }, nativeNetworkUpdate::NodeFailure {ref node_id, ref is_permanent, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut is_permanent_nonref = (*is_permanent).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut is_permanent_nonref = Clone::clone(is_permanent); NetworkUpdate::NodeFailure { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), is_permanent: is_permanent_nonref, @@ -425,9 +425,6 @@ pub(crate) type nativeP2PGossipSync = nativeP2PGossipSyncImport<&'static lightni /// This network graph is then used for routing payments. /// Provides interface to help with initial routing sync by /// serving historical announcements. -/// -/// Serves as an [`EventHandler`] for applying updates from [`Event::PaymentPathFailed`] to the -/// [`NetworkGraph`]. #[must_use] #[repr(C)] pub struct P2PGossipSync { @@ -456,7 +453,7 @@ pub extern "C" fn P2PGossipSync_free(this_obj: P2PGossipSync) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn P2PGossipSync_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeP2PGossipSync); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeP2PGossipSync) }; } #[allow(unused)] impl P2PGossipSync { @@ -496,29 +493,12 @@ pub extern "C" fn P2PGossipSync_add_chain_access(this_arg: &mut crate::lightning unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning::routing::gossip::nativeP2PGossipSync)) }.add_chain_access(local_chain_access) } -impl From for crate::lightning::util::events::EventHandler { - fn from(obj: nativeNetworkGraph) -> Self { - let mut rust_obj = NetworkGraph { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = NetworkGraph_as_EventHandler(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); - ret.free = Some(NetworkGraph_free_void); - ret - } -} -/// 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 +/// Handles any network updates originating from [`Event`]s. +/// +/// [`Event`]: crate::util::events::Event #[no_mangle] -pub extern "C" fn NetworkGraph_as_EventHandler(this_arg: &NetworkGraph) -> crate::lightning::util::events::EventHandler { - crate::lightning::util::events::EventHandler { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - handle_event: NetworkGraph_EventHandler_handle_event, - } -} - -extern "C" fn NetworkGraph_EventHandler_handle_event(this_arg: *const c_void, event: &crate::lightning::util::events::Event) { - >::handle_event(unsafe { &mut *(this_arg as *mut nativeNetworkGraph) }, &event.to_native()) +pub extern "C" fn NetworkGraph_handle_network_update(this_arg: &crate::lightning::routing::gossip::NetworkGraph, network_update: &crate::lightning::routing::gossip::NetworkUpdate) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_network_update(&network_update.to_native()) } impl From for crate::lightning::ln::msgs::RoutingMessageHandler { @@ -691,7 +671,7 @@ pub extern "C" fn ChannelUpdateInfo_free(this_obj: ChannelUpdateInfo) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelUpdateInfo_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUpdateInfo); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelUpdateInfo) }; } #[allow(unused)] impl ChannelUpdateInfo { @@ -893,7 +873,7 @@ pub extern "C" fn ChannelInfo_free(this_obj: ChannelInfo) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelInfo_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelInfo); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelInfo) }; } #[allow(unused)] impl ChannelInfo { @@ -1103,7 +1083,7 @@ pub extern "C" fn DirectedChannelInfo_free(this_obj: DirectedChannelInfo) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn DirectedChannelInfo_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDirectedChannelInfo); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDirectedChannelInfo) }; } #[allow(unused)] impl DirectedChannelInfo { @@ -1148,17 +1128,6 @@ pub extern "C" fn DirectedChannelInfo_channel(this_arg: &crate::lightning::routi crate::lightning::routing::gossip::ChannelInfo { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::routing::gossip::ChannelInfo<>) as *mut _) }, is_owned: false } } -/// Returns information for the direction. -/// -/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None -#[must_use] -#[no_mangle] -pub extern "C" fn DirectedChannelInfo_direction(this_arg: &crate::lightning::routing::gossip::DirectedChannelInfo) -> crate::lightning::routing::gossip::ChannelUpdateInfo { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.direction(); - let mut local_ret = crate::lightning::routing::gossip::ChannelUpdateInfo { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::routing::gossip::ChannelUpdateInfo<>) as *mut _ }, is_owned: false }; - local_ret -} - /// Returns the maximum HTLC amount allowed over the channel in the direction. #[must_use] #[no_mangle] @@ -1204,7 +1173,7 @@ pub enum EffectiveCapacity { /// The funding amount denominated in millisatoshi. capacity_msat: u64, /// The maximum HTLC amount denominated in millisatoshi. - htlc_maximum_msat: crate::c_types::derived::COption_u64Z, + htlc_maximum_msat: u64, }, /// A capacity sufficient to route any payment, typically used for private channels provided by /// an invoice. @@ -1221,24 +1190,23 @@ impl EffectiveCapacity { pub(crate) fn to_native(&self) -> nativeEffectiveCapacity { match self { EffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => { - let mut liquidity_msat_nonref = (*liquidity_msat).clone(); + let mut liquidity_msat_nonref = Clone::clone(liquidity_msat); nativeEffectiveCapacity::ExactLiquidity { liquidity_msat: liquidity_msat_nonref, } }, EffectiveCapacity::MaximumHTLC {ref amount_msat, } => { - let mut amount_msat_nonref = (*amount_msat).clone(); + let mut amount_msat_nonref = Clone::clone(amount_msat); nativeEffectiveCapacity::MaximumHTLC { amount_msat: amount_msat_nonref, } }, EffectiveCapacity::Total {ref capacity_msat, ref htlc_maximum_msat, } => { - let mut capacity_msat_nonref = (*capacity_msat).clone(); - let mut htlc_maximum_msat_nonref = (*htlc_maximum_msat).clone(); - let mut local_htlc_maximum_msat_nonref = if htlc_maximum_msat_nonref.is_some() { Some( { htlc_maximum_msat_nonref.take() }) } else { None }; + let mut capacity_msat_nonref = Clone::clone(capacity_msat); + let mut htlc_maximum_msat_nonref = Clone::clone(htlc_maximum_msat); nativeEffectiveCapacity::Total { capacity_msat: capacity_msat_nonref, - htlc_maximum_msat: local_htlc_maximum_msat_nonref, + htlc_maximum_msat: htlc_maximum_msat_nonref, } }, EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite, @@ -1259,10 +1227,9 @@ impl EffectiveCapacity { } }, EffectiveCapacity::Total {mut capacity_msat, mut htlc_maximum_msat, } => { - let mut local_htlc_maximum_msat = if htlc_maximum_msat.is_some() { Some( { htlc_maximum_msat.take() }) } else { None }; nativeEffectiveCapacity::Total { capacity_msat: capacity_msat, - htlc_maximum_msat: local_htlc_maximum_msat, + htlc_maximum_msat: htlc_maximum_msat, } }, EffectiveCapacity::Infinite => nativeEffectiveCapacity::Infinite, @@ -1273,24 +1240,23 @@ impl EffectiveCapacity { pub(crate) fn from_native(native: &nativeEffectiveCapacity) -> Self { match native { nativeEffectiveCapacity::ExactLiquidity {ref liquidity_msat, } => { - let mut liquidity_msat_nonref = (*liquidity_msat).clone(); + let mut liquidity_msat_nonref = Clone::clone(liquidity_msat); EffectiveCapacity::ExactLiquidity { liquidity_msat: liquidity_msat_nonref, } }, nativeEffectiveCapacity::MaximumHTLC {ref amount_msat, } => { - let mut amount_msat_nonref = (*amount_msat).clone(); + let mut amount_msat_nonref = Clone::clone(amount_msat); EffectiveCapacity::MaximumHTLC { amount_msat: amount_msat_nonref, } }, nativeEffectiveCapacity::Total {ref capacity_msat, ref htlc_maximum_msat, } => { - let mut capacity_msat_nonref = (*capacity_msat).clone(); - let mut htlc_maximum_msat_nonref = (*htlc_maximum_msat).clone(); - let mut local_htlc_maximum_msat_nonref = if htlc_maximum_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { htlc_maximum_msat_nonref.unwrap() }) }; + let mut capacity_msat_nonref = Clone::clone(capacity_msat); + let mut htlc_maximum_msat_nonref = Clone::clone(htlc_maximum_msat); EffectiveCapacity::Total { capacity_msat: capacity_msat_nonref, - htlc_maximum_msat: local_htlc_maximum_msat_nonref, + htlc_maximum_msat: htlc_maximum_msat_nonref, } }, nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite, @@ -1311,10 +1277,9 @@ impl EffectiveCapacity { } }, nativeEffectiveCapacity::Total {mut capacity_msat, mut htlc_maximum_msat, } => { - let mut local_htlc_maximum_msat = if htlc_maximum_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { htlc_maximum_msat.unwrap() }) }; EffectiveCapacity::Total { capacity_msat: capacity_msat, - htlc_maximum_msat: local_htlc_maximum_msat, + htlc_maximum_msat: htlc_maximum_msat, } }, nativeEffectiveCapacity::Infinite => EffectiveCapacity::Infinite, @@ -1346,7 +1311,7 @@ pub extern "C" fn EffectiveCapacity_maximum_htlc(amount_msat: u64) -> EffectiveC } #[no_mangle] /// Utility method to constructs a new Total-variant EffectiveCapacity -pub extern "C" fn EffectiveCapacity_total(capacity_msat: u64, htlc_maximum_msat: crate::c_types::derived::COption_u64Z) -> EffectiveCapacity { +pub extern "C" fn EffectiveCapacity_total(capacity_msat: u64, htlc_maximum_msat: u64) -> EffectiveCapacity { EffectiveCapacity::Total { capacity_msat, htlc_maximum_msat, @@ -1406,7 +1371,7 @@ pub extern "C" fn RoutingFees_free(this_obj: RoutingFees) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RoutingFees_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRoutingFees); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRoutingFees) }; } #[allow(unused)] impl RoutingFees { @@ -1544,7 +1509,7 @@ pub extern "C" fn NodeAnnouncementInfo_free(this_obj: NodeAnnouncementInfo) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeAnnouncementInfo_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAnnouncementInfo); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeAnnouncementInfo) }; } #[allow(unused)] impl NodeAnnouncementInfo { @@ -1745,7 +1710,7 @@ pub extern "C" fn NodeAlias_free(this_obj: NodeAlias) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeAlias_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeAlias); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeAlias) }; } #[allow(unused)] impl NodeAlias { @@ -1857,7 +1822,7 @@ pub extern "C" fn NodeInfo_free(this_obj: NodeInfo) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn NodeInfo_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeNodeInfo); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeNodeInfo) }; } #[allow(unused)] impl NodeInfo { diff --git a/lightning-c-bindings/src/lightning/routing/router.rs b/lightning-c-bindings/src/lightning/routing/router.rs index afab2a0..d2f7a30 100644 --- a/lightning-c-bindings/src/lightning/routing/router.rs +++ b/lightning-c-bindings/src/lightning/routing/router.rs @@ -20,6 +20,443 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; +use lightning::routing::router::DefaultRouter as nativeDefaultRouterImport; +pub(crate) type nativeDefaultRouter = nativeDefaultRouterImport<&'static lightning::routing::gossip::NetworkGraph, crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::LockableScore>; + +/// A [`Router`] implemented using [`find_route`]. +#[must_use] +#[repr(C)] +pub struct DefaultRouter { + /// 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. + pub inner: *mut nativeDefaultRouter, + /// 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. + pub is_owned: bool, +} + +impl Drop for DefaultRouter { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeDefaultRouter>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn DefaultRouter_free(this_obj: DefaultRouter) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn DefaultRouter_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDefaultRouter) }; +} +#[allow(unused)] +impl DefaultRouter { + pub(crate) fn get_native_ref(&self) -> &'static nativeDefaultRouter { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDefaultRouter { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeDefaultRouter { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Creates a new router. +#[must_use] +#[no_mangle] +pub extern "C" fn DefaultRouter_new(network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, mut random_seed_bytes: crate::c_types::ThirtyTwoBytes, mut scorer: crate::lightning::routing::scoring::LockableScore) -> crate::lightning::routing::router::DefaultRouter { + let mut ret = lightning::routing::router::DefaultRouter::new(network_graph.get_native_ref(), logger, random_seed_bytes.data, scorer); + crate::lightning::routing::router::DefaultRouter { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +impl From for crate::lightning::routing::router::Router { + fn from(obj: nativeDefaultRouter) -> Self { + let mut rust_obj = DefaultRouter { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = DefaultRouter_as_Router(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(DefaultRouter_free_void); + ret + } +} +/// Constructs a new Router which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is +#[no_mangle] +pub extern "C" fn DefaultRouter_as_Router(this_arg: &DefaultRouter) -> crate::lightning::routing::router::Router { + crate::lightning::routing::router::Router { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + find_route: DefaultRouter_Router_find_route, + find_route_with_id: DefaultRouter_Router_find_route_with_id, + notify_payment_path_failed: DefaultRouter_Router_notify_payment_path_failed, + notify_payment_path_successful: DefaultRouter_Router_notify_payment_path_successful, + notify_payment_probe_successful: DefaultRouter_Router_notify_payment_probe_successful, + notify_payment_probe_failed: DefaultRouter_Router_notify_payment_probe_failed, + } +} + +#[must_use] +extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteLightningErrorZ { + let mut local_first_hops_base = if first_hops == core::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]); + let mut ret = >::find_route(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), route_params.get_native_ref(), local_first_hops, *unsafe { Box::from_raw(inflight_htlcs.take_inner()) }); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + local_ret +} +#[must_use] +extern "C" fn DefaultRouter_Router_find_route_with_id(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs, mut _payment_hash: crate::c_types::ThirtyTwoBytes, mut _payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RouteLightningErrorZ { + let mut local_first_hops_base = if first_hops == core::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]); + let mut ret = >::find_route_with_id(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), route_params.get_native_ref(), local_first_hops, *unsafe { Box::from_raw(inflight_htlcs.take_inner()) }, ::lightning::ln::PaymentHash(_payment_hash.data), ::lightning::ln::channelmanager::PaymentId(_payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; + local_ret +} +extern "C" fn DefaultRouter_Router_notify_payment_path_failed(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::notify_payment_path_failed(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..], short_channel_id) +} +extern "C" fn DefaultRouter_Router_notify_payment_path_successful(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::notify_payment_path_successful(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..]) +} +extern "C" fn DefaultRouter_Router_notify_payment_probe_successful(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::notify_payment_probe_successful(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..]) +} +extern "C" fn DefaultRouter_Router_notify_payment_probe_failed(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::notify_payment_probe_failed(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..], short_channel_id) +} + +/// A trait defining behavior for routing a payment. +#[repr(C)] +pub struct Router { + /// 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. + pub this_arg: *mut c_void, + /// 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 + #[must_use] + pub find_route: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteLightningErrorZ, + /// Finds a [`Route`] between `payer` and `payee` for a payment with the given values. Includes + /// `PaymentHash` and `PaymentId` to be able to correlate the request with a specific payment. + /// + /// Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None + #[must_use] + pub find_route_with_id: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs, _payment_hash: crate::c_types::ThirtyTwoBytes, _payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RouteLightningErrorZ, + /// Lets the router know that payment through a specific path has failed. + pub notify_payment_path_failed: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64), + /// Lets the router know that payment through a specific path was successful. + pub notify_payment_path_successful: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ), + /// Lets the router know that a payment probe was successful. + pub notify_payment_probe_successful: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ), + /// Lets the router know that a payment probe failed. + pub notify_payment_probe_failed: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64), + /// 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. + pub free: Option, +} +unsafe impl Send for Router {} +unsafe impl Sync for Router {} +#[no_mangle] +pub(crate) extern "C" fn Router_clone_fields(orig: &Router) -> Router { + Router { + this_arg: orig.this_arg, + find_route: Clone::clone(&orig.find_route), + find_route_with_id: Clone::clone(&orig.find_route_with_id), + notify_payment_path_failed: Clone::clone(&orig.notify_payment_path_failed), + notify_payment_path_successful: Clone::clone(&orig.notify_payment_path_successful), + notify_payment_probe_successful: Clone::clone(&orig.notify_payment_probe_successful), + notify_payment_probe_failed: Clone::clone(&orig.notify_payment_probe_failed), + free: Clone::clone(&orig.free), + } +} + +use lightning::routing::router::Router as rustRouter; +impl rustRouter for Router { + fn find_route(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs) -> Result { + let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; + let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }); + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; + local_ret + } + fn find_route_with_id(&self, mut payer: &bitcoin::secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut inflight_htlcs: lightning::routing::router::InFlightHtlcs, mut _payment_hash: lightning::ln::PaymentHash, mut _payment_id: lightning::ln::channelmanager::PaymentId) -> Result { + let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; + let mut ret = (self.find_route_with_id)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, local_first_hops, crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }, crate::c_types::ThirtyTwoBytes { data: _payment_hash.0 }, crate::c_types::ThirtyTwoBytes { data: _payment_id.0 }); + let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; + local_ret + } + fn notify_payment_path_failed(&self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) { + let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; + (self.notify_payment_path_failed)(self.this_arg, local_path.into(), short_channel_id) + } + fn notify_payment_path_successful(&self, mut path: &[&lightning::routing::router::RouteHop]) { + let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; + (self.notify_payment_path_successful)(self.this_arg, local_path.into()) + } + fn notify_payment_probe_successful(&self, mut path: &[&lightning::routing::router::RouteHop]) { + let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; + (self.notify_payment_probe_successful)(self.this_arg, local_path.into()) + } + fn notify_payment_probe_failed(&self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) { + let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; + (self.notify_payment_probe_failed)(self.this_arg, local_path.into(), short_channel_id) + } +} + +// We're essentially a pointer already, or at least a set of pointers, so allow us to be used +// directly as a Deref trait in higher-level structs: +impl core::ops::Deref for Router { + type Target = Self; + fn deref(&self) -> &Self { + self + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn Router_free(this_ptr: Router) { } +impl Drop for Router { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} + +use lightning::routing::router::ScorerAccountingForInFlightHtlcs as nativeScorerAccountingForInFlightHtlcsImport; +pub(crate) type nativeScorerAccountingForInFlightHtlcs = nativeScorerAccountingForInFlightHtlcsImport; + +/// [`Score`] implementation that factors in in-flight HTLC liquidity. +/// +/// Useful for custom [`Router`] implementations to wrap their [`Score`] on-the-fly when calling +/// [`find_route`]. +/// +/// [`Score`]: crate::routing::scoring::Score +#[must_use] +#[repr(C)] +pub struct ScorerAccountingForInFlightHtlcs { + /// 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. + pub inner: *mut nativeScorerAccountingForInFlightHtlcs, + /// 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. + pub is_owned: bool, +} + +impl Drop for ScorerAccountingForInFlightHtlcs { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeScorerAccountingForInFlightHtlcs>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the ScorerAccountingForInFlightHtlcs, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn ScorerAccountingForInFlightHtlcs_free(this_obj: ScorerAccountingForInFlightHtlcs) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn ScorerAccountingForInFlightHtlcs_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeScorerAccountingForInFlightHtlcs) }; +} +#[allow(unused)] +impl ScorerAccountingForInFlightHtlcs { + pub(crate) fn get_native_ref(&self) -> &'static nativeScorerAccountingForInFlightHtlcs { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeScorerAccountingForInFlightHtlcs { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeScorerAccountingForInFlightHtlcs { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +/// Initialize a new `ScorerAccountingForInFlightHtlcs`. +#[must_use] +#[no_mangle] +pub extern "C" fn ScorerAccountingForInFlightHtlcs_new(mut scorer: crate::lightning::routing::scoring::Score, mut inflight_htlcs: crate::lightning::routing::router::InFlightHtlcs) -> crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs { + let mut ret = lightning::routing::router::ScorerAccountingForInFlightHtlcs::new(scorer, *unsafe { Box::from_raw(inflight_htlcs.take_inner()) }); + crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +#[no_mangle] +/// Serialize the ScorerAccountingForInFlightHtlcs object into a byte array which can be read by ScorerAccountingForInFlightHtlcs_read +pub extern "C" fn ScorerAccountingForInFlightHtlcs_write(obj: &crate::lightning::routing::router::ScorerAccountingForInFlightHtlcs) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn ScorerAccountingForInFlightHtlcs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeScorerAccountingForInFlightHtlcs) }) +} +impl From for crate::lightning::routing::scoring::Score { + fn from(obj: nativeScorerAccountingForInFlightHtlcs) -> Self { + let mut rust_obj = ScorerAccountingForInFlightHtlcs { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = ScorerAccountingForInFlightHtlcs_as_Score(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn + rust_obj.inner = core::ptr::null_mut(); + ret.free = Some(ScorerAccountingForInFlightHtlcs_free_void); + ret + } +} +/// 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 +#[no_mangle] +pub extern "C" fn ScorerAccountingForInFlightHtlcs_as_Score(this_arg: &ScorerAccountingForInFlightHtlcs) -> crate::lightning::routing::scoring::Score { + crate::lightning::routing::scoring::Score { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + channel_penalty_msat: ScorerAccountingForInFlightHtlcs_Score_channel_penalty_msat, + payment_path_failed: ScorerAccountingForInFlightHtlcs_Score_payment_path_failed, + payment_path_successful: ScorerAccountingForInFlightHtlcs_Score_payment_path_successful, + probe_failed: ScorerAccountingForInFlightHtlcs_Score_probe_failed, + probe_successful: ScorerAccountingForInFlightHtlcs_Score_probe_successful, + write: ScorerAccountingForInFlightHtlcs_write_void, + } +} + +#[must_use] +extern "C" fn ScorerAccountingForInFlightHtlcs_Score_channel_penalty_msat(this_arg: *const c_void, mut short_channel_id: u64, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut usage: crate::lightning::routing::scoring::ChannelUsage) -> u64 { + let mut ret = >::channel_penalty_msat(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, short_channel_id, source.get_native_ref(), target.get_native_ref(), *unsafe { Box::from_raw(usage.take_inner()) }); + ret +} +extern "C" fn ScorerAccountingForInFlightHtlcs_Score_payment_path_failed(this_arg: *mut c_void, mut path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::payment_path_failed(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, &local_path[..], short_channel_id) +} +extern "C" fn ScorerAccountingForInFlightHtlcs_Score_payment_path_successful(this_arg: *mut c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::payment_path_successful(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, &local_path[..]) +} +extern "C" fn ScorerAccountingForInFlightHtlcs_Score_probe_failed(this_arg: *mut c_void, mut path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::probe_failed(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, &local_path[..], short_channel_id) +} +extern "C" fn ScorerAccountingForInFlightHtlcs_Score_probe_successful(this_arg: *mut c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) { + let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; + >::probe_successful(unsafe { &mut *(this_arg as *mut nativeScorerAccountingForInFlightHtlcs) }, &local_path[..]) +} + + +use lightning::routing::router::InFlightHtlcs as nativeInFlightHtlcsImport; +pub(crate) type nativeInFlightHtlcs = nativeInFlightHtlcsImport; + +/// A data structure for tracking in-flight HTLCs. May be used during pathfinding to account for +/// in-use channel liquidity. +#[must_use] +#[repr(C)] +pub struct InFlightHtlcs { + /// 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. + pub inner: *mut nativeInFlightHtlcs, + /// 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. + pub is_owned: bool, +} + +impl Drop for InFlightHtlcs { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeInFlightHtlcs>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn InFlightHtlcs_free(this_obj: InFlightHtlcs) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InFlightHtlcs_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInFlightHtlcs) }; +} +#[allow(unused)] +impl InFlightHtlcs { + pub(crate) fn get_native_ref(&self) -> &'static nativeInFlightHtlcs { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInFlightHtlcs { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativeInFlightHtlcs { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +impl Clone for InFlightHtlcs { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeInFlightHtlcs>::is_null(self.inner) { core::ptr::null_mut() } else { + ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, + is_owned: true, + } + } +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InFlightHtlcs_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeInFlightHtlcs)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the InFlightHtlcs +pub extern "C" fn InFlightHtlcs_clone(orig: &InFlightHtlcs) -> InFlightHtlcs { + orig.clone() +} +/// Constructs an empty `InFlightHtlcs`. +#[must_use] +#[no_mangle] +pub extern "C" fn InFlightHtlcs_new() -> crate::lightning::routing::router::InFlightHtlcs { + let mut ret = lightning::routing::router::InFlightHtlcs::new(); + crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Returns liquidity in msat given the public key of the HTLC source, target, and short channel +/// id. +#[must_use] +#[no_mangle] +pub extern "C" fn InFlightHtlcs_used_liquidity_msat(this_arg: &crate::lightning::routing::router::InFlightHtlcs, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut channel_scid: u64) -> crate::c_types::derived::COption_u64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.used_liquidity_msat(source.get_native_ref(), target.get_native_ref(), channel_scid); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; + local_ret +} + +#[no_mangle] +/// Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read +pub extern "C" fn InFlightHtlcs_write(obj: &crate::lightning::routing::router::InFlightHtlcs) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[no_mangle] +pub(crate) extern "C" fn InFlightHtlcs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInFlightHtlcs) }) +} +#[no_mangle] +/// Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write +pub extern "C" fn InFlightHtlcs_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InFlightHtlcsDecodeErrorZ { + let res: Result = crate::c_types::deserialize_obj(ser); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} + use lightning::routing::router::RouteHop as nativeRouteHopImport; pub(crate) type nativeRouteHop = nativeRouteHopImport; @@ -52,7 +489,7 @@ pub extern "C" fn RouteHop_free(this_obj: RouteHop) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteHop_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHop); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRouteHop) }; } #[allow(unused)] impl RouteHop { @@ -247,7 +684,7 @@ pub extern "C" fn Route_free(this_obj: Route) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Route_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRoute); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRoute) }; } #[allow(unused)] impl Route { @@ -433,7 +870,7 @@ pub extern "C" fn RouteParameters_free(this_obj: RouteParameters) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteParameters_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteParameters); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRouteParameters) }; } #[allow(unused)] impl RouteParameters { @@ -570,7 +1007,7 @@ pub extern "C" fn PaymentParameters_free(this_obj: PaymentParameters) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PaymentParameters_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePaymentParameters); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePaymentParameters) }; } #[allow(unused)] impl PaymentParameters { @@ -854,7 +1291,7 @@ pub extern "C" fn RouteHint_free(this_obj: RouteHint) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteHint_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHint); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRouteHint) }; } #[allow(unused)] impl RouteHint { @@ -979,7 +1416,7 @@ pub extern "C" fn RouteHintHop_free(this_obj: RouteHintHop) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RouteHintHop_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRouteHintHop); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRouteHintHop) }; } #[allow(unused)] impl RouteHintHop { diff --git a/lightning-c-bindings/src/lightning/routing/scoring.rs b/lightning-c-bindings/src/lightning/routing/scoring.rs index 3a3ad98..9fe4268 100644 --- a/lightning-c-bindings/src/lightning/routing/scoring.rs +++ b/lightning-c-bindings/src/lightning/routing/scoring.rs @@ -312,7 +312,7 @@ pub extern "C" fn MultiThreadedLockableScore_free(this_obj: MultiThreadedLockabl #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn MultiThreadedLockableScore_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMultiThreadedLockableScore); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMultiThreadedLockableScore) }; } #[allow(unused)] impl MultiThreadedLockableScore { @@ -363,7 +363,7 @@ pub extern "C" fn MultiThreadedScoreLock_free(this_obj: MultiThreadedScoreLock) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn MultiThreadedScoreLock_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMultiThreadedScoreLock); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMultiThreadedScoreLock) }; } #[allow(unused)] impl MultiThreadedScoreLock { @@ -542,7 +542,7 @@ pub extern "C" fn ChannelUsage_free(this_obj: ChannelUsage) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelUsage_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelUsage); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelUsage) }; } #[allow(unused)] impl ChannelUsage { @@ -657,7 +657,7 @@ pub extern "C" fn FixedPenaltyScorer_free(this_obj: FixedPenaltyScorer) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FixedPenaltyScorer_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFixedPenaltyScorer); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFixedPenaltyScorer) }; } #[allow(unused)] impl FixedPenaltyScorer { @@ -835,7 +835,7 @@ pub extern "C" fn ProbabilisticScorer_free(this_obj: ProbabilisticScorer) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ProbabilisticScorer_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeProbabilisticScorer); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeProbabilisticScorer) }; } #[allow(unused)] impl ProbabilisticScorer { @@ -892,7 +892,7 @@ pub extern "C" fn ProbabilisticScoringParameters_free(this_obj: ProbabilisticSco #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ProbabilisticScoringParameters_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeProbabilisticScoringParameters); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeProbabilisticScoringParameters) }; } #[allow(unused)] impl ProbabilisticScoringParameters { diff --git a/lightning-c-bindings/src/lightning/util/config.rs b/lightning-c-bindings/src/lightning/util/config.rs index e99f722..6830ed0 100644 --- a/lightning-c-bindings/src/lightning/util/config.rs +++ b/lightning-c-bindings/src/lightning/util/config.rs @@ -52,7 +52,7 @@ pub extern "C" fn ChannelHandshakeConfig_free(this_obj: ChannelHandshakeConfig) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelHandshakeConfig_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelHandshakeConfig); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelHandshakeConfig) }; } #[allow(unused)] impl ChannelHandshakeConfig { @@ -471,7 +471,7 @@ pub extern "C" fn ChannelHandshakeLimits_free(this_obj: ChannelHandshakeLimits) #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelHandshakeLimits_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelHandshakeLimits); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelHandshakeLimits) }; } #[allow(unused)] impl ChannelHandshakeLimits { @@ -781,7 +781,7 @@ pub extern "C" fn ChannelConfig_free(this_obj: ChannelConfig) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ChannelConfig_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeChannelConfig); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeChannelConfig) }; } #[allow(unused)] impl ChannelConfig { @@ -1102,7 +1102,7 @@ pub extern "C" fn UserConfig_free(this_obj: UserConfig) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn UserConfig_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeUserConfig); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUserConfig) }; } #[allow(unused)] impl UserConfig { @@ -1242,10 +1242,39 @@ pub extern "C" fn UserConfig_get_manually_accept_inbound_channels(this_ptr: &Use pub extern "C" fn UserConfig_set_manually_accept_inbound_channels(this_ptr: &mut UserConfig, mut val: bool) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.manually_accept_inbound_channels = val; } +/// If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over +/// fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC +/// intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. +/// +/// Setting this to true may break backwards compatibility with LDK versions < 0.0.113. +/// +/// Default value: false. +/// +/// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid +/// [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted +#[no_mangle] +pub extern "C" fn UserConfig_get_accept_intercept_htlcs(this_ptr: &UserConfig) -> bool { + let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_intercept_htlcs; + *inner_val +} +/// If this is set to true, LDK will intercept HTLCs that are attempting to be forwarded over +/// fake short channel ids generated via [`ChannelManager::get_intercept_scid`]. Upon HTLC +/// intercept, LDK will generate an [`Event::HTLCIntercepted`] which MUST be handled by the user. +/// +/// Setting this to true may break backwards compatibility with LDK versions < 0.0.113. +/// +/// Default value: false. +/// +/// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid +/// [`Event::HTLCIntercepted`]: crate::util::events::Event::HTLCIntercepted +#[no_mangle] +pub extern "C" fn UserConfig_set_accept_intercept_htlcs(this_ptr: &mut UserConfig, mut val: bool) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.accept_intercept_htlcs = val; +} /// Constructs a new UserConfig given each field #[must_use] #[no_mangle] -pub extern "C" fn UserConfig_new(mut channel_handshake_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut channel_handshake_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_config_arg: crate::lightning::util::config::ChannelConfig, mut accept_forwards_to_priv_channels_arg: bool, mut accept_inbound_channels_arg: bool, mut manually_accept_inbound_channels_arg: bool) -> UserConfig { +pub extern "C" fn UserConfig_new(mut channel_handshake_config_arg: crate::lightning::util::config::ChannelHandshakeConfig, mut channel_handshake_limits_arg: crate::lightning::util::config::ChannelHandshakeLimits, mut channel_config_arg: crate::lightning::util::config::ChannelConfig, mut accept_forwards_to_priv_channels_arg: bool, mut accept_inbound_channels_arg: bool, mut manually_accept_inbound_channels_arg: bool, mut accept_intercept_htlcs_arg: bool) -> UserConfig { UserConfig { inner: ObjOps::heap_alloc(nativeUserConfig { channel_handshake_config: *unsafe { Box::from_raw(channel_handshake_config_arg.take_inner()) }, channel_handshake_limits: *unsafe { Box::from_raw(channel_handshake_limits_arg.take_inner()) }, @@ -1253,6 +1282,7 @@ pub extern "C" fn UserConfig_new(mut channel_handshake_config_arg: crate::lightn accept_forwards_to_priv_channels: accept_forwards_to_priv_channels_arg, accept_inbound_channels: accept_inbound_channels_arg, manually_accept_inbound_channels: manually_accept_inbound_channels_arg, + accept_intercept_htlcs: accept_intercept_htlcs_arg, }), is_owned: true } } impl Clone for UserConfig { diff --git a/lightning-c-bindings/src/lightning/util/errors.rs b/lightning-c-bindings/src/lightning/util/errors.rs index 4c911a5..91ce973 100644 --- a/lightning-c-bindings/src/lightning/util/errors.rs +++ b/lightning-c-bindings/src/lightning/util/errors.rs @@ -39,7 +39,7 @@ pub enum APIError { }, /// A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, /// too-many-hops, etc). - RouteError { + InvalidRoute { /// A human-readable error message err: crate::c_types::Str, }, @@ -80,34 +80,34 @@ impl APIError { pub(crate) fn to_native(&self) -> nativeAPIError { match self { APIError::APIMisuseError {ref err, } => { - let mut err_nonref = (*err).clone(); + let mut err_nonref = Clone::clone(err); nativeAPIError::APIMisuseError { err: err_nonref.into_string(), } }, APIError::FeeRateTooHigh {ref err, ref feerate, } => { - let mut err_nonref = (*err).clone(); - let mut feerate_nonref = (*feerate).clone(); + let mut err_nonref = Clone::clone(err); + let mut feerate_nonref = Clone::clone(feerate); nativeAPIError::FeeRateTooHigh { err: err_nonref.into_string(), feerate: feerate_nonref, } }, - APIError::RouteError {ref err, } => { - let mut err_nonref = (*err).clone(); - nativeAPIError::RouteError { + APIError::InvalidRoute {ref err, } => { + let mut err_nonref = Clone::clone(err); + nativeAPIError::InvalidRoute { err: err_nonref.into_str(), } }, APIError::ChannelUnavailable {ref err, } => { - let mut err_nonref = (*err).clone(); + let mut err_nonref = Clone::clone(err); nativeAPIError::ChannelUnavailable { err: err_nonref.into_string(), } }, APIError::MonitorUpdateInProgress => nativeAPIError::MonitorUpdateInProgress, APIError::IncompatibleShutdownScript {ref script, } => { - let mut script_nonref = (*script).clone(); + let mut script_nonref = Clone::clone(script); nativeAPIError::IncompatibleShutdownScript { script: *unsafe { Box::from_raw(script_nonref.take_inner()) }, } @@ -128,8 +128,8 @@ impl APIError { feerate: feerate, } }, - APIError::RouteError {mut err, } => { - nativeAPIError::RouteError { + APIError::InvalidRoute {mut err, } => { + nativeAPIError::InvalidRoute { err: err.into_str(), } }, @@ -150,34 +150,34 @@ impl APIError { pub(crate) fn from_native(native: &nativeAPIError) -> Self { match native { nativeAPIError::APIMisuseError {ref err, } => { - let mut err_nonref = (*err).clone(); + let mut err_nonref = Clone::clone(err); APIError::APIMisuseError { err: err_nonref.into(), } }, nativeAPIError::FeeRateTooHigh {ref err, ref feerate, } => { - let mut err_nonref = (*err).clone(); - let mut feerate_nonref = (*feerate).clone(); + let mut err_nonref = Clone::clone(err); + let mut feerate_nonref = Clone::clone(feerate); APIError::FeeRateTooHigh { err: err_nonref.into(), feerate: feerate_nonref, } }, - nativeAPIError::RouteError {ref err, } => { - let mut err_nonref = (*err).clone(); - APIError::RouteError { + nativeAPIError::InvalidRoute {ref err, } => { + let mut err_nonref = Clone::clone(err); + APIError::InvalidRoute { err: err_nonref.into(), } }, nativeAPIError::ChannelUnavailable {ref err, } => { - let mut err_nonref = (*err).clone(); + let mut err_nonref = Clone::clone(err); APIError::ChannelUnavailable { err: err_nonref.into(), } }, nativeAPIError::MonitorUpdateInProgress => APIError::MonitorUpdateInProgress, nativeAPIError::IncompatibleShutdownScript {ref script, } => { - let mut script_nonref = (*script).clone(); + let mut script_nonref = Clone::clone(script); APIError::IncompatibleShutdownScript { script: crate::lightning::ln::script::ShutdownScript { inner: ObjOps::heap_alloc(script_nonref), is_owned: true }, } @@ -198,8 +198,8 @@ impl APIError { feerate: feerate, } }, - nativeAPIError::RouteError {mut err, } => { - APIError::RouteError { + nativeAPIError::InvalidRoute {mut err, } => { + APIError::InvalidRoute { err: err.into(), } }, @@ -241,9 +241,9 @@ pub extern "C" fn APIError_fee_rate_too_high(err: crate::c_types::Str, feerate: } } #[no_mangle] -/// Utility method to constructs a new RouteError-variant APIError -pub extern "C" fn APIError_route_error(err: crate::c_types::Str) -> APIError { - APIError::RouteError { +/// Utility method to constructs a new InvalidRoute-variant APIError +pub extern "C" fn APIError_invalid_route(err: crate::c_types::Str) -> APIError { + APIError::InvalidRoute { err, } } diff --git a/lightning-c-bindings/src/lightning/util/events.rs b/lightning-c-bindings/src/lightning/util/events.rs index 33e3e24..07db22c 100644 --- a/lightning-c-bindings/src/lightning/util/events.rs +++ b/lightning-c-bindings/src/lightning/util/events.rs @@ -63,16 +63,16 @@ impl PaymentPurpose { pub(crate) fn to_native(&self) -> nativePaymentPurpose { match self { PaymentPurpose::InvoicePayment {ref payment_preimage, ref payment_secret, } => { - let mut payment_preimage_nonref = (*payment_preimage).clone(); + let mut payment_preimage_nonref = Clone::clone(payment_preimage); let mut local_payment_preimage_nonref = if payment_preimage_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentPreimage(payment_preimage_nonref.data) }) }; - let mut payment_secret_nonref = (*payment_secret).clone(); + let mut payment_secret_nonref = Clone::clone(payment_secret); nativePaymentPurpose::InvoicePayment { payment_preimage: local_payment_preimage_nonref, payment_secret: ::lightning::ln::PaymentSecret(payment_secret_nonref.data), } }, PaymentPurpose::SpontaneousPayment (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativePaymentPurpose::SpontaneousPayment ( ::lightning::ln::PaymentPreimage(a_nonref.data), ) @@ -100,16 +100,16 @@ impl PaymentPurpose { pub(crate) fn from_native(native: &nativePaymentPurpose) -> Self { match native { nativePaymentPurpose::InvoicePayment {ref payment_preimage, ref payment_secret, } => { - let mut payment_preimage_nonref = (*payment_preimage).clone(); + let mut payment_preimage_nonref = Clone::clone(payment_preimage); let mut local_payment_preimage_nonref = if payment_preimage_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_preimage_nonref.unwrap()).0 } } }; - let mut payment_secret_nonref = (*payment_secret).clone(); + let mut payment_secret_nonref = Clone::clone(payment_secret); PaymentPurpose::InvoicePayment { payment_preimage: local_payment_preimage_nonref, payment_secret: crate::c_types::ThirtyTwoBytes { data: payment_secret_nonref.0 }, } }, nativePaymentPurpose::SpontaneousPayment (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); PaymentPurpose::SpontaneousPayment ( crate::c_types::ThirtyTwoBytes { data: a_nonref.0 }, ) @@ -228,7 +228,7 @@ impl ClosureReason { pub(crate) fn to_native(&self) -> nativeClosureReason { match self { ClosureReason::CounterpartyForceClosed {ref peer_msg, } => { - let mut peer_msg_nonref = (*peer_msg).clone(); + let mut peer_msg_nonref = Clone::clone(peer_msg); nativeClosureReason::CounterpartyForceClosed { peer_msg: peer_msg_nonref.into_string(), } @@ -238,7 +238,7 @@ impl ClosureReason { ClosureReason::CommitmentTxConfirmed => nativeClosureReason::CommitmentTxConfirmed, ClosureReason::FundingTimedOut => nativeClosureReason::FundingTimedOut, ClosureReason::ProcessingError {ref err, } => { - let mut err_nonref = (*err).clone(); + let mut err_nonref = Clone::clone(err); nativeClosureReason::ProcessingError { err: err_nonref.into_string(), } @@ -272,7 +272,7 @@ impl ClosureReason { pub(crate) fn from_native(native: &nativeClosureReason) -> Self { match native { nativeClosureReason::CounterpartyForceClosed {ref peer_msg, } => { - let mut peer_msg_nonref = (*peer_msg).clone(); + let mut peer_msg_nonref = Clone::clone(peer_msg); ClosureReason::CounterpartyForceClosed { peer_msg: peer_msg_nonref.into(), } @@ -282,7 +282,7 @@ impl ClosureReason { nativeClosureReason::CommitmentTxConfirmed => ClosureReason::CommitmentTxConfirmed, nativeClosureReason::FundingTimedOut => ClosureReason::FundingTimedOut, nativeClosureReason::ProcessingError {ref err, } => { - let mut err_nonref = (*err).clone(); + let mut err_nonref = Clone::clone(err); ClosureReason::ProcessingError { err: err_nonref.into(), } @@ -399,6 +399,12 @@ pub enum HTLCDestination { /// Short channel id we are requesting to forward an HTLC to. requested_forward_scid: u64, }, + /// We couldn't forward to the outgoing scid. An example would be attempting to send a duplicate + /// intercept HTLC. + InvalidForward { + /// Short channel id we are requesting to forward an HTLC to. + requested_forward_scid: u64, + }, /// Failure scenario where an HTLC may have been forwarded to be intended for us, /// but is invalid for some reason, so we reject it. /// @@ -419,22 +425,28 @@ impl HTLCDestination { pub(crate) fn to_native(&self) -> nativeHTLCDestination { match self { HTLCDestination::NextHopChannel {ref node_id, ref channel_id, } => { - let mut node_id_nonref = (*node_id).clone(); + let mut node_id_nonref = Clone::clone(node_id); let mut local_node_id_nonref = if node_id_nonref.is_null() { None } else { Some( { node_id_nonref.into_rust() }) }; - let mut channel_id_nonref = (*channel_id).clone(); + let mut channel_id_nonref = Clone::clone(channel_id); nativeHTLCDestination::NextHopChannel { node_id: local_node_id_nonref, channel_id: channel_id_nonref.data, } }, HTLCDestination::UnknownNextHop {ref requested_forward_scid, } => { - let mut requested_forward_scid_nonref = (*requested_forward_scid).clone(); + let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); nativeHTLCDestination::UnknownNextHop { requested_forward_scid: requested_forward_scid_nonref, } }, + HTLCDestination::InvalidForward {ref requested_forward_scid, } => { + let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); + nativeHTLCDestination::InvalidForward { + requested_forward_scid: requested_forward_scid_nonref, + } + }, HTLCDestination::FailedPayment {ref payment_hash, } => { - let mut payment_hash_nonref = (*payment_hash).clone(); + let mut payment_hash_nonref = Clone::clone(payment_hash); nativeHTLCDestination::FailedPayment { payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), } @@ -456,6 +468,11 @@ impl HTLCDestination { requested_forward_scid: requested_forward_scid, } }, + HTLCDestination::InvalidForward {mut requested_forward_scid, } => { + nativeHTLCDestination::InvalidForward { + requested_forward_scid: requested_forward_scid, + } + }, HTLCDestination::FailedPayment {mut payment_hash, } => { nativeHTLCDestination::FailedPayment { payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), @@ -467,22 +484,28 @@ impl HTLCDestination { pub(crate) fn from_native(native: &nativeHTLCDestination) -> Self { match native { nativeHTLCDestination::NextHopChannel {ref node_id, ref channel_id, } => { - let mut node_id_nonref = (*node_id).clone(); + let mut node_id_nonref = Clone::clone(node_id); let mut local_node_id_nonref = if node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(node_id_nonref.unwrap())) } }; - let mut channel_id_nonref = (*channel_id).clone(); + let mut channel_id_nonref = Clone::clone(channel_id); HTLCDestination::NextHopChannel { node_id: local_node_id_nonref, channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, } }, nativeHTLCDestination::UnknownNextHop {ref requested_forward_scid, } => { - let mut requested_forward_scid_nonref = (*requested_forward_scid).clone(); + let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); HTLCDestination::UnknownNextHop { requested_forward_scid: requested_forward_scid_nonref, } }, + nativeHTLCDestination::InvalidForward {ref requested_forward_scid, } => { + let mut requested_forward_scid_nonref = Clone::clone(requested_forward_scid); + HTLCDestination::InvalidForward { + requested_forward_scid: requested_forward_scid_nonref, + } + }, nativeHTLCDestination::FailedPayment {ref payment_hash, } => { - let mut payment_hash_nonref = (*payment_hash).clone(); + let mut payment_hash_nonref = Clone::clone(payment_hash); HTLCDestination::FailedPayment { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, } @@ -504,6 +527,11 @@ impl HTLCDestination { requested_forward_scid: requested_forward_scid, } }, + nativeHTLCDestination::InvalidForward {mut requested_forward_scid, } => { + HTLCDestination::InvalidForward { + requested_forward_scid: requested_forward_scid, + } + }, nativeHTLCDestination::FailedPayment {mut payment_hash, } => { HTLCDestination::FailedPayment { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, @@ -536,6 +564,13 @@ pub extern "C" fn HTLCDestination_unknown_next_hop(requested_forward_scid: u64) } } #[no_mangle] +/// Utility method to constructs a new InvalidForward-variant HTLCDestination +pub extern "C" fn HTLCDestination_invalid_forward(requested_forward_scid: u64) -> HTLCDestination { + HTLCDestination::InvalidForward { + requested_forward_scid, + } +} +#[no_mangle] /// Utility method to constructs a new FailedPayment-variant HTLCDestination pub extern "C" fn HTLCDestination_failed_payment(payment_hash: crate::c_types::ThirtyTwoBytes) -> HTLCDestination { HTLCDestination::FailedPayment { @@ -592,14 +627,15 @@ pub enum Event { channel_value_satoshis: u64, /// The script which should be used in the transaction output. output_script: crate::c_types::derived::CVec_u8Z, - /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or 0 for - /// an inbound channel. + /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`], or a + /// random value for an inbound channel. This may be zero for objects serialized with LDK + /// versions prior to 0.0.113. /// /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel - user_channel_id: u64, + user_channel_id: crate::c_types::U128, }, - /// 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.... + /// Indicates that we've been offered a payment and it needs to be claimed via calling + /// [`ChannelManager::claim_funds`] with the preimage given in [`PaymentPurpose`]. /// /// Note that if the preimage is not known, you should call /// [`ChannelManager::fail_htlc_backwards`] to free up resources for this HTLC and avoid @@ -610,11 +646,23 @@ pub enum 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. + /// `PaymentClaimable` events may be generated for the same payment. + /// + /// # Note + /// This event used to be called `PaymentReceived` in LDK versions 0.0.112 and earlier. /// /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds /// [`ChannelManager::fail_htlc_backwards`]: crate::ln::channelmanager::ChannelManager::fail_htlc_backwards - PaymentReceived { + PaymentClaimable { + /// The node that will receive the payment after it has been claimed. + /// This is useful to identify payments received via [phantom nodes]. + /// This field will always be filled in when the event was generated by LDK versions + /// 0.0.113 and above. + /// + /// [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + receiver_node_id: crate::c_types::PublicKey, /// The hash for which the preimage should be handed to the ChannelManager. Note that LDK will /// not stop you from registering duplicate payment hashes for inbound payments. payment_hash: crate::c_types::ThirtyTwoBytes, @@ -623,28 +671,43 @@ pub enum Event { /// 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. purpose: crate::lightning::util::events::PaymentPurpose, + /// The `channel_id` indicating over which channel we received the payment. + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + via_channel_id: crate::c_types::ThirtyTwoBytes, + /// The `user_channel_id` indicating over which channel we received the payment. + via_user_channel_id: crate::c_types::derived::COption_u128Z, }, /// 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 + /// to an [`Event::PaymentClaimable`]. However, if we previously crashed during a /// [`ChannelManager::claim_funds`] call you may see this event without a corresponding - /// [`Event::PaymentReceived`] event. + /// [`Event::PaymentClaimable`] 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 + /// `PaymentClaimable` events may be generated for the same payment. If you then call + /// [`ChannelManager::claim_funds`] twice for the same [`Event::PaymentClaimable`] you may get /// multiple `PaymentClaimed` events. /// /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds PaymentClaimed { + /// The node that received the payment. + /// This is useful to identify payments which were received via [phantom nodes]. + /// This field will always be filled in when the event was generated by LDK versions + /// 0.0.113 and above. + /// + /// [phantom nodes]: crate::chain::keysinterface::PhantomKeysManager + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + receiver_node_id: crate::c_types::PublicKey, /// The payment hash of the claimed payment. Note that LDK will not stop you from /// registering duplicate payment hashes for inbound payments. payment_hash: crate::c_types::ThirtyTwoBytes, /// The value, in thousandths of a satoshi, that this payment is for. amount_msat: u64, - /// The purpose of this claimed payment, i.e. whether the payment was for an invoice or a + /// The purpose of the claimed payment, i.e. whether the payment was for an invoice or a /// spontaneous payment. purpose: crate::lightning::util::events::PaymentPurpose, }, @@ -685,8 +748,8 @@ pub enum Event { /// 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. + /// payment is no longer retryable due to [`ChannelManager::abandon_payment`] having been + /// called for the corresponding payment. /// /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment PaymentFailed { @@ -727,9 +790,14 @@ pub enum Event { /// Indicates an outbound HTLC we sent failed. Probably some intermediary node dropped /// something. You may wish to retry with a different route. /// + /// If you have given up retrying this payment and wish to fail it, you MUST call + /// [`ChannelManager::abandon_payment`] at least once for a given [`PaymentId`] or memory + /// related to payment tracking will leak. + /// /// Note that this does *not* indicate that all paths for an MPP payment have failed, see /// [`Event::PaymentFailed`] and [`all_paths_failed`]. /// + /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment /// [`all_paths_failed`]: Self::PaymentPathFailed::all_paths_failed PaymentPathFailed { /// The id returned by [`ChannelManager::send_payment`] and used with @@ -839,6 +907,38 @@ pub enum Event { /// now + 5*time_forwardable). time_forwardable: u64, }, + /// Used to indicate that we've intercepted an HTLC forward. This event will only be generated if + /// you've encoded an intercept scid in the receiver's invoice route hints using + /// [`ChannelManager::get_intercept_scid`] and have set [`UserConfig::accept_intercept_htlcs`]. + /// + /// [`ChannelManager::forward_intercepted_htlc`] or + /// [`ChannelManager::fail_intercepted_htlc`] MUST be called in response to this event. See + /// their docs for more information. + /// + /// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + /// [`UserConfig::accept_intercept_htlcs`]: crate::util::config::UserConfig::accept_intercept_htlcs + /// [`ChannelManager::forward_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::forward_intercepted_htlc + /// [`ChannelManager::fail_intercepted_htlc`]: crate::ln::channelmanager::ChannelManager::fail_intercepted_htlc + HTLCIntercepted { + /// An id to help LDK identify which HTLC is being forwarded or failed. + intercept_id: crate::c_types::ThirtyTwoBytes, + /// The fake scid that was programmed as the next hop's scid, generated using + /// [`ChannelManager::get_intercept_scid`]. + /// + /// [`ChannelManager::get_intercept_scid`]: crate::ln::channelmanager::ChannelManager::get_intercept_scid + requested_next_hop_scid: u64, + /// The payment hash used for this HTLC. + payment_hash: crate::c_types::ThirtyTwoBytes, + /// How many msats were received on the inbound edge of this HTLC. + inbound_amount_msat: u64, + /// How many msats the payer intended to route to the next node. Depending on the reason you are + /// intercepting this payment, you might take a fee by forwarding less than this amount. + /// + /// Note that LDK will NOT check that expected fees were factored into this value. You MUST + /// check that whatever fee you want has been included here or subtract it as required. Further, + /// LDK will not stop you from forwarding more than you received. + expected_outbound_amount_msat: u64, + }, /// Used to indicate that an output which you should know how to spend was confirmed on chain /// and is now spendable. /// Such an output will *not* ever be spent by rust-lightning, and are not at risk of your @@ -879,6 +979,27 @@ pub enum Event { /// transaction. claim_from_onchain_tx: bool, }, + /// Used to indicate that a channel with the given `channel_id` is ready to + /// be used. This event is emitted either when the funding transaction has been confirmed + /// on-chain, or, in case of a 0conf channel, when both parties have confirmed the channel + /// establishment. + ChannelReady { + /// The channel_id of the channel that is ready. + channel_id: crate::c_types::ThirtyTwoBytes, + /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound + /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if + /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise + /// `user_channel_id` will be randomized for an inbound channel. + /// + /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel + /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel + /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels + user_channel_id: crate::c_types::U128, + /// The node_id of the channel counterparty. + counterparty_node_id: crate::c_types::PublicKey, + /// The features that this channel will operate with. + channel_type: crate::lightning::ln::features::ChannelTypeFeatures, + }, /// Used to indicate that a previously opened channel with the given `channel_id` is in the /// process of closure. ChannelClosed { @@ -888,13 +1009,14 @@ pub enum Event { /// The `user_channel_id` value passed in to [`ChannelManager::create_channel`] for outbound /// channels, or to [`ChannelManager::accept_inbound_channel`] for inbound channels if /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise - /// `user_channel_id` will be 0 for an inbound channel. - /// This will always be zero for objects serialized with LDK versions prior to 0.0.102. + /// `user_channel_id` will be randomized for inbound channels. + /// This may be zero for inbound channels serialized prior to 0.0.113 and will always be + /// zero for objects serialized with LDK versions prior to 0.0.102. /// /// [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel /// [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels - user_channel_id: u64, + user_channel_id: crate::c_types::U128, /// The reason the channel was closed. reason: crate::lightning::util::events::ClosureReason, }, @@ -985,45 +1107,57 @@ impl Event { pub(crate) fn to_native(&self) -> nativeEvent { match self { Event::FundingGenerationReady {ref temporary_channel_id, ref counterparty_node_id, ref channel_value_satoshis, ref output_script, ref user_channel_id, } => { - let mut temporary_channel_id_nonref = (*temporary_channel_id).clone(); - let mut counterparty_node_id_nonref = (*counterparty_node_id).clone(); - let mut channel_value_satoshis_nonref = (*channel_value_satoshis).clone(); - let mut output_script_nonref = (*output_script).clone(); - let mut user_channel_id_nonref = (*user_channel_id).clone(); + let mut temporary_channel_id_nonref = Clone::clone(temporary_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut channel_value_satoshis_nonref = Clone::clone(channel_value_satoshis); + let mut output_script_nonref = Clone::clone(output_script); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); nativeEvent::FundingGenerationReady { temporary_channel_id: temporary_channel_id_nonref.data, counterparty_node_id: counterparty_node_id_nonref.into_rust(), channel_value_satoshis: channel_value_satoshis_nonref, output_script: ::bitcoin::blockdata::script::Script::from(output_script_nonref.into_rust()), - user_channel_id: user_channel_id_nonref, - } - }, - Event::PaymentReceived {ref payment_hash, ref amount_msat, ref purpose, } => { - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut amount_msat_nonref = (*amount_msat).clone(); - let mut purpose_nonref = (*purpose).clone(); - nativeEvent::PaymentReceived { + user_channel_id: user_channel_id_nonref.into(), + } + }, + Event::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, } => { + let mut receiver_node_id_nonref = Clone::clone(receiver_node_id); + let mut local_receiver_node_id_nonref = if receiver_node_id_nonref.is_null() { None } else { Some( { receiver_node_id_nonref.into_rust() }) }; + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut amount_msat_nonref = Clone::clone(amount_msat); + let mut purpose_nonref = Clone::clone(purpose); + let mut via_channel_id_nonref = Clone::clone(via_channel_id); + let mut local_via_channel_id_nonref = if via_channel_id_nonref.data == [0; 32] { None } else { Some( { via_channel_id_nonref.data }) }; + let mut via_user_channel_id_nonref = Clone::clone(via_user_channel_id); + let mut local_via_user_channel_id_nonref = { /* via_user_channel_id_nonref*/ let via_user_channel_id_nonref_opt = via_user_channel_id_nonref; { } if via_user_channel_id_nonref_opt.is_none() { None } else { Some({ via_user_channel_id_nonref_opt.take().into() }) } }; + nativeEvent::PaymentClaimable { + receiver_node_id: local_receiver_node_id_nonref, payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), amount_msat: amount_msat_nonref, purpose: purpose_nonref.into_native(), + via_channel_id: local_via_channel_id_nonref, + via_user_channel_id: local_via_user_channel_id_nonref, } }, - Event::PaymentClaimed {ref payment_hash, ref amount_msat, ref purpose, } => { - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut amount_msat_nonref = (*amount_msat).clone(); - let mut purpose_nonref = (*purpose).clone(); + Event::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, } => { + let mut receiver_node_id_nonref = Clone::clone(receiver_node_id); + let mut local_receiver_node_id_nonref = if receiver_node_id_nonref.is_null() { None } else { Some( { receiver_node_id_nonref.into_rust() }) }; + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut amount_msat_nonref = Clone::clone(amount_msat); + let mut purpose_nonref = Clone::clone(purpose); nativeEvent::PaymentClaimed { + receiver_node_id: local_receiver_node_id_nonref, payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), amount_msat: amount_msat_nonref, purpose: purpose_nonref.into_native(), } }, Event::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => { - let mut payment_id_nonref = (*payment_id).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); let mut local_payment_id_nonref = if payment_id_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data) }) }; - let mut payment_preimage_nonref = (*payment_preimage).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut fee_paid_msat_nonref = (*fee_paid_msat).clone(); + let mut payment_preimage_nonref = Clone::clone(payment_preimage); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut fee_paid_msat_nonref = Clone::clone(fee_paid_msat); let mut local_fee_paid_msat_nonref = if fee_paid_msat_nonref.is_some() { Some( { fee_paid_msat_nonref.take() }) } else { None }; nativeEvent::PaymentSent { payment_id: local_payment_id_nonref, @@ -1033,18 +1167,18 @@ impl Event { } }, Event::PaymentFailed {ref payment_id, ref payment_hash, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); nativeEvent::PaymentFailed { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), } }, Event::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); let mut local_payment_hash_nonref = if payment_hash_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash_nonref.data) }) }; - let mut path_nonref = (*path).clone(); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; nativeEvent::PaymentPathSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), @@ -1053,18 +1187,18 @@ impl Event { } }, Event::PaymentPathFailed {ref payment_id, ref payment_hash, ref payment_failed_permanently, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, ref retry, } => { - let mut payment_id_nonref = (*payment_id).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); let mut local_payment_id_nonref = if payment_id_nonref.data == [0; 32] { None } else { Some( { ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data) }) }; - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut payment_failed_permanently_nonref = (*payment_failed_permanently).clone(); - let mut network_update_nonref = (*network_update).clone(); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut payment_failed_permanently_nonref = Clone::clone(payment_failed_permanently); + let mut network_update_nonref = Clone::clone(network_update); let mut local_network_update_nonref = { /* network_update_nonref*/ let network_update_nonref_opt = network_update_nonref; { } if network_update_nonref_opt.is_none() { None } else { Some({ network_update_nonref_opt.take().into_native() }) } }; - let mut all_paths_failed_nonref = (*all_paths_failed).clone(); - let mut path_nonref = (*path).clone(); + let mut all_paths_failed_nonref = Clone::clone(all_paths_failed); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut short_channel_id_nonref = (*short_channel_id).clone(); + let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_some() { Some( { short_channel_id_nonref.take() }) } else { None }; - let mut retry_nonref = (*retry).clone(); + let mut retry_nonref = Clone::clone(retry); let mut local_retry_nonref = if retry_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(retry_nonref.take_inner()) } }) }; nativeEvent::PaymentPathFailed { payment_id: local_payment_id_nonref, @@ -1078,9 +1212,9 @@ impl Event { } }, Event::ProbeSuccessful {ref payment_id, ref payment_hash, ref path, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut path_nonref = (*path).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; nativeEvent::ProbeSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), @@ -1089,11 +1223,11 @@ impl Event { } }, Event::ProbeFailed {ref payment_id, ref payment_hash, ref path, ref short_channel_id, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut path_nonref = (*path).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.into_rust().drain(..) { local_path_nonref.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut short_channel_id_nonref = (*short_channel_id).clone(); + let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_some() { Some( { short_channel_id_nonref.take() }) } else { None }; nativeEvent::ProbeFailed { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), @@ -1103,26 +1237,40 @@ impl Event { } }, Event::PendingHTLCsForwardable {ref time_forwardable, } => { - let mut time_forwardable_nonref = (*time_forwardable).clone(); + let mut time_forwardable_nonref = Clone::clone(time_forwardable); nativeEvent::PendingHTLCsForwardable { time_forwardable: core::time::Duration::from_secs(time_forwardable_nonref), } }, + Event::HTLCIntercepted {ref intercept_id, ref requested_next_hop_scid, ref payment_hash, ref inbound_amount_msat, ref expected_outbound_amount_msat, } => { + let mut intercept_id_nonref = Clone::clone(intercept_id); + let mut requested_next_hop_scid_nonref = Clone::clone(requested_next_hop_scid); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut inbound_amount_msat_nonref = Clone::clone(inbound_amount_msat); + let mut expected_outbound_amount_msat_nonref = Clone::clone(expected_outbound_amount_msat); + nativeEvent::HTLCIntercepted { + intercept_id: ::lightning::ln::channelmanager::InterceptId(intercept_id_nonref.data), + requested_next_hop_scid: requested_next_hop_scid_nonref, + payment_hash: ::lightning::ln::PaymentHash(payment_hash_nonref.data), + inbound_amount_msat: inbound_amount_msat_nonref, + expected_outbound_amount_msat: expected_outbound_amount_msat_nonref, + } + }, Event::SpendableOutputs {ref outputs, } => { - let mut outputs_nonref = (*outputs).clone(); + let mut outputs_nonref = Clone::clone(outputs); let mut local_outputs_nonref = Vec::new(); for mut item in outputs_nonref.into_rust().drain(..) { local_outputs_nonref.push( { item.into_native() }); }; nativeEvent::SpendableOutputs { outputs: local_outputs_nonref, } }, Event::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref fee_earned_msat, ref claim_from_onchain_tx, } => { - let mut prev_channel_id_nonref = (*prev_channel_id).clone(); + let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.data == [0; 32] { None } else { Some( { prev_channel_id_nonref.data }) }; - let mut next_channel_id_nonref = (*next_channel_id).clone(); + let mut next_channel_id_nonref = Clone::clone(next_channel_id); let mut local_next_channel_id_nonref = if next_channel_id_nonref.data == [0; 32] { None } else { Some( { next_channel_id_nonref.data }) }; - let mut fee_earned_msat_nonref = (*fee_earned_msat).clone(); + let mut fee_earned_msat_nonref = Clone::clone(fee_earned_msat); let mut local_fee_earned_msat_nonref = if fee_earned_msat_nonref.is_some() { Some( { fee_earned_msat_nonref.take() }) } else { None }; - let mut claim_from_onchain_tx_nonref = (*claim_from_onchain_tx).clone(); + let mut claim_from_onchain_tx_nonref = Clone::clone(claim_from_onchain_tx); nativeEvent::PaymentForwarded { prev_channel_id: local_prev_channel_id_nonref, next_channel_id: local_next_channel_id_nonref, @@ -1130,30 +1278,42 @@ impl Event { claim_from_onchain_tx: claim_from_onchain_tx_nonref, } }, + Event::ChannelReady {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref channel_type, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut channel_type_nonref = Clone::clone(channel_type); + nativeEvent::ChannelReady { + channel_id: channel_id_nonref.data, + user_channel_id: user_channel_id_nonref.into(), + counterparty_node_id: counterparty_node_id_nonref.into_rust(), + channel_type: *unsafe { Box::from_raw(channel_type_nonref.take_inner()) }, + } + }, Event::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, } => { - let mut channel_id_nonref = (*channel_id).clone(); - let mut user_channel_id_nonref = (*user_channel_id).clone(); - let mut reason_nonref = (*reason).clone(); + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut reason_nonref = Clone::clone(reason); nativeEvent::ChannelClosed { channel_id: channel_id_nonref.data, - user_channel_id: user_channel_id_nonref, + user_channel_id: user_channel_id_nonref.into(), reason: reason_nonref.into_native(), } }, Event::DiscardFunding {ref channel_id, ref transaction, } => { - let mut channel_id_nonref = (*channel_id).clone(); - let mut transaction_nonref = (*transaction).clone(); + let mut channel_id_nonref = Clone::clone(channel_id); + let mut transaction_nonref = Clone::clone(transaction); nativeEvent::DiscardFunding { channel_id: channel_id_nonref.data, transaction: transaction_nonref.into_bitcoin(), } }, Event::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref push_msat, ref channel_type, } => { - let mut temporary_channel_id_nonref = (*temporary_channel_id).clone(); - let mut counterparty_node_id_nonref = (*counterparty_node_id).clone(); - let mut funding_satoshis_nonref = (*funding_satoshis).clone(); - let mut push_msat_nonref = (*push_msat).clone(); - let mut channel_type_nonref = (*channel_type).clone(); + let mut temporary_channel_id_nonref = Clone::clone(temporary_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut funding_satoshis_nonref = Clone::clone(funding_satoshis); + let mut push_msat_nonref = Clone::clone(push_msat); + let mut channel_type_nonref = Clone::clone(channel_type); nativeEvent::OpenChannelRequest { temporary_channel_id: temporary_channel_id_nonref.data, counterparty_node_id: counterparty_node_id_nonref.into_rust(), @@ -1163,8 +1323,8 @@ impl Event { } }, Event::HTLCHandlingFailed {ref prev_channel_id, ref failed_next_destination, } => { - let mut prev_channel_id_nonref = (*prev_channel_id).clone(); - let mut failed_next_destination_nonref = (*failed_next_destination).clone(); + let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); + let mut failed_next_destination_nonref = Clone::clone(failed_next_destination); nativeEvent::HTLCHandlingFailed { prev_channel_id: prev_channel_id_nonref.data, failed_next_destination: failed_next_destination_nonref.into_native(), @@ -1181,18 +1341,26 @@ impl Event { counterparty_node_id: counterparty_node_id.into_rust(), channel_value_satoshis: channel_value_satoshis, output_script: ::bitcoin::blockdata::script::Script::from(output_script.into_rust()), - user_channel_id: user_channel_id, + user_channel_id: user_channel_id.into(), } }, - Event::PaymentReceived {mut payment_hash, mut amount_msat, mut purpose, } => { - nativeEvent::PaymentReceived { + Event::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, } => { + let mut local_receiver_node_id = if receiver_node_id.is_null() { None } else { Some( { receiver_node_id.into_rust() }) }; + let mut local_via_channel_id = if via_channel_id.data == [0; 32] { None } else { Some( { via_channel_id.data }) }; + let mut local_via_user_channel_id = { /* via_user_channel_id*/ let via_user_channel_id_opt = via_user_channel_id; { } if via_user_channel_id_opt.is_none() { None } else { Some({ via_user_channel_id_opt.take().into() }) } }; + nativeEvent::PaymentClaimable { + receiver_node_id: local_receiver_node_id, payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), amount_msat: amount_msat, purpose: purpose.into_native(), + via_channel_id: local_via_channel_id, + via_user_channel_id: local_via_user_channel_id, } }, - Event::PaymentClaimed {mut payment_hash, mut amount_msat, mut purpose, } => { + Event::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, } => { + let mut local_receiver_node_id = if receiver_node_id.is_null() { None } else { Some( { receiver_node_id.into_rust() }) }; nativeEvent::PaymentClaimed { + receiver_node_id: local_receiver_node_id, payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), amount_msat: amount_msat, purpose: purpose.into_native(), @@ -1263,6 +1431,15 @@ impl Event { time_forwardable: core::time::Duration::from_secs(time_forwardable), } }, + Event::HTLCIntercepted {mut intercept_id, mut requested_next_hop_scid, mut payment_hash, mut inbound_amount_msat, mut expected_outbound_amount_msat, } => { + nativeEvent::HTLCIntercepted { + intercept_id: ::lightning::ln::channelmanager::InterceptId(intercept_id.data), + requested_next_hop_scid: requested_next_hop_scid, + payment_hash: ::lightning::ln::PaymentHash(payment_hash.data), + inbound_amount_msat: inbound_amount_msat, + expected_outbound_amount_msat: expected_outbound_amount_msat, + } + }, Event::SpendableOutputs {mut outputs, } => { let mut local_outputs = Vec::new(); for mut item in outputs.into_rust().drain(..) { local_outputs.push( { item.into_native() }); }; nativeEvent::SpendableOutputs { @@ -1280,10 +1457,18 @@ impl Event { claim_from_onchain_tx: claim_from_onchain_tx, } }, + Event::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut channel_type, } => { + nativeEvent::ChannelReady { + channel_id: channel_id.data, + user_channel_id: user_channel_id.into(), + counterparty_node_id: counterparty_node_id.into_rust(), + channel_type: *unsafe { Box::from_raw(channel_type.take_inner()) }, + } + }, Event::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, } => { nativeEvent::ChannelClosed { channel_id: channel_id.data, - user_channel_id: user_channel_id, + user_channel_id: user_channel_id.into(), reason: reason.into_native(), } }, @@ -1314,45 +1499,57 @@ impl Event { pub(crate) fn from_native(native: &nativeEvent) -> Self { match native { nativeEvent::FundingGenerationReady {ref temporary_channel_id, ref counterparty_node_id, ref channel_value_satoshis, ref output_script, ref user_channel_id, } => { - let mut temporary_channel_id_nonref = (*temporary_channel_id).clone(); - let mut counterparty_node_id_nonref = (*counterparty_node_id).clone(); - let mut channel_value_satoshis_nonref = (*channel_value_satoshis).clone(); - let mut output_script_nonref = (*output_script).clone(); - let mut user_channel_id_nonref = (*user_channel_id).clone(); + let mut temporary_channel_id_nonref = Clone::clone(temporary_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut channel_value_satoshis_nonref = Clone::clone(channel_value_satoshis); + let mut output_script_nonref = Clone::clone(output_script); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); Event::FundingGenerationReady { temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id_nonref }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), channel_value_satoshis: channel_value_satoshis_nonref, output_script: output_script_nonref.into_bytes().into(), - user_channel_id: user_channel_id_nonref, - } - }, - nativeEvent::PaymentReceived {ref payment_hash, ref amount_msat, ref purpose, } => { - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut amount_msat_nonref = (*amount_msat).clone(); - let mut purpose_nonref = (*purpose).clone(); - Event::PaymentReceived { + user_channel_id: user_channel_id_nonref.into(), + } + }, + nativeEvent::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, } => { + let mut receiver_node_id_nonref = Clone::clone(receiver_node_id); + let mut local_receiver_node_id_nonref = if receiver_node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(receiver_node_id_nonref.unwrap())) } }; + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut amount_msat_nonref = Clone::clone(amount_msat); + let mut purpose_nonref = Clone::clone(purpose); + let mut via_channel_id_nonref = Clone::clone(via_channel_id); + let mut local_via_channel_id_nonref = if via_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (via_channel_id_nonref.unwrap()) } } }; + let mut via_user_channel_id_nonref = Clone::clone(via_user_channel_id); + let mut local_via_user_channel_id_nonref = if via_user_channel_id_nonref.is_none() { crate::c_types::derived::COption_u128Z::None } else { crate::c_types::derived::COption_u128Z::Some( { via_user_channel_id_nonref.unwrap().into() }) }; + Event::PaymentClaimable { + receiver_node_id: local_receiver_node_id_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, amount_msat: amount_msat_nonref, purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose_nonref), + via_channel_id: local_via_channel_id_nonref, + via_user_channel_id: local_via_user_channel_id_nonref, } }, - nativeEvent::PaymentClaimed {ref payment_hash, ref amount_msat, ref purpose, } => { - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut amount_msat_nonref = (*amount_msat).clone(); - let mut purpose_nonref = (*purpose).clone(); + nativeEvent::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, } => { + let mut receiver_node_id_nonref = Clone::clone(receiver_node_id); + let mut local_receiver_node_id_nonref = if receiver_node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(receiver_node_id_nonref.unwrap())) } }; + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut amount_msat_nonref = Clone::clone(amount_msat); + let mut purpose_nonref = Clone::clone(purpose); Event::PaymentClaimed { + receiver_node_id: local_receiver_node_id_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, amount_msat: amount_msat_nonref, purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose_nonref), } }, nativeEvent::PaymentSent {ref payment_id, ref payment_preimage, ref payment_hash, ref fee_paid_msat, } => { - let mut payment_id_nonref = (*payment_id).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_id_nonref.unwrap()).0 } } }; - let mut payment_preimage_nonref = (*payment_preimage).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut fee_paid_msat_nonref = (*fee_paid_msat).clone(); + let mut payment_preimage_nonref = Clone::clone(payment_preimage); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut fee_paid_msat_nonref = Clone::clone(fee_paid_msat); let mut local_fee_paid_msat_nonref = if fee_paid_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_paid_msat_nonref.unwrap() }) }; Event::PaymentSent { payment_id: local_payment_id_nonref, @@ -1362,18 +1559,18 @@ impl Event { } }, nativeEvent::PaymentFailed {ref payment_id, ref payment_hash, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); Event::PaymentFailed { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, } }, nativeEvent::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); let mut local_payment_hash_nonref = if payment_hash_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_hash_nonref.unwrap()).0 } } }; - let mut path_nonref = (*path).clone(); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; Event::PaymentPathSuccessful { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, @@ -1382,18 +1579,18 @@ impl Event { } }, nativeEvent::PaymentPathFailed {ref payment_id, ref payment_hash, ref payment_failed_permanently, ref network_update, ref all_paths_failed, ref path, ref short_channel_id, ref retry, } => { - let mut payment_id_nonref = (*payment_id).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_id_nonref.unwrap()).0 } } }; - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut payment_failed_permanently_nonref = (*payment_failed_permanently).clone(); - let mut network_update_nonref = (*network_update).clone(); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut payment_failed_permanently_nonref = Clone::clone(payment_failed_permanently); + let mut network_update_nonref = Clone::clone(network_update); let mut local_network_update_nonref = if network_update_nonref.is_none() { crate::c_types::derived::COption_NetworkUpdateZ::None } else { crate::c_types::derived::COption_NetworkUpdateZ::Some( { crate::lightning::routing::gossip::NetworkUpdate::native_into(network_update_nonref.unwrap()) }) }; - let mut all_paths_failed_nonref = (*all_paths_failed).clone(); - let mut path_nonref = (*path).clone(); + let mut all_paths_failed_nonref = Clone::clone(all_paths_failed); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut short_channel_id_nonref = (*short_channel_id).clone(); + let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { short_channel_id_nonref.unwrap() }) }; - let mut retry_nonref = (*retry).clone(); + let mut retry_nonref = Clone::clone(retry); let mut local_retry_nonref = crate::lightning::routing::router::RouteParameters { inner: if retry_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((retry_nonref.unwrap())) } }, is_owned: true }; Event::PaymentPathFailed { payment_id: local_payment_id_nonref, @@ -1407,9 +1604,9 @@ impl Event { } }, nativeEvent::ProbeSuccessful {ref payment_id, ref payment_hash, ref path, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut path_nonref = (*path).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; Event::ProbeSuccessful { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, @@ -1418,11 +1615,11 @@ impl Event { } }, nativeEvent::ProbeFailed {ref payment_id, ref payment_hash, ref path, ref short_channel_id, } => { - let mut payment_id_nonref = (*payment_id).clone(); - let mut payment_hash_nonref = (*payment_hash).clone(); - let mut path_nonref = (*path).clone(); + let mut payment_id_nonref = Clone::clone(payment_id); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut path_nonref = Clone::clone(path); let mut local_path_nonref = Vec::new(); for mut item in path_nonref.drain(..) { local_path_nonref.push( { crate::lightning::routing::router::RouteHop { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut short_channel_id_nonref = (*short_channel_id).clone(); + let mut short_channel_id_nonref = Clone::clone(short_channel_id); let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { short_channel_id_nonref.unwrap() }) }; Event::ProbeFailed { payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, @@ -1432,26 +1629,40 @@ impl Event { } }, nativeEvent::PendingHTLCsForwardable {ref time_forwardable, } => { - let mut time_forwardable_nonref = (*time_forwardable).clone(); + let mut time_forwardable_nonref = Clone::clone(time_forwardable); Event::PendingHTLCsForwardable { time_forwardable: time_forwardable_nonref.as_secs(), } }, + nativeEvent::HTLCIntercepted {ref intercept_id, ref requested_next_hop_scid, ref payment_hash, ref inbound_amount_msat, ref expected_outbound_amount_msat, } => { + let mut intercept_id_nonref = Clone::clone(intercept_id); + let mut requested_next_hop_scid_nonref = Clone::clone(requested_next_hop_scid); + let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut inbound_amount_msat_nonref = Clone::clone(inbound_amount_msat); + let mut expected_outbound_amount_msat_nonref = Clone::clone(expected_outbound_amount_msat); + Event::HTLCIntercepted { + intercept_id: crate::c_types::ThirtyTwoBytes { data: intercept_id_nonref.0 }, + requested_next_hop_scid: requested_next_hop_scid_nonref, + payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, + inbound_amount_msat: inbound_amount_msat_nonref, + expected_outbound_amount_msat: expected_outbound_amount_msat_nonref, + } + }, nativeEvent::SpendableOutputs {ref outputs, } => { - let mut outputs_nonref = (*outputs).clone(); + let mut outputs_nonref = Clone::clone(outputs); let mut local_outputs_nonref = Vec::new(); for mut item in outputs_nonref.drain(..) { local_outputs_nonref.push( { crate::lightning::chain::keysinterface::SpendableOutputDescriptor::native_into(item) }); }; Event::SpendableOutputs { outputs: local_outputs_nonref.into(), } }, nativeEvent::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref fee_earned_msat, ref claim_from_onchain_tx, } => { - let mut prev_channel_id_nonref = (*prev_channel_id).clone(); + let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (prev_channel_id_nonref.unwrap()) } } }; - let mut next_channel_id_nonref = (*next_channel_id).clone(); + let mut next_channel_id_nonref = Clone::clone(next_channel_id); let mut local_next_channel_id_nonref = if next_channel_id_nonref.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (next_channel_id_nonref.unwrap()) } } }; - let mut fee_earned_msat_nonref = (*fee_earned_msat).clone(); + let mut fee_earned_msat_nonref = Clone::clone(fee_earned_msat); let mut local_fee_earned_msat_nonref = if fee_earned_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { fee_earned_msat_nonref.unwrap() }) }; - let mut claim_from_onchain_tx_nonref = (*claim_from_onchain_tx).clone(); + let mut claim_from_onchain_tx_nonref = Clone::clone(claim_from_onchain_tx); Event::PaymentForwarded { prev_channel_id: local_prev_channel_id_nonref, next_channel_id: local_next_channel_id_nonref, @@ -1459,30 +1670,42 @@ impl Event { claim_from_onchain_tx: claim_from_onchain_tx_nonref, } }, + nativeEvent::ChannelReady {ref channel_id, ref user_channel_id, ref counterparty_node_id, ref channel_type, } => { + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut channel_type_nonref = Clone::clone(channel_type); + Event::ChannelReady { + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, + user_channel_id: user_channel_id_nonref.into(), + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), + channel_type: crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type_nonref), is_owned: true }, + } + }, nativeEvent::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, } => { - let mut channel_id_nonref = (*channel_id).clone(); - let mut user_channel_id_nonref = (*user_channel_id).clone(); - let mut reason_nonref = (*reason).clone(); + let mut channel_id_nonref = Clone::clone(channel_id); + let mut user_channel_id_nonref = Clone::clone(user_channel_id); + let mut reason_nonref = Clone::clone(reason); Event::ChannelClosed { channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, - user_channel_id: user_channel_id_nonref, + user_channel_id: user_channel_id_nonref.into(), reason: crate::lightning::util::events::ClosureReason::native_into(reason_nonref), } }, nativeEvent::DiscardFunding {ref channel_id, ref transaction, } => { - let mut channel_id_nonref = (*channel_id).clone(); - let mut transaction_nonref = (*transaction).clone(); + let mut channel_id_nonref = Clone::clone(channel_id); + let mut transaction_nonref = Clone::clone(transaction); Event::DiscardFunding { channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id_nonref }, transaction: crate::c_types::Transaction::from_bitcoin(&transaction_nonref), } }, nativeEvent::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref push_msat, ref channel_type, } => { - let mut temporary_channel_id_nonref = (*temporary_channel_id).clone(); - let mut counterparty_node_id_nonref = (*counterparty_node_id).clone(); - let mut funding_satoshis_nonref = (*funding_satoshis).clone(); - let mut push_msat_nonref = (*push_msat).clone(); - let mut channel_type_nonref = (*channel_type).clone(); + let mut temporary_channel_id_nonref = Clone::clone(temporary_channel_id); + let mut counterparty_node_id_nonref = Clone::clone(counterparty_node_id); + let mut funding_satoshis_nonref = Clone::clone(funding_satoshis); + let mut push_msat_nonref = Clone::clone(push_msat); + let mut channel_type_nonref = Clone::clone(channel_type); Event::OpenChannelRequest { temporary_channel_id: crate::c_types::ThirtyTwoBytes { data: temporary_channel_id_nonref }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), @@ -1492,8 +1715,8 @@ impl Event { } }, nativeEvent::HTLCHandlingFailed {ref prev_channel_id, ref failed_next_destination, } => { - let mut prev_channel_id_nonref = (*prev_channel_id).clone(); - let mut failed_next_destination_nonref = (*failed_next_destination).clone(); + let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); + let mut failed_next_destination_nonref = Clone::clone(failed_next_destination); Event::HTLCHandlingFailed { prev_channel_id: crate::c_types::ThirtyTwoBytes { data: prev_channel_id_nonref }, failed_next_destination: crate::lightning::util::events::HTLCDestination::native_into(failed_next_destination_nonref), @@ -1510,18 +1733,26 @@ impl Event { counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), channel_value_satoshis: channel_value_satoshis, output_script: output_script.into_bytes().into(), - user_channel_id: user_channel_id, + user_channel_id: user_channel_id.into(), } }, - nativeEvent::PaymentReceived {mut payment_hash, mut amount_msat, mut purpose, } => { - Event::PaymentReceived { + nativeEvent::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, } => { + let mut local_receiver_node_id = if receiver_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(receiver_node_id.unwrap())) } }; + let mut local_via_channel_id = if via_channel_id.is_none() { crate::c_types::ThirtyTwoBytes { data: [0; 32] } } else { { crate::c_types::ThirtyTwoBytes { data: (via_channel_id.unwrap()) } } }; + let mut local_via_user_channel_id = if via_user_channel_id.is_none() { crate::c_types::derived::COption_u128Z::None } else { crate::c_types::derived::COption_u128Z::Some( { via_user_channel_id.unwrap().into() }) }; + Event::PaymentClaimable { + receiver_node_id: local_receiver_node_id, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, amount_msat: amount_msat, purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose), + via_channel_id: local_via_channel_id, + via_user_channel_id: local_via_user_channel_id, } }, - nativeEvent::PaymentClaimed {mut payment_hash, mut amount_msat, mut purpose, } => { + nativeEvent::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, } => { + let mut local_receiver_node_id = if receiver_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(receiver_node_id.unwrap())) } }; Event::PaymentClaimed { + receiver_node_id: local_receiver_node_id, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, amount_msat: amount_msat, purpose: crate::lightning::util::events::PaymentPurpose::native_into(purpose), @@ -1592,6 +1823,15 @@ impl Event { time_forwardable: time_forwardable.as_secs(), } }, + nativeEvent::HTLCIntercepted {mut intercept_id, mut requested_next_hop_scid, mut payment_hash, mut inbound_amount_msat, mut expected_outbound_amount_msat, } => { + Event::HTLCIntercepted { + intercept_id: crate::c_types::ThirtyTwoBytes { data: intercept_id.0 }, + requested_next_hop_scid: requested_next_hop_scid, + payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, + inbound_amount_msat: inbound_amount_msat, + expected_outbound_amount_msat: expected_outbound_amount_msat, + } + }, nativeEvent::SpendableOutputs {mut outputs, } => { let mut local_outputs = Vec::new(); for mut item in outputs.drain(..) { local_outputs.push( { crate::lightning::chain::keysinterface::SpendableOutputDescriptor::native_into(item) }); }; Event::SpendableOutputs { @@ -1609,10 +1849,18 @@ impl Event { claim_from_onchain_tx: claim_from_onchain_tx, } }, + nativeEvent::ChannelReady {mut channel_id, mut user_channel_id, mut counterparty_node_id, mut channel_type, } => { + Event::ChannelReady { + channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id }, + user_channel_id: user_channel_id.into(), + counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), + channel_type: crate::lightning::ln::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type), is_owned: true }, + } + }, nativeEvent::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, } => { Event::ChannelClosed { channel_id: crate::c_types::ThirtyTwoBytes { data: channel_id }, - user_channel_id: user_channel_id, + user_channel_id: user_channel_id.into(), reason: crate::lightning::util::events::ClosureReason::native_into(reason), } }, @@ -1650,7 +1898,7 @@ pub extern "C" fn Event_clone(orig: &Event) -> Event { } #[no_mangle] /// Utility method to constructs a new FundingGenerationReady-variant Event -pub extern "C" fn Event_funding_generation_ready(temporary_channel_id: crate::c_types::ThirtyTwoBytes, counterparty_node_id: crate::c_types::PublicKey, channel_value_satoshis: u64, output_script: crate::c_types::derived::CVec_u8Z, user_channel_id: u64) -> Event { +pub extern "C" fn Event_funding_generation_ready(temporary_channel_id: crate::c_types::ThirtyTwoBytes, counterparty_node_id: crate::c_types::PublicKey, channel_value_satoshis: u64, output_script: crate::c_types::derived::CVec_u8Z, user_channel_id: crate::c_types::U128) -> Event { Event::FundingGenerationReady { temporary_channel_id, counterparty_node_id, @@ -1660,18 +1908,22 @@ pub extern "C" fn Event_funding_generation_ready(temporary_channel_id: crate::c_ } } #[no_mangle] -/// Utility method to constructs a new PaymentReceived-variant Event -pub extern "C" fn Event_payment_received(payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::util::events::PaymentPurpose) -> Event { - Event::PaymentReceived { +/// Utility method to constructs a new PaymentClaimable-variant Event +pub extern "C" fn Event_payment_claimable(receiver_node_id: crate::c_types::PublicKey, payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::util::events::PaymentPurpose, via_channel_id: crate::c_types::ThirtyTwoBytes, via_user_channel_id: crate::c_types::derived::COption_u128Z) -> Event { + Event::PaymentClaimable { + receiver_node_id, payment_hash, amount_msat, purpose, + via_channel_id, + via_user_channel_id, } } #[no_mangle] /// Utility method to constructs a new PaymentClaimed-variant Event -pub extern "C" fn Event_payment_claimed(payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::util::events::PaymentPurpose) -> Event { +pub extern "C" fn Event_payment_claimed(receiver_node_id: crate::c_types::PublicKey, payment_hash: crate::c_types::ThirtyTwoBytes, amount_msat: u64, purpose: crate::lightning::util::events::PaymentPurpose) -> Event { Event::PaymentClaimed { + receiver_node_id, payment_hash, amount_msat, purpose, @@ -1745,6 +1997,17 @@ pub extern "C" fn Event_pending_htlcs_forwardable(time_forwardable: u64) -> Even } } #[no_mangle] +/// Utility method to constructs a new HTLCIntercepted-variant Event +pub extern "C" fn Event_htlcintercepted(intercept_id: crate::c_types::ThirtyTwoBytes, requested_next_hop_scid: u64, payment_hash: crate::c_types::ThirtyTwoBytes, inbound_amount_msat: u64, expected_outbound_amount_msat: u64) -> Event { + Event::HTLCIntercepted { + intercept_id, + requested_next_hop_scid, + payment_hash, + inbound_amount_msat, + expected_outbound_amount_msat, + } +} +#[no_mangle] /// Utility method to constructs a new SpendableOutputs-variant Event pub extern "C" fn Event_spendable_outputs(outputs: crate::c_types::derived::CVec_SpendableOutputDescriptorZ) -> Event { Event::SpendableOutputs { @@ -1762,8 +2025,18 @@ pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::c_types::Thirt } } #[no_mangle] +/// Utility method to constructs a new ChannelReady-variant Event +pub extern "C" fn Event_channel_ready(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: crate::c_types::U128, counterparty_node_id: crate::c_types::PublicKey, channel_type: crate::lightning::ln::features::ChannelTypeFeatures) -> Event { + Event::ChannelReady { + channel_id, + user_channel_id, + counterparty_node_id, + channel_type, + } +} +#[no_mangle] /// Utility method to constructs a new ChannelClosed-variant Event -pub extern "C" fn Event_channel_closed(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: u64, reason: crate::lightning::util::events::ClosureReason) -> Event { +pub extern "C" fn Event_channel_closed(channel_id: crate::c_types::ThirtyTwoBytes, user_channel_id: crate::c_types::U128, reason: crate::lightning::util::events::ClosureReason) -> Event { Event::ChannelClosed { channel_id, user_channel_id, @@ -1983,97 +2256,97 @@ impl MessageSendEvent { pub(crate) fn to_native(&self) -> nativeMessageSendEvent { match self { MessageSendEvent::SendAcceptChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendAcceptChannel { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendOpenChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendOpenChannel { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendFundingCreated {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendFundingCreated { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendFundingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendFundingSigned { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendChannelReady {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendChannelReady { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendAnnouncementSignatures { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::UpdateHTLCs {ref node_id, ref updates, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut updates_nonref = (*updates).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut updates_nonref = Clone::clone(updates); nativeMessageSendEvent::UpdateHTLCs { node_id: node_id_nonref.into_rust(), updates: *unsafe { Box::from_raw(updates_nonref.take_inner()) }, } }, MessageSendEvent::SendRevokeAndACK {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendRevokeAndACK { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendClosingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendClosingSigned { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendShutdown {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendShutdown { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendChannelReestablish {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendChannelReestablish { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendChannelAnnouncement {ref node_id, ref msg, ref update_msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); - let mut update_msg_nonref = (*update_msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); nativeMessageSendEvent::SendChannelAnnouncement { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, @@ -2081,62 +2354,62 @@ impl MessageSendEvent { } }, MessageSendEvent::BroadcastChannelAnnouncement {ref msg, ref update_msg, } => { - let mut msg_nonref = (*msg).clone(); - let mut update_msg_nonref = (*update_msg).clone(); + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); nativeMessageSendEvent::BroadcastChannelAnnouncement { msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, update_msg: *unsafe { Box::from_raw(update_msg_nonref.take_inner()) }, } }, MessageSendEvent::BroadcastChannelUpdate {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::BroadcastChannelUpdate { msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendChannelUpdate { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::HandleError {ref node_id, ref action, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut action_nonref = (*action).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut action_nonref = Clone::clone(action); nativeMessageSendEvent::HandleError { node_id: node_id_nonref.into_rust(), action: action_nonref.into_native(), } }, MessageSendEvent::SendChannelRangeQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendChannelRangeQuery { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendShortIdsQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendShortIdsQuery { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendReplyChannelRange { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, } }, MessageSendEvent::SendGossipTimestampFilter {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); nativeMessageSendEvent::SendGossipTimestampFilter { node_id: node_id_nonref.into_rust(), msg: *unsafe { Box::from_raw(msg_nonref.take_inner()) }, @@ -2273,97 +2546,97 @@ impl MessageSendEvent { pub(crate) fn from_native(native: &nativeMessageSendEvent) -> Self { match native { nativeMessageSendEvent::SendAcceptChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendAcceptChannel { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::AcceptChannel { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendOpenChannel {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendOpenChannel { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::OpenChannel { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendFundingCreated {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendFundingCreated { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::FundingCreated { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendFundingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendFundingSigned { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::FundingSigned { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendChannelReady {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendChannelReady { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::ChannelReady { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendAnnouncementSignatures {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendAnnouncementSignatures { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::AnnouncementSignatures { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::UpdateHTLCs {ref node_id, ref updates, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut updates_nonref = (*updates).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut updates_nonref = Clone::clone(updates); MessageSendEvent::UpdateHTLCs { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), updates: crate::lightning::ln::msgs::CommitmentUpdate { inner: ObjOps::heap_alloc(updates_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendRevokeAndACK {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendRevokeAndACK { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::RevokeAndACK { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendClosingSigned {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendClosingSigned { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::ClosingSigned { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendShutdown {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendShutdown { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::Shutdown { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendChannelReestablish {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendChannelReestablish { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::ChannelReestablish { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendChannelAnnouncement {ref node_id, ref msg, ref update_msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); - let mut update_msg_nonref = (*update_msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); MessageSendEvent::SendChannelAnnouncement { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, @@ -2371,62 +2644,62 @@ impl MessageSendEvent { } }, nativeMessageSendEvent::BroadcastChannelAnnouncement {ref msg, ref update_msg, } => { - let mut msg_nonref = (*msg).clone(); - let mut update_msg_nonref = (*update_msg).clone(); + let mut msg_nonref = Clone::clone(msg); + let mut update_msg_nonref = Clone::clone(update_msg); MessageSendEvent::BroadcastChannelAnnouncement { msg: crate::lightning::ln::msgs::ChannelAnnouncement { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, update_msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(update_msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::BroadcastChannelUpdate {ref msg, } => { - let mut msg_nonref = (*msg).clone(); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::BroadcastChannelUpdate { msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendChannelUpdate {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendChannelUpdate { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::ChannelUpdate { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::HandleError {ref node_id, ref action, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut action_nonref = (*action).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut action_nonref = Clone::clone(action); MessageSendEvent::HandleError { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), action: crate::lightning::ln::msgs::ErrorAction::native_into(action_nonref), } }, nativeMessageSendEvent::SendChannelRangeQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendChannelRangeQuery { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendShortIdsQuery {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendShortIdsQuery { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendReplyChannelRange {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendReplyChannelRange { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, } }, nativeMessageSendEvent::SendGossipTimestampFilter {ref node_id, ref msg, } => { - let mut node_id_nonref = (*node_id).clone(); - let mut msg_nonref = (*msg).clone(); + let mut node_id_nonref = Clone::clone(node_id); + let mut msg_nonref = Clone::clone(msg); MessageSendEvent::SendGossipTimestampFilter { node_id: crate::c_types::PublicKey::from_rust(&node_id_nonref), msg: crate::lightning::ln::msgs::GossipTimestampFilter { inner: ObjOps::heap_alloc(msg_nonref), is_owned: true }, @@ -2837,6 +3110,10 @@ impl Drop for OnionMessageProvider { /// /// Events are processed by passing an [`EventHandler`] to [`process_pending_events`]. /// +/// Implementations of this trait may also feature an async version of event handling, as shown with +/// [`ChannelManager::process_pending_events_async`] and +/// [`ChainMonitor::process_pending_events_async`]. +/// /// # Requirements /// /// When using this trait, [`process_pending_events`] will call [`handle_event`] for each pending @@ -2863,6 +3140,8 @@ impl Drop for OnionMessageProvider { /// [`handle_event`]: EventHandler::handle_event /// [`ChannelManager::process_pending_events`]: crate::ln::channelmanager::ChannelManager#method.process_pending_events /// [`ChainMonitor::process_pending_events`]: crate::chain::chainmonitor::ChainMonitor#method.process_pending_events +/// [`ChannelManager::process_pending_events_async`]: crate::ln::channelmanager::ChannelManager::process_pending_events_async +/// [`ChainMonitor::process_pending_events_async`]: crate::chain::chainmonitor::ChainMonitor::process_pending_events_async #[repr(C)] pub struct EventsProvider { /// An opaque pointer which is passed to your function implementations as an argument. @@ -2899,6 +3178,10 @@ impl Drop for EventsProvider { } } /// A trait implemented for objects handling events from [`EventsProvider`]. +/// +/// An async variation also exists for implementations of [`EventsProvider`] that support async +/// event handling. The async event handler should satisfy the generic bounds: `F: +/// core::future::Future, H: Fn(Event) -> F`. #[repr(C)] pub struct EventHandler { /// An opaque pointer which is passed to your function implementations as an argument. @@ -2907,7 +3190,7 @@ pub struct EventHandler { /// Handles the given [`Event`]. /// /// See [`EventsProvider`] for details that must be considered when implementing this method. - pub handle_event: extern "C" fn (this_arg: *const c_void, event: &crate::lightning::util::events::Event), + pub handle_event: extern "C" fn (this_arg: *const c_void, event: crate::lightning::util::events::Event), /// Frees any resources associated with this object given its this_arg pointer. /// Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. pub free: Option, @@ -2925,8 +3208,8 @@ pub(crate) extern "C" fn EventHandler_clone_fields(orig: &EventHandler) -> Event use lightning::util::events::EventHandler as rustEventHandler; impl rustEventHandler for EventHandler { - fn handle_event(&self, mut event: &lightning::util::events::Event) { - (self.handle_event)(self.this_arg, &crate::lightning::util::events::Event::from_native(event)) + fn handle_event(&self, mut event: lightning::util::events::Event) { + (self.handle_event)(self.this_arg, crate::lightning::util::events::Event::native_into(event)) } } diff --git a/lightning-c-bindings/src/lightning/util/invoice.rs b/lightning-c-bindings/src/lightning/util/invoice.rs index 9103429..4b32809 100644 --- a/lightning-c-bindings/src/lightning/util/invoice.rs +++ b/lightning-c-bindings/src/lightning/util/invoice.rs @@ -18,7 +18,7 @@ use alloc::{vec::Vec, boxed::Box}; /// Construct the invoice's HRP and signatureless data into a preimage to be hashed. #[no_mangle] -pub extern "C" fn construct_invoice_preimage(mut hrp_bytes: crate::c_types::u8slice, mut data_without_signature: crate::c_types::derived::CVec_u5Z) -> crate::c_types::derived::CVec_u8Z { +pub extern "C" fn construct_invoice_preimage(mut hrp_bytes: crate::c_types::u8slice, mut data_without_signature: crate::c_types::derived::CVec_U5Z) -> crate::c_types::derived::CVec_u8Z { let mut local_data_without_signature = Vec::new(); for mut item in data_without_signature.into_rust().drain(..) { local_data_without_signature.push( { item.into() }); }; let mut ret = lightning::util::invoice::construct_invoice_preimage(hrp_bytes.to_slice(), &local_data_without_signature[..]); let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { item }); }; diff --git a/lightning-c-bindings/src/lightning/util/logger.rs b/lightning-c-bindings/src/lightning/util/logger.rs index 00cd10e..1e4051d 100644 --- a/lightning-c-bindings/src/lightning/util/logger.rs +++ b/lightning-c-bindings/src/lightning/util/logger.rs @@ -174,7 +174,7 @@ pub extern "C" fn Record_free(this_obj: Record) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Record_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRecord); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRecord) }; } #[allow(unused)] impl Record { diff --git a/lightning-c-bindings/src/lightning/util/mod.rs b/lightning-c-bindings/src/lightning/util/mod.rs index 2a1eb60..9e081cb 100644 --- a/lightning-c-bindings/src/lightning/util/mod.rs +++ b/lightning-c-bindings/src/lightning/util/mod.rs @@ -22,6 +22,7 @@ pub mod ser; pub mod message_signing; pub mod invoice; pub mod persist; +pub mod string; pub mod wakers; pub mod logger; pub mod config; diff --git a/lightning-c-bindings/src/lightning/util/persist.rs b/lightning-c-bindings/src/lightning/util/persist.rs index 83aabf5..b1e371b 100644 --- a/lightning-c-bindings/src/lightning/util/persist.rs +++ b/lightning-c-bindings/src/lightning/util/persist.rs @@ -51,9 +51,9 @@ pub(crate) extern "C" fn Persister_clone_fields(orig: &Persister) -> Persister { } use lightning::util::persist::Persister as rustPersister; -impl<'a> rustPersister<'a, crate::lightning::chain::keysinterface::Sign, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::WriteableScore> for Persister { - fn persist_manager(&self, mut channel_manager: &lightning::ln::channelmanager::ChannelManager) -> Result<(), lightning::io::Error> { - let mut ret = (self.persist_manager)(self.this_arg, &crate::lightning::ln::channelmanager::ChannelManager { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_manager as *const lightning::ln::channelmanager::ChannelManager<_, _, _, _, _, _, >) as *mut _) }, is_owned: false }); +impl<'a> rustPersister<'a, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::chain::keysinterface::KeysInterface, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::WriteableScore> for Persister { + fn persist_manager(&self, mut channel_manager: &lightning::ln::channelmanager::ChannelManager) -> Result<(), lightning::io::Error> { + let mut ret = (self.persist_manager)(self.this_arg, &crate::lightning::ln::channelmanager::ChannelManager { inner: unsafe { ObjOps::nonnull_ptr_to_inner((channel_manager as *const lightning::ln::channelmanager::ChannelManager<_, _, _, _, _, >) as *mut _) }, is_owned: false }); let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; local_ret } diff --git a/lightning-c-bindings/src/lightning/util/ser.rs b/lightning-c-bindings/src/lightning/util/ser.rs index be7c626..241033d 100644 --- a/lightning-c-bindings/src/lightning/util/ser.rs +++ b/lightning-c-bindings/src/lightning/util/ser.rs @@ -60,7 +60,7 @@ pub extern "C" fn BigSize_free(this_obj: BigSize) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BigSize_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBigSize); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBigSize) }; } #[allow(unused)] impl BigSize { @@ -132,7 +132,7 @@ pub extern "C" fn Hostname_free(this_obj: Hostname) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Hostname_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeHostname); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHostname) }; } #[allow(unused)] impl Hostname { diff --git a/lightning-c-bindings/src/lightning/util/string.rs b/lightning-c-bindings/src/lightning/util/string.rs new file mode 100644 index 0000000..34a70c8 --- /dev/null +++ b/lightning-c-bindings/src/lightning/util/string.rs @@ -0,0 +1,87 @@ +// This file is Copyright its original authors, visible in version control +// history and in the source files from which this was generated. +// +// This file is licensed under the license available in the LICENSE or LICENSE.md +// file in the root of this repository or, if no such file exists, the same +// license as that which applies to the original source files from which this +// source was automatically generated. + +//! Utilities for strings. + +use alloc::str::FromStr; +use core::ffi::c_void; +use core::convert::Infallible; +use bitcoin::hashes::Hash; +use crate::c_types::*; +#[cfg(feature="no-std")] +use alloc::{vec::Vec, boxed::Box}; + + +use lightning::util::string::PrintableString as nativePrintableStringImport; +pub(crate) type nativePrintableString = nativePrintableStringImport<'static>; + +/// A string that displays only printable characters, replacing control characters with +/// [`core::char::REPLACEMENT_CHARACTER`]. +#[must_use] +#[repr(C)] +pub struct PrintableString { + /// 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. + pub inner: *mut nativePrintableString, + /// 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. + pub is_owned: bool, +} + +impl Drop for PrintableString { + fn drop(&mut self) { + if self.is_owned && !<*mut nativePrintableString>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the PrintableString, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn PrintableString_free(this_obj: PrintableString) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn PrintableString_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePrintableString) }; +} +#[allow(unused)] +impl PrintableString { + pub(crate) fn get_native_ref(&self) -> &'static nativePrintableString { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativePrintableString { + unsafe { &mut *ObjOps::untweak_ptr(self.inner) } + } + /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy + pub(crate) fn take_inner(mut self) -> *mut nativePrintableString { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } +} +#[no_mangle] +pub extern "C" fn PrintableString_get_a(this_ptr: &PrintableString) -> crate::c_types::Str { + let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + inner_val.into() +} +#[no_mangle] +pub extern "C" fn PrintableString_set_a(this_ptr: &mut PrintableString, mut val: crate::c_types::Str) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val.into_str(); +} +/// Constructs a new PrintableString given each field +#[must_use] +#[no_mangle] +pub extern "C" fn PrintableString_new(mut a_arg: crate::c_types::Str) -> PrintableString { + PrintableString { inner: ObjOps::heap_alloc(lightning::util::string::PrintableString ( + a_arg.into_str(), + )), is_owned: true } +} diff --git a/lightning-c-bindings/src/lightning/util/wakers.rs b/lightning-c-bindings/src/lightning/util/wakers.rs index 0de2321..84a442e 100644 --- a/lightning-c-bindings/src/lightning/util/wakers.rs +++ b/lightning-c-bindings/src/lightning/util/wakers.rs @@ -108,7 +108,7 @@ pub extern "C" fn Future_free(this_obj: Future) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Future_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFuture); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFuture) }; } #[allow(unused)] impl Future { @@ -133,14 +133,3 @@ pub extern "C" fn Future_register_callback_fn(this_arg: &crate::lightning::util: unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.register_callback_fn(callback) } -mod std_future { - -use alloc::str::FromStr; -use core::ffi::c_void; -use core::convert::Infallible; -use bitcoin::hashes::Hash; -use crate::c_types::*; -#[cfg(feature="no-std")] -use alloc::{vec::Vec, boxed::Box}; - -} diff --git a/lightning-c-bindings/src/lightning_background_processor.rs b/lightning-c-bindings/src/lightning_background_processor.rs index ffe1991..66ffc56 100644 --- a/lightning-c-bindings/src/lightning_background_processor.rs +++ b/lightning-c-bindings/src/lightning_background_processor.rs @@ -75,7 +75,7 @@ pub extern "C" fn BackgroundProcessor_free(this_obj: BackgroundProcessor) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn BackgroundProcessor_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeBackgroundProcessor); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBackgroundProcessor) }; } #[allow(unused)] impl BackgroundProcessor { diff --git a/lightning-c-bindings/src/lightning_invoice/mod.rs b/lightning-c-bindings/src/lightning_invoice/mod.rs index f91c4a6..78bc50b 100644 --- a/lightning-c-bindings/src/lightning_invoice/mod.rs +++ b/lightning-c-bindings/src/lightning_invoice/mod.rs @@ -221,19 +221,19 @@ impl ParseError { pub(crate) fn to_native(&self) -> nativeParseError { match self { ParseError::Bech32Error (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeParseError::Bech32Error ( a_nonref.into_rust(), ) }, ParseError::ParseAmountError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeParseError::ParseAmountError ( u8::from_str_radix(" a", 10).unwrap_err() /*a_nonref*/, ) }, ParseError::MalformedSignature (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeParseError::MalformedSignature ( a_nonref.into_rust(), ) @@ -245,7 +245,7 @@ impl ParseError { ParseError::TooShortDataPart => nativeParseError::TooShortDataPart, ParseError::UnexpectedEndOfTaggedFields => nativeParseError::UnexpectedEndOfTaggedFields, ParseError::DescriptionDecodeError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeParseError::DescriptionDecodeError ( core::str::from_utf8(&[0xff]).unwrap_err() /*a_nonref*/, ) @@ -257,7 +257,7 @@ impl ParseError { ParseError::InvalidScriptHashLength => nativeParseError::InvalidScriptHashLength, ParseError::InvalidRecoveryId => nativeParseError::InvalidRecoveryId, ParseError::InvalidSliceLength (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeParseError::InvalidSliceLength ( a_nonref.into_string(), ) @@ -312,19 +312,19 @@ impl ParseError { pub(crate) fn from_native(native: &nativeParseError) -> Self { match native { nativeParseError::Bech32Error (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ParseError::Bech32Error ( crate::c_types::Bech32Error::from_rust(a_nonref), ) }, nativeParseError::ParseAmountError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ParseError::ParseAmountError ( crate::c_types::Error { _dummy: 0 } /*a_nonref*/, ) }, nativeParseError::MalformedSignature (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ParseError::MalformedSignature ( crate::c_types::Secp256k1Error::from_rust(a_nonref), ) @@ -336,7 +336,7 @@ impl ParseError { nativeParseError::TooShortDataPart => ParseError::TooShortDataPart, nativeParseError::UnexpectedEndOfTaggedFields => ParseError::UnexpectedEndOfTaggedFields, nativeParseError::DescriptionDecodeError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ParseError::DescriptionDecodeError ( crate::c_types::Error { _dummy: 0 } /*a_nonref*/, ) @@ -348,7 +348,7 @@ impl ParseError { nativeParseError::InvalidScriptHashLength => ParseError::InvalidScriptHashLength, nativeParseError::InvalidRecoveryId => ParseError::InvalidRecoveryId, nativeParseError::InvalidSliceLength (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ParseError::InvalidSliceLength ( a_nonref.into(), ) @@ -513,13 +513,13 @@ impl ParseOrSemanticError { pub(crate) fn to_native(&self) -> nativeParseOrSemanticError { match self { ParseOrSemanticError::ParseError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeParseOrSemanticError::ParseError ( a_nonref.into_native(), ) }, ParseOrSemanticError::SemanticError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeParseOrSemanticError::SemanticError ( a_nonref.into_native(), ) @@ -545,13 +545,13 @@ impl ParseOrSemanticError { pub(crate) fn from_native(native: &nativeParseOrSemanticError) -> Self { match native { nativeParseOrSemanticError::ParseError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ParseOrSemanticError::ParseError ( crate::lightning_invoice::ParseError::native_into(a_nonref), ) }, nativeParseOrSemanticError::SemanticError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); ParseOrSemanticError::SemanticError ( crate::lightning_invoice::SemanticError::native_into(a_nonref), ) @@ -658,7 +658,7 @@ pub extern "C" fn Invoice_free(this_obj: Invoice) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Invoice_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoice); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoice) }; } #[allow(unused)] impl Invoice { @@ -751,7 +751,7 @@ pub extern "C" fn SignedRawInvoice_free(this_obj: SignedRawInvoice) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn SignedRawInvoice_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeSignedRawInvoice); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSignedRawInvoice) }; } #[allow(unused)] impl SignedRawInvoice { @@ -844,7 +844,7 @@ pub extern "C" fn RawInvoice_free(this_obj: RawInvoice) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RawInvoice_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRawInvoice); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRawInvoice) }; } #[allow(unused)] impl RawInvoice { @@ -944,7 +944,7 @@ pub extern "C" fn RawDataPart_free(this_obj: RawDataPart) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RawDataPart_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRawDataPart); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRawDataPart) }; } #[allow(unused)] impl RawDataPart { @@ -1049,7 +1049,7 @@ pub extern "C" fn PositiveTimestamp_free(this_obj: PositiveTimestamp) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PositiveTimestamp_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePositiveTimestamp); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePositiveTimestamp) }; } #[allow(unused)] impl PositiveTimestamp { @@ -1339,7 +1339,7 @@ pub extern "C" fn Sha256_free(this_obj: Sha256) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Sha256_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeSha256); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeSha256) }; } #[allow(unused)] impl Sha256 { @@ -1431,7 +1431,7 @@ pub extern "C" fn Description_free(this_obj: Description) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Description_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDescription); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDescription) }; } #[allow(unused)] impl Description { @@ -1520,7 +1520,7 @@ pub extern "C" fn PayeePubKey_free(this_obj: PayeePubKey) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PayeePubKey_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePayeePubKey); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePayeePubKey) }; } #[allow(unused)] impl PayeePubKey { @@ -1627,7 +1627,7 @@ pub extern "C" fn ExpiryTime_free(this_obj: ExpiryTime) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn ExpiryTime_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeExpiryTime); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeExpiryTime) }; } #[allow(unused)] impl ExpiryTime { @@ -1716,7 +1716,7 @@ pub extern "C" fn MinFinalCltvExpiry_free(this_obj: MinFinalCltvExpiry) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn MinFinalCltvExpiry_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeMinFinalCltvExpiry); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMinFinalCltvExpiry) }; } #[allow(unused)] impl MinFinalCltvExpiry { @@ -1795,7 +1795,7 @@ pub extern "C" fn MinFinalCltvExpiry_eq(a: &MinFinalCltvExpiry, b: &MinFinalCltv #[repr(C)] pub enum Fallback { SegWitProgram { - version: crate::c_types::u5, + version: crate::c_types::U5, program: crate::c_types::derived::CVec_u8Z, }, PubKeyHash( @@ -1811,8 +1811,8 @@ impl Fallback { pub(crate) fn to_native(&self) -> nativeFallback { match self { Fallback::SegWitProgram {ref version, ref program, } => { - let mut version_nonref = (*version).clone(); - let mut program_nonref = (*program).clone(); + let mut version_nonref = Clone::clone(version); + let mut program_nonref = Clone::clone(program); let mut local_program_nonref = Vec::new(); for mut item in program_nonref.into_rust().drain(..) { local_program_nonref.push( { item }); }; nativeFallback::SegWitProgram { version: version_nonref.into(), @@ -1820,13 +1820,13 @@ impl Fallback { } }, Fallback::PubKeyHash (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeFallback::PubKeyHash ( a_nonref.data, ) }, Fallback::ScriptHash (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeFallback::ScriptHash ( a_nonref.data, ) @@ -1859,8 +1859,8 @@ impl Fallback { pub(crate) fn from_native(native: &nativeFallback) -> Self { match native { nativeFallback::SegWitProgram {ref version, ref program, } => { - let mut version_nonref = (*version).clone(); - let mut program_nonref = (*program).clone(); + let mut version_nonref = Clone::clone(version); + let mut program_nonref = Clone::clone(program); let mut local_program_nonref = Vec::new(); for mut item in program_nonref.drain(..) { local_program_nonref.push( { item }); }; Fallback::SegWitProgram { version: version_nonref.into(), @@ -1868,13 +1868,13 @@ impl Fallback { } }, nativeFallback::PubKeyHash (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); Fallback::PubKeyHash ( crate::c_types::TwentyBytes { data: a_nonref }, ) }, nativeFallback::ScriptHash (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); Fallback::ScriptHash ( crate::c_types::TwentyBytes { data: a_nonref }, ) @@ -1914,7 +1914,7 @@ pub extern "C" fn Fallback_clone(orig: &Fallback) -> Fallback { } #[no_mangle] /// Utility method to constructs a new SegWitProgram-variant Fallback -pub extern "C" fn Fallback_seg_wit_program(version: crate::c_types::u5, program: crate::c_types::derived::CVec_u8Z) -> Fallback { +pub extern "C" fn Fallback_seg_wit_program(version: crate::c_types::U5, program: crate::c_types::derived::CVec_u8Z) -> Fallback { Fallback::SegWitProgram { version, program, @@ -1978,7 +1978,7 @@ pub extern "C" fn InvoiceSignature_free(this_obj: InvoiceSignature) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoiceSignature_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoiceSignature); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoiceSignature) }; } #[allow(unused)] impl InvoiceSignature { @@ -2071,7 +2071,7 @@ pub extern "C" fn PrivateRoute_free(this_obj: PrivateRoute) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn PrivateRoute_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativePrivateRoute); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativePrivateRoute) }; } #[allow(unused)] impl PrivateRoute { @@ -2874,7 +2874,7 @@ impl SignOrCreationError { ) }, SignOrCreationError::CreationError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeSignOrCreationError::CreationError ( a_nonref.into_native(), ) @@ -2902,7 +2902,7 @@ impl SignOrCreationError { nativeSignOrCreationError::SignError (ref a, ) => { SignOrCreationError::SignError }, nativeSignOrCreationError::CreationError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); SignOrCreationError::CreationError ( crate::lightning_invoice::CreationError::native_into(a_nonref), ) diff --git a/lightning-c-bindings/src/lightning_invoice/payment.rs b/lightning-c-bindings/src/lightning_invoice/payment.rs index 675f432..8550c27 100644 --- a/lightning-c-bindings/src/lightning_invoice/payment.rs +++ b/lightning-c-bindings/src/lightning_invoice/payment.rs @@ -37,13 +37,13 @@ //! # use lightning::ln::channelmanager::{ChannelDetails, PaymentId, PaymentSendFailure}; //! # use lightning::ln::msgs::LightningError; //! # use lightning::routing::gossip::NodeId; -//! # use lightning::routing::router::{Route, RouteHop, RouteParameters}; +//! # use lightning::routing::router::{InFlightHtlcs, Route, RouteHop, RouteParameters, Router}; //! # use lightning::routing::scoring::{ChannelUsage, Score}; //! # use lightning::util::events::{Event, EventHandler, EventsProvider}; //! # use lightning::util::logger::{Logger, Record}; //! # use lightning::util::ser::{Writeable, Writer}; //! # use lightning_invoice::Invoice; -//! # use lightning_invoice::payment::{InFlightHtlcs, InvoicePayer, Payer, Retry, Router}; +//! # use lightning_invoice::payment::{InvoicePayer, Payer, Retry}; //! # use secp256k1::PublicKey; //! # use std::cell::RefCell; //! # use std::ops::Deref; @@ -58,24 +58,25 @@ //! # fn node_id(&self) -> PublicKey { unimplemented!() } //! # fn first_hops(&self) -> Vec { unimplemented!() } //! # fn send_payment( -//! # &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option -//! # ) -> Result { unimplemented!() } +//! # &self, route: &Route, payment_hash: PaymentHash, payment_secret: &Option, +//! # payment_id: PaymentId +//! # ) -> Result<(), PaymentSendFailure> { unimplemented!() } //! # fn send_spontaneous_payment( -//! # &self, route: &Route, payment_preimage: PaymentPreimage -//! # ) -> Result { unimplemented!() } +//! # &self, route: &Route, payment_preimage: PaymentPreimage, payment_id: PaymentId, +//! # ) -> Result<(), PaymentSendFailure> { unimplemented!() } //! # fn retry_payment( //! # &self, route: &Route, payment_id: PaymentId //! # ) -> Result<(), PaymentSendFailure> { unimplemented!() } //! # fn abandon_payment(&self, payment_id: PaymentId) { unimplemented!() } +//! # fn inflight_htlcs(&self) -> InFlightHtlcs { unimplemented!() } //! # } //! # //! # struct FakeRouter {} //! # impl Router for FakeRouter { //! # fn find_route( -//! # &self, payer: &PublicKey, params: &RouteParameters, payment_hash: &PaymentHash, +//! # &self, payer: &PublicKey, params: &RouteParameters, //! # first_hops: Option<&[&ChannelDetails]>, _inflight_htlcs: InFlightHtlcs //! # ) -> Result { unimplemented!() } -//! # //! # fn notify_payment_path_failed(&self, path: &[&RouteHop], short_channel_id: u64) { unimplemented!() } //! # fn notify_payment_path_successful(&self, path: &[&RouteHop]) { unimplemented!() } //! # fn notify_payment_probe_successful(&self, path: &[&RouteHop]) { unimplemented!() } @@ -102,7 +103,7 @@ //! # } //! # //! # fn main() { -//! let event_handler = |event: &Event| { +//! let event_handler = |event: Event| { //! match event { //! Event::PaymentPathFailed { .. } => println!(\"payment failed after retries\"), //! Event::PaymentSent { .. } => println!(\"payment successful\"), @@ -143,7 +144,7 @@ use alloc::{vec::Vec, boxed::Box}; use lightning_invoice::payment::InvoicePayer as nativeInvoicePayerImport; -pub(crate) type nativeInvoicePayer = nativeInvoicePayerImport; +pub(crate) type nativeInvoicePayer = nativeInvoicePayerImport; /// A utility for paying [`Invoice`]s and sending spontaneous payments. /// @@ -178,7 +179,7 @@ pub extern "C" fn InvoicePayer_free(this_obj: InvoicePayer) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn InvoicePayer_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInvoicePayer); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoicePayer) }; } #[allow(unused)] impl InvoicePayer { @@ -197,6 +198,18 @@ impl InvoicePayer { } } /// A trait defining behavior of an [`Invoice`] payer. +/// +/// While the behavior of [`InvoicePayer`] provides idempotency of duplicate `send_*payment` calls +/// with the same [`PaymentHash`], it is up to the `Payer` to provide idempotency across restarts. +/// +/// [`ChannelManager`] provides idempotency for duplicate payments with the same [`PaymentId`]. +/// +/// In order to trivially ensure idempotency for payments, the default `Payer` implementation +/// reuses the [`PaymentHash`] bytes as the [`PaymentId`]. Custom implementations wishing to +/// provide payment idempotency with a different idempotency key (i.e. [`PaymentId`]) should map +/// the [`Invoice`] or spontaneous payment target pubkey to their own idempotency key. +/// +/// [`ChannelManager`]: lightning::ln::channelmanager::ChannelManager #[repr(C)] pub struct Payer { /// An opaque pointer which is passed to your function implementations as an argument. @@ -212,15 +225,19 @@ pub struct Payer { /// /// Note that payment_secret (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] - pub send_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_hash: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ, + pub send_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_hash: crate::c_types::ThirtyTwoBytes, payment_secret: crate::c_types::ThirtyTwoBytes, payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ, /// Sends a spontaneous payment over the Lightning Network using the given [`Route`]. #[must_use] - pub send_spontaneous_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ, + pub send_spontaneous_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ, /// Retries a failed payment path for the [`PaymentId`] using the given [`Route`]. #[must_use] pub retry_payment: extern "C" fn (this_arg: *const c_void, route: &crate::lightning::routing::router::Route, payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ, /// Signals that no further retries for the given payment will occur. pub abandon_payment: extern "C" fn (this_arg: *const c_void, payment_id: crate::c_types::ThirtyTwoBytes), + /// Construct an [`InFlightHtlcs`] containing information about currently used up liquidity + /// across payments. + #[must_use] + pub inflight_htlcs: extern "C" fn (this_arg: *const c_void) -> crate::lightning::routing::router::InFlightHtlcs, /// 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. pub free: Option, @@ -237,6 +254,7 @@ pub(crate) extern "C" fn Payer_clone_fields(orig: &Payer) -> Payer { send_spontaneous_payment: Clone::clone(&orig.send_spontaneous_payment), retry_payment: Clone::clone(&orig.retry_payment), abandon_payment: Clone::clone(&orig.abandon_payment), + inflight_htlcs: Clone::clone(&orig.inflight_htlcs), free: Clone::clone(&orig.free), } } @@ -252,15 +270,15 @@ impl rustPayer for Payer { let mut local_ret = Vec::new(); for mut item in ret.into_rust().drain(..) { local_ret.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret } - fn send_payment(&self, mut route: &lightning::routing::router::Route, mut payment_hash: lightning::ln::PaymentHash, mut payment_secret: &Option) -> Result { + fn send_payment(&self, mut route: &lightning::routing::router::Route, mut payment_hash: lightning::ln::PaymentHash, mut payment_secret: &Option, mut payment_id: lightning::ln::channelmanager::PaymentId) -> Result<(), lightning::ln::channelmanager::PaymentSendFailure> { let mut local_payment_secret = if payment_secret.is_none() { crate::c_types::ThirtyTwoBytes::null() } else { { crate::c_types::ThirtyTwoBytes { data: (payment_secret.unwrap()).0 } } }; - let mut ret = (self.send_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, local_payment_secret); - let mut local_ret = match ret.result_ok { true => Ok( { ::lightning::ln::channelmanager::PaymentId((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).data) }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })}; + let mut ret = (self.send_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, local_payment_secret, crate::c_types::ThirtyTwoBytes { data: payment_id.0 }); + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })}; local_ret } - fn send_spontaneous_payment(&self, mut route: &lightning::routing::router::Route, mut payment_preimage: lightning::ln::PaymentPreimage) -> Result { - let mut ret = (self.send_spontaneous_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_preimage.0 }); - let mut local_ret = match ret.result_ok { true => Ok( { ::lightning::ln::channelmanager::PaymentId((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).data) }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })}; + fn send_spontaneous_payment(&self, mut route: &lightning::routing::router::Route, mut payment_preimage: lightning::ln::PaymentPreimage, mut payment_id: lightning::ln::channelmanager::PaymentId) -> Result<(), lightning::ln::channelmanager::PaymentSendFailure> { + let mut ret = (self.send_spontaneous_payment)(self.this_arg, &crate::lightning::routing::router::Route { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route as *const lightning::routing::router::Route<>) as *mut _) }, is_owned: false }, crate::c_types::ThirtyTwoBytes { data: payment_preimage.0 }, crate::c_types::ThirtyTwoBytes { data: payment_id.0 }); + let mut local_ret = match ret.result_ok { true => Ok( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) })*/ }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).into_native() })}; local_ret } fn retry_payment(&self, mut route: &lightning::routing::router::Route, mut payment_id: lightning::ln::channelmanager::PaymentId) -> Result<(), lightning::ln::channelmanager::PaymentSendFailure> { @@ -271,6 +289,10 @@ impl rustPayer for Payer { fn abandon_payment(&self, mut payment_id: lightning::ln::channelmanager::PaymentId) { (self.abandon_payment)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: payment_id.0 }) } + fn inflight_htlcs(&self) -> lightning::routing::router::InFlightHtlcs { + let mut ret = (self.inflight_htlcs)(self.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used @@ -291,88 +313,6 @@ impl Drop for Payer { } } } -/// A trait defining behavior for routing an [`Invoice`] payment. -#[repr(C)] -pub struct Router { - /// 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. - pub this_arg: *mut c_void, - /// 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 - #[must_use] - pub find_route: extern "C" fn (this_arg: *const c_void, payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, payment_hash: *const [u8; 32], first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, inflight_htlcs: crate::lightning_invoice::payment::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteLightningErrorZ, - /// Lets the router know that payment through a specific path has failed. - pub notify_payment_path_failed: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64), - /// Lets the router know that payment through a specific path was successful. - pub notify_payment_path_successful: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ), - /// Lets the router know that a payment probe was successful. - pub notify_payment_probe_successful: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ), - /// Lets the router know that a payment probe failed. - pub notify_payment_probe_failed: extern "C" fn (this_arg: *const c_void, path: crate::c_types::derived::CVec_RouteHopZ, short_channel_id: u64), - /// 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. - pub free: Option, -} -unsafe impl Send for Router {} -unsafe impl Sync for Router {} -#[no_mangle] -pub(crate) extern "C" fn Router_clone_fields(orig: &Router) -> Router { - Router { - this_arg: orig.this_arg, - find_route: Clone::clone(&orig.find_route), - notify_payment_path_failed: Clone::clone(&orig.notify_payment_path_failed), - notify_payment_path_successful: Clone::clone(&orig.notify_payment_path_successful), - notify_payment_probe_successful: Clone::clone(&orig.notify_payment_probe_successful), - notify_payment_probe_failed: Clone::clone(&orig.notify_payment_probe_failed), - free: Clone::clone(&orig.free), - } -} - -use lightning_invoice::payment::Router as rustRouter; -impl rustRouter for Router { - fn find_route(&self, mut payer: &secp256k1::PublicKey, mut route_params: &lightning::routing::router::RouteParameters, mut payment_hash: &lightning::ln::PaymentHash, mut first_hops: Option<&[&lightning::ln::channelmanager::ChannelDetails]>, mut inflight_htlcs: lightning_invoice::payment::InFlightHtlcs) -> Result { - let mut local_first_hops_base = if first_hops.is_none() { SmartPtr::null() } else { SmartPtr::from_obj( { let mut local_first_hops_0 = Vec::new(); for item in (first_hops.unwrap()).iter() { local_first_hops_0.push( { crate::lightning::ln::channelmanager::ChannelDetails { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::ln::channelmanager::ChannelDetails<>) as *mut _) }, is_owned: false } }); }; local_first_hops_0.into() }) }; let mut local_first_hops = *local_first_hops_base; - let mut ret = (self.find_route)(self.this_arg, crate::c_types::PublicKey::from_rust(&payer), &crate::lightning::routing::router::RouteParameters { inner: unsafe { ObjOps::nonnull_ptr_to_inner((route_params as *const lightning::routing::router::RouteParameters<>) as *mut _) }, is_owned: false }, &payment_hash.0, local_first_hops, crate::lightning_invoice::payment::InFlightHtlcs { inner: ObjOps::heap_alloc(inflight_htlcs), is_owned: true }); - let mut local_ret = match ret.result_ok { true => Ok( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).take_inner()) } }), false => Err( { *unsafe { Box::from_raw((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; - local_ret - } - fn notify_payment_path_failed(&self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) { - let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; - (self.notify_payment_path_failed)(self.this_arg, local_path.into(), short_channel_id) - } - fn notify_payment_path_successful(&self, mut path: &[&lightning::routing::router::RouteHop]) { - let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; - (self.notify_payment_path_successful)(self.this_arg, local_path.into()) - } - fn notify_payment_probe_successful(&self, mut path: &[&lightning::routing::router::RouteHop]) { - let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; - (self.notify_payment_probe_successful)(self.this_arg, local_path.into()) - } - fn notify_payment_probe_failed(&self, mut path: &[&lightning::routing::router::RouteHop], mut short_channel_id: u64) { - let mut local_path = Vec::new(); for item in path.iter() { local_path.push( { crate::lightning::routing::router::RouteHop { inner: unsafe { ObjOps::nonnull_ptr_to_inner(((*item) as *const lightning::routing::router::RouteHop<>) as *mut _) }, is_owned: false } }); }; - (self.notify_payment_probe_failed)(self.this_arg, local_path.into(), short_channel_id) - } -} - -// We're essentially a pointer already, or at least a set of pointers, so allow us to be used -// directly as a Deref trait in higher-level structs: -impl core::ops::Deref for Router { - type Target = Self; - fn deref(&self) -> &Self { - self - } -} -/// Calls the free function if one is set -#[no_mangle] -pub extern "C" fn Router_free(this_ptr: Router) { } -impl Drop for Router { - fn drop(&mut self) { - if let Some(f) = self.free { - f(self.this_arg); - } - } -} /// Strategies available to retry payment path failures for an [`Invoice`]. /// #[derive(Clone)] @@ -398,13 +338,13 @@ impl Retry { pub(crate) fn to_native(&self) -> nativeRetry { match self { Retry::Attempts (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeRetry::Attempts ( a_nonref, ) }, Retry::Timeout (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeRetry::Timeout ( core::time::Duration::from_secs(a_nonref), ) @@ -430,13 +370,13 @@ impl Retry { pub(crate) fn from_native(native: &nativeRetry) -> Self { match native { nativeRetry::Attempts (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); Retry::Attempts ( a_nonref, ) }, nativeRetry::Timeout (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); Retry::Timeout ( a_nonref.as_secs(), ) @@ -515,19 +455,19 @@ impl PaymentError { pub(crate) fn to_native(&self) -> nativePaymentError { match self { PaymentError::Invoice (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativePaymentError::Invoice ( a_nonref.into_str(), ) }, PaymentError::Routing (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativePaymentError::Routing ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, PaymentError::Sending (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativePaymentError::Sending ( a_nonref.into_native(), ) @@ -558,19 +498,19 @@ impl PaymentError { pub(crate) fn from_native(native: &nativePaymentError) -> Self { match native { nativePaymentError::Invoice (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); PaymentError::Invoice ( a_nonref.into(), ) }, nativePaymentError::Routing (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); PaymentError::Routing ( crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, nativePaymentError::Sending (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); PaymentError::Sending ( crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(a_nonref), ) @@ -627,16 +567,19 @@ pub extern "C" fn PaymentError_sending(a: crate::lightning::ln::channelmanager:: /// `retry` has been exceeded for a given [`Invoice`]. #[must_use] #[no_mangle] -pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning_invoice::payment::Router, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry: crate::lightning_invoice::payment::Retry) -> crate::lightning_invoice::payment::InvoicePayer { +pub extern "C" fn InvoicePayer_new(mut payer: crate::lightning_invoice::payment::Payer, mut router: crate::lightning::routing::router::Router, mut logger: crate::lightning::util::logger::Logger, mut event_handler: crate::lightning::util::events::EventHandler, mut retry: crate::lightning_invoice::payment::Retry) -> crate::lightning_invoice::payment::InvoicePayer { let mut ret = lightning_invoice::payment::InvoicePayer::new(payer, router, logger, event_handler, retry.into_native()); crate::lightning_invoice::payment::InvoicePayer { inner: ObjOps::heap_alloc(ret), is_owned: true } } /// Pays the given [`Invoice`], caching it for later use in case a retry is needed. /// -/// You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has -/// never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so -/// for you. +/// [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long +/// as the payment is still pending. Once the payment completes or fails, you must ensure that +/// a second payment with the same [`PaymentHash`] is never sent. +/// +/// If you wish to use a different payment idempotency token, see +/// [`Self::pay_invoice_with_id`]. #[must_use] #[no_mangle] pub extern "C" fn InvoicePayer_pay_invoice(this_arg: &crate::lightning_invoice::payment::InvoicePayer, invoice: &crate::lightning_invoice::Invoice) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { @@ -645,12 +588,34 @@ pub extern "C" fn InvoicePayer_pay_invoice(this_arg: &crate::lightning_invoice:: local_ret } +/// Pays the given [`Invoice`] with a custom idempotency key, caching the invoice for later use +/// in case a retry is needed. +/// +/// Note that idempotency is only guaranteed as long as the payment is still pending. Once the +/// payment completes or fails, no idempotency guarantees are made. +/// +/// You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] +/// has never been paid before. +/// +/// See [`Self::pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency +/// token. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoicePayer_pay_invoice_with_id(this_arg: &crate::lightning_invoice::payment::InvoicePayer, invoice: &crate::lightning_invoice::Invoice, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_invoice_with_id(invoice.get_native_ref(), ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() }; + local_ret +} + /// Pays the given zero-value [`Invoice`] using the given amount, caching it for later use in /// case a retry is needed. /// -/// You should ensure that the `invoice.payment_hash()` is unique and the same payment_hash has -/// never been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so -/// for you. +/// [`Invoice::payment_hash`] is used as the [`PaymentId`], which ensures idempotency as long +/// as the payment is still pending. Once the payment completes or fails, you must ensure that +/// a second payment with the same [`PaymentHash`] is never sent. +/// +/// If you wish to use a different payment idempotency token, see +/// [`Self::pay_zero_value_invoice_with_id`]. #[must_use] #[no_mangle] pub extern "C" fn InvoicePayer_pay_zero_value_invoice(this_arg: &crate::lightning_invoice::payment::InvoicePayer, invoice: &crate::lightning_invoice::Invoice, mut amount_msats: u64) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { @@ -659,11 +624,31 @@ pub extern "C" fn InvoicePayer_pay_zero_value_invoice(this_arg: &crate::lightnin local_ret } +/// Pays the given zero-value [`Invoice`] using the given amount and custom idempotency key, +/// caching the invoice for later use in case a retry is needed. +/// +/// Note that idempotency is only guaranteed as long as the payment is still pending. Once the +/// payment completes or fails, no idempotency guarantees are made. +/// +/// You should ensure that the [`Invoice::payment_hash`] is unique and the same [`PaymentHash`] +/// has never been paid before. +/// +/// See [`Self::pay_zero_value_invoice`] for a variant which uses the [`PaymentHash`] for the +/// idempotency token. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoicePayer_pay_zero_value_invoice_with_id(this_arg: &crate::lightning_invoice::payment::InvoicePayer, invoice: &crate::lightning_invoice::Invoice, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_zero_value_invoice_with_id(invoice.get_native_ref(), amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() }; + local_ret +} + /// Pays `pubkey` an amount using the hash of the given preimage, caching it for later use in /// case a retry is needed. /// -/// You should ensure that `payment_preimage` is unique and that its `payment_hash` has never -/// been paid before. Because [`InvoicePayer`] is stateless no effort is made to do so for you. +/// The hash of the [`PaymentPreimage`] is used as the [`PaymentId`], which ensures idempotency +/// as long as the payment is still pending. Once the payment completes or fails, you must +/// ensure that a second payment with the same [`PaymentPreimage`] is never sent. #[must_use] #[no_mangle] pub extern "C" fn InvoicePayer_pay_pubkey(this_arg: &crate::lightning_invoice::payment::InvoicePayer, mut pubkey: crate::c_types::PublicKey, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut amount_msats: u64, mut final_cltv_expiry_delta: u32) -> crate::c_types::derived::CResult_PaymentIdPaymentErrorZ { @@ -672,6 +657,22 @@ pub extern "C" fn InvoicePayer_pay_pubkey(this_arg: &crate::lightning_invoice::p local_ret } +/// Pays `pubkey` an amount using the hash of the given preimage and a custom idempotency key, +/// caching the invoice for later use in case a retry is needed. +/// +/// Note that idempotency is only guaranteed as long as the payment is still pending. Once the +/// payment completes or fails, no idempotency guarantees are made. +/// +/// You should ensure that the [`PaymentPreimage`] is unique and the corresponding +/// [`PaymentHash`] has never been paid before. +#[must_use] +#[no_mangle] +pub extern "C" fn InvoicePayer_pay_pubkey_with_id(this_arg: &crate::lightning_invoice::payment::InvoicePayer, mut pubkey: crate::c_types::PublicKey, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut payment_id: crate::c_types::ThirtyTwoBytes, mut amount_msats: u64, mut final_cltv_expiry_delta: u32) -> crate::c_types::derived::CResult_NonePaymentErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_pubkey_with_id(pubkey.into_rust(), ::lightning::ln::PaymentPreimage(payment_preimage.data), ::lightning::ln::channelmanager::PaymentId(payment_id.data), amount_msats, final_cltv_expiry_delta); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::payment::PaymentError::native_into(e) }).into() }; + local_ret +} + /// Removes the payment cached by the given payment hash. /// /// Should be called once a payment has failed or succeeded if not using [`InvoicePayer`] as an @@ -702,87 +703,7 @@ pub extern "C" fn InvoicePayer_as_EventHandler(this_arg: &InvoicePayer) -> crate } } -extern "C" fn InvoicePayer_EventHandler_handle_event(this_arg: *const c_void, event: &crate::lightning::util::events::Event) { - >::handle_event(unsafe { &mut *(this_arg as *mut nativeInvoicePayer) }, &event.to_native()) +extern "C" fn InvoicePayer_EventHandler_handle_event(this_arg: *const c_void, mut event: crate::lightning::util::events::Event) { + >::handle_event(unsafe { &mut *(this_arg as *mut nativeInvoicePayer) }, event.into_native()) } - -use lightning_invoice::payment::InFlightHtlcs as nativeInFlightHtlcsImport; -pub(crate) type nativeInFlightHtlcs = nativeInFlightHtlcsImport; - -/// 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. -#[must_use] -#[repr(C)] -pub struct InFlightHtlcs { - /// 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. - pub inner: *mut nativeInFlightHtlcs, - /// 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. - pub is_owned: bool, -} - -impl Drop for InFlightHtlcs { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeInFlightHtlcs>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the InFlightHtlcs, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn InFlightHtlcs_free(this_obj: InFlightHtlcs) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn InFlightHtlcs_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeInFlightHtlcs); } -} -#[allow(unused)] -impl InFlightHtlcs { - pub(crate) fn get_native_ref(&self) -> &'static nativeInFlightHtlcs { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInFlightHtlcs { - unsafe { &mut *ObjOps::untweak_ptr(self.inner) } - } - /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy - pub(crate) fn take_inner(mut self) -> *mut nativeInFlightHtlcs { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} -/// Returns liquidity in msat given the public key of the HTLC source, target, and short channel -/// id. -#[must_use] -#[no_mangle] -pub extern "C" fn InFlightHtlcs_used_liquidity_msat(this_arg: &crate::lightning_invoice::payment::InFlightHtlcs, source: &crate::lightning::routing::gossip::NodeId, target: &crate::lightning::routing::gossip::NodeId, mut channel_scid: u64) -> crate::c_types::derived::COption_u64Z { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.used_liquidity_msat(source.get_native_ref(), target.get_native_ref(), channel_scid); - let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) }; - local_ret -} - -#[no_mangle] -/// Serialize the InFlightHtlcs object into a byte array which can be read by InFlightHtlcs_read -pub extern "C" fn InFlightHtlcs_write(obj: &crate::lightning_invoice::payment::InFlightHtlcs) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[no_mangle] -pub(crate) extern "C" fn InFlightHtlcs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInFlightHtlcs) }) -} -#[no_mangle] -/// Read a InFlightHtlcs from a byte array, created by InFlightHtlcs_write -pub extern "C" fn InFlightHtlcs_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InFlightHtlcsDecodeErrorZ { - let res: Result = crate::c_types::deserialize_obj(ser); - let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::payment::InFlightHtlcs { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; - local_res -} diff --git a/lightning-c-bindings/src/lightning_invoice/utils.rs b/lightning-c-bindings/src/lightning_invoice/utils.rs index 4a05bb7..b0d33ab 100644 --- a/lightning-c-bindings/src/lightning_invoice/utils.rs +++ b/lightning-c-bindings/src/lightning_invoice/utils.rs @@ -52,7 +52,7 @@ pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived:: let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) }; let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = lightning_invoice::utils::create_phantom_invoice::(local_amt_msat, local_payment_hash, description.into_string(), invoice_expiry_delta_secs, local_phantom_route_hints, keys_manager, logger, network.into_native()); + let mut ret = lightning_invoice::utils::create_phantom_invoice::(local_amt_msat, local_payment_hash, description.into_string(), invoice_expiry_delta_secs, local_phantom_route_hints, keys_manager, logger, network.into_native()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; local_ret } @@ -95,7 +95,7 @@ pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: cra let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_payment_hash = if payment_hash.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentHash(payment_hash.data) }) }; let mut local_phantom_route_hints = Vec::new(); for mut item in phantom_route_hints.into_rust().drain(..) { local_phantom_route_hints.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = lightning_invoice::utils::create_phantom_invoice_with_description_hash::(local_amt_msat, local_payment_hash, invoice_expiry_delta_secs, *unsafe { Box::from_raw(description_hash.take_inner()) }, local_phantom_route_hints, keys_manager, logger, network.into_native()); + let mut ret = lightning_invoice::utils::create_phantom_invoice_with_description_hash::(local_amt_msat, local_payment_hash, invoice_expiry_delta_secs, *unsafe { Box::from_raw(description_hash.take_inner()) }, local_phantom_route_hints, keys_manager, logger, network.into_native()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; local_ret } @@ -111,7 +111,7 @@ pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: cra #[no_mangle] pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; - let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs); + let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; local_ret } @@ -128,7 +128,7 @@ pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lig #[no_mangle] pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; - let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs); + let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; local_ret } @@ -139,7 +139,7 @@ pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(chann #[no_mangle] pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; - let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs); + let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; local_ret } @@ -150,119 +150,22 @@ pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_d #[no_mangle] pub extern "C" fn create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; - let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_and_duration_since_epoch::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs); + let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_and_duration_since_epoch::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; local_ret } - -use lightning_invoice::utils::DefaultRouter as nativeDefaultRouterImport; -pub(crate) type nativeDefaultRouter = nativeDefaultRouterImport<&'static lightning::routing::gossip::NetworkGraph, crate::lightning::util::logger::Logger, crate::lightning::routing::scoring::LockableScore>; - -/// A [`Router`] implemented using [`find_route`]. -#[must_use] -#[repr(C)] -pub struct DefaultRouter { - /// 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. - pub inner: *mut nativeDefaultRouter, - /// 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. - pub is_owned: bool, -} - -impl Drop for DefaultRouter { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeDefaultRouter>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the DefaultRouter, if is_owned is set and inner is non-NULL. +/// See [`create_invoice_from_channelmanager_and_duration_since_epoch`] +/// This version allows for providing a custom [`PaymentHash`] for the invoice. +/// This may be useful if you're building an on-chain swap or involving another protocol where +/// the payment hash is also involved outside the scope of lightning. #[no_mangle] -pub extern "C" fn DefaultRouter_free(this_obj: DefaultRouter) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn DefaultRouter_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeDefaultRouter); } -} -#[allow(unused)] -impl DefaultRouter { - pub(crate) fn get_native_ref(&self) -> &'static nativeDefaultRouter { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDefaultRouter { - unsafe { &mut *ObjOps::untweak_ptr(self.inner) } - } - /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy - pub(crate) fn take_inner(mut self) -> *mut nativeDefaultRouter { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } -} -/// Creates a new router using the given [`NetworkGraph`], a [`Logger`], and a randomness source -/// `random_seed_bytes`. -#[must_use] -#[no_mangle] -pub extern "C" fn DefaultRouter_new(network_graph: &crate::lightning::routing::gossip::NetworkGraph, mut logger: crate::lightning::util::logger::Logger, mut random_seed_bytes: crate::c_types::ThirtyTwoBytes, mut scorer: crate::lightning::routing::scoring::LockableScore) -> crate::lightning_invoice::utils::DefaultRouter { - let mut ret = lightning_invoice::utils::DefaultRouter::new(network_graph.get_native_ref(), logger, random_seed_bytes.data, scorer); - crate::lightning_invoice::utils::DefaultRouter { inner: ObjOps::heap_alloc(ret), is_owned: true } -} - -impl From for crate::lightning_invoice::payment::Router { - fn from(obj: nativeDefaultRouter) -> Self { - let mut rust_obj = DefaultRouter { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = DefaultRouter_as_Router(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so wipe rust_obj's pointer and set ret's free() fn - rust_obj.inner = core::ptr::null_mut(); - ret.free = Some(DefaultRouter_free_void); - ret - } -} -/// Constructs a new Router which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned Router must be freed before this_arg is -#[no_mangle] -pub extern "C" fn DefaultRouter_as_Router(this_arg: &DefaultRouter) -> crate::lightning_invoice::payment::Router { - crate::lightning_invoice::payment::Router { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - find_route: DefaultRouter_Router_find_route, - notify_payment_path_failed: DefaultRouter_Router_notify_payment_path_failed, - notify_payment_path_successful: DefaultRouter_Router_notify_payment_path_successful, - notify_payment_probe_successful: DefaultRouter_Router_notify_payment_probe_successful, - notify_payment_probe_failed: DefaultRouter_Router_notify_payment_probe_failed, - } -} - -#[must_use] -extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer: crate::c_types::PublicKey, route_params: &crate::lightning::routing::router::RouteParameters, payment_hash: *const [u8; 32], first_hops: *mut crate::c_types::derived::CVec_ChannelDetailsZ, mut inflight_htlcs: crate::lightning_invoice::payment::InFlightHtlcs) -> crate::c_types::derived::CResult_RouteLightningErrorZ { - let mut local_first_hops_base = if first_hops == core::ptr::null_mut() { None } else { Some( { let mut local_first_hops_0 = Vec::new(); for mut item in unsafe { &mut *first_hops }.as_slice().iter() { local_first_hops_0.push( { item.get_native_ref() }); }; local_first_hops_0 }) }; let mut local_first_hops = local_first_hops_base.as_ref().map(|a| &a[..]); - let mut ret = >::find_route(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &payer.into_rust(), route_params.get_native_ref(), &::lightning::ln::PaymentHash(unsafe { *payment_hash }), local_first_hops, *unsafe { Box::from_raw(inflight_htlcs.take_inner()) }); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::routing::router::Route { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; +pub extern "C" fn create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut keys_manager: crate::lightning::chain::keysinterface::KeysInterface, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut duration_since_epoch: u64, mut invoice_expiry_delta_secs: u32, mut payment_hash: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceSignOrCreationErrorZ { + let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; + let mut ret = lightning_invoice::utils::create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash::(channelmanager.get_native_ref(), keys_manager, logger, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs, ::lightning::ln::PaymentHash(payment_hash.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Invoice { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning_invoice::SignOrCreationError::native_into(e) }).into() }; local_ret } -extern "C" fn DefaultRouter_Router_notify_payment_path_failed(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) { - let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; - >::notify_payment_path_failed(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..], short_channel_id) -} -extern "C" fn DefaultRouter_Router_notify_payment_path_successful(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) { - let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; - >::notify_payment_path_successful(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..]) -} -extern "C" fn DefaultRouter_Router_notify_payment_probe_successful(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ) { - let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; - >::notify_payment_probe_successful(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..]) -} -extern "C" fn DefaultRouter_Router_notify_payment_probe_failed(this_arg: *const c_void, mut path: crate::c_types::derived::CVec_RouteHopZ, mut short_channel_id: u64) { - let mut local_path = Vec::new(); for mut item in path.as_slice().iter() { local_path.push( { item.get_native_ref() }); }; - >::notify_payment_probe_failed(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, &local_path[..], short_channel_id) -} impl From for crate::lightning_invoice::payment::Payer { fn from(obj: nativeChannelManager) -> Self { @@ -287,6 +190,7 @@ pub extern "C" fn ChannelManager_as_Payer(this_arg: &ChannelManager) -> crate::l send_spontaneous_payment: ChannelManager_Payer_send_spontaneous_payment, retry_payment: ChannelManager_Payer_retry_payment, abandon_payment: ChannelManager_Payer_abandon_payment, + inflight_htlcs: ChannelManager_Payer_inflight_htlcs, } } @@ -302,16 +206,16 @@ extern "C" fn ChannelManager_Payer_first_hops(this_arg: *const c_void) -> crate: local_ret.into() } #[must_use] -extern "C" fn ChannelManager_Payer_send_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ { +extern "C" fn ChannelManager_Payer_send_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ { let mut local_payment_secret = if payment_secret.data == [0; 32] { None } else { Some( { ::lightning::ln::PaymentSecret(payment_secret.data) }) }; - let mut ret = >::send_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; + let mut ret = >::send_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::PaymentHash(payment_hash.data), &local_payment_secret, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; local_ret } #[must_use] -extern "C" fn ChannelManager_Payer_send_spontaneous_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_PaymentIdPaymentSendFailureZ { - let mut ret = >::send_spontaneous_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::PaymentPreimage(payment_preimage.data)); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ThirtyTwoBytes { data: o.0 } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; +extern "C" fn ChannelManager_Payer_send_spontaneous_payment(this_arg: *const c_void, route: &crate::lightning::routing::router::Route, mut payment_preimage: crate::c_types::ThirtyTwoBytes, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ { + let mut ret = >::send_spontaneous_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, route.get_native_ref(), ::lightning::ln::PaymentPreimage(payment_preimage.data), ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::channelmanager::PaymentSendFailure::native_into(e) }).into() }; local_ret } #[must_use] @@ -323,6 +227,11 @@ extern "C" fn ChannelManager_Payer_retry_payment(this_arg: *const c_void, route: extern "C" fn ChannelManager_Payer_abandon_payment(this_arg: *const c_void, mut payment_id: crate::c_types::ThirtyTwoBytes) { >::abandon_payment(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data)) } +#[must_use] +extern "C" fn ChannelManager_Payer_inflight_htlcs(this_arg: *const c_void) -> crate::lightning::routing::router::InFlightHtlcs { + let mut ret = >::inflight_htlcs(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); + crate::lightning::routing::router::InFlightHtlcs { inner: ObjOps::heap_alloc(ret), is_owned: true } +} use crate::lightning::ln::channelmanager::nativeChannelManager as nativeChannelManager; use crate::lightning::ln::channelmanager::ChannelManager; diff --git a/lightning-c-bindings/src/lightning_persister.rs b/lightning-c-bindings/src/lightning_persister.rs index 7569bfb..3f6892e 100644 --- a/lightning-c-bindings/src/lightning_persister.rs +++ b/lightning-c-bindings/src/lightning_persister.rs @@ -71,7 +71,7 @@ pub extern "C" fn FilesystemPersister_free(this_obj: FilesystemPersister) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn FilesystemPersister_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeFilesystemPersister); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeFilesystemPersister) }; } #[allow(unused)] impl FilesystemPersister { diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs index 0fe5716..b7cd734 100644 --- a/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs +++ b/lightning-c-bindings/src/lightning_rapid_gossip_sync/error.rs @@ -38,13 +38,13 @@ impl GraphSyncError { pub(crate) fn to_native(&self) -> nativeGraphSyncError { match self { GraphSyncError::DecodeError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeGraphSyncError::DecodeError ( a_nonref.into_native(), ) }, GraphSyncError::LightningError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); nativeGraphSyncError::LightningError ( *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) @@ -70,13 +70,13 @@ impl GraphSyncError { pub(crate) fn from_native(native: &nativeGraphSyncError) -> Self { match native { nativeGraphSyncError::DecodeError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); GraphSyncError::DecodeError ( crate::lightning::ln::msgs::DecodeError::native_into(a_nonref), ) }, nativeGraphSyncError::LightningError (ref a, ) => { - let mut a_nonref = (*a).clone(); + let mut a_nonref = Clone::clone(a); GraphSyncError::LightningError ( crate::lightning::ln::msgs::LightningError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs index 1cc8d14..66c8f7e 100644 --- a/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs +++ b/lightning-c-bindings/src/lightning_rapid_gossip_sync/mod.rs @@ -113,7 +113,7 @@ pub extern "C" fn RapidGossipSync_free(this_obj: RapidGossipSync) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn RapidGossipSync_free_void(this_ptr: *mut c_void) { - unsafe { let _ = Box::from_raw(this_ptr as *mut nativeRapidGossipSync); } + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeRapidGossipSync) }; } #[allow(unused)] impl RapidGossipSync {