diff --git a/lightning-c-bindings/include/ldk_rust_types.h b/lightning-c-bindings/include/ldk_rust_types.h index bbc7ca0..1b790ed 100644 --- a/lightning-c-bindings/include/ldk_rust_types.h +++ b/lightning-c-bindings/include/ldk_rust_types.h @@ -16,6 +16,14 @@ struct nativeRefundOpaque; typedef struct nativeRefundOpaque LDKnativeRefund; struct nativeRecipientOnionFieldsOpaque; typedef struct nativeRecipientOnionFieldsOpaque LDKnativeRecipientOnionFields; +struct nativeDNSSECQueryOpaque; +typedef struct nativeDNSSECQueryOpaque LDKnativeDNSSECQuery; +struct nativeDNSSECProofOpaque; +typedef struct nativeDNSSECProofOpaque LDKnativeDNSSECProof; +struct nativeHumanReadableNameOpaque; +typedef struct nativeHumanReadableNameOpaque LDKnativeHumanReadableName; +struct nativeOMNameResolverOpaque; +typedef struct nativeOMNameResolverOpaque LDKnativeOMNameResolver; struct nativeInvoiceWithExplicitSigningPubkeyBuilderOpaque; typedef struct nativeInvoiceWithExplicitSigningPubkeyBuilderOpaque LDKnativeInvoiceWithExplicitSigningPubkeyBuilder; struct nativeInvoiceWithDerivedSigningPubkeyBuilderOpaque; @@ -147,6 +155,8 @@ struct nativeChainParametersOpaque; typedef struct nativeChainParametersOpaque LDKnativeChainParameters; struct nativePhantomRouteHintsOpaque; typedef struct nativePhantomRouteHintsOpaque LDKnativePhantomRouteHints; +struct nativeBolt11InvoiceParametersOpaque; +typedef struct nativeBolt11InvoiceParametersOpaque LDKnativeBolt11InvoiceParameters; struct nativeChannelManagerReadArgsOpaque; typedef struct nativeChannelManagerReadArgsOpaque LDKnativeChannelManagerReadArgs; struct nativeChannelHandshakeConfigOpaque; @@ -185,10 +195,12 @@ struct nativeRapidGossipSyncOpaque; typedef struct nativeRapidGossipSyncOpaque LDKnativeRapidGossipSync; struct nativeMonitorUpdatingPersisterOpaque; typedef struct nativeMonitorUpdatingPersisterOpaque LDKnativeMonitorUpdatingPersister; -struct nativeInvoiceRequestWithExplicitPayerIdBuilderOpaque; -typedef struct nativeInvoiceRequestWithExplicitPayerIdBuilderOpaque LDKnativeInvoiceRequestWithExplicitPayerIdBuilder; -struct nativeInvoiceRequestWithDerivedPayerIdBuilderOpaque; -typedef struct nativeInvoiceRequestWithDerivedPayerIdBuilderOpaque LDKnativeInvoiceRequestWithDerivedPayerIdBuilder; +struct nativeMonitorNameOpaque; +typedef struct nativeMonitorNameOpaque LDKnativeMonitorName; +struct nativeUpdateNameOpaque; +typedef struct nativeUpdateNameOpaque LDKnativeUpdateName; +struct nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilderOpaque; +typedef struct nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilderOpaque LDKnativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder; struct nativeUnsignedInvoiceRequestOpaque; typedef struct nativeUnsignedInvoiceRequestOpaque LDKnativeUnsignedInvoiceRequest; struct nativeInvoiceRequestOpaque; @@ -379,6 +391,8 @@ struct nativeRouteHintOpaque; typedef struct nativeRouteHintOpaque LDKnativeRouteHint; struct nativeRouteHintHopOpaque; typedef struct nativeRouteHintHopOpaque LDKnativeRouteHintHop; +struct nativeBolt11ParseErrorOpaque; +typedef struct nativeBolt11ParseErrorOpaque LDKnativeBolt11ParseError; struct nativeBolt11InvoiceOpaque; typedef struct nativeBolt11InvoiceOpaque LDKnativeBolt11Invoice; struct nativeSignedRawBolt11InvoiceOpaque; @@ -423,12 +437,12 @@ struct nativeForwardTlvsOpaque; typedef struct nativeForwardTlvsOpaque LDKnativeForwardTlvs; struct nativeReceiveTlvsOpaque; typedef struct nativeReceiveTlvsOpaque LDKnativeReceiveTlvs; +struct nativeUnauthenticatedReceiveTlvsOpaque; +typedef struct nativeUnauthenticatedReceiveTlvsOpaque LDKnativeUnauthenticatedReceiveTlvs; struct nativePaymentRelayOpaque; typedef struct nativePaymentRelayOpaque LDKnativePaymentRelay; struct nativePaymentConstraintsOpaque; typedef struct nativePaymentConstraintsOpaque LDKnativePaymentConstraints; -struct nativeUnknownPaymentContextOpaque; -typedef struct nativeUnknownPaymentContextOpaque LDKnativeUnknownPaymentContext; struct nativeBolt12OfferContextOpaque; typedef struct nativeBolt12OfferContextOpaque LDKnativeBolt12OfferContext; struct nativeBolt12RefundContextOpaque; @@ -497,3 +511,5 @@ struct nativeBlindedMessagePathOpaque; typedef struct nativeBlindedMessagePathOpaque LDKnativeBlindedMessagePath; struct nativeMessageForwardNodeOpaque; typedef struct nativeMessageForwardNodeOpaque LDKnativeMessageForwardNode; +struct nativeDNSResolverContextOpaque; +typedef struct nativeDNSResolverContextOpaque LDKnativeDNSResolverContext; diff --git a/lightning-c-bindings/include/lightning.h b/lightning-c-bindings/include/lightning.h index 9076f1a..6b96dbe 100644 --- a/lightning-c-bindings/include/lightning.h +++ b/lightning-c-bindings/include/lightning.h @@ -1,7 +1,7 @@ #ifndef LDK_C_BINDINGS_H #define LDK_C_BINDINGS_H -/* Generated with cbindgen:0.24.5 */ +/* Generated with cbindgen:0.20.0 */ /* Warning, this file is autogenerated by cbindgen. Don't modify this manually. */ @@ -115,7 +115,7 @@ typedef enum LDKBolt11SemanticError { */ typedef enum LDKBolt12SemanticError { /** - * The current [`std::time::SystemTime`] is past the offer or invoice's expiration. + * The current system time is past the offer or invoice's expiration. */ LDKBolt12SemanticError_AlreadyExpired, /** @@ -131,7 +131,7 @@ typedef enum LDKBolt12SemanticError { */ LDKBolt12SemanticError_MissingAmount, /** - * The amount exceeded the total bitcoin supply. + * The amount exceeded the total bitcoin supply or didn't match an expected amount. */ LDKBolt12SemanticError_InvalidAmount, /** @@ -159,17 +159,13 @@ typedef enum LDKBolt12SemanticError { */ LDKBolt12SemanticError_MissingDescription, /** - * A signing pubkey was not provided. - */ - LDKBolt12SemanticError_MissingSigningPubkey, - /** - * A signing pubkey was provided but a different one was expected. + * An issuer's signing pubkey was not provided. */ - LDKBolt12SemanticError_InvalidSigningPubkey, + LDKBolt12SemanticError_MissingIssuerSigningPubkey, /** - * A signing pubkey was provided but was not expected. + * An issuer's signing pubkey was provided but was not expected. */ - LDKBolt12SemanticError_UnexpectedSigningPubkey, + LDKBolt12SemanticError_UnexpectedIssuerSigningPubkey, /** * A quantity was expected but was missing. */ @@ -195,9 +191,9 @@ typedef enum LDKBolt12SemanticError { */ LDKBolt12SemanticError_MissingPayerMetadata, /** - * A payer id was expected but was missing. + * A payer signing pubkey was expected but was missing. */ - LDKBolt12SemanticError_MissingPayerId, + LDKBolt12SemanticError_MissingPayerSigningPubkey, /** * The payment id for a refund or request is already in use. */ @@ -226,10 +222,25 @@ typedef enum LDKBolt12SemanticError { * An invoice payment hash was provided but was not expected. */ LDKBolt12SemanticError_UnexpectedPaymentHash, + /** + * A signing pubkey was not provided. + */ + LDKBolt12SemanticError_MissingSigningPubkey, + /** + * A signing pubkey was provided but a different one was expected. + */ + LDKBolt12SemanticError_InvalidSigningPubkey, /** * A signature was expected but was missing. */ LDKBolt12SemanticError_MissingSignature, + /** + * A Human Readable Name was provided but was not expected (i.e. was included in a + * [`Refund`]). + * + * [`Refund`]: super::refund::Refund + */ + LDKBolt12SemanticError_UnexpectedHumanReadableName, /** * Must be last for serialization purposes */ @@ -821,12 +832,12 @@ typedef enum LDKPaymentFailureReason { */ LDKPaymentFailureReason_UserAbandoned, /** - * We exhausted all of our retry attempts while trying to send the payment, or we - * exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry - * attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will + *We exhausted all of our retry attempts while trying to send the payment, or we + *exhausted the [`Retry::Timeout`] if the user set one. + * If at any point a retry attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will * have come before this. * - * [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout + *[`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout */ LDKPaymentFailureReason_RetriesExhausted, /** @@ -840,11 +851,15 @@ typedef enum LDKPaymentFailureReason { */ LDKPaymentFailureReason_PaymentExpired, /** - * We failed to find a route while retrying the payment. + * We failed to find a route while sending or retrying the payment. * * Note that this generally indicates that we've exhausted the available set of possible * routes - we tried the payment over a few routes but were not able to find any further * candidate routes beyond those. + * + * Also used for [`BlindedPathCreationFailed`] when downgrading to versions prior to 0.0.124. + * + * [`BlindedPathCreationFailed`]: Self::BlindedPathCreationFailed */ LDKPaymentFailureReason_RouteNotFound, /** @@ -866,6 +881,14 @@ typedef enum LDKPaymentFailureReason { * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ LDKPaymentFailureReason_InvoiceRequestRejected, + /** + * Failed to create a blinded path back to ourselves. + * We attempted to initiate payment to a static invoice but failed to create a reply path for our + * [`HeldHtlcAvailable`] message. + * + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + */ + LDKPaymentFailureReason_BlindedPathCreationFailed, /** * Must be last for serialization purposes */ @@ -906,8 +929,9 @@ typedef enum LDKRecipient { */ typedef enum LDKRetryableSendFailure { /** - * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note - * that this error is *not* caused by [`Retry::Timeout`]. + * The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. + * + *Note that this error is *not* caused by [`Retry::Timeout`]. * * [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time */ @@ -1557,7 +1581,7 @@ typedef enum LDKDecodeError_Tag { */ LDKDecodeError_BadLengthDescriptor, /** - * Error from [`std::io`]. + * Error from [`crate::io`]. */ LDKDecodeError_Io, /** @@ -1747,197 +1771,6 @@ typedef struct LDKCResult_RetryDecodeErrorZ { bool result_ok; } LDKCResult_RetryDecodeErrorZ; - - -/** - * A script pubkey for shutting down a channel as defined by [BOLT #2]. - * - * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md - */ -typedef struct MUST_USE_STRUCT LDKShutdownScript { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeShutdownScript *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; -} LDKShutdownScript; - -/** - * Indicates an error on the client's part (usually some variant of attempting to use too-low or - * too-high values) - */ -typedef enum LDKAPIError_Tag { - /** - * Indicates the API was wholly misused (see err for more). Cases where these can be returned - * are documented, but generally indicates some precondition of a function was violated. - */ - LDKAPIError_APIMisuseError, - /** - * Due to a high feerate, we were unable to complete the request. - * For example, this may be returned if the feerate implies we cannot open a channel at the - * requested value, but opening a larger channel would succeed. - */ - LDKAPIError_FeeRateTooHigh, - /** - * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, - * too-many-hops, etc). - */ - LDKAPIError_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 - * peer, channel at capacity, channel shutting down, etc. - */ - LDKAPIError_ChannelUnavailable, - /** - * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`] - * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a - * monitor update is awaiting async resolution. Once it resolves the attempted action should - * complete automatically. - * - * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel - * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel - * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress - */ - LDKAPIError_MonitorUpdateInProgress, - /** - * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible - * with the channel counterparty as negotiated in [`InitFeatures`]. - * - * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open - * a channel or cooperatively close one with this peer (and will have to force-close instead). - * - * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey - * [`InitFeatures`]: crate::ln::features::InitFeatures - */ - LDKAPIError_IncompatibleShutdownScript, - /** - * Must be last for serialization purposes - */ - LDKAPIError_Sentinel, -} LDKAPIError_Tag; - -typedef struct LDKAPIError_LDKAPIMisuseError_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKAPIMisuseError_Body; - -typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { - /** - * A human-readable error message - */ - struct LDKStr err; - /** - * The feerate which was too high. - */ - uint32_t feerate; -} LDKAPIError_LDKFeeRateTooHigh_Body; - -typedef struct LDKAPIError_LDKInvalidRoute_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKInvalidRoute_Body; - -typedef struct LDKAPIError_LDKChannelUnavailable_Body { - /** - * A human-readable error message - */ - struct LDKStr err; -} LDKAPIError_LDKChannelUnavailable_Body; - -typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { - /** - * The incompatible shutdown script. - */ - struct LDKShutdownScript script; -} LDKAPIError_LDKIncompatibleShutdownScript_Body; - -typedef struct MUST_USE_STRUCT LDKAPIError { - LDKAPIError_Tag tag; - union { - LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; - LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; - LDKAPIError_LDKInvalidRoute_Body invalid_route; - LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; - LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; - }; -} LDKAPIError; - -/** - * The contents of CResult_NoneAPIErrorZ - */ -typedef union LDKCResult_NoneAPIErrorZPtr { - /** - * Note that this value is always NULL, as there are no contents in the OK variant - */ - void *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKAPIError *err; -} LDKCResult_NoneAPIErrorZPtr; - -/** - * A CResult_NoneAPIErrorZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::util::errors::APIError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NoneAPIErrorZ { - /** - * The contents of this CResult_NoneAPIErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_NoneAPIErrorZPtr contents; - /** - * Whether this CResult_NoneAPIErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_NoneAPIErrorZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_CResult_NoneAPIErrorZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKCResult_NoneAPIErrorZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_CResult_NoneAPIErrorZZ; - -/** - * A dynamically-allocated array of crate::lightning::util::errors::APIErrors of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_APIErrorZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKAPIError *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_APIErrorZ; - /** * An enum which can either contain a crate::c_types::ThirtyTwoBytes or not */ @@ -2113,329 +1946,1236 @@ typedef struct LDKCResult_RecipientOnionFieldsNoneZ { /** - * A semantically valid [`Bolt12Invoice`] that hasn't been signed. - * - * # Serialization - * - * This is serialized as a TLV stream, which includes TLV records from the originating message. As - * such, it may include unknown, odd TLV records. + * A message which is sent to a DNSSEC prover requesting a DNSSEC proof for the given name. */ -typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { +typedef struct MUST_USE_STRUCT LDKDNSSECQuery { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUnsignedBolt12Invoice *inner; + LDKnativeDNSSECQuery *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; -} LDKUnsignedBolt12Invoice; - -/** - * The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ - */ -typedef union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKUnsignedBolt12Invoice *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKBolt12SemanticError *err; -} LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr; - -/** - * A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - /** - * The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr contents; - /** - * Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ; +} LDKDNSSECQuery; /** - * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`]. - * - * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent - * directly after scanning a refund. It includes all the information needed to pay a recipient. - * - * [`Offer`]: crate::offers::offer::Offer - * [`Refund`]: crate::offers::refund::Refund - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * A message which is sent in response to [`DNSSECQuery`] containing a DNSSEC proof. */ -typedef struct MUST_USE_STRUCT LDKBolt12Invoice { +typedef struct MUST_USE_STRUCT LDKDNSSECProof { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeBolt12Invoice *inner; + LDKnativeDNSSECProof *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; -} LDKBolt12Invoice; +} LDKDNSSECProof; /** - * The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ + * An enum containing the possible onion messages which are used uses to request and receive + * DNSSEC proofs. */ -typedef union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKBolt12Invoice *result; +typedef enum LDKDNSResolverMessage_Tag { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * A query requesting a DNSSEC proof */ - enum LDKBolt12SemanticError *err; -} LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr; - -/** - * A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ { + LDKDNSResolverMessage_DNSSECQuery, /** - * The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A response containing a DNSSEC proof */ - union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr contents; + LDKDNSResolverMessage_DNSSECProof, /** - * Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state. + * Must be last for serialization purposes */ - bool result_ok; -} LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ; + LDKDNSResolverMessage_Sentinel, +} LDKDNSResolverMessage_Tag; -/** - * Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers - */ -typedef struct LDKSchnorrSignature { - /** - * The bytes of the signature as two 32-byte numbers - */ - uint8_t compact_form[64]; -} LDKSchnorrSignature; +typedef struct MUST_USE_STRUCT LDKDNSResolverMessage { + LDKDNSResolverMessage_Tag tag; + union { + struct { + struct LDKDNSSECQuery dnssec_query; + }; + struct { + struct LDKDNSSECProof dnssec_proof; + }; + }; +} LDKDNSResolverMessage; -/** - * The contents of CResult_SchnorrSignatureNoneZ - */ -typedef union LDKCResult_SchnorrSignatureNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKSchnorrSignature *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_SchnorrSignatureNoneZPtr; -/** - * A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, - * containing a crate::c_types::SchnorrSignature on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_SchnorrSignatureNoneZ { - /** - * The contents of this CResult_SchnorrSignatureNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_SchnorrSignatureNoneZPtr contents; - /** - * Whether this CResult_SchnorrSignatureNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_SchnorrSignatureNoneZ; /** - * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. - * This corresponds to std::vector in C++ + * Instructions for how and where to send the response to an onion message. */ -typedef struct LDKCVec_StrZ { +typedef struct MUST_USE_STRUCT LDKResponseInstruction { /** - * 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 LDKStr *data; + LDKnativeResponseInstruction *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_StrZ; + bool is_owned; +} LDKResponseInstruction; /** - * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. - * This corresponds to std::vector in C++ + * A tuple of 2 elements. See the individual fields for the types contained. */ -typedef struct LDKCVec_ThirtyTwoBytesZ { +typedef struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ { /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + * The element at position 0 */ - struct LDKThirtyTwoBytes *data; + struct LDKDNSResolverMessage a; /** - * The number of elements pointed to by `data`. + * The element at position 1 */ - uintptr_t datalen; -} LDKCVec_ThirtyTwoBytesZ; + struct LDKResponseInstruction b; +} LDKC2Tuple_DNSResolverMessageResponseInstructionZ; /** - * An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not + * An enum which can either contain a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ or not */ -typedef enum LDKCOption_CVec_ThirtyTwoBytesZZ_Tag { +typedef enum LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ_Tag { /** - * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ + * When we're in this state, this COption_C2Tuple_DNSResolverMessageResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ */ - LDKCOption_CVec_ThirtyTwoBytesZZ_Some, + LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ_Some, /** - * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing + * When we're in this state, this COption_C2Tuple_DNSResolverMessageResponseInstructionZZ contains nothing */ - LDKCOption_CVec_ThirtyTwoBytesZZ_None, + LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ_None, /** * Must be last for serialization purposes */ - LDKCOption_CVec_ThirtyTwoBytesZZ_Sentinel, -} LDKCOption_CVec_ThirtyTwoBytesZZ_Tag; + LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ_Sentinel, +} LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ_Tag; -typedef struct LDKCOption_CVec_ThirtyTwoBytesZZ { - LDKCOption_CVec_ThirtyTwoBytesZZ_Tag tag; +typedef struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ { + LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ_Tag tag; union { struct { - struct LDKCVec_ThirtyTwoBytesZ some; + struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ some; }; }; -} LDKCOption_CVec_ThirtyTwoBytesZZ; +} LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ; /** - * A 3-byte byte array. + * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. */ -typedef struct LDKThreeBytes { +typedef struct LDKPublicKey { /** - * The three bytes + * The bytes of the public key */ - uint8_t data[3]; -} LDKThreeBytes; + uint8_t compressed_form[33]; +} LDKPublicKey; /** - * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or - * another currency. + * The destination of an onion message. */ -typedef enum LDKAmount_Tag { +typedef enum LDKDestination_Tag { /** - * An amount of bitcoin. + * We're sending this onion message to a node. */ - LDKAmount_Bitcoin, + LDKDestination_Node, /** - * An amount of currency specified using ISO 4712. + * We're sending this onion message to a blinded path. */ - LDKAmount_Currency, + LDKDestination_BlindedPath, /** * Must be last for serialization purposes */ - LDKAmount_Sentinel, -} LDKAmount_Tag; - -typedef struct LDKAmount_LDKBitcoin_Body { - /** - * The amount in millisatoshi. - */ - uint64_t amount_msats; -} LDKAmount_LDKBitcoin_Body; - -typedef struct LDKAmount_LDKCurrency_Body { - /** - * The currency that the amount is denominated in. - */ - struct LDKThreeBytes iso4217_code; - /** - * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents). - */ - uint64_t amount; -} LDKAmount_LDKCurrency_Body; + LDKDestination_Sentinel, +} LDKDestination_Tag; -typedef struct MUST_USE_STRUCT LDKAmount { - LDKAmount_Tag tag; +typedef struct MUST_USE_STRUCT LDKDestination { + LDKDestination_Tag tag; union { - LDKAmount_LDKBitcoin_Body bitcoin; - LDKAmount_LDKCurrency_Body currency; + struct { + struct LDKPublicKey node; + }; + struct { + struct LDKBlindedMessagePath blinded_path; + }; }; -} LDKAmount; +} LDKDestination; + + /** - * An enum which can either contain a crate::lightning::offers::offer::Amount or not + * A 128-bit number used only once. + * + * Needed when constructing [`Offer::metadata`] and deriving [`Offer::issuer_signing_pubkey`] from + * [`ExpandedKey`]. Must not be reused for any other derivation without first hashing. + * + * [`Offer::metadata`]: crate::offers::offer::Offer::metadata + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -typedef enum LDKCOption_AmountZ_Tag { - /** - * When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount - */ - LDKCOption_AmountZ_Some, +typedef struct MUST_USE_STRUCT LDKNonce { /** - * When we're in this state, this COption_AmountZ 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_AmountZ_None, + LDKnativeNonce *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_AmountZ_Sentinel, -} LDKCOption_AmountZ_Tag; - -typedef struct LDKCOption_AmountZ { - LDKCOption_AmountZ_Tag tag; - union { - struct { - struct LDKAmount some; - }; - }; -} LDKCOption_AmountZ; + bool is_owned; +} LDKNonce; /** - * Quantity of items supported by an [`Offer`]. + * Contains data specific to an [`OffersMessage`]. + * + * [`OffersMessage`]: crate::onion_message::offers::OffersMessage */ -typedef enum LDKQuantity_Tag { +typedef enum LDKOffersContext_Tag { /** - * Up to a specific number of items (inclusive). Use when more than one item can be requested - * but is limited (e.g., because of per customer or inventory limits). + * Context used by a [`BlindedMessagePath`] within an [`Offer`]. * - * May be used with `NonZeroU64::new(1)` but prefer to use [`Quantity::One`] if only one item - * is supported. + * This variant is intended to be received when handling an [`InvoiceRequest`]. + * + * [`Offer`]: crate::offers::offer::Offer + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ - LDKQuantity_Bounded, + LDKOffersContext_InvoiceRequest, /** - * One or more items. Use when more than one item can be requested without any limit. + * Context used by a [`BlindedMessagePath`] within a [`Refund`] or as a reply path for an + * [`InvoiceRequest`]. + * + * This variant is intended to be received when handling a [`Bolt12Invoice`] or an + * [`InvoiceError`]. + * + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError */ - LDKQuantity_Unbounded, + LDKOffersContext_OutboundPayment, /** - * Only one item. Use when only a single item can be requested. + * Context used by a [`BlindedMessagePath`] as a reply path for a [`Bolt12Invoice`]. + * + * This variant is intended to be received when handling an [`InvoiceError`]. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError */ - LDKQuantity_One, + LDKOffersContext_InboundPayment, /** * Must be last for serialization purposes */ - LDKQuantity_Sentinel, -} LDKQuantity_Tag; + LDKOffersContext_Sentinel, +} LDKOffersContext_Tag; + +typedef struct LDKOffersContext_LDKInvoiceRequest_Body { + /** + * A nonce used for authenticating that an [`InvoiceRequest`] is for a valid [`Offer`] and + * for deriving the offer's signing keys. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Offer`]: crate::offers::offer::Offer + */ + struct LDKNonce nonce; +} LDKOffersContext_LDKInvoiceRequest_Body; + +typedef struct LDKOffersContext_LDKOutboundPayment_Body { + /** + * Payment ID used when creating a [`Refund`] or [`InvoiceRequest`]. + * + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKThirtyTwoBytes payment_id; + /** + * A nonce used for authenticating that a [`Bolt12Invoice`] is for a valid [`Refund`] or + * [`InvoiceRequest`] and for deriving their signing keys. + * + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ + struct LDKNonce nonce; + /** + * Authentication code for the [`PaymentId`], which should be checked when the context is + * used with an [`InvoiceError`]. + * + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKThirtyTwoBytes hmac; +} LDKOffersContext_LDKOutboundPayment_Body; + +typedef struct LDKOffersContext_LDKInboundPayment_Body { + /** + * The same payment hash as [`Bolt12Invoice::payment_hash`]. + * + * [`Bolt12Invoice::payment_hash`]: crate::offers::invoice::Bolt12Invoice::payment_hash + */ + struct LDKThirtyTwoBytes payment_hash; + /** + * A nonce used for authenticating that a received [`InvoiceError`] is for a valid + * sent [`Bolt12Invoice`]. + * + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ + struct LDKNonce nonce; + /** + * Authentication code for the [`PaymentHash`], which should be checked when the context is + * used to log the received [`InvoiceError`]. + * + * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + */ + struct LDKThirtyTwoBytes hmac; +} LDKOffersContext_LDKInboundPayment_Body; + +typedef struct MUST_USE_STRUCT LDKOffersContext { + LDKOffersContext_Tag tag; + union { + LDKOffersContext_LDKInvoiceRequest_Body invoice_request; + LDKOffersContext_LDKOutboundPayment_Body outbound_payment; + LDKOffersContext_LDKInboundPayment_Body inbound_payment; + }; +} LDKOffersContext; + +/** + * Contains data specific to an [`AsyncPaymentsMessage`]. + * + * [`AsyncPaymentsMessage`]: crate::onion_message::async_payments::AsyncPaymentsMessage + */ +typedef enum LDKAsyncPaymentsContext_Tag { + /** + * Context contained within the reply [`BlindedMessagePath`] we put in outbound + * [`HeldHtlcAvailable`] messages, provided back to us in corresponding [`ReleaseHeldHtlc`] + * messages. + * + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + */ + LDKAsyncPaymentsContext_OutboundPayment, + /** + * Must be last for serialization purposes + */ + LDKAsyncPaymentsContext_Sentinel, +} LDKAsyncPaymentsContext_Tag; + +typedef struct LDKAsyncPaymentsContext_LDKOutboundPayment_Body { + /** + * ID used when payment to the originating [`Offer`] was initiated. Useful for us to identify + * which of our pending outbound payments should be released to its often-offline payee. + * + * [`Offer`]: crate::offers::offer::Offer + */ + struct LDKThirtyTwoBytes payment_id; + /** + * A nonce used for authenticating that a [`ReleaseHeldHtlc`] message is valid for a preceding + * [`HeldHtlcAvailable`] message. + * + * [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + * [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + */ + struct LDKNonce nonce; + /** + * Authentication code for the [`PaymentId`]. + * + * Prevents the recipient from being able to deanonymize us by creating a blinded path to us + * containing the expected [`PaymentId`]. + */ + struct LDKThirtyTwoBytes hmac; +} LDKAsyncPaymentsContext_LDKOutboundPayment_Body; + +typedef struct MUST_USE_STRUCT LDKAsyncPaymentsContext { + LDKAsyncPaymentsContext_Tag tag; + union { + LDKAsyncPaymentsContext_LDKOutboundPayment_Body outbound_payment; + }; +} LDKAsyncPaymentsContext; + + + +/** + * Contains a simple nonce for use in a blinded path's context. + * + * Such a context is required when receiving a [`DNSSECProof`] message. + * + * [`DNSSECProof`]: crate::onion_message::dns_resolution::DNSSECProof + */ +typedef struct MUST_USE_STRUCT LDKDNSResolverContext { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeDNSResolverContext *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; +} LDKDNSResolverContext; + +/** + * Additional data included by the recipient in a [`BlindedMessagePath`]. + * + * This data is encrypted by the recipient and will be given to the corresponding message handler + * when handling a message sent over the [`BlindedMessagePath`]. The recipient can use this data to + * authenticate the message or for further processing if needed. + */ +typedef enum LDKMessageContext_Tag { + /** + * Context specific to an [`OffersMessage`]. + * + * [`OffersMessage`]: crate::onion_message::offers::OffersMessage + */ + LDKMessageContext_Offers, + /** + * Context specific to an [`AsyncPaymentsMessage`]. + * + * [`AsyncPaymentsMessage`]: crate::onion_message::async_payments::AsyncPaymentsMessage + */ + LDKMessageContext_AsyncPayments, + /** + * Represents a context for a blinded path used in a reply path when requesting a DNSSEC proof + * in a [`DNSResolverMessage`]. + * + * [`DNSResolverMessage`]: crate::onion_message::dns_resolution::DNSResolverMessage + */ + LDKMessageContext_DNSResolver, + /** + * Context specific to a [`CustomOnionMessageHandler::CustomMessage`]. + * + * [`CustomOnionMessageHandler::CustomMessage`]: crate::onion_message::messenger::CustomOnionMessageHandler::CustomMessage + */ + LDKMessageContext_Custom, + /** + * Must be last for serialization purposes + */ + LDKMessageContext_Sentinel, +} LDKMessageContext_Tag; + +typedef struct MUST_USE_STRUCT LDKMessageContext { + LDKMessageContext_Tag tag; + union { + struct { + struct LDKOffersContext offers; + }; + struct { + struct LDKAsyncPaymentsContext async_payments; + }; + struct { + struct LDKDNSResolverContext dns_resolver; + }; + struct { + struct LDKCVec_u8Z custom; + }; + }; +} LDKMessageContext; + +/** + * Instructions for how and where to send a message. + */ +typedef enum LDKMessageSendInstructions_Tag { + /** + * Indicates that a message should be sent including the provided reply path for the recipient + * to respond. + */ + LDKMessageSendInstructions_WithSpecifiedReplyPath, + /** + * Indicates that a message should be sent including a reply path for the recipient to + * respond. + */ + LDKMessageSendInstructions_WithReplyPath, + /** + * Indicates that a message should be sent without including a reply path, preventing the + * recipient from responding. + */ + LDKMessageSendInstructions_WithoutReplyPath, + /** + * Indicates that a message is being sent as a reply to a received message. + */ + LDKMessageSendInstructions_ForReply, + /** + * Must be last for serialization purposes + */ + LDKMessageSendInstructions_Sentinel, +} LDKMessageSendInstructions_Tag; + +typedef struct LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body { + /** + * The destination where we need to send our message. + */ + struct LDKDestination destination; + /** + * The reply path which should be included in the message. + */ + struct LDKBlindedMessagePath reply_path; +} LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body; + +typedef struct LDKMessageSendInstructions_LDKWithReplyPath_Body { + /** + * The destination where we need to send our message. + */ + struct LDKDestination destination; + /** + * The context to include in the reply path we'll give the recipient so they can respond + * to us. + */ + struct LDKMessageContext context; +} LDKMessageSendInstructions_LDKWithReplyPath_Body; + +typedef struct LDKMessageSendInstructions_LDKWithoutReplyPath_Body { + /** + * The destination where we need to send our message. + */ + struct LDKDestination destination; +} LDKMessageSendInstructions_LDKWithoutReplyPath_Body; + +typedef struct LDKMessageSendInstructions_LDKForReply_Body { + /** + * The instructions provided by the [`Responder`]. + */ + struct LDKResponseInstruction instructions; +} LDKMessageSendInstructions_LDKForReply_Body; + +typedef struct MUST_USE_STRUCT LDKMessageSendInstructions { + LDKMessageSendInstructions_Tag tag; + union { + LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body with_specified_reply_path; + LDKMessageSendInstructions_LDKWithReplyPath_Body with_reply_path; + LDKMessageSendInstructions_LDKWithoutReplyPath_Body without_reply_path; + LDKMessageSendInstructions_LDKForReply_Body for_reply; + }; +} LDKMessageSendInstructions; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ { + /** + * The element at position 0 + */ + struct LDKDNSResolverMessage a; + /** + * The element at position 1 + */ + struct LDKMessageSendInstructions b; +} LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_DNSResolverMessageMessageSendInstructionsZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ; + +/** + * The contents of CResult_DNSResolverMessageDecodeErrorZ + */ +typedef union LDKCResult_DNSResolverMessageDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKDNSResolverMessage *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_DNSResolverMessageDecodeErrorZPtr; + +/** + * A CResult_DNSResolverMessageDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::dns_resolution::DNSResolverMessage 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_DNSResolverMessageDecodeErrorZ { + /** + * The contents of this CResult_DNSResolverMessageDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_DNSResolverMessageDecodeErrorZPtr contents; + /** + * Whether this CResult_DNSResolverMessageDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_DNSResolverMessageDecodeErrorZ; + + + +/** + * A struct containing the two parts of a BIP 353 Human Readable Name - the user and domain parts. + * + * The `user` and `domain` parts, together, cannot exceed 232 bytes in length, and both must be + * non-empty. + * + * To protect against [Homograph Attacks], both parts of a Human Readable Name must be plain + * ASCII. + * + * [Homograph Attacks]: https://en.wikipedia.org/wiki/IDN_homograph_attack + */ +typedef struct MUST_USE_STRUCT LDKHumanReadableName { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeHumanReadableName *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; +} LDKHumanReadableName; + +/** + * The contents of CResult_HumanReadableNameNoneZ + */ +typedef union LDKCResult_HumanReadableNameNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKHumanReadableName *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_HumanReadableNameNoneZPtr; + +/** + * A CResult_HumanReadableNameNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::dns_resolution::HumanReadableName on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_HumanReadableNameNoneZ { + /** + * The contents of this CResult_HumanReadableNameNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_HumanReadableNameNoneZPtr contents; + /** + * Whether this CResult_HumanReadableNameNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_HumanReadableNameNoneZ; + +/** + * The contents of CResult_HumanReadableNameDecodeErrorZ + */ +typedef union LDKCResult_HumanReadableNameDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKHumanReadableName *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_HumanReadableNameDecodeErrorZPtr; + +/** + * A CResult_HumanReadableNameDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::dns_resolution::HumanReadableName 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_HumanReadableNameDecodeErrorZ { + /** + * The contents of this CResult_HumanReadableNameDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_HumanReadableNameDecodeErrorZPtr contents; + /** + * Whether this CResult_HumanReadableNameDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_HumanReadableNameDecodeErrorZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ { + /** + * The element at position 0 + */ + struct LDKDNSSECQuery a; + /** + * The element at position 1 + */ + struct LDKDNSResolverContext b; +} LDKC2Tuple_DNSSECQueryDNSResolverContextZ; + +/** + * The contents of CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ + */ +typedef union LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr; + +/** + * A CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_DNSSECQueryDNSResolverContextZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + /** + * The contents of this CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr contents; + /** + * Whether this CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ { + /** + * The element at position 0 + */ + struct LDKHumanReadableName a; + /** + * The element at position 1 + */ + struct LDKThirtyTwoBytes b; +} LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C2Tuple_HumanReadableNameThirtyTwoBytesZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ; + + + +/** + * An `Offer` is a potentially long-lived proposal for payment of a good or service. + * + * An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a + * customer may request an [`Bolt12Invoice`] for a specific quantity and using an amount sufficient + * to cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`]. + * + * Offers may be denominated in currency other than bitcoin but are ultimately paid using the + * latter. + * + * Through the use of [`BlindedMessagePath`]s, offers provide recipient privacy. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + */ +typedef struct MUST_USE_STRUCT LDKOffer { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOffer *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKOffer; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { + /** + * The element at position 0 + */ + struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a; + /** + * The element at position 1 + */ + struct LDKOffer b; +} LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ or not + */ +typedef enum LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ contains a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ + */ + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ contains nothing + */ + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_Sentinel, +} LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_Tag; + +typedef struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ some; + }; + }; +} LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ; + +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { + /** + * The element at position 0 + */ + struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a; + /** + * The element at position 1 + */ + struct LDKStr b; +} LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ or not + */ +typedef enum LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ contains a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ + */ + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ contains nothing + */ + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_Sentinel, +} LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_Tag; + +typedef struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ some; + }; + }; +} LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ; + + + +/** + * A semantically valid [`Bolt12Invoice`] that hasn't been signed. + * + * # Serialization + * + * This is serialized as a TLV stream, which includes TLV records from the originating message. As + * such, it may include unknown, odd TLV records. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedBolt12Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedBolt12Invoice *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; +} LDKUnsignedBolt12Invoice; + +/** + * The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ + */ +typedef union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKUnsignedBolt12Invoice *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr; + +/** + * A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + /** + * The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ; + + + +/** + * A `Bolt12Invoice` is a payment request, typically corresponding to an [`Offer`] or a [`Refund`]. + * + * An invoice may be sent in response to an [`InvoiceRequest`] in the case of an offer or sent + * directly after scanning a refund. It includes all the information needed to pay a recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Refund`]: crate::offers::refund::Refund + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + */ +typedef struct MUST_USE_STRUCT LDKBolt12Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt12Invoice *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; +} LDKBolt12Invoice; + +/** + * The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ + */ +typedef union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBolt12Invoice *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKBolt12SemanticError *err; +} LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr; + +/** + * A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ { + /** + * The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_Bolt12InvoiceBolt12SemanticErrorZPtr contents; + /** + * Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ; + +/** + * Represents a secp256k1 Schnorr signature serialized as two 32-byte numbers + */ +typedef struct LDKSchnorrSignature { + /** + * The bytes of the signature as two 32-byte numbers + */ + uint8_t compact_form[64]; +} LDKSchnorrSignature; + +/** + * The contents of CResult_SchnorrSignatureNoneZ + */ +typedef union LDKCResult_SchnorrSignatureNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKSchnorrSignature *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_SchnorrSignatureNoneZPtr; + +/** + * A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, + * containing a crate::c_types::SchnorrSignature on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_SchnorrSignatureNoneZ { + /** + * The contents of this CResult_SchnorrSignatureNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_SchnorrSignatureNoneZPtr contents; + /** + * Whether this CResult_SchnorrSignatureNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_SchnorrSignatureNoneZ; + + + +/** + * A blinded path to be used for sending or receiving a payment, hiding the identity of the + * recipient. + */ +typedef struct MUST_USE_STRUCT LDKBlindedPaymentPath { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedPaymentPath *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; +} LDKBlindedPaymentPath; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::payment::BlindedPaymentPaths of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_BlindedPaymentPathZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKBlindedPaymentPath *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_BlindedPaymentPathZ; + +/** + * A dynamically-allocated array of crate::c_types::Strs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_StrZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKStr *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_StrZ; + +/** + * A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_ThirtyTwoBytesZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKThirtyTwoBytes *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_ThirtyTwoBytesZ; + +/** + * An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not + */ +typedef enum LDKCOption_CVec_ThirtyTwoBytesZZ_Tag { + /** + * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ + */ + LDKCOption_CVec_ThirtyTwoBytesZZ_Some, + /** + * When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing + */ + LDKCOption_CVec_ThirtyTwoBytesZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_CVec_ThirtyTwoBytesZZ_Sentinel, +} LDKCOption_CVec_ThirtyTwoBytesZZ_Tag; + +typedef struct LDKCOption_CVec_ThirtyTwoBytesZZ { + LDKCOption_CVec_ThirtyTwoBytesZZ_Tag tag; + union { + struct { + struct LDKCVec_ThirtyTwoBytesZ some; + }; + }; +} LDKCOption_CVec_ThirtyTwoBytesZZ; + +/** + * A 3-byte byte array. + */ +typedef struct LDKThreeBytes { + /** + * The three bytes + */ + uint8_t data[3]; +} LDKThreeBytes; + +/** + * The minimum amount required for an item in an [`Offer`], denominated in either bitcoin or + * another currency. + */ +typedef enum LDKAmount_Tag { + /** + * An amount of bitcoin. + */ + LDKAmount_Bitcoin, + /** + * An amount of currency specified using ISO 4217. + */ + LDKAmount_Currency, + /** + * Must be last for serialization purposes + */ + LDKAmount_Sentinel, +} LDKAmount_Tag; + +typedef struct LDKAmount_LDKBitcoin_Body { + /** + * The amount in millisatoshi. + */ + uint64_t amount_msats; +} LDKAmount_LDKBitcoin_Body; + +typedef struct LDKAmount_LDKCurrency_Body { + /** + * The currency that the amount is denominated in. + */ + struct LDKThreeBytes iso4217_code; + /** + * The amount in the currency unit adjusted by the ISO 4712 exponent (e.g., USD cents). + */ + uint64_t amount; +} LDKAmount_LDKCurrency_Body; + +typedef struct MUST_USE_STRUCT LDKAmount { + LDKAmount_Tag tag; + union { + LDKAmount_LDKBitcoin_Body bitcoin; + LDKAmount_LDKCurrency_Body currency; + }; +} LDKAmount; + +/** + * An enum which can either contain a crate::lightning::offers::offer::Amount or not + */ +typedef enum LDKCOption_AmountZ_Tag { + /** + * When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount + */ + LDKCOption_AmountZ_Some, + /** + * When we're in this state, this COption_AmountZ contains nothing + */ + LDKCOption_AmountZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_AmountZ_Sentinel, +} LDKCOption_AmountZ_Tag; + +typedef struct LDKCOption_AmountZ { + LDKCOption_AmountZ_Tag tag; + union { + struct { + struct LDKAmount some; + }; + }; +} LDKCOption_AmountZ; + +/** + * Quantity of items supported by an [`Offer`]. + */ +typedef enum LDKQuantity_Tag { + /** + * Up to a specific number of items (inclusive). Use when more than one item can be requested + * but is limited (e.g., because of per customer or inventory limits). + * + * May be used with `NonZeroU64::new(1)` but prefer to use [`Quantity::One`] if only one item + * is supported. + */ + LDKQuantity_Bounded, + /** + * One or more items. Use when more than one item can be requested without any limit. + */ + LDKQuantity_Unbounded, + /** + * Only one item. Use when only a single item can be requested. + */ + LDKQuantity_One, + /** + * Must be last for serialization purposes + */ + LDKQuantity_Sentinel, +} LDKQuantity_Tag; typedef struct MUST_USE_STRUCT LDKQuantity { LDKQuantity_Tag tag; @@ -3042,16 +3782,6 @@ typedef struct LDKCResult_HTLCDescriptorDecodeErrorZ { bool result_ok; } LDKCResult_HTLCDescriptorDecodeErrorZ; -/** - * Represents a valid secp256k1 public key serialized in "compressed form" as a 33 byte array. - */ -typedef struct LDKPublicKey { - /** - * The bytes of the public key - */ - uint8_t compressed_form[33]; -} LDKPublicKey; - /** * The contents of CResult_PublicKeyNoneZ */ @@ -3515,9 +4245,12 @@ typedef struct MUST_USE_STRUCT LDKChannelTransactionParameters { * A trait to handle Lightning channel key material without concretizing the channel type or * the signature mechanism. * - * Several methods allow error types to be returned to support async signing. This feature - * is not yet complete, and panics may occur in certain situations when returning errors - * for these methods. + * Several methods allow errors to be returned to support async signing. In such cases, the + * signing operation can be replayed by calling [`ChannelManager::signer_unblocked`] once the + * result is ready, at which point the channel operation will resume. Methods which allow for + * async results are explicitly documented as such + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ typedef struct LDKChannelSigner { /** @@ -3530,10 +4263,9 @@ typedef struct LDKChannelSigner { * * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. * - * If the signer returns `Err`, then the user is responsible for either force-closing the channel - * or calling `ChannelManager::signer_unblocked` (this method is only available when the - * `async_signing` cfg flag is enabled) once the signature is ready. - * + * This method is *not* asynchronous. This method is expected to always return `Ok` + * immediately after we reconnect to peers, and returning an `Err` may lead to an immediate + * `panic`. This method will be made asynchronous in a future release. */ struct LDKCResult_PublicKeyNoneZ (*get_per_commitment_point)(const void *this_arg, uint64_t idx); /** @@ -3545,6 +4277,12 @@ typedef struct LDKChannelSigner { * May be called more than once for the same index. * * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ struct LDKCResult__u832NoneZ (*release_commitment_secret)(const void *this_arg, uint64_t idx); /** @@ -3561,6 +4299,10 @@ typedef struct LDKChannelSigner { * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + * and pause future signing operations until this validation completes. */ struct LDKCResult_NoneNoneZ (*validate_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** @@ -3568,10 +4310,16 @@ typedef struct LDKChannelSigner { * * This is required in order for the signer to make sure that the state has moved * forward and it is safe to sign the next counterparty commitment. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + * and pause future signing operations until this validation completes. */ struct LDKCResult_NoneNoneZ (*validate_counterparty_revocation)(const void *this_arg, uint64_t idx, const uint8_t (*secret)[32]); /** * Returns the holder's channel public keys and basepoints. + * + * This method is *not* asynchronous. Instead, the value must be cached locally. */ struct LDKChannelPublicKeys pubkeys; /** @@ -3584,6 +4332,8 @@ typedef struct LDKChannelSigner { * 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 * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. + * + * This method is *not* asynchronous. Instead, the value must be cached locally. */ struct LDKThirtyTwoBytes (*channel_keys_id)(const void *this_arg); /** @@ -3613,6 +4363,15 @@ typedef struct LDKChannelSigner { * 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. + * + * Like [`ChannelSigner`], many of the methods allow errors to be returned to support async + * signing. In such cases, the signing operation can be replayed by calling + * [`ChannelManager::signer_unblocked`] or [`ChainMonitor::signer_unblocked`] (see individual + * method documentation for which method should be called) once the result is ready, at which + * point the channel operation will resume. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ typedef struct LDKEcdsaChannelSigner { /** @@ -3623,8 +4382,6 @@ typedef struct LDKEcdsaChannelSigner { /** * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. * - * Note that if signing fails or is rejected, the channel will be force-closed. - * * Policy checks should be implemented in this function, including checking the amount * sent to us and checking the HTLCs. * @@ -3635,6 +4392,12 @@ typedef struct LDKEcdsaChannelSigner { * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ struct LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ (*sign_counterparty_commitment)(const void *this_arg, const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** @@ -3651,9 +4414,10 @@ typedef struct LDKEcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_commitment)(const void *this_arg, const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** @@ -3675,9 +4439,10 @@ typedef struct LDKEcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*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]); /** @@ -3703,9 +4468,10 @@ typedef struct LDKEcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*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); /** @@ -3720,11 +4486,12 @@ typedef struct LDKEcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); /** @@ -3749,9 +4516,10 @@ typedef struct LDKEcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_counterparty_htlc_transaction)(const void *this_arg, struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** @@ -3759,6 +4527,12 @@ typedef struct LDKEcdsaChannelSigner { * * Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have * chosen to forgo their output as dust. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_closing_transaction)(const void *this_arg, const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** @@ -3768,9 +4542,10 @@ typedef struct LDKEcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ struct LDKCResult_ECDSASignatureNoneZ (*sign_holder_anchor_input)(const void *this_arg, struct LDKTransaction anchor_tx, uintptr_t input); /** @@ -3780,13 +4555,28 @@ typedef struct LDKEcdsaChannelSigner { * Channel announcements also require a signature from each node's network key. Our node * signature is computed through [`NodeSigner::sign_gossip_message`]. * - * Note that if this fails or is rejected, the channel will not be publicly announced and - * our counterparty may (though likely will not) close the channel on us for violating the - * protocol. + * This method is *not* asynchronous. If an `Err` is returned, the channel will not be + * publicly announced and our counterparty may (though likely will not) close the channel on + * us for violating the protocol. * * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message */ struct LDKCResult_ECDSASignatureNoneZ (*sign_channel_announcement_with_funding_key)(const void *this_arg, const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + /** + * Signs the input of a splicing funding transaction with our funding key. + * + * In splicing, the previous funding transaction output is spent as the input of + * the new funding transaction, and is a 2-of-2 multisig. + * + * `input_index`: The index of the input within the new funding transaction `tx`, + * spending the previous funding transaction's output + * + * `input_value`: The value of the previous funding transaction output. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. + */ + struct LDKCResult_ECDSASignatureNoneZ (*sign_splicing_funding_input)(const void *this_arg, struct LDKTransaction tx, uintptr_t input_index, uint64_t input_value); /** * Implementation of ChannelSigner for this object. */ @@ -3869,6 +4659,28 @@ typedef struct LDKCResult_CVec_u8ZNoneZ { bool result_ok; } LDKCResult_CVec_u8ZNoneZ; + + +/** + * A script pubkey for shutting down a channel as defined by [BOLT #2]. + * + * [BOLT #2]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md + */ +typedef struct MUST_USE_STRUCT LDKShutdownScript { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeShutdownScript *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; +} LDKShutdownScript; + /** * The contents of CResult_ShutdownScriptNoneZ */ @@ -4664,43 +5476,6 @@ typedef struct LDKCResult_RouteLightningErrorZ { bool result_ok; } LDKCResult_RouteLightningErrorZ; - - -/** - * A blinded path to be used for sending or receiving a payment, hiding the identity of the - * recipient. - */ -typedef struct MUST_USE_STRUCT LDKBlindedPaymentPath { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeBlindedPaymentPath *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; -} LDKBlindedPaymentPath; - -/** - * A dynamically-allocated array of crate::lightning::blinded_path::payment::BlindedPaymentPaths of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_BlindedPaymentPathZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKBlindedPaymentPath *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_BlindedPaymentPathZ; - /** * The contents of CResult_CVec_BlindedPaymentPathZNoneZ */ @@ -4733,142 +5508,6 @@ typedef struct LDKCResult_CVec_BlindedPaymentPathZNoneZ { bool result_ok; } LDKCResult_CVec_BlindedPaymentPathZNoneZ; -/** - * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_PublicKeyZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKPublicKey *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_PublicKeyZ; - - - -/** - * A path for sending an [`OnionMessage`]. - */ -typedef struct MUST_USE_STRUCT LDKOnionMessagePath { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeOnionMessagePath *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; -} LDKOnionMessagePath; - -/** - * The contents of CResult_OnionMessagePathNoneZ - */ -typedef union LDKCResult_OnionMessagePathNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKOnionMessagePath *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_OnionMessagePathNoneZPtr; - -/** - * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, - * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_OnionMessagePathNoneZ { - /** - * The contents of this CResult_OnionMessagePathNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_OnionMessagePathNoneZPtr contents; - /** - * Whether this CResult_OnionMessagePathNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_OnionMessagePathNoneZ; - -/** - * The contents of CResult_CVec_BlindedMessagePathZNoneZ - */ -typedef union LDKCResult_CVec_BlindedMessagePathZNoneZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKCVec_BlindedMessagePathZ *result; - /** - * Note that this value is always NULL, as there are no contents in the Err variant - */ - void *err; -} LDKCResult_CVec_BlindedMessagePathZNoneZPtr; - -/** - * A CResult_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, - * containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_CVec_BlindedMessagePathZNoneZ { - /** - * The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_CVec_BlindedMessagePathZNoneZPtr contents; - /** - * Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. - */ - bool result_ok; -} LDKCResult_CVec_BlindedMessagePathZNoneZ; - - - -/** - * An intermediate node, and possibly a short channel id leading to the next node. - */ -typedef struct MUST_USE_STRUCT LDKMessageForwardNode { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeMessageForwardNode *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; -} LDKMessageForwardNode; - -/** - * A dynamically-allocated array of crate::lightning::blinded_path::message::MessageForwardNodes of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_MessageForwardNodeZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKMessageForwardNode *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_MessageForwardNodeZ; - /** @@ -5364,6 +6003,22 @@ typedef struct LDKCResult_RouteHintHopDecodeErrorZ { bool result_ok; } LDKCResult_RouteHintHopDecodeErrorZ; +/** + * A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_PublicKeyZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKPublicKey *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_PublicKeyZ; + /** @@ -5995,635 +6650,255 @@ typedef enum LDKClosureReason_Tag { */ LDKClosureReason_OutdatedChannelManager, /** - * The counterparty requested a cooperative close of a channel that had not been funded yet. - * The channel has been immediately closed. - */ - LDKClosureReason_CounterpartyCoopClosedUnfundedChannel, - /** - * Another channel in the same funding batch closed before the funding transaction - * was ready to be broadcast. - */ - LDKClosureReason_FundingBatchClosure, - /** - * One of our HTLCs timed out in a channel, causing us to force close the channel. - */ - LDKClosureReason_HTLCsTimedOut, - /** - * Our peer provided a feerate which violated our required minimum (fetched from our - * [`FeeEstimator`] either as [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`] or - * [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]). - * - * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator - * [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedAnchorChannelRemoteFee - * [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee - */ - LDKClosureReason_PeerFeerateTooLow, - /** - * Must be last for serialization purposes - */ - LDKClosureReason_Sentinel, -} LDKClosureReason_Tag; - -typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { - /** - * The error which the peer sent us. - * - * Be careful about printing the peer_msg, a well-crafted message could exploit - * a security vulnerability in the terminal emulator or the logging subsystem. - * To be safe, use `Display` on `UntrustedString` - * - * [`UntrustedString`]: crate::util::string::UntrustedString - */ - struct LDKUntrustedString peer_msg; -} LDKClosureReason_LDKCounterpartyForceClosed_Body; - -typedef struct LDKClosureReason_LDKHolderForceClosed_Body { - /** - * Whether or not the latest transaction was broadcasted when the channel was force - * closed. - * - * Channels closed using [`ChannelManager::force_close_broadcasting_latest_txn`] will have - * this field set to true, whereas channels closed using [`ChannelManager::force_close_without_broadcasting_txn`] - * or force-closed prior to being funded will have this field set to false. - * - * This will be `None` for objects generated or written by LDK 0.0.123 and - * earlier. - * - * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn. - * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn. - */ - struct LDKCOption_boolZ broadcasted_latest_txn; -} LDKClosureReason_LDKHolderForceClosed_Body; - -typedef struct LDKClosureReason_LDKProcessingError_Body { - /** - * A developer-readable error message which we generated. - */ - struct LDKStr err; -} LDKClosureReason_LDKProcessingError_Body; - -typedef struct LDKClosureReason_LDKPeerFeerateTooLow_Body { - /** - * The feerate on our channel set by our peer. - */ - uint32_t peer_feerate_sat_per_kw; - /** - * The required feerate we enforce, from our [`FeeEstimator`]. - * - * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator - */ - uint32_t required_feerate_sat_per_kw; -} LDKClosureReason_LDKPeerFeerateTooLow_Body; - -typedef struct MUST_USE_STRUCT LDKClosureReason { - LDKClosureReason_Tag tag; - union { - LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; - LDKClosureReason_LDKHolderForceClosed_Body holder_force_closed; - LDKClosureReason_LDKProcessingError_Body processing_error; - LDKClosureReason_LDKPeerFeerateTooLow_Body peer_feerate_too_low; - }; -} LDKClosureReason; - - - -/** - * A unique 32-byte identifier for a channel. - * Depending on how the ID is generated, several varieties are distinguished - * (but all are stored as 32 bytes): - * _v1_ and _temporary_. - * A _v1_ channel ID is generated based on funding tx outpoint (txid & index). - * A _temporary_ ID is generated randomly. - * (Later revocation-point-based _v2_ is a possibility.) - * The variety (context) is not stored, it is relevant only at creation. - */ -typedef struct MUST_USE_STRUCT LDKChannelId { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChannelId *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; -} LDKChannelId; - -/** - * An event to be processed by the ChannelManager. - */ -typedef enum LDKMonitorEvent_Tag { - /** - * A monitor event containing an HTLCUpdate. - */ - LDKMonitorEvent_HTLCEvent, - /** - * Indicates we broadcasted the channel's latest commitment transaction and thus closed the - * channel. Holds information about the channel and why it was closed. - */ - LDKMonitorEvent_HolderForceClosedWithInfo, - /** - * Indicates we broadcasted the channel's latest commitment transaction and thus closed the - * channel. - */ - LDKMonitorEvent_HolderForceClosed, - /** - * Indicates a [`ChannelMonitor`] update has completed. See - * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. - * - * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress - */ - LDKMonitorEvent_Completed, - /** - * Must be last for serialization purposes - */ - LDKMonitorEvent_Sentinel, -} LDKMonitorEvent_Tag; - -typedef struct LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body { - /** - * The reason the channel was closed. - */ - struct LDKClosureReason reason; - /** - * The funding outpoint of the channel. - */ - struct LDKOutPoint outpoint; - /** - * The channel ID of the channel. - */ - struct LDKChannelId channel_id; -} LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body; - -typedef struct LDKMonitorEvent_LDKCompleted_Body { - /** - * The funding outpoint of the [`ChannelMonitor`] that was updated - */ - struct LDKOutPoint funding_txo; - /** - * The channel ID of the channel associated with the [`ChannelMonitor`] - */ - struct LDKChannelId channel_id; - /** - * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or - * [`ChannelMonitor::get_latest_update_id`]. - * - * Note that this should only be set to a given update's ID if all previous updates for the - * same [`ChannelMonitor`] have been applied and persisted. - */ - uint64_t monitor_update_id; -} LDKMonitorEvent_LDKCompleted_Body; - -typedef struct MUST_USE_STRUCT LDKMonitorEvent { - LDKMonitorEvent_Tag tag; - union { - struct { - struct LDKHTLCUpdate htlc_event; - }; - LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body holder_force_closed_with_info; - struct { - struct LDKOutPoint holder_force_closed; - }; - LDKMonitorEvent_LDKCompleted_Body completed; - }; -} LDKMonitorEvent; - -/** - * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_MonitorEventZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKMonitorEvent *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_MonitorEventZ; - -/** - * A tuple of 4 elements. See the individual fields for the types contained. - */ -typedef struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { - /** - * The element at position 0 - */ - struct LDKOutPoint a; - /** - * The element at position 1 - */ - struct LDKChannelId b; - /** - * The element at position 2 - */ - struct LDKCVec_MonitorEventZ c; - /** - * The element at position 3 - */ - struct LDKPublicKey d; -} LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ; - -/** - * A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size. - * This corresponds to std::vector in C++ - */ -typedef struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { - /** - * The elements in the array. - * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - */ - struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *data; - /** - * The number of elements pointed to by `data`. - */ - uintptr_t datalen; -} LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ; - - - -/** - * Features used within an `init` message. - */ -typedef struct MUST_USE_STRUCT LDKInitFeatures { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInitFeatures *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKInitFeatures; - -/** - * The contents of CResult_InitFeaturesDecodeErrorZ - */ -typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInitFeatures *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_InitFeaturesDecodeErrorZPtr; - -/** - * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InitFeaturesDecodeErrorZ { - /** - * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InitFeaturesDecodeErrorZPtr contents; - /** - * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InitFeaturesDecodeErrorZ; - - - -/** - * Features used within a `channel_announcement` message. - */ -typedef struct MUST_USE_STRUCT LDKChannelFeatures { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeChannelFeatures *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKChannelFeatures; - -/** - * The contents of CResult_ChannelFeaturesDecodeErrorZ - */ -typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKChannelFeatures *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_ChannelFeaturesDecodeErrorZPtr; - -/** - * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { - /** - * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents; - /** - * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_ChannelFeaturesDecodeErrorZ; - - - -/** - * Features used within a `node_announcement` message. - */ -typedef struct MUST_USE_STRUCT LDKNodeFeatures { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNodeFeatures *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; -} LDKNodeFeatures; - -/** - * The contents of CResult_NodeFeaturesDecodeErrorZ - */ -typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKNodeFeatures *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_NodeFeaturesDecodeErrorZPtr; - -/** - * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { + * The counterparty requested a cooperative close of a channel that had not been funded yet. + * The channel has been immediately closed. + */ + LDKClosureReason_CounterpartyCoopClosedUnfundedChannel, /** - * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Another channel in the same funding batch closed before the funding transaction + * was ready to be broadcast. */ - union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; + LDKClosureReason_FundingBatchClosure, /** - * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. + * One of our HTLCs timed out in a channel, causing us to force close the channel. */ - bool result_ok; -} LDKCResult_NodeFeaturesDecodeErrorZ; - - - -/** - * Features used within an invoice. - */ -typedef struct MUST_USE_STRUCT LDKBolt11InvoiceFeatures { + LDKClosureReason_HTLCsTimedOut, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Our peer provided a feerate which violated our required minimum (fetched from our + * [`FeeEstimator`] either as [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`] or + * [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]). + * + * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator + * [`ConfirmationTarget::MinAllowedAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedAnchorChannelRemoteFee + * [`ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee`]: crate::chain::chaininterface::ConfirmationTarget::MinAllowedNonAnchorChannelRemoteFee */ - LDKnativeBolt11InvoiceFeatures *inner; + LDKClosureReason_PeerFeerateTooLow, /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * Must be last for serialization purposes */ - bool is_owned; -} LDKBolt11InvoiceFeatures; + LDKClosureReason_Sentinel, +} LDKClosureReason_Tag; -/** - * The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ - */ -typedef union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { +typedef struct LDKClosureReason_LDKCounterpartyForceClosed_Body { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The error which the peer sent us. + * + * Be careful about printing the peer_msg, a well-crafted message could exploit + * a security vulnerability in the terminal emulator or the logging subsystem. + * To be safe, use `Display` on `UntrustedString` + * + * [`UntrustedString`]: crate::util::string::UntrustedString */ - struct LDKBolt11InvoiceFeatures *result; + struct LDKUntrustedString peer_msg; +} LDKClosureReason_LDKCounterpartyForceClosed_Body; + +typedef struct LDKClosureReason_LDKHolderForceClosed_Body { /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Whether or not the latest transaction was broadcasted when the channel was force + * closed. + * + * Channels closed using [`ChannelManager::force_close_broadcasting_latest_txn`] will have + * this field set to true, whereas channels closed using [`ChannelManager::force_close_without_broadcasting_txn`] + * or force-closed prior to being funded will have this field set to false. + * + * This will be `None` for objects generated or written by LDK 0.0.123 and + * earlier. + * + * [`ChannelManager::force_close_broadcasting_latest_txn`]: crate::ln::channelmanager::ChannelManager::force_close_broadcasting_latest_txn. + * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn. */ - struct LDKDecodeError *err; -} LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr; + struct LDKCOption_boolZ broadcasted_latest_txn; +} LDKClosureReason_LDKHolderForceClosed_Body; -/** - * A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::features::Bolt11InvoiceFeatures 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_Bolt11InvoiceFeaturesDecodeErrorZ { +typedef struct LDKClosureReason_LDKProcessingError_Body { /** - * The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * A developer-readable error message which we generated. */ - union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr contents; + struct LDKStr err; +} LDKClosureReason_LDKProcessingError_Body; + +typedef struct LDKClosureReason_LDKPeerFeerateTooLow_Body { /** - * Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state. + * The feerate on our channel set by our peer. */ - bool result_ok; -} LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ; + uint32_t peer_feerate_sat_per_kw; + /** + * The required feerate we enforce, from our [`FeeEstimator`]. + * + * [`FeeEstimator`]: crate::chain::chaininterface::FeeEstimator + */ + uint32_t required_feerate_sat_per_kw; +} LDKClosureReason_LDKPeerFeerateTooLow_Body; + +typedef struct MUST_USE_STRUCT LDKClosureReason { + LDKClosureReason_Tag tag; + union { + LDKClosureReason_LDKCounterpartyForceClosed_Body counterparty_force_closed; + LDKClosureReason_LDKHolderForceClosed_Body holder_force_closed; + LDKClosureReason_LDKProcessingError_Body processing_error; + LDKClosureReason_LDKPeerFeerateTooLow_Body peer_feerate_too_low; + }; +} LDKClosureReason; /** - * Features used within an `invoice`. + * A unique 32-byte identifier for a channel. + * Depending on how the ID is generated, several varieties are distinguished + * (but all are stored as 32 bytes): + * _v1_ and _temporary_. + * A _v1_ channel ID is generated based on funding tx outpoint (txid & index). + * A _temporary_ ID is generated randomly. + * (Later revocation-point-based _v2_ is a possibility.) + * The variety (context) is not stored, it is relevant only at creation. */ -typedef struct MUST_USE_STRUCT LDKBolt12InvoiceFeatures { +typedef struct MUST_USE_STRUCT LDKChannelId { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeBolt12InvoiceFeatures *inner; + LDKnativeChannelId *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; -} LDKBolt12InvoiceFeatures; +} LDKChannelId; /** - * The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ + * An event to be processed by the ChannelManager. */ -typedef union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { +typedef enum LDKMonitorEvent_Tag { /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * A monitor event containing an HTLCUpdate. */ - struct LDKBolt12InvoiceFeatures *result; + LDKMonitorEvent_HTLCEvent, /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * Indicates we broadcasted the channel's latest commitment transaction and thus closed the + * channel. Holds information about the channel and why it was closed. */ - struct LDKDecodeError *err; -} LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr; - -/** - * A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::features::Bolt12InvoiceFeatures 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_Bolt12InvoiceFeaturesDecodeErrorZ { + LDKMonitorEvent_HolderForceClosedWithInfo, /** - * The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * Indicates we broadcasted the channel's latest commitment transaction and thus closed the + * channel. */ - union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr contents; + LDKMonitorEvent_HolderForceClosed, /** - * Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state. + * Indicates a [`ChannelMonitor`] update has completed. See + * [`ChannelMonitorUpdateStatus::InProgress`] for more information on how this is used. + * + * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ - bool result_ok; -} LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ; - - - -/** - * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo - */ -typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures { + LDKMonitorEvent_Completed, /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. + * Must be last for serialization purposes */ - LDKnativeBlindedHopFeatures *inner; + LDKMonitorEvent_Sentinel, +} LDKMonitorEvent_Tag; + +typedef struct LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body { /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. + * The reason the channel was closed. */ - bool is_owned; -} LDKBlindedHopFeatures; - -/** - * The contents of CResult_BlindedHopFeaturesDecodeErrorZ - */ -typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr { + struct LDKClosureReason reason; /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. + * The funding outpoint of the channel. */ - struct LDKBlindedHopFeatures *result; + struct LDKOutPoint outpoint; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The channel ID of the channel. */ - struct LDKDecodeError *err; -} LDKCResult_BlindedHopFeaturesDecodeErrorZPtr; + struct LDKChannelId channel_id; +} LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body; -/** - * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_BlindedHopFeaturesDecodeErrorZ { +typedef struct LDKMonitorEvent_LDKCompleted_Body { /** - * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. + * The funding outpoint of the [`ChannelMonitor`] that was updated */ - union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents; + struct LDKOutPoint funding_txo; /** - * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state. + * The channel ID of the channel associated with the [`ChannelMonitor`] */ - bool result_ok; -} LDKCResult_BlindedHopFeaturesDecodeErrorZ; - + struct LDKChannelId channel_id; + /** + * The Update ID from [`ChannelMonitorUpdate::update_id`] which was applied or + * [`ChannelMonitor::get_latest_update_id`]. + * + * Note that this should only be set to a given update's ID if all previous updates for the + * same [`ChannelMonitor`] have been applied and persisted. + */ + uint64_t monitor_update_id; +} LDKMonitorEvent_LDKCompleted_Body; +typedef struct MUST_USE_STRUCT LDKMonitorEvent { + LDKMonitorEvent_Tag tag; + union { + struct { + struct LDKHTLCUpdate htlc_event; + }; + LDKMonitorEvent_LDKHolderForceClosedWithInfo_Body holder_force_closed_with_info; + struct { + struct LDKOutPoint holder_force_closed; + }; + LDKMonitorEvent_LDKCompleted_Body completed; + }; +} LDKMonitorEvent; /** - * Features used within the channel_type field in an OpenChannel message. - * - * A channel is always of some known \"type\", describing the transaction formats used and the exact - * semantics of our interaction with our peer. - * - * Note that because a channel is a specific type which is proposed by the opener and accepted by - * the counterparty, only required features are allowed here. - * - * This is serialized differently from other feature types - it is not prefixed by a length, and - * thus must only appear inside a TLV where its length is known in advance. + * A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures { +typedef struct LDKCVec_MonitorEventZ { /** - * A pointer to the opaque Rust object. - * Nearly everywhere, 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(). */ - LDKnativeChannelTypeFeatures *inner; + struct LDKMonitorEvent *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; -} LDKChannelTypeFeatures; + uintptr_t datalen; +} LDKCVec_MonitorEventZ; /** - * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ + * A tuple of 4 elements. See the individual fields for the types contained. */ -typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr { +typedef struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { /** - * 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 LDKChannelTypeFeatures *result; + struct LDKOutPoint a; /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. + * The element at position 1 */ - struct LDKDecodeError *err; -} LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr; + struct LDKChannelId b; + /** + * The element at position 2 + */ + struct LDKCVec_MonitorEventZ c; + /** + * The element at position 3 + */ + struct LDKPublicKey d; +} LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ; /** - * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning_types::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. + * A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size. + * This corresponds to std::vector in C++ */ -typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { +typedef struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { /** - * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, 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_ChannelTypeFeaturesDecodeErrorZPtr contents; + struct LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ *data; /** - * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. + * The number of elements pointed to by `data`. */ - bool result_ok; -} LDKCResult_ChannelTypeFeaturesDecodeErrorZ; + uintptr_t datalen; +} LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ; @@ -6710,38 +6985,6 @@ typedef struct LDKCResult_NoneBolt12SemanticErrorZ { bool result_ok; } LDKCResult_NoneBolt12SemanticErrorZ; - - -/** - * An `Offer` is a potentially long-lived proposal for payment of a good or service. - * - * An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a - * customer may request an [`Bolt12Invoice`] for a specific quantity and using an amount sufficient - * to cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`]. - * - * Offers may be denominated in currency other than bitcoin but are ultimately paid using the - * latter. - * - * Through the use of [`BlindedMessagePath`]s, offers provide recipient privacy. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - */ -typedef struct MUST_USE_STRUCT LDKOffer { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeOffer *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKOffer; - /** * The contents of CResult_OfferBolt12SemanticErrorZ */ @@ -6784,110 +7027,53 @@ typedef struct LDKCResult_OfferBolt12SemanticErrorZ { * * [module-level documentation]: self */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequestWithDerivedPayerIdBuilder { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeInvoiceRequestWithDerivedPayerIdBuilder *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; -} LDKInvoiceRequestWithDerivedPayerIdBuilder; - -/** - * The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ - */ -typedef union LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKInvoiceRequestWithDerivedPayerIdBuilder *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - enum LDKBolt12SemanticError *err; -} LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr; - -/** - * A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - /** - * The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr contents; - /** - * Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ; - - - -/** - * Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow. - * - * See [module-level documentation] for usage. - * - * [module-level documentation]: self - */ -typedef struct MUST_USE_STRUCT LDKInvoiceRequestWithExplicitPayerIdBuilder { +typedef struct MUST_USE_STRUCT LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeInvoiceRequestWithExplicitPayerIdBuilder *inner; + LDKnativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder *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; -} LDKInvoiceRequestWithExplicitPayerIdBuilder; +} LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder; /** - * The contents of CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ + * The contents of CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ */ -typedef union LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { +typedef union LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKInvoiceRequestWithExplicitPayerIdBuilder *result; + struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ enum LDKBolt12SemanticError *err; -} LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr; +} LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr; /** - * A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * A CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { +typedef struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { /** - * The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either + * The contents of this CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr contents; + union LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr contents; /** - * Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state. + * Whether this CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. */ bool result_ok; -} LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ; +} LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ; /** * The contents of CResult_OfferDecodeErrorZ @@ -7462,10 +7648,11 @@ typedef struct MUST_USE_STRUCT LDKAcceptChannel { /** - * An accept_channel2 message to be sent by or received from the channel accepter. + * An [`accept_channel2`] message to be sent by or received from the channel accepter. * * Used in V2 channel establishment * + * [`accept_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel2-message */ typedef struct MUST_USE_STRUCT LDKAcceptChannelV2 { /** @@ -7509,10 +7696,11 @@ typedef struct MUST_USE_STRUCT LDKOpenChannel { /** - * An open_channel2 message to be sent by or received from the channel initiator. + * An [`open_channel2`] message to be sent by or received from the channel initiator. * * Used in V2 channel establishment * + * [`open_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel2-message */ typedef struct MUST_USE_STRUCT LDKOpenChannelV2 { /** @@ -7664,8 +7852,9 @@ typedef struct MUST_USE_STRUCT LDKSpliceLocked { /** - * A tx_add_input message for adding an input during interactive transaction construction + * A [`tx_add_input`] message for adding an input during interactive transaction construction * + * [`tx_add_input`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_add_input-message */ typedef struct MUST_USE_STRUCT LDKTxAddInput { /** @@ -7685,8 +7874,9 @@ typedef struct MUST_USE_STRUCT LDKTxAddInput { /** - * A tx_add_output message for adding an output during interactive transaction construction. + * A [`tx_add_output`] message for adding an output during interactive transaction construction. * + * [`tx_add_output`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_add_output-message */ typedef struct MUST_USE_STRUCT LDKTxAddOutput { /** @@ -7706,8 +7896,9 @@ typedef struct MUST_USE_STRUCT LDKTxAddOutput { /** - * A tx_remove_input message for removing an input during interactive transaction construction. + * A [`tx_remove_input`] message for removing an input during interactive transaction construction. * + * [`tx_remove_input`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_remove_input-and-tx_remove_output-messages */ typedef struct MUST_USE_STRUCT LDKTxRemoveInput { /** @@ -7727,8 +7918,9 @@ typedef struct MUST_USE_STRUCT LDKTxRemoveInput { /** - * A tx_remove_output message for removing an output during interactive transaction construction. + * A [`tx_remove_output`] message for removing an output during interactive transaction construction. * + * [`tx_remove_output`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_remove_input-and-tx_remove_output-messages */ typedef struct MUST_USE_STRUCT LDKTxRemoveOutput { /** @@ -7748,9 +7940,10 @@ typedef struct MUST_USE_STRUCT LDKTxRemoveOutput { /** - * A tx_complete message signalling the conclusion of a peer's transaction contributions during + * [`A tx_complete`] message signalling the conclusion of a peer's transaction contributions during * interactive transaction construction. * + * [`tx_complete`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_complete-message */ typedef struct MUST_USE_STRUCT LDKTxComplete { /** @@ -7770,9 +7963,10 @@ typedef struct MUST_USE_STRUCT LDKTxComplete { /** - * A tx_signatures message containing the sender's signatures for a transaction constructed with + * A [`tx_signatures`] message containing the sender's signatures for a transaction constructed with * interactive transaction construction. * + * [`tx_signatures`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_signatures-message */ typedef struct MUST_USE_STRUCT LDKTxSignatures { /** @@ -7792,9 +7986,10 @@ typedef struct MUST_USE_STRUCT LDKTxSignatures { /** - * A tx_init_rbf message which initiates a replacement of the transaction after it's been + * A [`tx_init_rbf`] message which initiates a replacement of the transaction after it's been * completed. * + * [`tx_init_rbf`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_init_rbf-message */ typedef struct MUST_USE_STRUCT LDKTxInitRbf { /** @@ -7814,9 +8009,10 @@ typedef struct MUST_USE_STRUCT LDKTxInitRbf { /** - * A tx_ack_rbf message which acknowledges replacement of the transaction after it's been + * A [`tx_ack_rbf`] message which acknowledges replacement of the transaction after it's been * completed. * + * [`tx_ack_rbf`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_ack_rbf-message */ typedef struct MUST_USE_STRUCT LDKTxAckRbf { /** @@ -7836,8 +8032,9 @@ typedef struct MUST_USE_STRUCT LDKTxAckRbf { /** - * A tx_abort message which signals the cancellation of an in-progress transaction negotiation. + * A [`tx_abort`] message which signals the cancellation of an in-progress transaction negotiation. * + * [`tx_abort`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_abort-message */ typedef struct MUST_USE_STRUCT LDKTxAbort { /** @@ -9832,26 +10029,6 @@ typedef struct LDKCResult_CVec_UtxoZNoneZ { -/** - * An unknown payment context. - */ -typedef struct MUST_USE_STRUCT LDKUnknownPaymentContext { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeUnknownPaymentContext *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; -} LDKUnknownPaymentContext; - - - /** * The context of a payment made for an invoice requested from a BOLT 12 [`Offer`]. * @@ -9901,10 +10078,6 @@ typedef struct MUST_USE_STRUCT LDKBolt12RefundContext { * [`PaymentPurpose`]: crate::events::PaymentPurpose */ typedef enum LDKPaymentContext_Tag { - /** - * The payment context was unknown. - */ - LDKPaymentContext_Unknown, /** * The payment was made for an invoice requested from a BOLT 12 [`Offer`]. * @@ -9926,9 +10099,6 @@ typedef enum LDKPaymentContext_Tag { typedef struct MUST_USE_STRUCT LDKPaymentContext { LDKPaymentContext_Tag tag; union { - struct { - struct LDKUnknownPaymentContext unknown; - }; struct { struct LDKBolt12OfferContext bolt12_offer; }; @@ -10004,7 +10174,112 @@ typedef struct LDKCOption_C2Tuple_u64u16ZZ { struct LDKC2Tuple_u64u16Z some; }; }; -} LDKCOption_C2Tuple_u64u16ZZ; +} LDKCOption_C2Tuple_u64u16ZZ; + +/** + * Indicates an error on the client's part (usually some variant of attempting to use too-low or + * too-high values) + */ +typedef enum LDKAPIError_Tag { + /** + * Indicates the API was wholly misused (see err for more). Cases where these can be returned + * are documented, but generally indicates some precondition of a function was violated. + */ + LDKAPIError_APIMisuseError, + /** + * Due to a high feerate, we were unable to complete the request. + * For example, this may be returned if the feerate implies we cannot open a channel at the + * requested value, but opening a larger channel would succeed. + */ + LDKAPIError_FeeRateTooHigh, + /** + * A malformed Route was provided (eg overflowed value, node id mismatch, overly-looped route, + * too-many-hops, etc). + */ + LDKAPIError_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 + * peer, channel at capacity, channel shutting down, etc. + */ + LDKAPIError_ChannelUnavailable, + /** + * An attempt to call [`chain::Watch::watch_channel`]/[`chain::Watch::update_channel`] + * returned a [`ChannelMonitorUpdateStatus::InProgress`] indicating the persistence of a + * monitor update is awaiting async resolution. Once it resolves the attempted action should + * complete automatically. + * + * [`chain::Watch::watch_channel`]: crate::chain::Watch::watch_channel + * [`chain::Watch::update_channel`]: crate::chain::Watch::update_channel + * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress + */ + LDKAPIError_MonitorUpdateInProgress, + /** + * [`SignerProvider::get_shutdown_scriptpubkey`] returned a shutdown scriptpubkey incompatible + * with the channel counterparty as negotiated in [`InitFeatures`]. + * + * Using a SegWit v0 script should resolve this issue. If you cannot, you won't be able to open + * a channel or cooperatively close one with this peer (and will have to force-close instead). + * + * [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey + * [`InitFeatures`]: crate::types::features::InitFeatures + */ + LDKAPIError_IncompatibleShutdownScript, + /** + * Must be last for serialization purposes + */ + LDKAPIError_Sentinel, +} LDKAPIError_Tag; + +typedef struct LDKAPIError_LDKAPIMisuseError_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKAPIMisuseError_Body; + +typedef struct LDKAPIError_LDKFeeRateTooHigh_Body { + /** + * A human-readable error message + */ + struct LDKStr err; + /** + * The feerate which was too high. + */ + uint32_t feerate; +} LDKAPIError_LDKFeeRateTooHigh_Body; + +typedef struct LDKAPIError_LDKInvalidRoute_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKInvalidRoute_Body; + +typedef struct LDKAPIError_LDKChannelUnavailable_Body { + /** + * A human-readable error message + */ + struct LDKStr err; +} LDKAPIError_LDKChannelUnavailable_Body; + +typedef struct LDKAPIError_LDKIncompatibleShutdownScript_Body { + /** + * The incompatible shutdown script. + */ + struct LDKShutdownScript script; +} LDKAPIError_LDKIncompatibleShutdownScript_Body; + +typedef struct MUST_USE_STRUCT LDKAPIError { + LDKAPIError_Tag tag; + union { + LDKAPIError_LDKAPIMisuseError_Body api_misuse_error; + LDKAPIError_LDKFeeRateTooHigh_Body fee_rate_too_high; + LDKAPIError_LDKInvalidRoute_Body invalid_route; + LDKAPIError_LDKChannelUnavailable_Body channel_unavailable; + LDKAPIError_LDKIncompatibleShutdownScript_Body incompatible_shutdown_script; + }; +} LDKAPIError; /** * The contents of CResult_ChannelIdAPIErrorZ @@ -10072,16 +10347,19 @@ typedef enum LDKRecentPaymentDetails_Tag { typedef struct LDKRecentPaymentDetails_LDKAwaitingInvoice_Body { /** - * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify - * a payment and ensure idempotency in LDK. + * A user-provided identifier in [`ChannelManager::pay_for_offer`] used to uniquely identify a + * payment and ensure idempotency in LDK. */ struct LDKThirtyTwoBytes payment_id; } LDKRecentPaymentDetails_LDKAwaitingInvoice_Body; typedef struct LDKRecentPaymentDetails_LDKPending_Body { /** - * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify - * a payment and ensure idempotency in LDK. + * A user-provided identifier in [`send_payment`] or [`pay_for_offer`] used to uniquely + * identify a payment and ensure idempotency in LDK. + * + * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`pay_for_offer`]: crate::ln::channelmanager::ChannelManager::pay_for_offer */ struct LDKThirtyTwoBytes payment_id; /** @@ -10098,8 +10376,11 @@ typedef struct LDKRecentPaymentDetails_LDKPending_Body { typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body { /** - * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify - * a payment and ensure idempotency in LDK. + * A user-provided identifier in [`send_payment`] or [`pay_for_offer`] used to uniquely + * identify a payment and ensure idempotency in LDK. + * + * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`pay_for_offer`]: crate::ln::channelmanager::ChannelManager::pay_for_offer */ struct LDKThirtyTwoBytes payment_id; /** @@ -10111,8 +10392,11 @@ typedef struct LDKRecentPaymentDetails_LDKFulfilled_Body { typedef struct LDKRecentPaymentDetails_LDKAbandoned_Body { /** - * A user-provided identifier in [`ChannelManager::send_payment`] used to uniquely identify - * a payment and ensure idempotency in LDK. + * A user-provided identifier in [`send_payment`] or [`pay_for_offer`] used to uniquely + * identify a payment and ensure idempotency in LDK. + * + * [`send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment + * [`pay_for_offer`]: crate::ln::channelmanager::ChannelManager::pay_for_offer */ struct LDKThirtyTwoBytes payment_id; /** @@ -10148,120 +10432,9 @@ typedef struct LDKCVec_RecentPaymentDetailsZ { } LDKCVec_RecentPaymentDetailsZ; /** - * If a payment fails to send with [`ChannelManager::send_payment_with_route`], it can be in one - * of several states. This enum is returned as the Err() type describing which state the payment - * is in, see the description of individual enum states for more. - * - * [`ChannelManager::send_payment_with_route`]: crate::ln::channelmanager::ChannelManager::send_payment_with_route - */ -typedef enum LDKPaymentSendFailure_Tag { - /** - * A parameter which was passed to send_payment was invalid, preventing us from attempting to - * 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 and no - * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. - * - * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed - * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - */ - 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. - * - * You can freely resend the payment in full (with the parameter error fixed). - * - * Because the payment failed outright, no payment tracking is done and no - * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. - * - * The results here are ordered the same as the paths in the route object which was passed to - * send_payment. - * - * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed - * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - */ - LDKPaymentSendFailure_PathParameterError, - /** - * All paths which were attempted failed to send, with no channel state change taking place. - * 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 and no - * [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. - * - * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed - * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - */ - 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 [`Event::PaymentFailed`]). - * - * [`PaymentId`]: crate::ln::channelmanager::PaymentId - * [`Event::PaymentSent`]: crate::events::Event::PaymentSent - * [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - */ - LDKPaymentSendFailure_DuplicatePayment, - /** - * Some paths that were attempted failed to send, though some paths may have succeeded. At least - * some paths have irrevocably committed to the HTLC. - * - * The results here are ordered the same as the paths in the route object that was passed to - * send_payment. - * - * Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a - * [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id. - * - * [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed - */ - LDKPaymentSendFailure_PartialFailure, - /** - * Must be last for serialization purposes - */ - LDKPaymentSendFailure_Sentinel, -} LDKPaymentSendFailure_Tag; - -typedef struct LDKPaymentSendFailure_LDKPartialFailure_Body { - /** - * The errors themselves, in the same order as the paths from the route. - */ - struct LDKCVec_CResult_NoneAPIErrorZZ results; - /** - * If some paths failed without irrevocably committing to the new HTLC(s), this will - * contain a [`RouteParameters`] object for the failing paths. - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKRouteParameters failed_paths_retry; - /** - * The payment id for the payment, which is now at least partially pending. - */ - struct LDKThirtyTwoBytes payment_id; -} LDKPaymentSendFailure_LDKPartialFailure_Body; - -typedef struct MUST_USE_STRUCT LDKPaymentSendFailure { - LDKPaymentSendFailure_Tag tag; - union { - struct { - struct LDKAPIError parameter_error; - }; - struct { - struct LDKCVec_CResult_NoneAPIErrorZZ path_parameter_error; - }; - struct { - struct LDKCVec_APIErrorZ all_failed_resend_safe; - }; - LDKPaymentSendFailure_LDKPartialFailure_Body partial_failure; - }; -} LDKPaymentSendFailure; - -/** - * The contents of CResult_NonePaymentSendFailureZ + * The contents of CResult_NoneAPIErrorZ */ -typedef union LDKCResult_NonePaymentSendFailureZPtr { +typedef union LDKCResult_NoneAPIErrorZPtr { /** * Note that this value is always NULL, as there are no contents in the OK variant */ @@ -10270,25 +10443,25 @@ typedef union LDKCResult_NonePaymentSendFailureZPtr { * 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; + struct LDKAPIError *err; +} LDKCResult_NoneAPIErrorZPtr; /** - * A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, - * containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. + * A CResult_NoneAPIErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::util::errors::APIError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_NonePaymentSendFailureZ { +typedef struct LDKCResult_NoneAPIErrorZ { /** - * The contents of this CResult_NonePaymentSendFailureZ, accessible via either + * The contents of this CResult_NoneAPIErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_NonePaymentSendFailureZPtr contents; + union LDKCResult_NoneAPIErrorZPtr contents; /** - * Whether this CResult_NonePaymentSendFailureZ represents a success state. + * Whether this CResult_NoneAPIErrorZ represents a success state. */ bool result_ok; -} LDKCResult_NonePaymentSendFailureZ; +} LDKCResult_NoneAPIErrorZ; /** * The contents of CResult_NoneRetryableSendFailureZ @@ -10323,37 +10496,98 @@ typedef struct LDKCResult_NoneRetryableSendFailureZ { } LDKCResult_NoneRetryableSendFailureZ; /** - * The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ + * An enum which can either contain a crate::lightning::blinded_path::message::OffersContext or not */ -typedef union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr { +typedef enum LDKCOption_OffersContextZ_Tag { /** - * 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_OffersContextZ contains a crate::lightning::blinded_path::message::OffersContext */ - struct LDKThirtyTwoBytes *result; + LDKCOption_OffersContextZ_Some, + /** + * When we're in this state, this COption_OffersContextZ contains nothing + */ + LDKCOption_OffersContextZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_OffersContextZ_Sentinel, +} LDKCOption_OffersContextZ_Tag; + +typedef struct LDKCOption_OffersContextZ { + LDKCOption_OffersContextZ_Tag tag; + union { + struct { + struct LDKOffersContext some; + }; + }; +} LDKCOption_OffersContextZ; + +/** + * An error when attempting to pay a [`Bolt12Invoice`]. + */ +typedef enum LDKBolt12PaymentError_Tag { + /** + * The invoice was not requested. + */ + LDKBolt12PaymentError_UnexpectedInvoice, + /** + * Payment for an invoice with the corresponding [`PaymentId`] was already initiated. + */ + LDKBolt12PaymentError_DuplicateInvoice, + /** + * The invoice was valid for the corresponding [`PaymentId`], but required unknown features. + */ + LDKBolt12PaymentError_UnknownRequiredFeatures, + /** + * The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. + */ + LDKBolt12PaymentError_SendingFailed, + /** + * Must be last for serialization purposes + */ + LDKBolt12PaymentError_Sentinel, +} LDKBolt12PaymentError_Tag; + +typedef struct MUST_USE_STRUCT LDKBolt12PaymentError { + LDKBolt12PaymentError_Tag tag; + union { + struct { + enum LDKRetryableSendFailure sending_failed; + }; + }; +} LDKBolt12PaymentError; + +/** + * The contents of CResult_NoneBolt12PaymentErrorZ + */ +typedef union LDKCResult_NoneBolt12PaymentErrorZPtr { + /** + * Note that this value is always NULL, as there are no contents in the OK variant + */ + void *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPaymentSendFailure *err; -} LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr; + struct LDKBolt12PaymentError *err; +} LDKCResult_NoneBolt12PaymentErrorZPtr; /** - * A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. + * A CResult_NoneBolt12PaymentErrorZ represents the result of a fallible operation, + * containing a () on success and a crate::lightning::ln::outbound_payment::Bolt12PaymentError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ { +typedef struct LDKCResult_NoneBolt12PaymentErrorZ { /** - * The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either + * The contents of this CResult_NoneBolt12PaymentErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_ThirtyTwoBytesPaymentSendFailureZPtr contents; + union LDKCResult_NoneBolt12PaymentErrorZPtr contents; /** - * Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state. + * Whether this CResult_NoneBolt12PaymentErrorZ represents a success state. */ bool result_ok; -} LDKCResult_ThirtyTwoBytesPaymentSendFailureZ; +} LDKCResult_NoneBolt12PaymentErrorZ; /** * The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ @@ -10403,9 +10637,57 @@ typedef struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { } LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ; /** - * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ + * Indicates that we failed to send a payment probe. Further errors may be surfaced later via + * [`Event::ProbeFailed`]. + * + * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed + */ +typedef enum LDKProbeSendFailure_Tag { + /** + * We were unable to find a route to the destination. + */ + LDKProbeSendFailure_RouteNotFound, + /** + * A parameter which was passed to [`ChannelManager::send_probe`] was invalid, preventing us from + * attempting to send the probe at all. + * + * You can freely resend the probe (with the parameter error fixed). + * + * Because the probe failed outright, no payment tracking is done and no + * [`Event::ProbeFailed`] events will be generated. + * + * [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed + */ + LDKProbeSendFailure_ParameterError, + /** + * Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not + * yet completed (i.e. generated an [`Event::ProbeSuccessful`] or [`Event::ProbeFailed`]). + * + * [`PaymentId`]: crate::ln::channelmanager::PaymentId + * [`Event::ProbeSuccessful`]: crate::events::Event::ProbeSuccessful + * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed + */ + LDKProbeSendFailure_DuplicateProbe, + /** + * Must be last for serialization purposes + */ + LDKProbeSendFailure_Sentinel, +} LDKProbeSendFailure_Tag; + +typedef struct MUST_USE_STRUCT LDKProbeSendFailure { + LDKProbeSendFailure_Tag tag; + union { + struct { + struct LDKAPIError parameter_error; + }; + }; +} LDKProbeSendFailure; + +/** + * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ */ -typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { +typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. @@ -10415,25 +10697,25 @@ typedef union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailure * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - struct LDKPaymentSendFailure *err; -} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr; + struct LDKProbeSendFailure *err; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr; /** - * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation, - * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. + * A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents the result of a fallible operation, + * containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { +typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { /** - * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either + * The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr contents; + union LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr contents; /** - * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state. + * Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents a success state. */ bool result_ok; -} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ; +} LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ; /** * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. @@ -10451,36 +10733,6 @@ typedef struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { uintptr_t datalen; } LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ; -/** - * Indicates that we failed to send a payment probe. Further errors may be surfaced later via - * [`Event::ProbeFailed`]. - * - * [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed - */ -typedef enum LDKProbeSendFailure_Tag { - /** - * We were unable to find a route to the destination. - */ - LDKProbeSendFailure_RouteNotFound, - /** - * We failed to send the payment probes. - */ - LDKProbeSendFailure_SendingFailed, - /** - * Must be last for serialization purposes - */ - LDKProbeSendFailure_Sentinel, -} LDKProbeSendFailure_Tag; - -typedef struct MUST_USE_STRUCT LDKProbeSendFailure { - LDKProbeSendFailure_Tag tag; - union { - struct { - struct LDKPaymentSendFailure sending_failed; - }; - }; -} LDKProbeSendFailure; - /** * The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ */ @@ -10560,6 +10812,135 @@ typedef struct LDKCVec_ChannelIdZ { uintptr_t datalen; } LDKCVec_ChannelIdZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_PublicKeyChannelIdZ { + /** + * The element at position 0 + */ + struct LDKPublicKey a; + /** + * The element at position 1 + */ + struct LDKChannelId b; +} LDKC2Tuple_PublicKeyChannelIdZ; + +/** + * An enum which can either contain a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ or not + */ +typedef enum LDKCOption_C2Tuple_PublicKeyChannelIdZZ_Tag { + /** + * When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ + */ + LDKCOption_C2Tuple_PublicKeyChannelIdZZ_Some, + /** + * When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains nothing + */ + LDKCOption_C2Tuple_PublicKeyChannelIdZZ_None, + /** + * Must be last for serialization purposes + */ + LDKCOption_C2Tuple_PublicKeyChannelIdZZ_Sentinel, +} LDKCOption_C2Tuple_PublicKeyChannelIdZZ_Tag; + +typedef struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ { + LDKCOption_C2Tuple_PublicKeyChannelIdZZ_Tag tag; + union { + struct { + struct LDKC2Tuple_PublicKeyChannelIdZ some; + }; + }; +} LDKCOption_C2Tuple_PublicKeyChannelIdZZ; + + + +/** + * Represents a syntactically and semantically correct lightning BOLT11 invoice. + * + * There are three ways to construct a `Bolt11Invoice`: + * 1. using [`InvoiceBuilder`] + * 2. using [`Bolt11Invoice::from_signed`] + * 3. using `str::parse::(&str)` (see [`Bolt11Invoice::from_str`]) + * + * [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr + */ +typedef struct MUST_USE_STRUCT LDKBolt11Invoice { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt11Invoice *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; +} LDKBolt11Invoice; + +/** + * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`] + * may occur. + */ +typedef enum LDKSignOrCreationError_Tag { + /** + * An error occurred during signing + */ + LDKSignOrCreationError_SignError, + /** + * An error occurred while building the transaction + */ + LDKSignOrCreationError_CreationError, + /** + * Must be last for serialization purposes + */ + LDKSignOrCreationError_Sentinel, +} LDKSignOrCreationError_Tag; + +typedef struct MUST_USE_STRUCT LDKSignOrCreationError { + LDKSignOrCreationError_Tag tag; + union { + struct { + enum LDKCreationError creation_error; + }; + }; +} LDKSignOrCreationError; + +/** + * The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ + */ +typedef union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBolt11Invoice *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKSignOrCreationError *err; +} LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr; + +/** + * A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, + * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ { + /** + * The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr contents; + /** + * Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_Bolt11InvoiceSignOrCreationErrorZ; + /** @@ -10644,6 +11025,22 @@ typedef struct LDKCOption_StrZ { }; } LDKCOption_StrZ; +/** + * A dynamically-allocated array of crate::lightning::onion_message::messenger::Destinations of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_DestinationZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKDestination *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_DestinationZ; + /** * The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ */ @@ -10711,160 +11108,6 @@ typedef struct LDKCResult_ThirtyTwoBytesAPIErrorZ { -/** - * A 128-bit number used only once. - * - * Needed when constructing [`Offer::metadata`] and deriving [`Offer::signing_pubkey`] from - * [`ExpandedKey`]. Must not be reused for any other derivation without first hashing. - * - * [`Offer::metadata`]: crate::offers::offer::Offer::metadata - * [`Offer::signing_pubkey`]: crate::offers::offer::Offer::signing_pubkey - * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey - */ -typedef struct MUST_USE_STRUCT LDKNonce { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeNonce *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; -} LDKNonce; - -/** - * Contains data specific to an [`OffersMessage`]. - * - * [`OffersMessage`]: crate::onion_message::offers::OffersMessage - */ -typedef enum LDKOffersContext_Tag { - /** - * Context used by a [`BlindedMessagePath`] within an [`Offer`]. - * - * This variant is intended to be received when handling an [`InvoiceRequest`]. - * - * [`Offer`]: crate::offers::offer::Offer - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - */ - LDKOffersContext_InvoiceRequest, - /** - * Context used by a [`BlindedMessagePath`] within a [`Refund`] or as a reply path for an - * [`InvoiceRequest`]. - * - * This variant is intended to be received when handling a [`Bolt12Invoice`] or an - * [`InvoiceError`]. - * - * [`Refund`]: crate::offers::refund::Refund - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - */ - LDKOffersContext_OutboundPayment, - /** - * Context used by a [`BlindedMessagePath`] as a reply path for a [`Bolt12Invoice`]. - * - * This variant is intended to be received when handling an [`InvoiceError`]. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - */ - LDKOffersContext_InboundPayment, - /** - * Must be last for serialization purposes - */ - LDKOffersContext_Sentinel, -} LDKOffersContext_Tag; - -typedef struct LDKOffersContext_LDKInvoiceRequest_Body { - /** - * A nonce used for authenticating that an [`InvoiceRequest`] is for a valid [`Offer`] and - * for deriving the offer's signing keys. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - * [`Offer`]: crate::offers::offer::Offer - */ - struct LDKNonce nonce; -} LDKOffersContext_LDKInvoiceRequest_Body; - -typedef struct LDKOffersContext_LDKOutboundPayment_Body { - /** - * Payment ID used when creating a [`Refund`] or [`InvoiceRequest`]. - * - * [`Refund`]: crate::offers::refund::Refund - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - */ - struct LDKThirtyTwoBytes payment_id; - /** - * A nonce used for authenticating that a [`Bolt12Invoice`] is for a valid [`Refund`] or - * [`InvoiceRequest`] and for deriving their signing keys. - * - * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice - * [`Refund`]: crate::offers::refund::Refund - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - */ - struct LDKNonce nonce; - /** - * Authentication code for the [`PaymentId`], which should be checked when the context is - * used with an [`InvoiceError`]. - * - * [`InvoiceError`]: crate::offers::invoice_error::InvoiceError - * - * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - */ - struct LDKThirtyTwoBytes hmac; -} LDKOffersContext_LDKOutboundPayment_Body; - -typedef struct LDKOffersContext_LDKInboundPayment_Body { - /** - * The same payment hash as [`Bolt12Invoice::payment_hash`]. - * - * [`Bolt12Invoice::payment_hash`]: crate::offers::invoice::Bolt12Invoice::payment_hash - */ - struct LDKThirtyTwoBytes payment_hash; -} LDKOffersContext_LDKInboundPayment_Body; - -typedef struct MUST_USE_STRUCT LDKOffersContext { - LDKOffersContext_Tag tag; - union { - LDKOffersContext_LDKInvoiceRequest_Body invoice_request; - LDKOffersContext_LDKOutboundPayment_Body outbound_payment; - LDKOffersContext_LDKInboundPayment_Body inbound_payment; - }; -} LDKOffersContext; - -/** - * An enum which can either contain a crate::lightning::blinded_path::message::OffersContext or not - */ -typedef enum LDKCOption_OffersContextZ_Tag { - /** - * When we're in this state, this COption_OffersContextZ contains a crate::lightning::blinded_path::message::OffersContext - */ - LDKCOption_OffersContextZ_Some, - /** - * When we're in this state, this COption_OffersContextZ contains nothing - */ - LDKCOption_OffersContextZ_None, - /** - * Must be last for serialization purposes - */ - LDKCOption_OffersContextZ_Sentinel, -} LDKCOption_OffersContextZ_Tag; - -typedef struct LDKCOption_OffersContextZ { - LDKCOption_OffersContextZ_Tag tag; - union { - struct { - struct LDKOffersContext some; - }; - }; -} LDKCOption_OffersContextZ; - - - /** * An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`]. * @@ -10955,26 +11198,6 @@ typedef struct MUST_USE_STRUCT LDKOffersMessage { }; } LDKOffersMessage; - - -/** - * Instructions for how and where to send the response to an onion message. - */ -typedef struct MUST_USE_STRUCT LDKResponseInstruction { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeResponseInstruction *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; -} LDKResponseInstruction; - /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -11016,150 +11239,6 @@ typedef struct LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ { }; } LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ; -/** - * The destination of an onion message. - */ -typedef enum LDKDestination_Tag { - /** - * We're sending this onion message to a node. - */ - LDKDestination_Node, - /** - * We're sending this onion message to a blinded path. - */ - LDKDestination_BlindedPath, - /** - * Must be last for serialization purposes - */ - LDKDestination_Sentinel, -} LDKDestination_Tag; - -typedef struct MUST_USE_STRUCT LDKDestination { - LDKDestination_Tag tag; - union { - struct { - struct LDKPublicKey node; - }; - struct { - struct LDKBlindedMessagePath blinded_path; - }; - }; -} LDKDestination; - -/** - * Additional data included by the recipient in a [`BlindedMessagePath`]. - * - * This data is encrypted by the recipient and will be given to the corresponding message handler - * when handling a message sent over the [`BlindedMessagePath`]. The recipient can use this data to - * authenticate the message or for further processing if needed. - */ -typedef enum LDKMessageContext_Tag { - /** - * Context specific to an [`OffersMessage`]. - * - * [`OffersMessage`]: crate::onion_message::offers::OffersMessage - */ - LDKMessageContext_Offers, - /** - * Context specific to a [`CustomOnionMessageHandler::CustomMessage`]. - * - * [`CustomOnionMessageHandler::CustomMessage`]: crate::onion_message::messenger::CustomOnionMessageHandler::CustomMessage - */ - LDKMessageContext_Custom, - /** - * Must be last for serialization purposes - */ - LDKMessageContext_Sentinel, -} LDKMessageContext_Tag; - -typedef struct MUST_USE_STRUCT LDKMessageContext { - LDKMessageContext_Tag tag; - union { - struct { - struct LDKOffersContext offers; - }; - struct { - struct LDKCVec_u8Z custom; - }; - }; -} LDKMessageContext; - -/** - * Instructions for how and where to send a message. - */ -typedef enum LDKMessageSendInstructions_Tag { - /** - * Indicates that a message should be sent including the provided reply path for the recipient - * to respond. - */ - LDKMessageSendInstructions_WithSpecifiedReplyPath, - /** - * Indicates that a message should be sent including a reply path for the recipient to - * respond. - */ - LDKMessageSendInstructions_WithReplyPath, - /** - * Indicates that a message should be sent without including a reply path, preventing the - * recipient from responding. - */ - LDKMessageSendInstructions_WithoutReplyPath, - /** - * Indicates that a message is being sent as a reply to a received message. - */ - LDKMessageSendInstructions_ForReply, - /** - * Must be last for serialization purposes - */ - LDKMessageSendInstructions_Sentinel, -} LDKMessageSendInstructions_Tag; - -typedef struct LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body { - /** - * The destination where we need to send our message. - */ - struct LDKDestination destination; - /** - * The reply path which should be included in the message. - */ - struct LDKBlindedMessagePath reply_path; -} LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body; - -typedef struct LDKMessageSendInstructions_LDKWithReplyPath_Body { - /** - * The destination where we need to send our message. - */ - struct LDKDestination destination; - /** - * The context to include in the reply path we'll give the recipient so they can respond - * to us. - */ - struct LDKMessageContext context; -} LDKMessageSendInstructions_LDKWithReplyPath_Body; - -typedef struct LDKMessageSendInstructions_LDKWithoutReplyPath_Body { - /** - * The destination where we need to send our message. - */ - struct LDKDestination destination; -} LDKMessageSendInstructions_LDKWithoutReplyPath_Body; - -typedef struct LDKMessageSendInstructions_LDKForReply_Body { - /** - * The instructions provided by the [`Responder`]. - */ - struct LDKResponseInstruction instructions; -} LDKMessageSendInstructions_LDKForReply_Body; - -typedef struct MUST_USE_STRUCT LDKMessageSendInstructions { - LDKMessageSendInstructions_Tag tag; - union { - LDKMessageSendInstructions_LDKWithSpecifiedReplyPath_Body with_specified_reply_path; - LDKMessageSendInstructions_LDKWithReplyPath_Body with_reply_path; - LDKMessageSendInstructions_LDKWithoutReplyPath_Body without_reply_path; - LDKMessageSendInstructions_LDKForReply_Body for_reply; - }; -} LDKMessageSendInstructions; - /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -11624,6 +11703,12 @@ typedef struct LDKPendingHTLCRouting_LDKReceiveKeysend_Body { * Set if this HTLC is the final hop in a multi-hop blinded path. */ bool requires_blinded_error; + /** + * Set if we are receiving a keysend to a blinded path, meaning we created the + * [`PaymentSecret`] and should verify it using our + * [`NodeSigner::get_inbound_payment_key`]. + */ + bool has_recipient_created_payment_secret; } LDKPendingHTLCRouting_LDKReceiveKeysend_Body; typedef struct MUST_USE_STRUCT LDKPendingHTLCRouting { @@ -11951,51 +12036,48 @@ typedef struct LDKEntropySource { /** - * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network, - * but without the signature information. - * Decoding and encoding should not lead to information loss but may lead to different hashes. + * A set of keys that were HKDF-expanded. Returned by [`NodeSigner::get_inbound_payment_key`]. * - * For methods without docs see the corresponding methods in [`Bolt11Invoice`]. + * [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key */ -typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice { +typedef struct MUST_USE_STRUCT LDKExpandedKey { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeRawBolt11Invoice *inner; + LDKnativeExpandedKey *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKRawBolt11Invoice; +} LDKExpandedKey; /** - * A semantically valid [`InvoiceRequest`] that hasn't been signed. - * - * # Serialization + * Represents an syntactically correct [`Bolt11Invoice`] for a payment on the lightning network, + * but without the signature information. + * Decoding and encoding should not lead to information loss but may lead to different hashes. * - * This is serialized as a TLV stream, which includes TLV records from the originating message. As - * such, it may include unknown, odd TLV records. + * For methods without docs see the corresponding methods in [`Bolt11Invoice`]. */ -typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { +typedef struct MUST_USE_STRUCT LDKRawBolt11Invoice { /** * A pointer to the opaque Rust object. * Nearly everywhere, inner must be non-null, however in places where * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKnativeUnsignedInvoiceRequest *inner; + LDKnativeRawBolt11Invoice *inner; /** * Indicates that this is the only struct which contains the same pointer. * Rust functions which take ownership of an object provided via an argument require * this to be true and invalidate the object pointed to by inner. */ bool is_owned; -} LDKUnsignedInvoiceRequest; +} LDKRawBolt11Invoice; @@ -12088,7 +12170,7 @@ typedef struct LDKNodeSigner { */ void *this_arg; /** - * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * Get the [`ExpandedKey`] for use in encrypting and decrypting inbound payment data. * * If the implementor of this trait supports [phantom node payments], then every node that is * intended to be included in the phantom invoice route hints must return the same value from @@ -12098,7 +12180,7 @@ typedef struct LDKNodeSigner { * * [phantom node payments]: PhantomKeysManager */ - struct LDKThirtyTwoBytes (*get_inbound_payment_key_material)(const void *this_arg); + struct LDKExpandedKey (*get_inbound_payment_key)(const void *this_arg); /** * Get node id based on the provided [`Recipient`]. * @@ -12133,26 +12215,9 @@ typedef struct LDKNodeSigner { * Errors if the [`Recipient`] variant is not supported by the implementation. */ struct LDKCResult_RecoverableSignatureNoneZ (*sign_invoice)(const void *this_arg, const struct LDKRawBolt11Invoice *NONNULL_PTR invoice, enum LDKRecipient recipient); - /** - * Signs the [`TaggedHash`] of a BOLT 12 invoice request. - * - * May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where - * `invoice_request` is the callee. - * - * Implementors may check that the `invoice_request` is expected rather than blindly signing - * the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with - * the node's signing key or an ephemeral key to preserve privacy, whichever is associated with - * [`UnsignedInvoiceRequest::payer_id`]. - * - * [`TaggedHash`]: crate::offers::merkle::TaggedHash - */ - struct LDKCResult_SchnorrSignatureNoneZ (*sign_bolt12_invoice_request)(const void *this_arg, const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request); /** * Signs the [`TaggedHash`] of a BOLT 12 invoice. * - * May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the - * callee. - * * Implementors may check that the `invoice` is expected rather than blindly signing the tagged * hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing * key or an ephemeral key to preserve privacy, whichever is associated with @@ -12293,6 +12358,8 @@ typedef struct LDKFeeEstimator { /** * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and * may not be valid if received by another lightning implementation. + * + * Can only be constructed by calling [`UnauthenticatedReceiveTlvs::authenticate`]. */ typedef struct MUST_USE_STRUCT LDKReceiveTlvs { /** @@ -12309,47 +12376,6 @@ typedef struct MUST_USE_STRUCT LDKReceiveTlvs { bool is_owned; } LDKReceiveTlvs; -/** - * A trait defining behavior for routing an [`OnionMessage`]. - */ -typedef struct LDKMessageRouter { - /** - * An opaque pointer which is passed to your function implementations as an argument. - * This has no meaning in the LDK, and can be NULL or any other value. - */ - void *this_arg; - /** - * Returns a route for sending an [`OnionMessage`] to the given [`Destination`]. - */ - struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination); - /** - * Creates [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are assumed to - * be direct peers with the `recipient`. - */ - struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_PublicKeyZ peers); - /** - * Creates compact [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are - * assumed to be direct peers with the `recipient`. - * - * Compact blinded paths use short channel ids instead of pubkeys for a smaller serialization, - * which is beneficial when a QR code is used to transport the data. The SCID is passed using - * a [`MessageForwardNode`] but may be `None` for graceful degradation. - * - * Implementations using additional intermediate nodes are responsible for using a - * [`MessageForwardNode`] with `Some` short channel id, if possible. Similarly, implementations - * should call [`BlindedMessagePath::use_compact_introduction_node`]. - * - * The provided implementation simply delegates to [`MessageRouter::create_blinded_paths`], - * ignoring the short channel ids. - */ - struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_compact_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers); - /** - * 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); -} LDKMessageRouter; - /** * A trait defining behavior for routing a payment. */ @@ -12387,15 +12413,172 @@ typedef struct LDKRouter { */ struct LDKCResult_CVec_BlindedPaymentPathZNoneZ (*create_blinded_payment_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKCVec_ChannelDetailsZ first_hops, struct LDKReceiveTlvs tlvs, uint64_t amount_msats); /** - * Implementation of MessageRouter for this object. + * Frees any resources associated with this object given its this_arg pointer. + * Does not need to free the outer struct containing function pointers and may be NULL is no resources need to be freed. + */ + void (*free)(void *this_arg); +} LDKRouter; + + + +/** + * A path for sending an [`OnionMessage`]. + */ +typedef struct MUST_USE_STRUCT LDKOnionMessagePath { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOnionMessagePath *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; +} LDKOnionMessagePath; + +/** + * The contents of CResult_OnionMessagePathNoneZ + */ +typedef union LDKCResult_OnionMessagePathNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKOnionMessagePath *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_OnionMessagePathNoneZPtr; + +/** + * A CResult_OnionMessagePathNoneZ represents the result of a fallible operation, + * containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_OnionMessagePathNoneZ { + /** + * The contents of this CResult_OnionMessagePathNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_OnionMessagePathNoneZPtr contents; + /** + * Whether this CResult_OnionMessagePathNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_OnionMessagePathNoneZ; + +/** + * The contents of CResult_CVec_BlindedMessagePathZNoneZ + */ +typedef union LDKCResult_CVec_BlindedMessagePathZNoneZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_BlindedMessagePathZ *result; + /** + * Note that this value is always NULL, as there are no contents in the Err variant + */ + void *err; +} LDKCResult_CVec_BlindedMessagePathZNoneZPtr; + +/** + * A CResult_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_BlindedMessagePathZNoneZ { + /** + * The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_BlindedMessagePathZNoneZPtr contents; + /** + * Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_BlindedMessagePathZNoneZ; + + + +/** + * An intermediate node, and possibly a short channel id leading to the next node. + */ +typedef struct MUST_USE_STRUCT LDKMessageForwardNode { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMessageForwardNode *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. */ - struct LDKMessageRouter MessageRouter; + bool is_owned; +} LDKMessageForwardNode; + +/** + * A dynamically-allocated array of crate::lightning::blinded_path::message::MessageForwardNodes of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_MessageForwardNodeZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKMessageForwardNode *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_MessageForwardNodeZ; + +/** + * A trait defining behavior for routing an [`OnionMessage`]. + */ +typedef struct LDKMessageRouter { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns a route for sending an [`OnionMessage`] to the given [`Destination`]. + */ + struct LDKCResult_OnionMessagePathNoneZ (*find_path)(const void *this_arg, struct LDKPublicKey sender, struct LDKCVec_PublicKeyZ peers, struct LDKDestination destination); + /** + * Creates [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are assumed to + * be direct peers with the `recipient`. + */ + struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_PublicKeyZ peers); + /** + * Creates compact [`BlindedMessagePath`]s to the `recipient` node. The nodes in `peers` are + * assumed to be direct peers with the `recipient`. + * + * Compact blinded paths use short channel ids instead of pubkeys for a smaller serialization, + * which is beneficial when a QR code is used to transport the data. The SCID is passed using + * a [`MessageForwardNode`] but may be `None` for graceful degradation. + * + * Implementations using additional intermediate nodes are responsible for using a + * [`MessageForwardNode`] with `Some` short channel id, if possible. Similarly, implementations + * should call [`BlindedMessagePath::use_compact_introduction_node`]. + * + * The provided implementation simply delegates to [`MessageRouter::create_blinded_paths`], + * ignoring the short channel ids. + */ + struct LDKCResult_CVec_BlindedMessagePathZNoneZ (*create_compact_blinded_paths)(const void *this_arg, struct LDKPublicKey recipient, struct LDKMessageContext context, struct LDKCVec_MessageForwardNodeZ peers); /** * 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; +} LDKMessageRouter; @@ -12414,6 +12597,7 @@ typedef struct LDKRouter { * - [`FeeEstimator`] to determine transaction fee rates needed to have a transaction mined in a * timely manner * - [`Router`] for finding payment paths when initiating and retrying payments + * - [`MessageRouter`] for finding message paths when initiating and retrying onion messages * - [`Logger`] for logging operational information of varying degrees * * Additionally, it implements the following traits: @@ -12473,7 +12657,8 @@ typedef struct LDKRouter { * # fee_estimator: &dyn lightning::chain::chaininterface::FeeEstimator, * # chain_monitor: &dyn lightning::chain::Watch, * # tx_broadcaster: &dyn lightning::chain::chaininterface::BroadcasterInterface, - * # router: &lightning::routing::router::DefaultRouter<&NetworkGraph<&'a L>, &'a L, &ES, &S, SP, SL>, + * # router: &lightning::routing::router::DefaultRouter<&NetworkGraph<&'a L>, &'a L, &ES, &S>, + * # message_router: &lightning::onion_message::messenger::DefaultMessageRouter<&NetworkGraph<&'a L>, &'a L, &ES>, * # logger: &L, * # entropy_source: &ES, * # node_signer: &dyn lightning::sign::NodeSigner, @@ -12489,18 +12674,18 @@ typedef struct LDKRouter { * }; * let default_config = UserConfig::default(); * let channel_manager = ChannelManager::new( - * fee_estimator, chain_monitor, tx_broadcaster, router, logger, entropy_source, node_signer, - * signer_provider, default_config, params, current_timestamp + * fee_estimator, chain_monitor, tx_broadcaster, router, message_router, logger, + * entropy_source, node_signer, signer_provider, default_config, params, current_timestamp, * ); * * // Restart from deserialized data * let mut channel_monitors = read_channel_monitors(); * let args = ChannelManagerReadArgs::new( * entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, - * router, logger, default_config, channel_monitors.iter_mut().collect() + * router, message_router, logger, default_config, channel_monitors.iter().collect(), * ); * let (block_hash, channel_manager) = - * <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _>)>::read(&mut reader, args)?; + * <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _, _>)>::read(&mut reader, args)?; * * // Update the ChannelManager and ChannelMonitors with the latest chain data * // ... @@ -12725,12 +12910,12 @@ typedef struct LDKRouter { * * ## BOLT 11 Invoices * - * The [`lightning-invoice`] crate is useful for creating BOLT 11 invoices. Specifically, use the - * functions in its `utils` module for constructing invoices that are compatible with - * [`ChannelManager`]. These functions serve as a convenience for building invoices with the + * The [`lightning-invoice`] crate is useful for creating BOLT 11 invoices. However, in order to + * construct a [`Bolt11Invoice`] that is compatible with [`ChannelManager`], use + * [`create_bolt11_invoice`]. This method serves as a convenience for building invoices with the * [`PaymentHash`] and [`PaymentSecret`] returned from [`create_inbound_payment`]. To provide your - * own [`PaymentHash`], use [`create_inbound_payment_for_hash`] or the corresponding functions in - * the [`lightning-invoice`] `utils` module. + * own [`PaymentHash`], override the appropriate [`Bolt11InvoiceParameters`], which is equivalent + * to using [`create_inbound_payment_for_hash`]. * * [`ChannelManager`] generates an [`Event::PaymentClaimable`] once the full payment has been * received. Call [`claim_funds`] to release the [`PaymentPreimage`], which in turn will result in @@ -12738,19 +12923,21 @@ typedef struct LDKRouter { * * ``` * # use lightning::events::{Event, EventsProvider, PaymentPurpose}; - * # use lightning::ln::channelmanager::AChannelManager; + * # use lightning::ln::channelmanager::{AChannelManager, Bolt11InvoiceParameters}; * # * # fn example(channel_manager: T) { * # let channel_manager = channel_manager.get_cm(); - * // Or use utils::create_invoice_from_channelmanager - * let known_payment_hash = match channel_manager.create_inbound_payment( - * Some(10_000_000), 3600, None - * ) { - * Ok((payment_hash, _payment_secret)) => { - * println!(\"Creating inbound payment {}\", payment_hash); - * payment_hash + * let params = Bolt11InvoiceParameters { + * amount_msats: Some(10_000_000), + * invoice_expiry_delta_secs: Some(3600), + * ..Default::default() + * }; + * let invoice = match channel_manager.create_bolt11_invoice(params) { + * Ok(invoice) => { + * println!(\"Creating invoice with payment hash {}\", invoice.payment_hash()); + * invoice * }, - * Err(()) => panic!(\"Error creating inbound payment\"), + * Err(e) => panic!(\"Error creating invoice: {}\", e), * }; * * // On the event processing thread @@ -12758,7 +12945,7 @@ typedef struct LDKRouter { * match event { * Event::PaymentClaimable { payment_hash, purpose, .. } => match purpose { * PaymentPurpose::Bolt11InvoicePayment { payment_preimage: Some(payment_preimage), .. } => { - * assert_eq!(payment_hash, known_payment_hash); + * assert_eq!(payment_hash.0, invoice.payment_hash().as_ref()); * println!(\"Claiming payment {}\", payment_hash); * channel_manager.claim_funds(payment_preimage); * }, @@ -12766,7 +12953,7 @@ typedef struct LDKRouter { * println!(\"Unknown payment hash: {}\", payment_hash); * }, * PaymentPurpose::SpontaneousPayment(payment_preimage) => { - * assert_ne!(payment_hash, known_payment_hash); + * assert_ne!(payment_hash.0, invoice.payment_hash().as_ref()); * println!(\"Claiming spontaneous payment {}\", payment_hash); * channel_manager.claim_funds(payment_preimage); * }, @@ -12774,7 +12961,7 @@ typedef struct LDKRouter { * # _ => {}, * }, * Event::PaymentClaimed { payment_hash, amount_msat, .. } => { - * assert_eq!(payment_hash, known_payment_hash); + * assert_eq!(payment_hash.0, invoice.payment_hash().as_ref()); * println!(\"Claimed {} msats\", amount_msat); * }, * // ... @@ -12785,13 +12972,14 @@ typedef struct LDKRouter { * # } * ``` * - * For paying an invoice, [`lightning-invoice`] provides a `payment` module with convenience - * functions for use with [`send_payment`]. + * For paying an invoice, see the [`bolt11_payment`] module with convenience functions for use with + * [`send_payment`]. * * ``` * # use lightning::events::{Event, EventsProvider}; - * # use lightning::ln::types::PaymentHash; - * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, RecipientOnionFields, Retry}; + * # use lightning::types::payment::PaymentHash; + * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails}; + * # use lightning::ln::outbound_payment::{RecipientOnionFields, Retry}; * # use lightning::routing::router::RouteParameters; * # * # fn example( @@ -12894,7 +13082,8 @@ typedef struct LDKRouter { * * ``` * # use lightning::events::{Event, EventsProvider}; - * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry}; + * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails}; + * # use lightning::ln::outbound_payment::Retry; * # use lightning::offers::offer::Offer; * # * # fn example( @@ -12950,7 +13139,8 @@ typedef struct LDKRouter { * ``` * # use core::time::Duration; * # use lightning::events::{Event, EventsProvider}; - * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails, Retry}; + * # use lightning::ln::channelmanager::{AChannelManager, PaymentId, RecentPaymentDetails}; + * # use lightning::ln::outbound_payment::Retry; * # use lightning::offers::parse::Bolt12SemanticError; * # * # fn example( @@ -13120,8 +13310,10 @@ typedef struct LDKRouter { * [`list_recent_payments`]: Self::list_recent_payments * [`abandon_payment`]: Self::abandon_payment * [`lightning-invoice`]: https://docs.rs/lightning_invoice/latest/lightning_invoice + * [`create_bolt11_invoice`]: Self::create_bolt11_invoice * [`create_inbound_payment`]: Self::create_inbound_payment * [`create_inbound_payment_for_hash`]: Self::create_inbound_payment_for_hash + * [`bolt11_payment`]: crate::ln::bolt11_payment * [`claim_funds`]: Self::claim_funds * [`send_payment`]: Self::send_payment * [`offers`]: crate::offers @@ -13770,6 +13962,20 @@ typedef struct LDKCVec_TransactionOutputsZ { uintptr_t datalen; } LDKCVec_TransactionOutputsZ; +/** + * A tuple of 2 elements. See the individual fields for the types contained. + */ +typedef struct LDKC2Tuple_boolboolZ { + /** + * The element at position 0 + */ + bool a; + /** + * The element at position 1 + */ + bool b; +} LDKC2Tuple_boolboolZ; + /** * Details about the balance(s) available for spending once the channel appears on chain. * @@ -14657,6 +14863,73 @@ typedef struct LDKCResult_CVec_StrZIOErrorZ { bool result_ok; } LDKCResult_CVec_StrZIOErrorZ; +/** + * A tuple of 3 elements. See the individual fields for the types contained. + */ +typedef struct LDKC3Tuple_StrStrStrZ { + /** + * The element at position 0 + */ + struct LDKStr a; + /** + * The element at position 1 + */ + struct LDKStr b; + /** + * The element at position 2 + */ + struct LDKStr c; +} LDKC3Tuple_StrStrStrZ; + +/** + * A dynamically-allocated array of crate::c_types::derived::C3Tuple_StrStrStrZs of arbitrary size. + * This corresponds to std::vector in C++ + */ +typedef struct LDKCVec_C3Tuple_StrStrStrZZ { + /** + * The elements in the array. + * If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + */ + struct LDKC3Tuple_StrStrStrZ *data; + /** + * The number of elements pointed to by `data`. + */ + uintptr_t datalen; +} LDKCVec_C3Tuple_StrStrStrZZ; + +/** + * The contents of CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ + */ +typedef union LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKCVec_C3Tuple_StrStrStrZZ *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr; + +/** + * A CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents the result of a fallible operation, + * containing a crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + /** + * The contents of this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr contents; + /** + * Whether this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ; + /** * A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. * This corresponds to std::vector in C++ @@ -14739,38 +15012,174 @@ typedef struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { bool result_ok; } LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; + + /** - * The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ + * A struct representing a name for a channel monitor. + * + * `MonitorName` is primarily used within the [`MonitorUpdatingPersister`] + * in functions that store or retrieve channel monitor snapshots. + * It provides a consistent way to generate a unique key for channel + * monitors based on their funding outpoints. + * + * While users of the Lightning Dev Kit library generally won't need + * to interact with [`MonitorName`] directly, it can be useful for: + * - Custom persistence implementations + * - Debugging or logging channel monitor operations + * - Extending the functionality of the `MonitorUpdatingPersister` + * # Examples + * + * ``` + * use std::str::FromStr; + * + * use bitcoin::Txid; + * + * use lightning::util::persist::MonitorName; + * use lightning::chain::transaction::OutPoint; + * + * let outpoint = OutPoint { + *\t txid: Txid::from_str(\"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\").unwrap(), + *\t index: 1, + * }; + * let monitor_name = MonitorName::from(outpoint); + * assert_eq!(monitor_name.as_str(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1\"); + * + * // Using MonitorName to generate a storage key + * let storage_key = format!(\"channel_monitors/{}\", monitor_name.as_str()); + * ``` */ -typedef union LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { +typedef struct MUST_USE_STRUCT LDKMonitorName { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeMonitorName *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; +} LDKMonitorName; + +/** + * The contents of CResult_MonitorNameIOErrorZ + */ +typedef union LDKCResult_MonitorNameIOErrorZPtr { /** * A pointer to the contents in the success state. * Reading from this pointer when `result_ok` is not set is undefined. */ - struct LDKUnsignedInvoiceRequest *result; + struct LDKMonitorName *result; /** * A pointer to the contents in the error state. * Reading from this pointer when `result_ok` is set is undefined. */ - enum LDKBolt12SemanticError *err; -} LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr; + enum LDKIOError *err; +} LDKCResult_MonitorNameIOErrorZPtr; /** - * A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, - * containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. + * A CResult_MonitorNameIOErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::persist::MonitorName on success and a crate::c_types::IOError on failure. * `result_ok` indicates the overall state, and the contents are provided via `contents`. */ -typedef struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { +typedef struct LDKCResult_MonitorNameIOErrorZ { /** - * The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either + * The contents of this CResult_MonitorNameIOErrorZ, accessible via either * `err` or `result` depending on the state of `result_ok`. */ - union LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr contents; + union LDKCResult_MonitorNameIOErrorZPtr contents; /** - * Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state. + * Whether this CResult_MonitorNameIOErrorZ represents a success state. */ bool result_ok; -} LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ; +} LDKCResult_MonitorNameIOErrorZ; + + + +/** + * A struct representing a name for a channel monitor update. + * + * [`UpdateName`] is primarily used within the [`MonitorUpdatingPersister`] in + * functions that store or retrieve partial updates to channel monitors. It + * provides a consistent way to generate and parse unique identifiers for + * monitor updates based on their sequence number. + * + * The name is derived from the update's sequence ID, which is a monotonically + * increasing u64 value. This format allows for easy ordering of updates and + * efficient storage and retrieval in key-value stores. + * + * # Usage + * + * While users of the Lightning Dev Kit library generally won't need to + * interact with `UpdateName` directly, it still can be useful for custom + * persistence implementations. The u64 value is the update_id that can be + * compared with [ChannelMonitor::get_latest_update_id] to check if this update + * has been applied to the channel monitor or not, which is useful for pruning + * stale channel monitor updates off persistence. + * + * # Examples + * + * ``` + * use lightning::util::persist::UpdateName; + * + * let update_id: u64 = 42; + * let update_name = UpdateName::from(update_id); + * assert_eq!(update_name.as_str(), \"42\"); + * + * // Using UpdateName to generate a storage key + * let monitor_name = \"some_monitor_name\"; + * let storage_key = format!(\"channel_monitor_updates/{}/{}\", monitor_name, update_name.as_str()); + * ``` + */ +typedef struct MUST_USE_STRUCT LDKUpdateName { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUpdateName *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; +} LDKUpdateName; + +/** + * The contents of CResult_UpdateNameIOErrorZ + */ +typedef union LDKCResult_UpdateNameIOErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKUpdateName *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + enum LDKIOError *err; +} LDKCResult_UpdateNameIOErrorZPtr; + +/** + * A CResult_UpdateNameIOErrorZ represents the result of a fallible operation, + * containing a crate::lightning::util::persist::UpdateName on success and a crate::c_types::IOError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_UpdateNameIOErrorZ { + /** + * The contents of this CResult_UpdateNameIOErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_UpdateNameIOErrorZPtr contents; + /** + * Whether this CResult_UpdateNameIOErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_UpdateNameIOErrorZ; /** * The contents of CResult_InvoiceRequestBolt12SemanticErrorZ @@ -14981,6 +15390,39 @@ typedef struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticEr bool result_ok; } LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; +/** + * The contents of CResult_InvoiceRequestDecodeErrorZ + */ +typedef union LDKCResult_InvoiceRequestDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInvoiceRequest *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_InvoiceRequestDecodeErrorZPtr; + +/** + * A CResult_InvoiceRequestDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::offers::invoice_request::InvoiceRequest 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_InvoiceRequestDecodeErrorZ { + /** + * The contents of this CResult_InvoiceRequestDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InvoiceRequestDecodeErrorZPtr contents; + /** + * Whether this CResult_InvoiceRequestDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InvoiceRequestDecodeErrorZ; + /** @@ -18700,6 +19142,10 @@ typedef struct LDKPaymentPurpose_LDKBolt12OfferPayment_Body { * The context of the payment such as information about the corresponding [`Offer`] and * [`InvoiceRequest`]. * + * This includes the Human Readable Name which the sender indicated they were paying to, + * for possible recipient disambiguation if you're using a single wildcard DNS entry to + * resolve to many recipients. + * * [`Offer`]: crate::offers::offer::Offer * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest */ @@ -19270,6 +19716,67 @@ typedef struct MUST_USE_STRUCT LDKResponder { +/** + * Features used within the channel_type field in an OpenChannel message. + * + * A channel is always of some known \"type\", describing the transaction formats used and the exact + * semantics of our interaction with our peer. + * + * Note that because a channel is a specific type which is proposed by the opener and accepted by + * the counterparty, only required features are allowed here. + * + * This is serialized differently from other feature types - it is not prefixed by a length, and + * thus must only appear inside a TLV where its length is known in advance. + */ +typedef struct MUST_USE_STRUCT LDKChannelTypeFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelTypeFeatures *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKChannelTypeFeatures; + +/** + * Used to indicate the kind of funding for this channel by the channel acceptor (us). + * + * Allows the differentiation between a request for a dual-funded and non-dual-funded channel. + */ +typedef enum LDKInboundChannelFunds_Tag { + /** + * For a non-dual-funded channel, the `push_msat` value from the channel initiator to us. + */ + LDKInboundChannelFunds_PushMsat, + /** + * Indicates the open request is for a dual funded channel. + * + * Note that these channels do not support starting with initial funds pushed from the counterparty, + * who is the channel opener in this case. + */ + LDKInboundChannelFunds_DualFunded, + /** + * Must be last for serialization purposes + */ + LDKInboundChannelFunds_Sentinel, +} LDKInboundChannelFunds_Tag; + +typedef struct MUST_USE_STRUCT LDKInboundChannelFunds { + LDKInboundChannelFunds_Tag tag; + union { + struct { + uint64_t push_msat; + }; + }; +} LDKInboundChannelFunds; + + + /** * A subset of [`CommonOpenChannelFields`], containing various parameters which are set by the * channel initiator and which are not part of the channel funding transaction. @@ -19808,16 +20315,17 @@ typedef enum LDKEvent_Tag { /** * Indicates a request to open a new channel by a peer. * - * To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request, - * call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`] - * event will _not_ be triggered if the channel is rejected. + * To accept the request (and in the case of a dual-funded channel, not contribute funds), + * call [`ChannelManager::accept_inbound_channel`]. + * To reject the request, call [`ChannelManager::force_close_without_broadcasting_txn`]. + * Note that a ['ChannelClosed`] event will _not_ be triggered if the channel is rejected. * * The event is only triggered when a new open channel request is received and the * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. * * # Failure Behavior and Persistence * This event will eventually be replayed after failures-to-handle (i.e., the event handler - * returning `Err(ReplayEvent ())`) and will be persisted across restarts. + * returning `Err(ReplayEvent ())`) and won't be persisted across restarts. * * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel * [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn @@ -20027,6 +20535,16 @@ typedef struct LDKEvent_LDKPaymentClaimable_Body { * [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds */ struct LDKCOption_u32Z claim_deadline; + /** + * A unique ID describing this payment (derived from the list of HTLCs in the payment). + * + * Payers may pay for the same [`PaymentHash`] multiple times (though this is unsafe and + * an intermediary node may steal the funds). Thus, in order to accurately track when + * payments are received and claimed, you should use this identifier. + * + * Only filled in for payments received on LDK versions 0.1 and higher. + */ + struct LDKCOption_ThirtyTwoBytesZ payment_id; } LDKEvent_LDKPaymentClaimable_Body; typedef struct LDKEvent_LDKPaymentClaimed_Body { @@ -20075,6 +20593,16 @@ typedef struct LDKEvent_LDKPaymentClaimed_Body { * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKRecipientOnionFields onion_fields; + /** + * A unique ID describing this payment (derived from the list of HTLCs in the payment). + * + * Payers may pay for the same [`PaymentHash`] multiple times (though this is unsafe and + * an intermediary node may steal the funds). Thus, in order to accurately track when + * payments are received and claimed, you should use this identifier. + * + * Only filled in for payments received on LDK versions 0.1 and higher. + */ + struct LDKCOption_ThirtyTwoBytesZ payment_id; } LDKEvent_LDKPaymentClaimed_Body; typedef struct LDKEvent_LDKConnectionNeeded_Body { @@ -20376,6 +20904,24 @@ typedef struct LDKEvent_LDKPaymentForwarded_Body { * events generated or serialized by versions prior to 0.0.122. */ struct LDKCOption_U128Z next_user_channel_id; + /** + * The node id of the previous node. + * + * This is only `None` for HTLCs received prior to 0.1 or for events serialized by + * versions prior to 0.1 + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey prev_node_id; + /** + * The node id of the next node. + * + * This is only `None` for HTLCs received prior to 0.1 or for events serialized by + * versions prior to 0.1 + * + * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKPublicKey next_node_id; /** * The total fee, in milli-satoshis, which was earned as a result of the payment. * @@ -20534,6 +21080,19 @@ typedef struct LDKEvent_LDKChannelClosed_Body { * Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None */ struct LDKOutPoint channel_funding_txo; + /** + * An upper bound on the our last local balance in msats before the channel was closed. + * + * Will overstate our balance as it ignores pending outbound HTLCs and transaction fees. + * + * For more accurate balances including fee information see + * [`ChainMonitor::get_claimable_balances`]. + * + * This field will be `None` only for objects serialized prior to LDK 0.1. + * + * [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances + */ + struct LDKCOption_u64Z last_local_balance_msat; } LDKEvent_LDKChannelClosed_Body; typedef struct LDKEvent_LDKDiscardFunding_Body { @@ -20576,9 +21135,11 @@ typedef struct LDKEvent_LDKOpenChannelRequest_Body { */ uint64_t funding_satoshis; /** - * Our starting balance in the channel if the request is accepted, in milli-satoshi. + * If `channel_negotiation_type` is `InboundChannelFunds::DualFunded`, this indicates that the peer wishes to + * open a dual-funded channel. Otherwise, this field will be `InboundChannelFunds::PushMsats`, + * indicating the `push_msats` value our peer is pushing to us for a non-dual-funded channel. */ - uint64_t push_msat; + struct LDKInboundChannelFunds channel_negotiation_type; /** * The features that this channel will operate with. If you reject the channel, a * well-behaved counterparty may automatically re-attempt the channel with a new set of @@ -20779,68 +21340,25 @@ typedef struct LDKCVec_RouteHintHopZ { uintptr_t datalen; } LDKCVec_RouteHintHopZ; -/** - * Sub-errors which don't have specific information in them use this type. - */ -typedef struct LDKError { - /** - * Zero-Sized_types aren't consistent across Rust/C/C++, so we add some size here - */ - uint8_t _dummy; -} LDKError; + /** * Errors that indicate what is wrong with the invoice. They have some granularity for debug * reasons, but should generally result in an \"invalid BOLT11 invoice\" message for the user. */ -typedef enum LDKBolt11ParseError_Tag { - LDKBolt11ParseError_Bech32Error, - LDKBolt11ParseError_ParseAmountError, - LDKBolt11ParseError_MalformedSignature, - LDKBolt11ParseError_BadPrefix, - LDKBolt11ParseError_UnknownCurrency, - LDKBolt11ParseError_UnknownSiPrefix, - LDKBolt11ParseError_MalformedHRP, - LDKBolt11ParseError_TooShortDataPart, - LDKBolt11ParseError_UnexpectedEndOfTaggedFields, - LDKBolt11ParseError_DescriptionDecodeError, - LDKBolt11ParseError_PaddingError, - LDKBolt11ParseError_IntegerOverflowError, - LDKBolt11ParseError_InvalidSegWitProgramLength, - LDKBolt11ParseError_InvalidPubKeyHashLength, - LDKBolt11ParseError_InvalidScriptHashLength, - LDKBolt11ParseError_InvalidRecoveryId, - LDKBolt11ParseError_InvalidSliceLength, - /** - * Not an error, but used internally to signal that a part of the invoice should be ignored - * according to BOLT11 - */ - LDKBolt11ParseError_Skip, +typedef struct MUST_USE_STRUCT LDKBolt11ParseError { /** - * Must be last for serialization purposes + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. */ - LDKBolt11ParseError_Sentinel, -} LDKBolt11ParseError_Tag; - -typedef struct MUST_USE_STRUCT LDKBolt11ParseError { - LDKBolt11ParseError_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; - }; - }; + LDKnativeBolt11ParseError *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; } LDKBolt11ParseError; /** @@ -20876,33 +21394,6 @@ typedef struct LDKCResult_SiPrefixBolt11ParseErrorZ { bool result_ok; } LDKCResult_SiPrefixBolt11ParseErrorZ; - - -/** - * Represents a syntactically and semantically correct lightning BOLT11 invoice. - * - * There are three ways to construct a `Bolt11Invoice`: - * 1. using [`InvoiceBuilder`] - * 2. using [`Bolt11Invoice::from_signed`] - * 3. using `str::parse::(&str)` (see [`Bolt11Invoice::from_str`]) - * - * [`Bolt11Invoice::from_str`]: crate::Bolt11Invoice#impl-FromStr - */ -typedef struct MUST_USE_STRUCT LDKBolt11Invoice { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeBolt11Invoice *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; -} LDKBolt11Invoice; - /** * 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 @@ -21647,6 +22138,357 @@ typedef struct LDKCResult_ChannelIdDecodeErrorZ { bool result_ok; } LDKCResult_ChannelIdDecodeErrorZ; + + +/** + * Features used within an `init` message. + */ +typedef struct MUST_USE_STRUCT LDKInitFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeInitFeatures *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKInitFeatures; + +/** + * The contents of CResult_InitFeaturesDecodeErrorZ + */ +typedef union LDKCResult_InitFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKInitFeatures *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_InitFeaturesDecodeErrorZPtr; + +/** + * A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_InitFeaturesDecodeErrorZ { + /** + * The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_InitFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_InitFeaturesDecodeErrorZ; + + + +/** + * Features used within a `channel_announcement` message. + */ +typedef struct MUST_USE_STRUCT LDKChannelFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeChannelFeatures *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKChannelFeatures; + +/** + * The contents of CResult_ChannelFeaturesDecodeErrorZ + */ +typedef union LDKCResult_ChannelFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelFeatures *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_ChannelFeaturesDecodeErrorZPtr; + +/** + * A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelFeaturesDecodeErrorZ { + /** + * The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelFeaturesDecodeErrorZ; + + + +/** + * Features used within a `node_announcement` message. + */ +typedef struct MUST_USE_STRUCT LDKNodeFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeNodeFeatures *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; +} LDKNodeFeatures; + +/** + * The contents of CResult_NodeFeaturesDecodeErrorZ + */ +typedef union LDKCResult_NodeFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKNodeFeatures *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_NodeFeaturesDecodeErrorZPtr; + +/** + * A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_NodeFeaturesDecodeErrorZ { + /** + * The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_NodeFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_NodeFeaturesDecodeErrorZ; + + + +/** + * Features used within an invoice. + */ +typedef struct MUST_USE_STRUCT LDKBolt11InvoiceFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt11InvoiceFeatures *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; +} LDKBolt11InvoiceFeatures; + +/** + * The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ + */ +typedef union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBolt11InvoiceFeatures *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_Bolt11InvoiceFeaturesDecodeErrorZPtr; + +/** + * A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::features::Bolt11InvoiceFeatures 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_Bolt11InvoiceFeaturesDecodeErrorZ { + /** + * The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ; + + + +/** + * Features used within an `invoice`. + */ +typedef struct MUST_USE_STRUCT LDKBolt12InvoiceFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt12InvoiceFeatures *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; +} LDKBolt12InvoiceFeatures; + +/** + * The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ + */ +typedef union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBolt12InvoiceFeatures *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_Bolt12InvoiceFeaturesDecodeErrorZPtr; + +/** + * A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::features::Bolt12InvoiceFeatures 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_Bolt12InvoiceFeaturesDecodeErrorZ { + /** + * The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ; + + + +/** + * Features used within BOLT 4 encrypted_data_tlv and BOLT 12 blinded_payinfo + */ +typedef struct MUST_USE_STRUCT LDKBlindedHopFeatures { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBlindedHopFeatures *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; +} LDKBlindedHopFeatures; + +/** + * The contents of CResult_BlindedHopFeaturesDecodeErrorZ + */ +typedef union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKBlindedHopFeatures *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_BlindedHopFeaturesDecodeErrorZPtr; + +/** + * A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_BlindedHopFeaturesDecodeErrorZ { + /** + * The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_BlindedHopFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_BlindedHopFeaturesDecodeErrorZ; + +/** + * The contents of CResult_ChannelTypeFeaturesDecodeErrorZ + */ +typedef union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKChannelTypeFeatures *result; + /** + * A pointer to the contents in the error state. + * Reading from this pointer when `result_ok` is set is undefined. + */ + struct LDKDecodeError *err; +} LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr; + +/** + * A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning_types::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. + * `result_ok` indicates the overall state, and the contents are provided via `contents`. + */ +typedef struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ { + /** + * The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_ChannelTypeFeaturesDecodeErrorZPtr contents; + /** + * Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_ChannelTypeFeaturesDecodeErrorZ; + /** * A tuple of 2 elements. See the individual fields for the types contained. */ @@ -21925,39 +22767,6 @@ typedef struct LDKCResult_PaymentContextDecodeErrorZ { bool result_ok; } LDKCResult_PaymentContextDecodeErrorZ; -/** - * The contents of CResult_UnknownPaymentContextDecodeErrorZ - */ -typedef union LDKCResult_UnknownPaymentContextDecodeErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKUnknownPaymentContext *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_UnknownPaymentContextDecodeErrorZPtr; - -/** - * A CResult_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation, - * containing a crate::lightning::blinded_path::payment::UnknownPaymentContext 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_UnknownPaymentContextDecodeErrorZ { - /** - * The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_UnknownPaymentContextDecodeErrorZPtr contents; - /** - * Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_UnknownPaymentContextDecodeErrorZ; - /** * The contents of CResult_Bolt12OfferContextDecodeErrorZ */ @@ -22254,6 +23063,10 @@ typedef enum LDKParsedOnionMessageContents_Tag { * A message related to BOLT 12 Offers. */ LDKParsedOnionMessageContents_Offers, + /** + * A message requesting or providing a DNSSEC proof + */ + LDKParsedOnionMessageContents_DNSResolver, /** * A custom onion message specified by the user. */ @@ -22270,6 +23083,9 @@ typedef struct MUST_USE_STRUCT LDKParsedOnionMessageContents { struct { struct LDKOffersMessage offers; }; + struct { + struct LDKDNSResolverMessage dns_resolver; + }; struct { struct LDKOnionMessageContents custom; }; @@ -22495,67 +23311,6 @@ typedef struct LDKCVec_PhantomRouteHintsZ { uintptr_t datalen; } LDKCVec_PhantomRouteHintsZ; -/** - * When signing using a fallible method either an user-supplied `SignError` or a [`CreationError`] - * may occur. - */ -typedef enum LDKSignOrCreationError_Tag { - /** - * An error occurred during signing - */ - LDKSignOrCreationError_SignError, - /** - * An error occurred while building the transaction - */ - LDKSignOrCreationError_CreationError, - /** - * Must be last for serialization purposes - */ - LDKSignOrCreationError_Sentinel, -} LDKSignOrCreationError_Tag; - -typedef struct MUST_USE_STRUCT LDKSignOrCreationError { - LDKSignOrCreationError_Tag tag; - union { - struct { - enum LDKCreationError creation_error; - }; - }; -} LDKSignOrCreationError; - -/** - * The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ - */ -typedef union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr { - /** - * A pointer to the contents in the success state. - * Reading from this pointer when `result_ok` is not set is undefined. - */ - struct LDKBolt11Invoice *result; - /** - * A pointer to the contents in the error state. - * Reading from this pointer when `result_ok` is set is undefined. - */ - struct LDKSignOrCreationError *err; -} LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr; - -/** - * A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, - * containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure. - * `result_ok` indicates the overall state, and the contents are provided via `contents`. - */ -typedef struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ { - /** - * The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either - * `err` or `result` depending on the state of `result_ok`. - */ - union LDKCResult_Bolt11InvoiceSignOrCreationErrorZPtr contents; - /** - * Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state. - */ - bool result_ok; -} LDKCResult_Bolt11InvoiceSignOrCreationErrorZ; - /** * The contents of CResult_InvoiceErrorDecodeErrorZ */ @@ -23731,6 +24486,103 @@ typedef struct LDKCResult_OffersContextDecodeErrorZ { bool result_ok; } LDKCResult_OffersContextDecodeErrorZ; +/** + * The contents of CResult_AsyncPaymentsContextDecodeErrorZ + */ +typedef union LDKCResult_AsyncPaymentsContextDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKAsyncPaymentsContext *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_AsyncPaymentsContextDecodeErrorZPtr; + +/** + * A CResult_AsyncPaymentsContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::message::AsyncPaymentsContext 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_AsyncPaymentsContextDecodeErrorZ { + /** + * The contents of this CResult_AsyncPaymentsContextDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_AsyncPaymentsContextDecodeErrorZPtr contents; + /** + * Whether this CResult_AsyncPaymentsContextDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_AsyncPaymentsContextDecodeErrorZ; + +/** + * The contents of CResult_DNSResolverContextDecodeErrorZ + */ +typedef union LDKCResult_DNSResolverContextDecodeErrorZPtr { + /** + * A pointer to the contents in the success state. + * Reading from this pointer when `result_ok` is not set is undefined. + */ + struct LDKDNSResolverContext *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_DNSResolverContextDecodeErrorZPtr; + +/** + * A CResult_DNSResolverContextDecodeErrorZ represents the result of a fallible operation, + * containing a crate::lightning::blinded_path::message::DNSResolverContext 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_DNSResolverContextDecodeErrorZ { + /** + * The contents of this CResult_DNSResolverContextDecodeErrorZ, accessible via either + * `err` or `result` depending on the state of `result_ok`. + */ + union LDKCResult_DNSResolverContextDecodeErrorZPtr contents; + /** + * Whether this CResult_DNSResolverContextDecodeErrorZ represents a success state. + */ + bool result_ok; +} LDKCResult_DNSResolverContextDecodeErrorZ; + +/** + * Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`] + * data migration. + */ +typedef struct LDKMigratableKVStore { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples. + * + * This is useful for migrating data from [`KVStore`] implementation to [`KVStore`] + * implementation. + * + * Must exhaustively return all entries known to the store to ensure no data is missed, but + * may return the items in arbitrary order. + */ + struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ (*list_all_keys)(const void *this_arg); + /** + * Implementation of KVStore for this object. + */ + struct LDKKVStore KVStore; + /** + * 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); +} LDKMigratableKVStore; + /** * Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. * @@ -23994,6 +24846,13 @@ typedef struct LDKPersist { * * Archiving the data in a backup location (rather than deleting it fully) is useful for * hedging against data loss in case of unexpected failure. + * + * Note that if a crash occurs during the archiving process, and its implementation is not + * atomic, a state may emerge with the archival operation only being partially complete. In + * that scenario, the monitor may still be loaded on startup pending successful completion of + * the archive process. Additionally, because the archive operation could be retried on + * restart, this method must in that case be idempotent, ensuring it can handle scenarios where + * the monitor already exists in the archive. */ void (*archive_persisted_channel)(const void *this_arg, struct LDKOutPoint channel_funding_outpoint); /** @@ -24198,11 +25057,10 @@ typedef struct MUST_USE_STRUCT LDKSpendingDelay { * A callback which is called when a [`Future`] completes. * * Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be - * taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`] - * instead. + * taken later. + *Rust users should use the [`std::future::Future`] implementation for [`Future`] instead. * - * Note that the [`std::future::Future`] implementation may only work for runtimes which schedule - * futures when they receive a wake, rather than immediately executing them. + *Note that the [`std::future::Future`] implementation may only work for runtimes which schedule futures when they receive a wake, rather than immediately executing them. */ typedef struct LDKFutureCallback { /** @@ -24459,6 +25317,51 @@ typedef struct LDKEventsProvider { void (*free)(void *this_arg); } LDKEventsProvider; +/** + * A trait defining behavior for creating and verifing the HMAC for authenticating a given data. + */ +typedef struct LDKVerification { + /** + * 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; + /** + * Constructs an HMAC to include in [`OffersContext`] for the data along with the given + * [`Nonce`]. + */ + struct LDKThirtyTwoBytes (*hmac_for_offer_payment)(const void *this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); + /** + * Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`]. + */ + struct LDKCResult_NoneNoneZ (*verify_for_offer_payment)(const void *this_arg, struct LDKThirtyTwoBytes hmac, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); + /** + * 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); +} LDKVerification; + + + +/** + * An unauthenticated [`ReceiveTlvs`]. + */ +typedef struct MUST_USE_STRUCT LDKUnauthenticatedReceiveTlvs { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnauthenticatedReceiveTlvs *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; +} LDKUnauthenticatedReceiveTlvs; + /** * This enum is used to specify which error data to send to peers when failing back an HTLC * using [`ChannelManager::fail_htlc_backwards_with_reason`]. @@ -24530,6 +25433,79 @@ typedef struct MUST_USE_STRUCT LDKChainParameters { bool is_owned; } LDKChainParameters; + + +/** + * Parameters used with [`create_bolt11_invoice`]. + * + * [`create_bolt11_invoice`]: ChannelManager::create_bolt11_invoice + */ +typedef struct MUST_USE_STRUCT LDKBolt11InvoiceParameters { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeBolt11InvoiceParameters *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; +} LDKBolt11InvoiceParameters; + + + +/** + * SHA-256 hash + */ +typedef struct MUST_USE_STRUCT LDKSha256 { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeSha256 *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKSha256; + +/** + * Represents the description of an invoice which has to be either a directly included string or + * a hash of a description provided out of band. + */ +typedef enum LDKBolt11InvoiceDescription_Tag { + /** + * Description of what the invoice is for + */ + LDKBolt11InvoiceDescription_Direct, + /** + * Hash of the description of what the invoice is for + */ + LDKBolt11InvoiceDescription_Hash, + /** + * Must be last for serialization purposes + */ + LDKBolt11InvoiceDescription_Sentinel, +} LDKBolt11InvoiceDescription_Tag; + +typedef struct MUST_USE_STRUCT LDKBolt11InvoiceDescription { + LDKBolt11InvoiceDescription_Tag tag; + union { + struct { + struct LDKDescription direct; + }; + struct { + struct LDKSha256 hash; + }; + }; +} LDKBolt11InvoiceDescription; + /** * A trait indicating an object may generate message send events */ @@ -24716,6 +25692,15 @@ typedef struct LDKChannelMessageHandler { * connecting to peers. */ struct LDKCOption_CVec_ThirtyTwoBytesZZ (*get_chain_hashes)(const void *this_arg); + /** + * Indicates that a message was received from any peer for any handler. + * Called before the message is passed to the appropriate handler. + * Useful for indicating that a network connection is active. + * + * Note: Since this function is called frequently, it should be as + * efficient as possible for its intended purpose. + */ + void (*message_received)(const void *this_arg); /** * Implementation of MessageSendEventsProvider for this object. */ @@ -24780,12 +25765,12 @@ typedef struct LDKAsyncPaymentsMessageHandler { * * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ (*held_htlc_available)(const void *this_arg, struct LDKHeldHtlcAvailable message, struct LDKResponder responder); + struct LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ (*handle_held_htlc_available)(const void *this_arg, struct LDKHeldHtlcAvailable message, struct LDKResponder responder); /** * Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC * should be released to the corresponding payee. */ - void (*release_held_htlc)(const void *this_arg, struct LDKReleaseHeldHtlc message); + void (*handle_release_held_htlc)(const void *this_arg, struct LDKReleaseHeldHtlc message, struct LDKAsyncPaymentsContext context); /** * Release any [`AsyncPaymentsMessage`]s that need to be sent. * @@ -24800,6 +25785,49 @@ typedef struct LDKAsyncPaymentsMessageHandler { void (*free)(void *this_arg); } LDKAsyncPaymentsMessageHandler; +/** + * A handler for an [`OnionMessage`] containing a DNS(SEC) query or a DNSSEC proof + * + * [`OnionMessage`]: crate::ln::msgs::OnionMessage + */ +typedef struct LDKDNSResolverMessageHandler { + /** + * An opaque pointer which is passed to your function implementations as an argument. + * This has no meaning in the LDK, and can be NULL or any other value. + */ + void *this_arg; + /** + * Handle a [`DNSSECQuery`] message. + * + * If we provide DNS resolution services to third parties, we should respond with a + * [`DNSSECProof`] message. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ (*handle_dnssec_query)(const void *this_arg, struct LDKDNSSECQuery message, struct LDKResponder responder); + /** + * Handle a [`DNSSECProof`] message (in response to a [`DNSSECQuery`] we presumably sent). + * + * With this, we should be able to validate the DNS record we requested. + */ + void (*handle_dnssec_proof)(const void *this_arg, struct LDKDNSSECProof message, struct LDKDNSResolverContext context); + /** + * Gets the node feature flags which this handler itself supports. Useful for setting the + * `dns_resolver` flag if this handler supports returning [`DNSSECProof`] messages in response + * to [`DNSSECQuery`] messages. + */ + struct LDKNodeFeatures (*provided_node_features)(const void *this_arg); + /** + * Release any [`DNSResolverMessage`]s that need to be sent. + */ + struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ (*release_pending_messages)(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); +} LDKDNSResolverMessageHandler; + /** * An interface for looking up the node id of a channel counterparty for the purpose of forwarding * an [`OnionMessage`]. @@ -24845,9 +25873,12 @@ typedef struct LDKNodeIdLookUp { * 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the * same way you would handle a [`chain::Filter`] call using * [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`]. - * 4) Reconnect blocks on your [`ChannelMonitor`]s. - * 5) Disconnect/connect blocks on the [`ChannelManager`]. - * 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. + * 4) Disconnect/connect blocks on your [`ChannelMonitor`]s to get them in sync with the chain. + * 5) Disconnect/connect blocks on the [`ChannelManager`] to get it in sync with the chain. + * 6) Optionally re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. + * This is important if you have replayed a nontrivial number of blocks in step (4), allowing + * you to avoid having to replay the same blocks if you shut down quickly after startup. It is + * otherwise not required. * Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you * will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in * the next step. @@ -24884,32 +25915,10 @@ typedef struct MUST_USE_STRUCT LDKChannelManagerReadArgs { /** - * A set of keys that were HKDF-expanded from an initial call to - * [`NodeSigner::get_inbound_payment_key_material`]. - * - * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material - */ -typedef struct MUST_USE_STRUCT LDKExpandedKey { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeExpandedKey *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKExpandedKey; - - - -/** - * Contains fields that are both common to [`open_channel`] and `open_channel2` messages. + * Contains fields that are both common to [`open_channel`] and [`open_channel2`] messages. * * [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message + * [`open_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel2-message */ typedef struct MUST_USE_STRUCT LDKCommonOpenChannelFields { /** @@ -24929,9 +25938,10 @@ typedef struct MUST_USE_STRUCT LDKCommonOpenChannelFields { /** - * Contains fields that are both common to [`accept_channel`] and `accept_channel2` messages. + * Contains fields that are both common to [`accept_channel`] and [`accept_channel2`] messages. * * [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message + * [`accept_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel2-message */ typedef struct MUST_USE_STRUCT LDKCommonAcceptChannelFields { /** @@ -24986,18 +25996,30 @@ typedef struct LDKRoutingMessageHandler { /** * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, * `false` or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, const struct LDKNodeAnnouncement *NONNULL_PTR msg); + struct LDKCResult_boolLightningErrorZ (*handle_node_announcement)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` * or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, const struct LDKChannelAnnouncement *NONNULL_PTR msg); + struct LDKCResult_boolLightningErrorZ (*handle_channel_announcement)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** * Handle an incoming `channel_update` message, returning true if it should be forwarded on, * `false` or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ - struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); + struct LDKCResult_boolLightningErrorZ (*handle_channel_update)(const void *this_arg, struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); /** * Gets channel announcements and updates required to dump our routing table to a remote node, * starting at the `short_channel_id` indicated by `starting_point` and including announcements @@ -25499,61 +26521,6 @@ typedef struct MUST_USE_STRUCT LDKDirectedChannelTransactionParameters { -/** - * SHA-256 hash - */ -typedef struct MUST_USE_STRUCT LDKSha256 { - /** - * A pointer to the opaque Rust object. - * Nearly everywhere, inner must be non-null, however in places where - * the Rust equivalent takes an Option, it may be set to null to indicate None. - */ - LDKnativeSha256 *inner; - /** - * Indicates that this is the only struct which contains the same pointer. - * Rust functions which take ownership of an object provided via an argument require - * this to be true and invalidate the object pointed to by inner. - */ - bool is_owned; -} LDKSha256; - -/** - * An error when attempting to pay a [`Bolt12Invoice`]. - */ -typedef enum LDKBolt12PaymentError_Tag { - /** - * The invoice was not requested. - */ - LDKBolt12PaymentError_UnexpectedInvoice, - /** - * Payment for an invoice with the corresponding [`PaymentId`] was already initiated. - */ - LDKBolt12PaymentError_DuplicateInvoice, - /** - * The invoice was valid for the corresponding [`PaymentId`], but required unknown features. - */ - LDKBolt12PaymentError_UnknownRequiredFeatures, - /** - * The invoice was valid for the corresponding [`PaymentId`], but sending the payment failed. - */ - LDKBolt12PaymentError_SendingFailed, - /** - * Must be last for serialization purposes - */ - LDKBolt12PaymentError_Sentinel, -} LDKBolt12PaymentError_Tag; - -typedef struct MUST_USE_STRUCT LDKBolt12PaymentError { - LDKBolt12PaymentError_Tag tag; - union { - struct { - enum LDKRetryableSendFailure sending_failed; - }; - }; -} LDKBolt12PaymentError; - - - /** * Builds an [`Offer`] for the \"offer to be paid\" flow. * @@ -25714,6 +26681,31 @@ typedef struct MUST_USE_STRUCT LDKErroneousField { bool is_owned; } LDKErroneousField; + + +/** + * A semantically valid [`InvoiceRequest`] that hasn't been signed. + * + * # Serialization + * + * This is serialized as a TLV stream, which includes TLV records from the originating message. As + * such, it may include unknown, odd TLV records. + */ +typedef struct MUST_USE_STRUCT LDKUnsignedInvoiceRequest { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeUnsignedInvoiceRequest *inner; + /** + * Indicates that this is the only struct which contains the same pointer. + * Rust functions which take ownership of an object provided via an argument require + * this to be true and invalidate the object pointed to by inner. + */ + bool is_owned; +} LDKUnsignedInvoiceRequest; + /** * A function for signing an [`UnsignedInvoiceRequest`]. */ @@ -25916,8 +26908,10 @@ typedef struct MUST_USE_STRUCT LDKEffectiveCapacity { * * # Privacy * - * Implements [`MessageRouter`] by delegating to [`DefaultMessageRouter`]. See those docs for - * privacy implications. + * Creating [`BlindedPaymentPath`]s may affect privacy since, if a suitable path cannot be found, + * it will create a one-hop path using the recipient as the introduction node if it is a announced + * node. Otherwise, there is no way to find a path to the introduction node in order to send a + * payment, and thus an `Err` is returned. */ typedef struct MUST_USE_STRUCT LDKDefaultRouter { /** @@ -26235,6 +27229,33 @@ typedef struct MUST_USE_STRUCT LDKRandomBytes { +/** + * A stateful resolver which maps BIP 353 Human Readable Names to URIs and BOLT12 [`Offer`]s. + * + * It does not directly implement [`DNSResolverMessageHandler`] but implements all the core logic + * which is required in a client which intends to. + * + * It relies on being made aware of the passage of time with regular calls to + * [`Self::new_best_block`] in order to time out existing queries. Queries time out after two + * blocks. + */ +typedef struct MUST_USE_STRUCT LDKOMNameResolver { + /** + * A pointer to the opaque Rust object. + * Nearly everywhere, inner must be non-null, however in places where + * the Rust equivalent takes an Option, it may be set to null to indicate None. + */ + LDKnativeOMNameResolver *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; +} LDKOMNameResolver; + + + /** * A sender, receiver and forwarder of [`OnionMessage`]s. * @@ -26306,14 +27327,16 @@ typedef struct MUST_USE_STRUCT LDKRandomBytes { * # let custom_message_handler = IgnoringMessageHandler {}; * # let offers_message_handler = IgnoringMessageHandler {}; * # let async_payments_message_handler = IgnoringMessageHandler {}; + * # let dns_resolution_message_handler = IgnoringMessageHandler {}; * // Create the onion messenger. This must use the same `keys_manager` as is passed to your * // ChannelManager. * let onion_messenger = OnionMessenger::new( * &keys_manager, &keys_manager, logger, &node_id_lookup, message_router, - * &offers_message_handler, &async_payments_message_handler, &custom_message_handler + * &offers_message_handler, &async_payments_message_handler, &dns_resolution_message_handler, + * &custom_message_handler, * ); * - * # #[derive(Debug, Clone)] + * # #[derive(Clone, Debug)] * # struct YourCustomMessage {} * impl Writeable for YourCustomMessage { * \tfn write(&self, w: &mut W) -> Result<(), io::Error> { @@ -26854,8 +27877,6 @@ extern const uint64_t MIN_RELAY_FEE_SAT_PER_1000_WEIGHT; extern const uint32_t FEERATE_FLOOR_SATS_PER_KW; -extern const uint64_t CLOSED_CHANNEL_UPDATE_ID; - extern const uint32_t ANTI_REORG_DELAY; extern const uint16_t BREAKDOWN_TIMEOUT; @@ -27229,42 +28250,6 @@ void CResult_RetryDecodeErrorZ_free(struct LDKCResult_RetryDecodeErrorZ _res); */ struct LDKCResult_RetryDecodeErrorZ CResult_RetryDecodeErrorZ_clone(const struct LDKCResult_RetryDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new CResult_NoneAPIErrorZ in the success state. - */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); - -/** - * Creates a new CResult_NoneAPIErrorZ in the error state. - */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_NoneAPIErrorZ. - */ -void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); - -/** - * Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_CResult_NoneAPIErrorZZ_free(struct LDKCVec_CResult_NoneAPIErrorZZ _res); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_APIErrorZ_free(struct LDKCVec_APIErrorZ _res); - /** * Constructs a new COption_ThirtyTwoBytesZ containing a crate::c_types::ThirtyTwoBytes */ @@ -27380,6 +28365,279 @@ void CResult_RecipientOnionFieldsNoneZ_free(struct LDKCResult_RecipientOnionFiel */ struct LDKCResult_RecipientOnionFieldsNoneZ CResult_RecipientOnionFieldsNoneZ_clone(const struct LDKCResult_RecipientOnionFieldsNoneZ *NONNULL_PTR orig); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ C2Tuple_DNSResolverMessageResponseInstructionZ_clone(const struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_DNSResolverMessageResponseInstructionZ from the contained elements. + */ +struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ C2Tuple_DNSResolverMessageResponseInstructionZ_new(struct LDKDNSResolverMessage a, struct LDKResponseInstruction b); + +/** + * Frees any resources used by the C2Tuple_DNSResolverMessageResponseInstructionZ. + */ +void C2Tuple_DNSResolverMessageResponseInstructionZ_free(struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ _res); + +/** + * Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ + */ +struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_some(struct LDKC2Tuple_DNSResolverMessageResponseInstructionZ o); + +/** + * Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing nothing + */ +struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ, if we are in the Some state + */ +void COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_free(struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ _res); + +/** + * Creates a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_clone(const struct LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ C2Tuple_DNSResolverMessageMessageSendInstructionsZ_clone(const struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_DNSResolverMessageMessageSendInstructionsZ from the contained elements. + */ +struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ C2Tuple_DNSResolverMessageMessageSendInstructionsZ_new(struct LDKDNSResolverMessage a, struct LDKMessageSendInstructions b); + +/** + * Frees any resources used by the C2Tuple_DNSResolverMessageMessageSendInstructionsZ. + */ +void C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(struct LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(struct LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ _res); + +/** + * Creates a new CResult_DNSResolverMessageDecodeErrorZ in the success state. + */ +struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_ok(struct LDKDNSResolverMessage o); + +/** + * Creates a new CResult_DNSResolverMessageDecodeErrorZ in the error state. + */ +struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DNSResolverMessageDecodeErrorZ_is_ok(const struct LDKCResult_DNSResolverMessageDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_DNSResolverMessageDecodeErrorZ. + */ +void CResult_DNSResolverMessageDecodeErrorZ_free(struct LDKCResult_DNSResolverMessageDecodeErrorZ _res); + +/** + * Creates a new CResult_DNSResolverMessageDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_DNSResolverMessageDecodeErrorZ CResult_DNSResolverMessageDecodeErrorZ_clone(const struct LDKCResult_DNSResolverMessageDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HumanReadableNameNoneZ in the success state. + */ +struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_ok(struct LDKHumanReadableName o); + +/** + * Creates a new CResult_HumanReadableNameNoneZ in the error state. + */ +struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HumanReadableNameNoneZ_is_ok(const struct LDKCResult_HumanReadableNameNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HumanReadableNameNoneZ. + */ +void CResult_HumanReadableNameNoneZ_free(struct LDKCResult_HumanReadableNameNoneZ _res); + +/** + * Creates a new CResult_HumanReadableNameNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HumanReadableNameNoneZ CResult_HumanReadableNameNoneZ_clone(const struct LDKCResult_HumanReadableNameNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_HumanReadableNameDecodeErrorZ in the success state. + */ +struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_ok(struct LDKHumanReadableName o); + +/** + * Creates a new CResult_HumanReadableNameDecodeErrorZ in the error state. + */ +struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_HumanReadableNameDecodeErrorZ_is_ok(const struct LDKCResult_HumanReadableNameDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_HumanReadableNameDecodeErrorZ. + */ +void CResult_HumanReadableNameDecodeErrorZ_free(struct LDKCResult_HumanReadableNameDecodeErrorZ _res); + +/** + * Creates a new CResult_HumanReadableNameDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_HumanReadableNameDecodeErrorZ CResult_HumanReadableNameDecodeErrorZ_clone(const struct LDKCResult_HumanReadableNameDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ C2Tuple_DNSSECQueryDNSResolverContextZ_clone(const struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_DNSSECQueryDNSResolverContextZ from the contained elements. + */ +struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ C2Tuple_DNSSECQueryDNSResolverContextZ_new(struct LDKDNSSECQuery a, struct LDKDNSResolverContext b); + +/** + * Frees any resources used by the C2Tuple_DNSSECQueryDNSResolverContextZ. + */ +void C2Tuple_DNSSECQueryDNSResolverContextZ_free(struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ _res); + +/** + * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_ok(struct LDKC2Tuple_DNSSECQueryDNSResolverContextZ o); + +/** + * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_is_ok(const struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ. + */ +void CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_free(struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_clone(const struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ C2Tuple_HumanReadableNameThirtyTwoBytesZ_clone(const struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_HumanReadableNameThirtyTwoBytesZ from the contained elements. + */ +struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ C2Tuple_HumanReadableNameThirtyTwoBytesZ_new(struct LDKHumanReadableName a, struct LDKThirtyTwoBytes b); + +/** + * Frees any resources used by the C2Tuple_HumanReadableNameThirtyTwoBytesZ. + */ +void C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(struct LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_clone(const struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ from the contained elements. + */ +struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_new(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a, struct LDKOffer b); + +/** + * Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ. + */ +void C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ _res); + +/** + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_some(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ o); + +/** + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing nothing + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ, if we are in the Some state + */ +void COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ _res); + +/** + * Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_clone(const struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_clone(const struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ from the contained elements. + */ +struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_new(struct LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ a, struct LDKStr b); + +/** + * Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ. + */ +void C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ _res); + +/** + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_some(struct LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ o); + +/** + * Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing nothing + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ, if we are in the Some state + */ +void COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_free(struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ _res); + +/** + * Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_clone(const struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ *NONNULL_PTR orig); + /** * Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state. */ @@ -27458,6 +28716,11 @@ void CResult_SchnorrSignatureNoneZ_free(struct LDKCResult_SchnorrSignatureNoneZ */ struct LDKCResult_SchnorrSignatureNoneZ CResult_SchnorrSignatureNoneZ_clone(const struct LDKCResult_SchnorrSignatureNoneZ *NONNULL_PTR orig); +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_BlindedPaymentPathZ_free(struct LDKCVec_BlindedPaymentPathZ _res); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -28296,11 +29559,6 @@ void CResult_RouteLightningErrorZ_free(struct LDKCResult_RouteLightningErrorZ _r */ struct LDKCResult_RouteLightningErrorZ CResult_RouteLightningErrorZ_clone(const struct LDKCResult_RouteLightningErrorZ *NONNULL_PTR orig); -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_BlindedPaymentPathZ_free(struct LDKCVec_BlindedPaymentPathZ _res); - /** * Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the success state. */ @@ -28327,68 +29585,6 @@ void CResult_CVec_BlindedPaymentPathZNoneZ_free(struct LDKCResult_CVec_BlindedPa */ struct LDKCResult_CVec_BlindedPaymentPathZNoneZ CResult_CVec_BlindedPaymentPathZNoneZ_clone(const struct LDKCResult_CVec_BlindedPaymentPathZNoneZ *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_OnionMessagePathNoneZ in the success state. - */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); - -/** - * Creates a new CResult_OnionMessagePathNoneZ in the error state. - */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_OnionMessagePathNoneZ. - */ -void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); - -/** - * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. - */ -struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_ok(struct LDKCVec_BlindedMessagePathZ o); - -/** - * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. - */ -struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CVec_BlindedMessagePathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. - */ -void CResult_CVec_BlindedMessagePathZNoneZ_free(struct LDKCResult_CVec_BlindedMessagePathZNoneZ _res); - -/** - * Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_clone(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_MessageForwardNodeZ_free(struct LDKCVec_MessageForwardNodeZ _res); - /** * Creates a new CResult_InFlightHtlcsDecodeErrorZ in the success state. */ @@ -28622,6 +29818,11 @@ 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_PublicKeyZ_free(struct LDKCVec_PublicKeyZ _res); + /** * Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. */ @@ -28886,188 +30087,6 @@ void C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(struct LDKC4Tupl */ void CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(struct LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ _res); -/** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. - */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); - -/** - * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. - */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. - */ -void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); - -/** - * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); - -/** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. - */ -void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); - -/** - * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. - */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); - -/** - * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. - */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. - */ -void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); - -/** - * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. - */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o); - -/** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. - */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. - */ -void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res); - -/** - * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. - */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o); - -/** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. - */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. - */ -void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res); - -/** - * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. - */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); - -/** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. - */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. - */ -void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); - -/** - * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. - */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); - -/** - * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. - */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. - */ -void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); - -/** - * Creates a new CResult_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_OfferIdDecodeErrorZ in the success state. */ @@ -29147,44 +30166,24 @@ void CResult_OfferBolt12SemanticErrorZ_free(struct LDKCResult_OfferBolt12Semanti struct LDKCResult_OfferBolt12SemanticErrorZ CResult_OfferBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferBolt12SemanticErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state. - */ -struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithDerivedPayerIdBuilder o); - -/** - * Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state. - */ -struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ. - */ -void CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ _res); - -/** - * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state. + * Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. */ -struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithExplicitPayerIdBuilder o); +struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_ok(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder o); /** - * Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state. + * Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. */ -struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); /** * Checks if the given object is currently in the success state */ -bool CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ. + * Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ. */ -void CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ _res); +void CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ _res); /** * Creates a new CResult_OfferDecodeErrorZ in the success state. @@ -29898,30 +30897,30 @@ struct LDKCResult_ChannelIdAPIErrorZ CResult_ChannelIdAPIErrorZ_clone(const stru void CVec_RecentPaymentDetailsZ_free(struct LDKCVec_RecentPaymentDetailsZ _res); /** - * Creates a new CResult_NonePaymentSendFailureZ in the success state. + * Creates a new CResult_NoneAPIErrorZ in the success state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_ok(void); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_ok(void); /** - * Creates a new CResult_NonePaymentSendFailureZ in the error state. + * Creates a new CResult_NoneAPIErrorZ in the error state. */ -struct LDKCResult_NonePaymentSendFailureZ CResult_NonePaymentSendFailureZ_err(struct LDKPaymentSendFailure e); +struct LDKCResult_NoneAPIErrorZ CResult_NoneAPIErrorZ_err(struct LDKAPIError 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_NoneAPIErrorZ_is_ok(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_NonePaymentSendFailureZ. + * Frees any resources used by the CResult_NoneAPIErrorZ. */ -void CResult_NonePaymentSendFailureZ_free(struct LDKCResult_NonePaymentSendFailureZ _res); +void CResult_NoneAPIErrorZ_free(struct LDKCResult_NoneAPIErrorZ _res); /** - * Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` + * Creates a new CResult_NoneAPIErrorZ 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_NoneAPIErrorZ CResult_NoneAPIErrorZ_clone(const struct LDKCResult_NoneAPIErrorZ *NONNULL_PTR orig); /** * Creates a new CResult_NoneRetryableSendFailureZ in the success state. @@ -29949,256 +30948,6 @@ void CResult_NoneRetryableSendFailureZ_free(struct LDKCResult_NoneRetryableSendF */ struct LDKCResult_NoneRetryableSendFailureZ CResult_NoneRetryableSendFailureZ_clone(const struct LDKCResult_NoneRetryableSendFailureZ *NONNULL_PTR orig); -/** - * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state. - */ -struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(struct LDKThirtyTwoBytes o); - -/** - * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state. - */ -struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ. - */ -void CResult_ThirtyTwoBytesPaymentSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ _res); - -/** - * Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. - */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); - -/** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. - */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. - */ -void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); - -/** - * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); - -/** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. - */ -struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); - -/** - * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. - */ -void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); - -/** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state. - */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); - -/** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state. - */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(struct LDKPaymentSendFailure e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ. - */ -void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ _res); - -/** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ *NONNULL_PTR orig); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); - -/** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. - */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); - -/** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. - */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. - */ -void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); - -/** - * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); - -/** - * Creates a new tuple which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_clone(const struct LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR orig); - -/** - * Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. - */ -struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_new(struct LDKChannelId a, struct LDKPublicKey b); - -/** - * Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. - */ -void C2Tuple_ChannelIdPublicKeyZ_free(struct LDKC2Tuple_ChannelIdPublicKeyZ _res); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_C2Tuple_ChannelIdPublicKeyZZ_free(struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res); - -/** - * Frees the buffer pointed to by `data` if `datalen` is non-0. - */ -void CVec_ChannelIdZ_free(struct LDKCVec_ChannelIdZ _res); - -/** - * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. - */ -struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKOfferWithDerivedMetadataBuilder o); - -/** - * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. - */ -struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ. - */ -void CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); - -/** - * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); - -/** - * Constructs a new COption_StrZ containing a crate::c_types::Str - */ -struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); - -/** - * Constructs a new COption_StrZ containing nothing - */ -struct LDKCOption_StrZ COption_StrZ_none(void); - -/** - * Frees any resources associated with the crate::c_types::Str, if we are in the Some state - */ -void COption_StrZ_free(struct LDKCOption_StrZ _res); - -/** - * Creates a new COption_StrZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. - */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); - -/** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. - */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. - */ -void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); - -/** - * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); - -/** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. - */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); - -/** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. - */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. - */ -void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); - -/** - * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); - /** * Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext */ @@ -30220,6 +30969,324 @@ void COption_OffersContextZ_free(struct LDKCOption_OffersContextZ _res); */ struct LDKCOption_OffersContextZ COption_OffersContextZ_clone(const struct LDKCOption_OffersContextZ *NONNULL_PTR orig); +/** + * Creates a new CResult_NoneBolt12PaymentErrorZ in the success state. + */ +struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_ok(void); + +/** + * Creates a new CResult_NoneBolt12PaymentErrorZ in the error state. + */ +struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_err(struct LDKBolt12PaymentError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NoneBolt12PaymentErrorZ_is_ok(const struct LDKCResult_NoneBolt12PaymentErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NoneBolt12PaymentErrorZ. + */ +void CResult_NoneBolt12PaymentErrorZ_free(struct LDKCResult_NoneBolt12PaymentErrorZ _res); + +/** + * Creates a new CResult_NoneBolt12PaymentErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NoneBolt12PaymentErrorZ CResult_NoneBolt12PaymentErrorZ_clone(const struct LDKCResult_NoneBolt12PaymentErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_err(enum LDKRetryableSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. + */ +void CResult_ThirtyTwoBytesRetryableSendFailureZ_free(struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(const struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_clone(const struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. + */ +struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(struct LDKThirtyTwoBytes a, struct LDKThirtyTwoBytes b); + +/** + * Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. + */ +void C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_err(struct LDKProbeSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(struct LDKCVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ o); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(struct LDKProbeSendFailure e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. + */ +void CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ _res); + +/** + * Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(const struct LDKCResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ *NONNULL_PTR orig); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_clone(const struct LDKC2Tuple_ChannelIdPublicKeyZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. + */ +struct LDKC2Tuple_ChannelIdPublicKeyZ C2Tuple_ChannelIdPublicKeyZ_new(struct LDKChannelId a, struct LDKPublicKey b); + +/** + * Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. + */ +void C2Tuple_ChannelIdPublicKeyZ_free(struct LDKC2Tuple_ChannelIdPublicKeyZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C2Tuple_ChannelIdPublicKeyZZ_free(struct LDKCVec_C2Tuple_ChannelIdPublicKeyZZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_ChannelIdZ_free(struct LDKCVec_ChannelIdZ _res); + +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_PublicKeyChannelIdZ C2Tuple_PublicKeyChannelIdZ_clone(const struct LDKC2Tuple_PublicKeyChannelIdZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_PublicKeyChannelIdZ from the contained elements. + */ +struct LDKC2Tuple_PublicKeyChannelIdZ C2Tuple_PublicKeyChannelIdZ_new(struct LDKPublicKey a, struct LDKChannelId b); + +/** + * Frees any resources used by the C2Tuple_PublicKeyChannelIdZ. + */ +void C2Tuple_PublicKeyChannelIdZ_free(struct LDKC2Tuple_PublicKeyChannelIdZ _res); + +/** + * Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ + */ +struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_some(struct LDKC2Tuple_PublicKeyChannelIdZ o); + +/** + * Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing nothing + */ +struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ, if we are in the Some state + */ +void COption_C2Tuple_PublicKeyChannelIdZZ_free(struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ _res); + +/** + * Creates a new COption_C2Tuple_PublicKeyChannelIdZZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ COption_C2Tuple_PublicKeyChannelIdZZ_clone(const struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. + */ +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o); + +/** + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. + */ +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. + */ +void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res); + +/** + * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the success state. + */ +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_ok(struct LDKOfferWithDerivedMetadataBuilder o); + +/** + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ in the error state. + */ +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_is_ok(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ. + */ +void CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_free(struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ _res); + +/** + * Creates a new CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ_clone(const struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ *NONNULL_PTR orig); + +/** + * Constructs a new COption_StrZ containing a crate::c_types::Str + */ +struct LDKCOption_StrZ COption_StrZ_some(struct LDKStr o); + +/** + * Constructs a new COption_StrZ containing nothing + */ +struct LDKCOption_StrZ COption_StrZ_none(void); + +/** + * Frees any resources associated with the crate::c_types::Str, if we are in the Some state + */ +void COption_StrZ_free(struct LDKCOption_StrZ _res); + +/** + * Creates a new COption_StrZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCOption_StrZ COption_StrZ_clone(const struct LDKCOption_StrZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_DestinationZ_free(struct LDKCVec_DestinationZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the success state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_ok(struct LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ o); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ in the error state. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_is_ok(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ. + */ +void CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_free(struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ _res); + +/** + * Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the success state. + */ +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_ok(struct LDKThirtyTwoBytes o); + +/** + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ in the error state. + */ +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_err(struct LDKAPIError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ThirtyTwoBytesAPIErrorZ_is_ok(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ThirtyTwoBytesAPIErrorZ. + */ +void CResult_ThirtyTwoBytesAPIErrorZ_free(struct LDKCResult_ThirtyTwoBytesAPIErrorZ _res); + +/** + * Creates a new CResult_ThirtyTwoBytesAPIErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ThirtyTwoBytesAPIErrorZ CResult_ThirtyTwoBytesAPIErrorZ_clone(const struct LDKCResult_ThirtyTwoBytesAPIErrorZ *NONNULL_PTR orig); + /** * Creates a new tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. @@ -30851,6 +31918,22 @@ void C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ_free(struct LDKC2Tuple_Thirt */ void CVec_TransactionOutputsZ_free(struct LDKCVec_TransactionOutputsZ _res); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC2Tuple_boolboolZ C2Tuple_boolboolZ_clone(const struct LDKC2Tuple_boolboolZ *NONNULL_PTR orig); + +/** + * Creates a new C2Tuple_boolboolZ from the contained elements. + */ +struct LDKC2Tuple_boolboolZ C2Tuple_boolboolZ_new(bool a, bool b); + +/** + * Frees any resources used by the C2Tuple_boolboolZ. + */ +void C2Tuple_boolboolZ_free(struct LDKC2Tuple_boolboolZ _res); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -31247,6 +32330,53 @@ void CResult_CVec_StrZIOErrorZ_free(struct LDKCResult_CVec_StrZIOErrorZ _res); */ struct LDKCResult_CVec_StrZIOErrorZ CResult_CVec_StrZIOErrorZ_clone(const struct LDKCResult_CVec_StrZIOErrorZ *NONNULL_PTR orig); +/** + * Creates a new tuple which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKC3Tuple_StrStrStrZ C3Tuple_StrStrStrZ_clone(const struct LDKC3Tuple_StrStrStrZ *NONNULL_PTR orig); + +/** + * Creates a new C3Tuple_StrStrStrZ from the contained elements. + */ +struct LDKC3Tuple_StrStrStrZ C3Tuple_StrStrStrZ_new(struct LDKStr a, struct LDKStr b, struct LDKStr c); + +/** + * Frees any resources used by the C3Tuple_StrStrStrZ. + */ +void C3Tuple_StrStrStrZ_free(struct LDKC3Tuple_StrStrStrZ _res); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_C3Tuple_StrStrStrZZ_free(struct LDKCVec_C3Tuple_StrStrStrZZ _res); + +/** + * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the success state. + */ +struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_ok(struct LDKCVec_C3Tuple_StrStrStrZZ o); + +/** + * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the error state. + */ +struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_is_ok(const struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ. + */ +void CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ _res); + +/** + * Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_clone(const struct LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ *NONNULL_PTR orig); + /** * Frees the buffer pointed to by `data` if `datalen` is non-0. */ @@ -31305,30 +32435,44 @@ void CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(struct LDKCResul struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(const struct LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ *NONNULL_PTR orig); /** - * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state. + * Creates a new CResult_MonitorNameIOErrorZ in the success state. */ -struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(struct LDKUnsignedInvoiceRequest o); +struct LDKCResult_MonitorNameIOErrorZ CResult_MonitorNameIOErrorZ_ok(struct LDKMonitorName o); /** - * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state. + * Creates a new CResult_MonitorNameIOErrorZ in the error state. */ -struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(enum LDKBolt12SemanticError e); +struct LDKCResult_MonitorNameIOErrorZ CResult_MonitorNameIOErrorZ_err(enum LDKIOError e); /** * Checks if the given object is currently in the success state */ -bool CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(const struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR o); +bool CResult_MonitorNameIOErrorZ_is_ok(const struct LDKCResult_MonitorNameIOErrorZ *NONNULL_PTR o); /** - * Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ. + * Frees any resources used by the CResult_MonitorNameIOErrorZ. */ -void CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ _res); +void CResult_MonitorNameIOErrorZ_free(struct LDKCResult_MonitorNameIOErrorZ _res); /** - * Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. + * Creates a new CResult_UpdateNameIOErrorZ in the success state. */ -struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(const struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ *NONNULL_PTR orig); +struct LDKCResult_UpdateNameIOErrorZ CResult_UpdateNameIOErrorZ_ok(struct LDKUpdateName o); + +/** + * Creates a new CResult_UpdateNameIOErrorZ in the error state. + */ +struct LDKCResult_UpdateNameIOErrorZ CResult_UpdateNameIOErrorZ_err(enum LDKIOError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_UpdateNameIOErrorZ_is_ok(const struct LDKCResult_UpdateNameIOErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_UpdateNameIOErrorZ. + */ +void CResult_UpdateNameIOErrorZ_free(struct LDKCResult_UpdateNameIOErrorZ _res); /** * Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state. @@ -31422,6 +32566,32 @@ bool CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(co */ void CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(struct LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ _res); +/** + * Creates a new CResult_InvoiceRequestDecodeErrorZ in the success state. + */ +struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_ok(struct LDKInvoiceRequest o); + +/** + * Creates a new CResult_InvoiceRequestDecodeErrorZ in the error state. + */ +struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InvoiceRequestDecodeErrorZ_is_ok(const struct LDKCResult_InvoiceRequestDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InvoiceRequestDecodeErrorZ. + */ +void CResult_InvoiceRequestDecodeErrorZ_free(struct LDKCResult_InvoiceRequestDecodeErrorZ _res); + +/** + * Creates a new CResult_InvoiceRequestDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InvoiceRequestDecodeErrorZ CResult_InvoiceRequestDecodeErrorZ_clone(const struct LDKCResult_InvoiceRequestDecodeErrorZ *NONNULL_PTR orig); + /** * Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. */ @@ -34524,6 +35694,188 @@ void CResult_ChannelIdDecodeErrorZ_free(struct LDKCResult_ChannelIdDecodeErrorZ */ struct LDKCResult_ChannelIdDecodeErrorZ CResult_ChannelIdDecodeErrorZ_clone(const struct LDKCResult_ChannelIdDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_ok(struct LDKInitFeatures o); + +/** + * Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_InitFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. + */ +void CResult_InitFeaturesDecodeErrorZ_free(struct LDKCResult_InitFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_InitFeaturesDecodeErrorZ CResult_InitFeaturesDecodeErrorZ_clone(const struct LDKCResult_InitFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_ok(struct LDKChannelFeatures o); + +/** + * Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. + */ +void CResult_ChannelFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_ChannelFeaturesDecodeErrorZ CResult_ChannelFeaturesDecodeErrorZ_clone(const struct LDKCResult_ChannelFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_ok(struct LDKNodeFeatures o); + +/** + * Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_NodeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. + */ +void CResult_NodeFeaturesDecodeErrorZ_free(struct LDKCResult_NodeFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_NodeFeaturesDecodeErrorZ CResult_NodeFeaturesDecodeErrorZ_clone(const struct LDKCResult_NodeFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt11InvoiceFeatures o); + +/** + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. + */ +void CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(struct LDKBolt12InvoiceFeatures o); + +/** + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. + */ +void CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(const struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_ok(struct LDKBlindedHopFeatures o); + +/** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. + */ +void CResult_BlindedHopFeaturesDecodeErrorZ_free(struct LDKCResult_BlindedHopFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ CResult_BlindedHopFeaturesDecodeErrorZ_clone(const struct LDKCResult_BlindedHopFeaturesDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. + */ +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_ok(struct LDKChannelTypeFeatures o); + +/** + * Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. + */ +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ CResult_ChannelTypeFeaturesDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(const struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. + */ +void CResult_ChannelTypeFeaturesDecodeErrorZ_free(struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ _res); + +/** + * Creates a new CResult_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 tuple which has the same data as `orig` * but with all dynamically-allocated buffers duplicated in new buffers. @@ -34675,32 +36027,6 @@ void CResult_PaymentContextDecodeErrorZ_free(struct LDKCResult_PaymentContextDec */ struct LDKCResult_PaymentContextDecodeErrorZ CResult_PaymentContextDecodeErrorZ_clone(const struct LDKCResult_PaymentContextDecodeErrorZ *NONNULL_PTR orig); -/** - * Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state. - */ -struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_ok(struct LDKUnknownPaymentContext o); - -/** - * Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state. - */ -struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_err(struct LDKDecodeError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_UnknownPaymentContextDecodeErrorZ_is_ok(const struct LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ. - */ -void CResult_UnknownPaymentContextDecodeErrorZ_free(struct LDKCResult_UnknownPaymentContextDecodeErrorZ _res); - -/** - * Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_UnknownPaymentContextDecodeErrorZ CResult_UnknownPaymentContextDecodeErrorZ_clone(const struct LDKCResult_UnknownPaymentContextDecodeErrorZ *NONNULL_PTR orig); - /** * Creates a new CResult_Bolt12OfferContextDecodeErrorZ in the success state. */ @@ -34805,6 +36131,63 @@ void CResult_ResponderDecodeErrorZ_free(struct LDKCResult_ResponderDecodeErrorZ */ struct LDKCResult_ResponderDecodeErrorZ CResult_ResponderDecodeErrorZ_clone(const struct LDKCResult_ResponderDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_OnionMessagePathNoneZ in the success state. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_ok(struct LDKOnionMessagePath o); + +/** + * Creates a new CResult_OnionMessagePathNoneZ in the error state. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_OnionMessagePathNoneZ_is_ok(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_OnionMessagePathNoneZ. + */ +void CResult_OnionMessagePathNoneZ_free(struct LDKCResult_OnionMessagePathNoneZ _res); + +/** + * Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_OnionMessagePathNoneZ CResult_OnionMessagePathNoneZ_clone(const struct LDKCResult_OnionMessagePathNoneZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. + */ +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_ok(struct LDKCVec_BlindedMessagePathZ o); + +/** + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. + */ +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_err(void); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_CVec_BlindedMessagePathZNoneZ_is_ok(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. + */ +void CResult_CVec_BlindedMessagePathZNoneZ_free(struct LDKCResult_CVec_BlindedMessagePathZNoneZ _res); + +/** + * Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_CVec_BlindedMessagePathZNoneZ CResult_CVec_BlindedMessagePathZNoneZ_clone(const struct LDKCResult_CVec_BlindedMessagePathZNoneZ *NONNULL_PTR orig); + +/** + * Frees the buffer pointed to by `data` if `datalen` is non-0. + */ +void CVec_MessageForwardNodeZ_free(struct LDKCVec_MessageForwardNodeZ _res); + /** * Constructs a new COption_MessageContextZ containing a crate::lightning::blinded_path::message::MessageContext */ @@ -34977,32 +36360,6 @@ struct LDKCResult_BlindedHopDecodeErrorZ CResult_BlindedHopDecodeErrorZ_clone(co */ void CVec_PhantomRouteHintsZ_free(struct LDKCVec_PhantomRouteHintsZ _res); -/** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. - */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(struct LDKBolt11Invoice o); - -/** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. - */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_err(struct LDKSignOrCreationError e); - -/** - * Checks if the given object is currently in the success state - */ -bool CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR o); - -/** - * Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. - */ -void CResult_Bolt11InvoiceSignOrCreationErrorZ_free(struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ _res); - -/** - * Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` - * but with all dynamically-allocated buffers duplicated in new buffers. - */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(const struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ *NONNULL_PTR orig); - /** * Creates a new CResult_InvoiceErrorDecodeErrorZ in the success state. */ @@ -35473,6 +36830,58 @@ void CResult_OffersContextDecodeErrorZ_free(struct LDKCResult_OffersContextDecod */ struct LDKCResult_OffersContextDecodeErrorZ CResult_OffersContextDecodeErrorZ_clone(const struct LDKCResult_OffersContextDecodeErrorZ *NONNULL_PTR orig); +/** + * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the success state. + */ +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_ok(struct LDKAsyncPaymentsContext o); + +/** + * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the error state. + */ +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_AsyncPaymentsContextDecodeErrorZ_is_ok(const struct LDKCResult_AsyncPaymentsContextDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_AsyncPaymentsContextDecodeErrorZ. + */ +void CResult_AsyncPaymentsContextDecodeErrorZ_free(struct LDKCResult_AsyncPaymentsContextDecodeErrorZ _res); + +/** + * Creates a new CResult_AsyncPaymentsContextDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ CResult_AsyncPaymentsContextDecodeErrorZ_clone(const struct LDKCResult_AsyncPaymentsContextDecodeErrorZ *NONNULL_PTR orig); + +/** + * Creates a new CResult_DNSResolverContextDecodeErrorZ in the success state. + */ +struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_ok(struct LDKDNSResolverContext o); + +/** + * Creates a new CResult_DNSResolverContextDecodeErrorZ in the error state. + */ +struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_err(struct LDKDecodeError e); + +/** + * Checks if the given object is currently in the success state + */ +bool CResult_DNSResolverContextDecodeErrorZ_is_ok(const struct LDKCResult_DNSResolverContextDecodeErrorZ *NONNULL_PTR o); + +/** + * Frees any resources used by the CResult_DNSResolverContextDecodeErrorZ. + */ +void CResult_DNSResolverContextDecodeErrorZ_free(struct LDKCResult_DNSResolverContextDecodeErrorZ _res); + +/** + * Creates a new CResult_DNSResolverContextDecodeErrorZ which has the same data as `orig` + * but with all dynamically-allocated buffers duplicated in new buffers. + */ +struct LDKCResult_DNSResolverContextDecodeErrorZ CResult_DNSResolverContextDecodeErrorZ_clone(const struct LDKCResult_DNSResolverContextDecodeErrorZ *NONNULL_PTR orig); + /** * Frees any resources used by the APIError */ @@ -35693,6 +37102,23 @@ bool verify(struct LDKu8slice msg, struct LDKStr sig, struct LDKPublicKey pk); */ void KVStore_free(struct LDKKVStore this_ptr); +/** + * Calls the free function if one is set + */ +void MigratableKVStore_free(struct LDKMigratableKVStore this_ptr); + +/** + * Migrates all data from one store to another. + * + * This operation assumes that `target_store` is empty, i.e., any data present under copied keys + * might get overriden. User must ensure `source_store` is not modified during operation, + * otherwise no consistency guarantees can be given. + * + * Will abort and return an error if any IO operation fails. Note that in this case the + * `target_store` might get left in an intermediate state. + */ +struct LDKCResult_NoneIOErrorZ migrate_kv_store_data(struct LDKMigratableKVStore *NONNULL_PTR source_store, struct LDKMigratableKVStore *NONNULL_PTR target_store); + /** * Calls the free function if one is set */ @@ -35774,6 +37200,58 @@ MUST_USE_RES struct LDKCResult_NoneIOErrorZ MonitorUpdatingPersister_cleanup_sta */ struct LDKPersist MonitorUpdatingPersister_as_Persist(const struct LDKMonitorUpdatingPersister *NONNULL_PTR this_arg); +/** + * Frees any resources used by the MonitorName, if is_owned is set and inner is non-NULL. + */ +void MonitorName_free(struct LDKMonitorName this_obj); + +/** + * Constructs a [`MonitorName`], after verifying that an [`OutPoint`] can + * be formed from the given `name`. + * This method is useful if you have a String and you want to verify that + * it's a valid storage key for a channel monitor. + */ +MUST_USE_RES struct LDKCResult_MonitorNameIOErrorZ MonitorName_new(struct LDKStr name); + +/** + * Convert this monitor name to a str. + * This method is particularly useful when you need to use the monitor name + * as a key in a key-value store or when logging. + */ +MUST_USE_RES struct LDKStr MonitorName_as_str(const struct LDKMonitorName *NONNULL_PTR this_arg); + +/** + * Frees any resources used by the UpdateName, if is_owned is set and inner is non-NULL. + */ +void UpdateName_free(struct LDKUpdateName this_obj); + +uint64_t UpdateName_get_a(const struct LDKUpdateName *NONNULL_PTR this_ptr); + +void UpdateName_set_a(struct LDKUpdateName *NONNULL_PTR this_ptr, uint64_t val); + +/** + * Constructs an [`UpdateName`], after verifying that an update sequence ID + * can be derived from the given `name`. + */ +MUST_USE_RES struct LDKCResult_UpdateNameIOErrorZ UpdateName_new(struct LDKStr name); + +/** + * Convert this update name to a string slice. + * + * This method is particularly useful when you need to use the update name + * as part of a key in a key-value store or when logging. + * + * # Examples + * + * ``` + * use lightning::util::persist::UpdateName; + * + * let update_name = UpdateName::from(42); + * assert_eq!(update_name.as_str(), \"42\"); + * ``` + */ +MUST_USE_RES struct LDKStr UpdateName_as_str(const struct LDKUpdateName *NONNULL_PTR this_arg); + /** * Creates a copy of the ShortChannelIdError */ @@ -37542,34 +39020,6 @@ bool UserConfig_get_accept_intercept_htlcs(const struct LDKUserConfig *NONNULL_P */ void UserConfig_set_accept_intercept_htlcs(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); -/** - * If this is set to `false`, when receiving a keysend payment we'll fail it if it has multiple - * parts. If this is set to `true`, we'll accept the payment. - * - * Setting this to `true` will break backwards compatibility upon downgrading to an LDK - * version prior to 0.0.116 while receiving an MPP keysend. If we have already received an MPP - * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. - * - * Default value: `false` - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ -bool UserConfig_get_accept_mpp_keysend(const struct LDKUserConfig *NONNULL_PTR this_ptr); - -/** - * If this is set to `false`, when receiving a keysend payment we'll fail it if it has multiple - * parts. If this is set to `true`, we'll accept the payment. - * - * Setting this to `true` will break backwards compatibility upon downgrading to an LDK - * version prior to 0.0.116 while receiving an MPP keysend. If we have already received an MPP - * keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. - * - * Default value: `false` - * - * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager - */ -void UserConfig_set_accept_mpp_keysend(struct LDKUserConfig *NONNULL_PTR this_ptr, bool val); - /** * If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. * @@ -37607,7 +39057,7 @@ void UserConfig_set_manually_handle_bolt12_invoices(struct LDKUserConfig *NONNUL /** * 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, bool accept_intercept_htlcs_arg, bool accept_mpp_keysend_arg, bool manually_handle_bolt12_invoices_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, bool manually_handle_bolt12_invoices_arg); /** * Creates a copy of the UserConfig @@ -38020,11 +39470,9 @@ void ChannelMonitorUpdate_free(struct LDKChannelMonitorUpdate this_obj); * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given * ChannelMonitor when ChannelManager::channel_monitor_updated is called. * - * The only instances we allow where update_id values are not strictly increasing have a - * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that - * will force close the channel by broadcasting the latest commitment transaction or - * special post-force-close updates, like providing preimages necessary to claim outputs on the - * broadcast commitment transaction. See its docs for more details. + * Note that for [`ChannelMonitorUpdate`]s generated on LDK versions prior to 0.1 after the + * channel was closed, this value may be [`u64::MAX`]. In that case, multiple updates may + * appear with the same ID, and all should be replayed. * * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ @@ -38039,11 +39487,9 @@ uint64_t ChannelMonitorUpdate_get_update_id(const struct LDKChannelMonitorUpdate * [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given * ChannelMonitor when ChannelManager::channel_monitor_updated is called. * - * The only instances we allow where update_id values are not strictly increasing have a - * special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that - * will force close the channel by broadcasting the latest commitment transaction or - * special post-force-close updates, like providing preimages necessary to claim outputs on the - * broadcast commitment transaction. See its docs for more details. + * Note that for [`ChannelMonitorUpdate`]s generated on LDK versions prior to 0.1 after the + * channel was closed, this value may be [`u64::MAX`]. In that case, multiple updates may + * appear with the same ID, and all should be replayed. * * [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress */ @@ -38283,6 +39729,8 @@ MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelMonitor_update_monitor(const str /** * Gets the update_id from the latest ChannelMonitorUpdate which was applied to this * ChannelMonitor. + * + * Note that for channels closed prior to LDK 0.1, this may return [`u64::MAX`]. */ MUST_USE_RES uint64_t ChannelMonitor_get_latest_update_id(const struct LDKChannelMonitor *NONNULL_PTR this_arg); @@ -38332,7 +39780,7 @@ MUST_USE_RES struct LDKCVec_MonitorEventZ ChannelMonitor_get_and_clear_pending_m * [`SpendableOutputs`]: crate::events::Event::SpendableOutputs * [`BumpTransaction`]: crate::events::Event::BumpTransaction */ -MUST_USE_RES struct LDKCResult_NoneReplayEventZ ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler); +MUST_USE_RES struct LDKCResult_NoneReplayEventZ ChannelMonitor_process_pending_events(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKEventHandler *NONNULL_PTR handler, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the counterparty's initial commitment transaction. The returned commitment @@ -38528,12 +39976,20 @@ MUST_USE_RES struct LDKCVec_SpendableOutputDescriptorZ ChannelMonitor_get_spenda /** * Checks if the monitor is fully resolved. Resolved monitor is one that has claimed all of - * its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set). + * its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set) and + * which does not have any payment preimages for HTLCs which are still pending on other + * channels. + * + * Additionally may update state to track when the balances set became empty. * - * This function returns true only if [`Self::get_claimable_balances`] has been empty for at least + * This function returns a tuple of two booleans, the first indicating whether the monitor is + * fully resolved, and the second whether the monitor needs persistence to ensure it is + * reliably marked as resolved within 4032 blocks. + * + * The first boolean is true only if [`Self::get_claimable_balances`] has been empty for at least * 4032 blocks as an additional protection against any bugs resulting in spuriously empty balance sets. */ -MUST_USE_RES bool ChannelMonitor_is_fully_resolved(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); +MUST_USE_RES struct LDKC2Tuple_boolboolZ ChannelMonitor_check_and_update_full_resolution_status(const struct LDKChannelMonitor *NONNULL_PTR this_arg, const struct LDKLogger *NONNULL_PTR logger); /** * Gets the balances in this channel which are either claimable by us if we were to @@ -38690,7 +40146,7 @@ bool InboundHTLCErr_eq(const struct LDKInboundHTLCErr *NONNULL_PTR a, const stru * * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable */ -struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(const struct LDKUpdateAddHTLC *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, uint32_t cur_height, bool accept_mpp_keysend, bool allow_skimmed_fees); +struct LDKCResult_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(const struct LDKUpdateAddHTLC *NONNULL_PTR msg, struct LDKNodeSigner node_signer, struct LDKLogger logger, uint32_t cur_height, bool allow_skimmed_fees); /** * Frees any resources used by the PendingHTLCRouting @@ -38715,7 +40171,7 @@ struct LDKPendingHTLCRouting PendingHTLCRouting_receive(struct LDKFinalOnionHopD /** * Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting */ -struct LDKPendingHTLCRouting PendingHTLCRouting_receive_keysend(struct LDKFinalOnionHopData payment_data, struct LDKThirtyTwoBytes payment_preimage, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error); +struct LDKPendingHTLCRouting PendingHTLCRouting_receive_keysend(struct LDKFinalOnionHopData payment_data, struct LDKThirtyTwoBytes payment_preimage, struct LDKCOption_CVec_u8ZZ payment_metadata, uint32_t incoming_cltv_expiry, struct LDKCVec_C2Tuple_u64CVec_u8ZZZ custom_tlvs, bool requires_blinded_error, bool has_recipient_created_payment_secret); /** * Frees any resources used by the BlindedForward, if is_owned is set and inner is non-NULL. @@ -38949,6 +40405,17 @@ uint64_t BlindedFailure_hash(const enum LDKBlindedFailure *NONNULL_PTR o); */ bool BlindedFailure_eq(const enum LDKBlindedFailure *NONNULL_PTR a, const enum LDKBlindedFailure *NONNULL_PTR b); +/** + * Calls the free function if one is set + */ +void Verification_free(struct LDKVerification this_ptr); + +/** + * Constructs a new Verification which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned Verification must be freed before this_arg is + */ +struct LDKVerification UnauthenticatedReceiveTlvs_as_Verification(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_arg); + /** * Frees any resources used by the FailureCode */ @@ -39119,7 +40586,7 @@ struct LDKPhantomRouteHints PhantomRouteHints_clone(const struct LDKPhantomRoute * [`block_disconnected`]: chain::Listen::block_disconnected * [`params.best_block.block_hash`]: chain::BestBlock::block_hash */ -MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params, uint32_t current_timestamp); +MUST_USE_RES struct LDKChannelManager ChannelManager_new(struct LDKFeeEstimator fee_est, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKMessageRouter message_router, struct LDKLogger logger, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKUserConfig config, struct LDKChainParameters params, uint32_t current_timestamp); /** * Gets the current configuration applied to all new channels. @@ -39305,14 +40772,8 @@ void ChannelManager_force_close_all_channels_broadcasting_latest_txn(const struc void ChannelManager_force_close_all_channels_without_broadcasting_txn(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKStr error_message); /** - * Sends a payment along a given route. - * - * This method is *DEPRECATED*, use [`Self::send_payment`] instead. If you wish to fix the - * route for a payment, do so by matching the [`PaymentId`] passed to - * [`Router::find_route_with_id`]. - * - * Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] - * fields for more info. + * Sends a payment to the route found using the provided [`RouteParameters`], retrying failed + * payment paths based on the provided `Retry`. * * May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via * [`PeerManager::process_events`]). @@ -39320,9 +40781,9 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru * # Avoiding Duplicate Payments * * 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`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a + * method will error with [`RetryableSendFailure::DuplicatePayment`]. Note, however, that once a + * payment is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of + * an [`Event::PaymentSent`] or [`Event::PaymentFailed`]) 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 @@ -39336,38 +40797,40 @@ void ChannelManager_force_close_all_channels_without_broadcasting_txn(const stru * using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See * [`ChannelManager::list_recent_payments`] for more information. * - * # Possible Error States on [`PaymentSendFailure`] + * Routes are automatically found using the [`Router] provided on startup. To fix a route for a + * particular payment, match the [`PaymentId`] passed to [`Router::find_route_with_id`]. * - * Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with - * each entry matching the corresponding-index entry in the route paths, see - * [`PaymentSendFailure`] for more info. - * - * In general, a path may raise: - * * [`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 as it has been - * closed, doesn't exist, or the peer is currently disconnected. - * * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the - * relevant updates. - * - * Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been - * irrevocably committed to on our end. In such a case, do NOT retry the payment with a - * different route unless you intend to pay twice! - * - * [`RouteHop`]: crate::routing::router::RouteHop * [`Event::PaymentSent`]: events::Event::PaymentSent * [`Event::PaymentFailed`]: events::Event::PaymentFailed * [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs * [`PeerManager::process_events`]: crate::ln::peer_handler::PeerManager::process_events * [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress */ -MUST_USE_RES struct LDKCResult_NonePaymentSendFailureZ ChannelManager_send_payment_with_route(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKRoute route, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); +MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** - * Similar to [`ChannelManager::send_payment_with_route`], but will automatically find a route based on - * `route_params` and retry failed payment paths based on `retry_strategy`. + * Pays the [`Bolt12Invoice`] associated with the `payment_id` encoded in its `payer_metadata`. + * + * The invoice's `payer_metadata` is used to authenticate that the invoice was indeed requested + * before attempting a payment. [`Bolt12PaymentError::UnexpectedInvoice`] is returned if this + * fails or if the encoded `payment_id` is not recognized. The latter may happen once the + * payment is no longer tracked because the payment was attempted after: + * - an invoice for the `payment_id` was already paid, + * - one full [timer tick] has elapsed since initially requesting the invoice when paying an + * offer, or + * - the refund corresponding to the invoice has already expired. + * + * To retry the payment, request another invoice using a new `payment_id`. + * + * Attempting to pay the same invoice twice while the first payment is still pending will + * result in a [`Bolt12PaymentError::DuplicateInvoice`]. + * + * Otherwise, either [`Event::PaymentSent`] or [`Event::PaymentFailed`] are used to indicate + * whether or not the payment was successful. + * + * [timer tick]: Self::timer_tick_occurred */ -MUST_USE_RES struct LDKCResult_NoneRetryableSendFailureZ ChannelManager_send_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); +MUST_USE_RES struct LDKCResult_NoneBolt12PaymentErrorZ ChannelManager_send_payment_for_bolt12_invoice(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKBolt12Invoice *NONNULL_PTR invoice, struct LDKCOption_OffersContextZ context); /** * Signals that no further attempts for the given payment should occur. Useful if you have a @@ -39405,33 +40868,26 @@ 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 - * 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. * - * [`send_payment`]: Self::send_payment - */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesPaymentSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRoute *NONNULL_PTR route, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id); - -/** - * Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route - * based on `route_params` and retry failed payment paths based on `retry_strategy`. + * See [`send_payment`] documentation for more details on the idempotency guarantees provided by + * the [`PaymentId`] key. * * See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous * payments. * + * [`send_payment`]: Self::send_payment * [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend */ -MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment_with_retry(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); +MUST_USE_RES struct LDKCResult_ThirtyTwoBytesRetryableSendFailureZ ChannelManager_send_spontaneous_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_ThirtyTwoBytesZ payment_preimage, struct LDKRecipientOnionFields recipient_onion, struct LDKThirtyTwoBytes payment_id, struct LDKRouteParameters route_params, struct LDKRetry retry_strategy); /** * Send a payment that is probing the given route for liquidity. We calculate the * [`PaymentHash`] of probes based on a static secret and a random [`PaymentId`], which allows * us to easily discern them from real payments. */ -MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); +MUST_USE_RES struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ ChannelManager_send_probe(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKPath path); /** * Sends payment probes over all paths of a route that would be used to pay the given @@ -39651,7 +41107,7 @@ void ChannelManager_process_pending_htlc_forwards(const struct LDKChannelManager * * Forgetting about stale outbound payments, either those that have already been fulfilled * or those awaiting an invoice that hasn't been delivered in the necessary amount of time. * The latter is determined using the system clock in `std` and the highest seen block time - * minus two hours in `no-std`. + * minus two hours in non-`std`. * * Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate * estimate fetches. @@ -39747,6 +41203,10 @@ MUST_USE_RES struct LDKPublicKey ChannelManager_get_our_node_id(const struct LDK * for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be * used to accept such channels. * + * NOTE: LDK makes no attempt to prevent the counterparty from using non-standard inputs which + * will prevent the funding transaction from being relayed on the bitcoin network and hence being + * confirmed. + * * [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest * [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id */ @@ -39774,6 +41234,118 @@ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_chann */ MUST_USE_RES struct LDKCResult_NoneAPIErrorZ ChannelManager_accept_inbound_channel_from_trusted_peer_0conf(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKChannelId *NONNULL_PTR temporary_channel_id, struct LDKPublicKey counterparty_node_id, struct LDKU128 user_channel_id); +/** + * When a call to a [`ChannelSigner`] method returns an error, this indicates that the signer + * is (temporarily) unavailable, and the operation should be retried later. + * + * This method allows for that retry - either checking for any signer-pending messages to be + * attempted in every channel, or in the specifically provided channel. + * + * [`ChannelSigner`]: crate::sign::ChannelSigner + */ +void ChannelManager_signer_unblocked(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKCOption_C2Tuple_PublicKeyChannelIdZZ channel_opt); + +/** + * Utility for creating a BOLT11 invoice that can be verified by [`ChannelManager`] without + * storing any additional state. It achieves this by including a [`PaymentSecret`] in the + * invoice which it uses to verify that the invoice has not expired and the payment amount is + * sufficient, reproducing the [`PaymentPreimage`] if applicable. + */ +MUST_USE_RES struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ ChannelManager_create_bolt11_invoice(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKBolt11InvoiceParameters params); + +/** + * Frees any resources used by the Bolt11InvoiceParameters, if is_owned is set and inner is non-NULL. + */ +void Bolt11InvoiceParameters_free(struct LDKBolt11InvoiceParameters this_obj); + +/** + * The amount for the invoice, if any. + */ +struct LDKCOption_u64Z Bolt11InvoiceParameters_get_amount_msats(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); + +/** + * The amount for the invoice, if any. + */ +void Bolt11InvoiceParameters_set_amount_msats(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u64Z val); + +/** + * The description for what the invoice is for, or hash of such description. + */ +struct LDKBolt11InvoiceDescription Bolt11InvoiceParameters_get_description(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); + +/** + * The description for what the invoice is for, or hash of such description. + */ +void Bolt11InvoiceParameters_set_description(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKBolt11InvoiceDescription val); + +/** + * The invoice expiration relative to its creation time. If not set, the invoice will expire in + * [`DEFAULT_EXPIRY_TIME`] by default. + * + * The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` + * builds, the highest block timestamp seen is used instead. In the latter case, use a long + * enough expiry to account for the average block time. + */ +struct LDKCOption_u32Z Bolt11InvoiceParameters_get_invoice_expiry_delta_secs(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); + +/** + * The invoice expiration relative to its creation time. If not set, the invoice will expire in + * [`DEFAULT_EXPIRY_TIME`] by default. + * + * The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` + * builds, the highest block timestamp seen is used instead. In the latter case, use a long + * enough expiry to account for the average block time. + */ +void Bolt11InvoiceParameters_set_invoice_expiry_delta_secs(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); + +/** + * The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be + * added as well to allow for up to a few new block confirmations during routing. + */ +struct LDKCOption_u16Z Bolt11InvoiceParameters_get_min_final_cltv_expiry_delta(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); + +/** + * The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use + * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. + * + * If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be + * added as well to allow for up to a few new block confirmations during routing. + */ +void Bolt11InvoiceParameters_set_min_final_cltv_expiry_delta(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_u16Z val); + +/** + * The payment hash used in the invoice. If not set, a payment hash will be generated using a + * preimage that can be reproduced by [`ChannelManager`] without storing any state. + * + * Uses the payment hash if set. 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 LDKCOption_ThirtyTwoBytesZ Bolt11InvoiceParameters_get_payment_hash(const struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr); + +/** + * The payment hash used in the invoice. If not set, a payment hash will be generated using a + * preimage that can be reproduced by [`ChannelManager`] without storing any state. + * + * Uses the payment hash if set. 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. + */ +void Bolt11InvoiceParameters_set_payment_hash(struct LDKBolt11InvoiceParameters *NONNULL_PTR this_ptr, struct LDKCOption_ThirtyTwoBytesZ val); + +/** + * Constructs a new Bolt11InvoiceParameters given each field + */ +MUST_USE_RES struct LDKBolt11InvoiceParameters Bolt11InvoiceParameters_new(struct LDKCOption_u64Z amount_msats_arg, struct LDKBolt11InvoiceDescription description_arg, struct LDKCOption_u32Z invoice_expiry_delta_secs_arg, struct LDKCOption_u16Z min_final_cltv_expiry_delta_arg, struct LDKCOption_ThirtyTwoBytesZ payment_hash_arg); + +/** + * Creates a "default" Bolt11InvoiceParameters. See struct and individual field documentaiton for details on which values are used. + */ +MUST_USE_RES struct LDKBolt11InvoiceParameters Bolt11InvoiceParameters_default(void); + /** * Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the * [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer's @@ -39812,7 +41384,7 @@ MUST_USE_RES struct LDKCResult_OfferWithDerivedMetadataBuilderBolt12SemanticErro * See [Avoiding Duplicate Payments] for other requirements once the payment has been sent. * * The builder will have the provided expiration set. Any changes to the expiration on the - * returned builder will not be honored by [`ChannelManager`]. For `no-std`, the highest seen + * returned builder will not be honored by [`ChannelManager`]. For non-`std`, the highest seen * block time minus two hours is used for the current time when determining if the refund has * expired. * @@ -39886,7 +41458,7 @@ MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12Semant * # Limitations * * Requires a direct connection to an introduction node in [`Offer::paths`] or to - * [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding + * [`Offer::issuer_signing_pubkey`], if empty. A similar restriction applies to the responding * [`Bolt12Invoice::payment_paths`]. * * # Errors @@ -39919,9 +41491,9 @@ MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_o * # Limitations * * Requires a direct connection to an introduction node in [`Refund::paths`] or to - * [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each - * node meeting the aforementioned criteria, but there's no guarantee that they will be - * received and no retries will be made. + * [`Refund::payer_signing_pubkey`], if empty. This request is best effort; an invoice will be + * sent to each node meeting the aforementioned criteria, but there's no guarantee that they + * will be received and no retries will be made. * * # Errors * @@ -39934,6 +41506,50 @@ MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ ChannelManager_pay_for_o */ MUST_USE_RES struct LDKCResult_Bolt12InvoiceBolt12SemanticErrorZ ChannelManager_request_refund_payment(const struct LDKChannelManager *NONNULL_PTR this_arg, const struct LDKRefund *NONNULL_PTR refund); +/** + * Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS + * resolver(s) at `dns_resolvers` which resolve names according to bLIP 32. + * + * If the wallet supports paying on-chain schemes, you should instead use + * [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by + * implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to + * your normal URI handling. + * + * If `max_total_routing_fee_msat` is not specified, the default from + * [`RouteParameters::from_payment_params_and_value`] is applied. + * + * # Payment + * + * The provided `payment_id` is used to ensure that only one invoice is paid for the request + * when received. See [Avoiding Duplicate Payments] for other requirements once the payment has + * been sent. + * + * To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the + * invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the + * payment will fail with an [`Event::InvoiceRequestFailed`]. + * + * # Privacy + * + * For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] + * to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the + * docs of the parameterized [`Router`], which implements [`MessageRouter`]. + * + * # Limitations + * + * Requires a direct connection to the given [`Destination`] as well as an introduction node in + * [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to + * the responding [`Bolt12Invoice::payment_paths`]. + * + * # Errors + * + * Errors if: + * - a duplicate `payment_id` is provided given the caveats in the aforementioned link, + * + * [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths + * [Avoiding Duplicate Payments]: #avoiding-duplicate-payments + */ +MUST_USE_RES struct LDKCResult_NoneNoneZ ChannelManager_pay_for_offer_from_human_readable_name(const struct LDKChannelManager *NONNULL_PTR this_arg, struct LDKHumanReadableName name, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id, struct LDKRetry retry_strategy, struct LDKCOption_u64Z max_total_routing_fee_msat, struct LDKCVec_DestinationZ dns_resolvers); + /** * Gets a payment secret and payment hash for use in an invoice given to a third party wishing * to pay us. @@ -40149,6 +41765,12 @@ struct LDKOffersMessageHandler ChannelManager_as_OffersMessageHandler(const stru */ struct LDKAsyncPaymentsMessageHandler ChannelManager_as_AsyncPaymentsMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); +/** + * Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is + */ +struct LDKDNSResolverMessageHandler ChannelManager_as_DNSResolverMessageHandler(const struct LDKChannelManager *NONNULL_PTR this_arg); + /** * Constructs a new NodeIdLookUp which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned NodeIdLookUp must be freed before this_arg is @@ -40317,6 +41939,18 @@ const struct LDKRouter *ChannelManagerReadArgs_get_router(const struct LDKChanne */ void ChannelManagerReadArgs_set_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKRouter val); +/** + * The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, + * [`Refund`]s, and any reply paths. + */ +const struct LDKMessageRouter *ChannelManagerReadArgs_get_message_router(const struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr); + +/** + * The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, + * [`Refund`]s, and any reply paths. + */ +void ChannelManagerReadArgs_set_message_router(struct LDKChannelManagerReadArgs *NONNULL_PTR this_ptr, struct LDKMessageRouter val); + /** * The Logger for use in the ChannelManager and which may be used to log information during * deserialization. @@ -40346,7 +41980,7 @@ void ChannelManagerReadArgs_set_default_config(struct LDKChannelManagerReadArgs * HashMap for you. This is primarily useful for C bindings where it is not practical to * populate a HashMap directly from C. */ -MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); +MUST_USE_RES struct LDKChannelManagerReadArgs ChannelManagerReadArgs_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKSignerProvider signer_provider, struct LDKFeeEstimator fee_estimator, struct LDKWatch chain_monitor, struct LDKBroadcasterInterface tx_broadcaster, struct LDKRouter router, struct LDKMessageRouter message_router, struct LDKLogger logger, struct LDKUserConfig default_config, struct LDKCVec_ChannelMonitorZ channel_monitors); /** * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write @@ -41410,42 +43044,12 @@ struct LDKCOption_u32Z ChannelDetails_get_feerate_sat_per_1000_weight(const stru */ void ChannelDetails_set_feerate_sat_per_1000_weight(struct LDKChannelDetails *NONNULL_PTR this_ptr, struct LDKCOption_u32Z val); -/** - * Our total balance. This is the amount we would get if we close the channel. - * This value is not exact. Due to various in-flight changes and feerate changes, exactly this - * amount is not likely to be recoverable on close. - * - * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose - * balance is not available for inclusion in new outbound HTLCs). This further does not include - * any pending outgoing HTLCs which are awaiting some other resolution to be sent. - * This does not consider any on-chain fees. - * - * See also [`ChannelDetails::outbound_capacity_msat`] - */ -uint64_t ChannelDetails_get_balance_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); - -/** - * 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 - * amount is not likely to be recoverable on close. - * - * This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose - * balance is not available for inclusion in new outbound HTLCs). This further does not include - * any pending outgoing HTLCs which are awaiting some other resolution to be sent. - * This does not consider any on-chain fees. - * - * See also [`ChannelDetails::outbound_capacity_msat`] - */ -void ChannelDetails_set_balance_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); - /** * The available outbound capacity for sending HTLCs to the remote peer. This does not include * any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. * - * See also [`ChannelDetails::balance_msat`] - * * This value is not exact. Due to various in-flight changes, feerate changes, and our * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we * should be able to spend nearly this amount. @@ -41458,8 +43062,6 @@ uint64_t ChannelDetails_get_outbound_capacity_msat(const struct LDKChannelDetail * available for inclusion in new outbound HTLCs). This further does not include any pending * outgoing HTLCs which are awaiting some other resolution to be sent. * - * See also [`ChannelDetails::balance_msat`] - * * This value is not exact. Due to various in-flight changes, feerate changes, and our * conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we * should be able to spend nearly this amount. @@ -41472,8 +43074,8 @@ void ChannelDetails_set_outbound_capacity_msat(struct LDKChannelDetails *NONNULL * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us * to use a limit as close as possible to the HTLC limit we can currently send. * - * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], - * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and + * [`ChannelDetails::outbound_capacity_msat`]. */ uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChannelDetails *NONNULL_PTR this_ptr); @@ -41483,8 +43085,8 @@ uint64_t ChannelDetails_get_next_outbound_htlc_limit_msat(const struct LDKChanne * the current state and per-HTLC limit(s). This is intended for use when routing, allowing us * to use a limit as close as possible to the HTLC limit we can currently send. * - * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], - * [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. + * See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and + * [`ChannelDetails::outbound_capacity_msat`]. */ void ChannelDetails_set_next_outbound_htlc_limit_msat(struct LDKChannelDetails *NONNULL_PTR this_ptr, uint64_t val); @@ -41743,7 +43345,7 @@ void ChannelDetails_set_pending_outbound_htlcs(struct LDKChannelDetails *NONNULL * Note that channel_type_arg (or a relevant inner pointer) may be NULL or all-0s to represent None * Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKChannelId channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t balance_msat_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t next_outbound_htlc_minimum_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, struct LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg, bool is_usable_arg, bool is_announced_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg, struct LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg, struct LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg); +MUST_USE_RES struct LDKChannelDetails ChannelDetails_new(struct LDKChannelId channel_id_arg, struct LDKChannelCounterparty counterparty_arg, struct LDKOutPoint funding_txo_arg, struct LDKChannelTypeFeatures channel_type_arg, struct LDKCOption_u64Z short_channel_id_arg, struct LDKCOption_u64Z outbound_scid_alias_arg, struct LDKCOption_u64Z inbound_scid_alias_arg, uint64_t channel_value_satoshis_arg, struct LDKCOption_u64Z unspendable_punishment_reserve_arg, struct LDKU128 user_channel_id_arg, struct LDKCOption_u32Z feerate_sat_per_1000_weight_arg, uint64_t outbound_capacity_msat_arg, uint64_t next_outbound_htlc_limit_msat_arg, uint64_t next_outbound_htlc_minimum_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, struct LDKCOption_ChannelShutdownStateZ channel_shutdown_state_arg, bool is_usable_arg, bool is_announced_arg, struct LDKCOption_u64Z inbound_htlc_minimum_msat_arg, struct LDKCOption_u64Z inbound_htlc_maximum_msat_arg, struct LDKChannelConfig config_arg, struct LDKCVec_InboundHTLCDetailsZ pending_inbound_htlcs_arg, struct LDKCVec_OutboundHTLCDetailsZ pending_outbound_htlcs_arg); /** * Creates a copy of the ChannelDetails @@ -41833,21 +43435,37 @@ struct LDKCResult_ChannelShutdownStateDecodeErrorZ ChannelShutdownState_read(str */ void ExpandedKey_free(struct LDKExpandedKey this_obj); +/** + * Generates a non-cryptographic 64-bit hash of the ExpandedKey. + */ +uint64_t ExpandedKey_hash(const struct LDKExpandedKey *NONNULL_PTR o); + +/** + * Creates a copy of the ExpandedKey + */ +struct LDKExpandedKey ExpandedKey_clone(const struct LDKExpandedKey *NONNULL_PTR orig); + +/** + * Checks if two ExpandedKeys 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 ExpandedKey_eq(const struct LDKExpandedKey *NONNULL_PTR a, const struct LDKExpandedKey *NONNULL_PTR b); + /** * Create a new [`ExpandedKey`] for generating an inbound payment hash and secret. * * It is recommended to cache this value and not regenerate it for each new inbound payment. */ -MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material)[32]); +MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(struct LDKThirtyTwoBytes key_material); /** * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without * a `ChannelManager`. * - * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then - * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not - * regenerate it for each new inbound payment. + * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key`]. It is recommended to + * cache this value and not regenerate it for each new inbound payment. * * `current_time` is a Unix timestamp representing the current time. * @@ -41855,7 +43473,7 @@ MUST_USE_RES struct LDKExpandedKey ExpandedKey_new(const uint8_t (*key_material) * on versions of LDK prior to 0.0.114. * * [phantom node payments]: crate::sign::PhantomKeysManager - * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material + * [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key */ struct LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ create(const struct LDKExpandedKey *NONNULL_PTR keys, struct LDKCOption_u64Z min_value_msat, uint32_t invoice_expiry_delta_secs, const struct LDKEntropySource *NONNULL_PTR entropy_source, uint64_t current_time, struct LDKCOption_u16Z min_final_cltv_expiry_delta); @@ -46068,6 +47686,13 @@ MUST_USE_RES struct LDKFinalOnionHopData FinalOnionHopData_new(struct LDKThirtyT */ struct LDKFinalOnionHopData FinalOnionHopData_clone(const struct LDKFinalOnionHopData *NONNULL_PTR orig); +/** + * Checks if two FinalOnionHopDatas 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 FinalOnionHopData_eq(const struct LDKFinalOnionHopData *NONNULL_PTR a, const struct LDKFinalOnionHopData *NONNULL_PTR b); + /** * Frees any resources used by the OnionPacket, if is_owned is set and inner is non-NULL. */ @@ -46781,6 +48406,12 @@ struct LDKOffersMessageHandler IgnoringMessageHandler_as_OffersMessageHandler(co */ struct LDKAsyncPaymentsMessageHandler IgnoringMessageHandler_as_AsyncPaymentsMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); +/** + * Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is + */ +struct LDKDNSResolverMessageHandler IgnoringMessageHandler_as_DNSResolverMessageHandler(const struct LDKIgnoringMessageHandler *NONNULL_PTR this_arg); + /** * Constructs a new CustomOnionMessageHandler which calls the relevant methods on this_arg. * This copies the `inner` pointer in this_arg and thus the returned CustomOnionMessageHandler must be freed before this_arg is @@ -47105,8 +48736,11 @@ MUST_USE_RES struct LDKCResult_boolPeerHandleErrorZ PeerManager_read_event(const * May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy * issues! * - * You don't have to call this function explicitly if you are using [`lightning-net-tokio`] - * or one of the other clients provided in our language bindings. + * This should be called any time we may have messages to send. It is automatically called by + * [`lightning-net-tokio`] after processing incoming messages, and by + * [`lightning-background-processor`] when channel state has changed. Therefore, If you are not + * using both [`lightning-net-tokio`] and [`lightning-background-processor`], you may need to call + * this function manually to prevent messages from being delayed. * * Note that if there are any other calls to this function waiting on lock(s) this may return * without doing any work. All available events that need handling will be handled before the @@ -48236,76 +49870,6 @@ MUST_USE_RES struct LDKCResult_TransactionNoneZ TrustedCommitmentTransaction_bui */ uint64_t get_commitment_transaction_number_obscure_factor(struct LDKPublicKey broadcaster_payment_basepoint, struct LDKPublicKey countersignatory_payment_basepoint, bool outbound_from_broadcaster); -/** - * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read - */ -struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); - -/** - * Read a InitFeatures from a byte array, created by InitFeatures_write - */ -struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); - -/** - * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read - */ -struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); - -/** - * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write - */ -struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); - -/** - * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read - */ -struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); - -/** - * Read a NodeFeatures from a byte array, created by NodeFeatures_write - */ -struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); - -/** - * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read - */ -struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj); - -/** - * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write - */ -struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser); - -/** - * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read - */ -struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj); - -/** - * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write - */ -struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser); - -/** - * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read - */ -struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); - -/** - * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write - */ -struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); - -/** - * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read - */ -struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); - -/** - * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write - */ -struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); - /** * Frees any resources used by the ShutdownScript, if is_owned is set and inner is non-NULL. */ @@ -48493,11 +50057,6 @@ struct LDKCVec_u8Z ChannelId_write(const struct LDKChannelId *NONNULL_PTR obj); */ struct LDKCResult_ChannelIdDecodeErrorZ ChannelId_read(struct LDKu8slice ser); -/** - * Get the string representation of a ChannelId object - */ -struct LDKStr ChannelId_to_str(const struct LDKChannelId *NONNULL_PTR o); - /** * 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. @@ -48537,8 +50096,7 @@ struct LDKStr ChannelId_to_str(const struct LDKChannelId *NONNULL_PTR o); * [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA * - * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not - * available and the current time is supplied by the caller. + *This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller. */ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); @@ -48579,8 +50137,7 @@ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(struc * [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash * [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels * - * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not - * available and the current time is supplied by the caller. + *This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller. */ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(struct LDKCOption_u64Z amt_msat, struct LDKCOption_ThirtyTwoBytesZ payment_hash, uint32_t invoice_expiry_delta_secs, struct LDKSha256 description_hash, struct LDKCVec_PhantomRouteHintsZ phantom_route_hints, struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u16Z min_final_cltv_expiry_delta, uint64_t duration_since_epoch); @@ -48601,7 +50158,7 @@ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_ * * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** * Utility to construct an invoice. Generally, unless you want to do something like a custom @@ -48621,34 +50178,32 @@ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelm * * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); - -/** - * See [`create_invoice_from_channelmanager_with_description_hash`] - * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not - * available and the current time is supplied by the caller. - */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, struct LDKLogger logger, enum LDKCurrency network, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint64_t duration_since_epoch, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * See [`create_invoice_from_channelmanager`] - * This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not - * available and the current time is supplied by the caller. + * See [`create_invoice_from_channelmanager`]. + * + * This version allows for providing custom [`PaymentHash`] and description hash 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 and want to set the + * description hash. */ -struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, 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 LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKSha256 description_hash, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * See [`create_invoice_from_channelmanager_and_duration_since_epoch`] + * See [`create_invoice_from_channelmanager`]. + * * 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 LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKNodeSigner node_signer, 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, struct LDKCOption_u16Z min_final_cltv_expiry_delta); +struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_payment_hash(const struct LDKChannelManager *NONNULL_PTR channelmanager, struct LDKCOption_u64Z amt_msat, struct LDKStr description, uint32_t invoice_expiry_delta_secs, struct LDKThirtyTwoBytes payment_hash, struct LDKCOption_u16Z min_final_cltv_expiry_delta); /** - * Builds the necessary parameters to pay or pre-flight probe the given zero-amount - * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or - * [`ChannelManager::send_preflight_probes`]. + * Builds the necessary parameters to pay or pre-flight probe the given variable-amount + * (also known as 'zero-amount') [`Bolt11Invoice`] using + * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. * * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the * same [`PaymentHash`] has never been paid before. @@ -48659,7 +50214,7 @@ struct LDKCResult_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelm * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes */ -struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_zero_amount_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat); +struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_variable_amount_invoice(const struct LDKBolt11Invoice *NONNULL_PTR invoice, uint64_t amount_msat); /** * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using @@ -48669,7 +50224,7 @@ struct LDKCResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNone * same [`PaymentHash`] has never been paid before. * * Will always succeed unless the invoice has no amount specified, in which case - * [`payment_parameters_from_zero_amount_invoice`] should be used. + * [`payment_parameters_from_variable_amount_invoice`] should be used. * * [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment * [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes @@ -48748,47 +50303,6 @@ enum LDKRetryableSendFailure RetryableSendFailure_onion_packet_size_exceeded(voi */ bool RetryableSendFailure_eq(const enum LDKRetryableSendFailure *NONNULL_PTR a, const enum LDKRetryableSendFailure *NONNULL_PTR b); -/** - * Frees any resources used by the PaymentSendFailure - */ -void PaymentSendFailure_free(struct LDKPaymentSendFailure this_ptr); - -/** - * Creates a copy of the PaymentSendFailure - */ -struct LDKPaymentSendFailure PaymentSendFailure_clone(const struct LDKPaymentSendFailure *NONNULL_PTR orig); - -/** - * Utility method to constructs a new ParameterError-variant PaymentSendFailure - */ -struct LDKPaymentSendFailure PaymentSendFailure_parameter_error(struct LDKAPIError a); - -/** - * Utility method to constructs a new PathParameterError-variant PaymentSendFailure - */ -struct LDKPaymentSendFailure PaymentSendFailure_path_parameter_error(struct LDKCVec_CResult_NoneAPIErrorZZ a); - -/** - * 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_duplicate_payment(void); - -/** - * Utility method to constructs a new PartialFailure-variant PaymentSendFailure - */ -struct LDKPaymentSendFailure PaymentSendFailure_partial_failure(struct LDKCVec_CResult_NoneAPIErrorZZ results, struct LDKRouteParameters failed_paths_retry, struct LDKThirtyTwoBytes payment_id); - -/** - * Checks if two PaymentSendFailures contain equal inner contents. - * This ignores pointers and is_owned flags and looks at the values in fields. - */ -bool PaymentSendFailure_eq(const struct LDKPaymentSendFailure *NONNULL_PTR a, const struct LDKPaymentSendFailure *NONNULL_PTR b); - /** * Frees any resources used by the Bolt12PaymentError */ @@ -48841,9 +50355,14 @@ struct LDKProbeSendFailure ProbeSendFailure_clone(const struct LDKProbeSendFailu struct LDKProbeSendFailure ProbeSendFailure_route_not_found(void); /** - * Utility method to constructs a new SendingFailed-variant ProbeSendFailure + * Utility method to constructs a new ParameterError-variant ProbeSendFailure */ -struct LDKProbeSendFailure ProbeSendFailure_sending_failed(struct LDKPaymentSendFailure a); +struct LDKProbeSendFailure ProbeSendFailure_parameter_error(struct LDKAPIError a); + +/** + * Utility method to constructs a new DuplicateProbe-variant ProbeSendFailure + */ +struct LDKProbeSendFailure ProbeSendFailure_duplicate_probe(void); /** * Checks if two ProbeSendFailures contain equal inner contents. @@ -49003,6 +50522,76 @@ struct LDKType Type_clone(const struct LDKType *NONNULL_PTR orig); */ void Type_free(struct LDKType this_ptr); +/** + * Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read + */ +struct LDKCVec_u8Z InitFeatures_write(const struct LDKInitFeatures *NONNULL_PTR obj); + +/** + * Read a InitFeatures from a byte array, created by InitFeatures_write + */ +struct LDKCResult_InitFeaturesDecodeErrorZ InitFeatures_read(struct LDKu8slice ser); + +/** + * Serialize the ChannelFeatures object into a byte array which can be read by ChannelFeatures_read + */ +struct LDKCVec_u8Z ChannelFeatures_write(const struct LDKChannelFeatures *NONNULL_PTR obj); + +/** + * Read a ChannelFeatures from a byte array, created by ChannelFeatures_write + */ +struct LDKCResult_ChannelFeaturesDecodeErrorZ ChannelFeatures_read(struct LDKu8slice ser); + +/** + * Serialize the NodeFeatures object into a byte array which can be read by NodeFeatures_read + */ +struct LDKCVec_u8Z NodeFeatures_write(const struct LDKNodeFeatures *NONNULL_PTR obj); + +/** + * Read a NodeFeatures from a byte array, created by NodeFeatures_write + */ +struct LDKCResult_NodeFeaturesDecodeErrorZ NodeFeatures_read(struct LDKu8slice ser); + +/** + * Serialize the Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read + */ +struct LDKCVec_u8Z Bolt11InvoiceFeatures_write(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR obj); + +/** + * Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write + */ +struct LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ Bolt11InvoiceFeatures_read(struct LDKu8slice ser); + +/** + * Serialize the Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read + */ +struct LDKCVec_u8Z Bolt12InvoiceFeatures_write(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR obj); + +/** + * Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write + */ +struct LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ Bolt12InvoiceFeatures_read(struct LDKu8slice ser); + +/** + * Serialize the BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read + */ +struct LDKCVec_u8Z BlindedHopFeatures_write(const struct LDKBlindedHopFeatures *NONNULL_PTR obj); + +/** + * Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write + */ +struct LDKCResult_BlindedHopFeaturesDecodeErrorZ BlindedHopFeatures_read(struct LDKu8slice ser); + +/** + * Serialize the ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read + */ +struct LDKCVec_u8Z ChannelTypeFeatures_write(const struct LDKChannelTypeFeatures *NONNULL_PTR obj); + +/** + * Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write + */ +struct LDKCResult_ChannelTypeFeaturesDecodeErrorZ ChannelTypeFeatures_read(struct LDKu8slice ser); + /** * Frees any resources used by the OfferId, if is_owned is set and inner is non-NULL. */ @@ -49060,8 +50649,8 @@ void OfferWithDerivedMetadataBuilder_free(struct LDKOfferWithDerivedMetadataBuil struct LDKOfferWithDerivedMetadataBuilder OfferWithDerivedMetadataBuilder_clone(const struct LDKOfferWithDerivedMetadataBuilder *NONNULL_PTR orig); /** - * Creates a new builder for an offer using the [`Offer::signing_pubkey`] for signing invoices. - * The associated secret key must be remembered while the offer is valid. + * Creates a new builder for an offer using the `signing_pubkey` for signing invoices. The + * associated secret key must be remembered while the offer is valid. * * Use a different pubkey per offer to avoid correlating offers. * @@ -49100,8 +50689,8 @@ MUST_USE_RES void OfferWithExplicitMetadataBuilder_chain(struct LDKOfferWithExpl MUST_USE_RES void OfferWithExplicitMetadataBuilder_amount_msats(struct LDKOfferWithExplicitMetadataBuilder this_arg, uint64_t amount_msats); /** - * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has - * already passed is valid and can be checked for using [`Offer::is_expired`]. + * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. + *Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. * * Successive calls to this method will override the previous setting. */ @@ -49123,7 +50712,7 @@ MUST_USE_RES void OfferWithExplicitMetadataBuilder_issuer(struct LDKOfferWithExp /** * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by - * private channels or if [`Offer::signing_pubkey`] is not a public node id. + * private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. * * Successive calls to this method will add another blinded path. Caller is responsible for not * adding duplicate paths. @@ -49147,7 +50736,7 @@ MUST_USE_RES struct LDKCResult_OfferBolt12SemanticErrorZ OfferWithExplicitMetada * Similar to [`OfferBuilder::new`] except, if [`OfferBuilder::path`] is called, the signing * pubkey is derived from the given [`ExpandedKey`] and [`Nonce`]. This provides recipient * privacy by using a different signing pubkey for each offer. Otherwise, the provided - * `node_id` is used for the signing pubkey. + * `node_id` is used for [`Offer::issuer_signing_pubkey`]. * * Also, sets the metadata when [`OfferBuilder::build`] is called such that it can be used by * [`InvoiceRequest::verify_using_metadata`] to determine if the request was produced for the @@ -49179,8 +50768,8 @@ MUST_USE_RES void OfferWithDerivedMetadataBuilder_chain(struct LDKOfferWithDeriv MUST_USE_RES void OfferWithDerivedMetadataBuilder_amount_msats(struct LDKOfferWithDerivedMetadataBuilder this_arg, uint64_t amount_msats); /** - * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has - * already passed is valid and can be checked for using [`Offer::is_expired`]. + * Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. + *Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. * * Successive calls to this method will override the previous setting. */ @@ -49202,7 +50791,7 @@ MUST_USE_RES void OfferWithDerivedMetadataBuilder_issuer(struct LDKOfferWithDeri /** * Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by - * private channels or if [`Offer::signing_pubkey`] is not a public node id. + * private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. * * Successive calls to this method will add another blinded path. Caller is responsible for not * adding duplicate paths. @@ -49290,11 +50879,21 @@ MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Offer_paths(const struct LDKOffe MUST_USE_RES struct LDKQuantity Offer_supported_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. + * + * See also [`Bolt12Invoice::signing_pubkey`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPublicKey Offer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey Offer_issuer_signing_pubkey(const struct LDKOffer *NONNULL_PTR this_arg); /** * Returns the id of the offer. @@ -49329,51 +50928,24 @@ MUST_USE_RES bool Offer_is_valid_quantity(const struct LDKOffer *NONNULL_PTR thi MUST_USE_RES bool Offer_expects_quantity(const struct LDKOffer *NONNULL_PTR this_arg); /** - * Similar to [`Offer::request_invoice`] except it: - * - derives the [`InvoiceRequest::payer_id`] such that a different key can be used for each - * request, - * - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build`] is called - * such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine if the - * invoice was requested using a base [`ExpandedKey`] from which the payer id was derived, - * and + * Creates an [`InvoiceRequestBuilder`] for the offer, which + * - derives the [`InvoiceRequest::payer_signing_pubkey`] such that a different key can be used + * for each request in order to protect the sender's privacy, + * - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build_and_sign`] is + * called such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine + * if the invoice was requested using a base [`ExpandedKey`] from which the payer id was + * derived, and * - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can * be used when sending the payment for the requested invoice. * - * Useful to protect the sender's privacy. + * Errors if the offer contains unknown required features. * - * [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id + * [`InvoiceRequest::payer_signing_pubkey`]: crate::offers::invoice_request::InvoiceRequest::payer_signing_pubkey * [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata * [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -MUST_USE_RES struct LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice_deriving_payer_id(const struct LDKOffer *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); - -/** - * Similar to [`Offer::request_invoice_deriving_payer_id`] except uses `payer_id` for the - * [`InvoiceRequest::payer_id`] instead of deriving a different key for each request. - * - * Useful for recurring payments using the same `payer_id` with different invoices. - * - * [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id - */ -MUST_USE_RES struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice_deriving_metadata(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKPublicKey payer_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); - -/** - * Creates an [`InvoiceRequestBuilder`] for the offer with the given `metadata` and `payer_id`, - * which will be reflected in the `Bolt12Invoice` response. - * - * The `metadata` is useful for including information about the derivation of `payer_id` such - * that invoice response handling can be stateless. Also serves as payer-provided entropy while - * hashing in the signature calculation. - * - * This should not leak any information such as by using a simple BIP-32 derivation path. - * Otherwise, payments may be correlated. - * - * Errors if the offer contains unknown required features. - * - * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest - */ -MUST_USE_RES struct LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ Offer_request_invoice(const struct LDKOffer *NONNULL_PTR this_arg, struct LDKCVec_u8Z metadata, struct LDKPublicKey payer_id); +MUST_USE_RES struct LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ Offer_request_invoice(const struct LDKOffer *NONNULL_PTR this_arg, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, struct LDKThirtyTwoBytes payment_id); /** * Generates a non-cryptographic 64-bit hash of the Offer. @@ -49456,8 +51028,7 @@ void InvoiceWithExplicitSigningPubkeyBuilder_free(struct LDKInvoiceWithExplicitS void InvoiceWithDerivedSigningPubkeyBuilder_free(struct LDKInvoiceWithDerivedSigningPubkeyBuilder this_obj); /** - * Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. It can be signed by - * [`UnsignedBolt12Invoice::sign`]. + * Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. */ MUST_USE_RES struct LDKCResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ InvoiceWithExplicitSigningPubkeyBuilder_build(struct LDKInvoiceWithExplicitSigningPubkeyBuilder this_arg); @@ -49576,6 +51147,16 @@ void Bolt12Invoice_free(struct LDKBolt12Invoice this_obj); */ struct LDKBolt12Invoice Bolt12Invoice_clone(const struct LDKBolt12Invoice *NONNULL_PTR orig); +/** + * Paths to the recipient originating from publicly reachable nodes, including information + * needed for routing payments across them. + * + * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this + * privacy is lost if a public node id is used for + *[`UnsignedBolt12Invoice::signing_pubkey`]. + */ +MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ UnsignedBolt12Invoice_payment_paths(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + /** * Duration since the Unix epoch when the invoice was created. */ @@ -49583,7 +51164,7 @@ MUST_USE_RES uint64_t UnsignedBolt12Invoice_created_at(const struct LDKUnsignedB /** * Duration since - *[`Bolt12Invoice::created_at`] + *[`UnsignedBolt12Invoice::created_at`] * when the invoice has expired and therefore should no longer be paid. */ MUST_USE_RES uint64_t UnsignedBolt12Invoice_relative_expiry(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); @@ -49605,7 +51186,19 @@ MUST_USE_RES struct LDKCVec_StrZ UnsignedBolt12Invoice_fallbacks(const struct LD MUST_USE_RES struct LDKBolt12InvoiceFeatures UnsignedBolt12Invoice_invoice_features(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** - * The public key corresponding to the key used to sign the invoice. + * A typically transient public key corresponding to the key used to sign the invoice. + * + * If the invoices was created in response to an [`Offer`], then this will be: + * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise + * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. + * + * If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by + * the recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * [`Offer::paths`]: crate::offers::offer::Offer::paths + * [`Refund`]: crate::offers::refund::Refund */ MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); @@ -49714,6 +51307,18 @@ MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedBolt12Invoice_message_pa */ MUST_USE_RES struct LDKCOption_QuantityZ UnsignedBolt12Invoice_supported_quantity(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +/** + * The public key used by the recipient to sign invoices. + * + * From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was + * created in response to a [`Refund`]. + * + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_issuer_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); + /** * An unpredictable series of bytes from the payer. * @@ -49741,7 +51346,7 @@ MUST_USE_RES struct LDKCOption_u64Z UnsignedBolt12Invoice_quantity(const struct * * [`message_paths`]: Self::message_paths */ -MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_id(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey UnsignedBolt12Invoice_payer_signing_pubkey(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); /** * A payer-provided note reflected back in the invoice. @@ -49762,6 +51367,16 @@ MUST_USE_RES struct LDKThirtyTwoBytes UnsignedBolt12Invoice_payment_hash(const s */ MUST_USE_RES uint64_t UnsignedBolt12Invoice_amount_msats(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR this_arg); +/** + * Paths to the recipient originating from publicly reachable nodes, including information + * needed for routing payments across them. + * + * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this + * privacy is lost if a public node id is used for + *[`Bolt12Invoice::signing_pubkey`]. + */ +MUST_USE_RES struct LDKCVec_BlindedPaymentPathZ Bolt12Invoice_payment_paths(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + /** * Duration since the Unix epoch when the invoice was created. */ @@ -49791,7 +51406,19 @@ MUST_USE_RES struct LDKCVec_StrZ Bolt12Invoice_fallbacks(const struct LDKBolt12I MUST_USE_RES struct LDKBolt12InvoiceFeatures Bolt12Invoice_invoice_features(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** - * The public key corresponding to the key used to sign the invoice. + * A typically transient public key corresponding to the key used to sign the invoice. + * + * If the invoices was created in response to an [`Offer`], then this will be: + * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise + * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. + * + * If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by + * the recipient. + * + * [`Offer`]: crate::offers::offer::Offer + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * [`Offer::paths`]: crate::offers::offer::Offer::paths + * [`Refund`]: crate::offers::refund::Refund */ MUST_USE_RES struct LDKPublicKey Bolt12Invoice_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); @@ -49900,6 +51527,18 @@ MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Bolt12Invoice_message_paths(cons */ MUST_USE_RES struct LDKCOption_QuantityZ Bolt12Invoice_supported_quantity(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +/** + * The public key used by the recipient to sign invoices. + * + * From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was + * created in response to a [`Refund`]. + * + * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_issuer_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); + /** * An unpredictable series of bytes from the payer. * @@ -49927,7 +51566,7 @@ MUST_USE_RES struct LDKCOption_u64Z Bolt12Invoice_quantity(const struct LDKBolt1 * * [`message_paths`]: Self::message_paths */ -MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_id(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey Bolt12Invoice_payer_signing_pubkey(const struct LDKBolt12Invoice *NONNULL_PTR this_arg); /** * A payer-provided note reflected back in the invoice. @@ -50098,20 +51737,14 @@ struct LDKCVec_u8Z InvoiceError_write(const struct LDKInvoiceError *NONNULL_PTR struct LDKCResult_InvoiceErrorDecodeErrorZ InvoiceError_read(struct LDKu8slice ser); /** - * Frees any resources used by the InvoiceRequestWithExplicitPayerIdBuilder, if is_owned is set and inner is non-NULL. + * Frees any resources used by the InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. */ -void InvoiceRequestWithExplicitPayerIdBuilder_free(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_obj); +void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_obj); /** - * Frees any resources used by the InvoiceRequestWithDerivedPayerIdBuilder, if is_owned is set and inner is non-NULL. - */ -void InvoiceRequestWithDerivedPayerIdBuilder_free(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_obj); - -/** - * Builds an unsigned [`InvoiceRequest`] after checking for valid semantics. It can be signed - * by [`UnsignedInvoiceRequest::sign`]. + * Builds a signed [`InvoiceRequest`] after checking for valid semantics. */ -MUST_USE_RES struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_build(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg); +MUST_USE_RES struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_build_and_sign(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg); /** * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not @@ -50120,7 +51753,7 @@ MUST_USE_RES struct LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ Invoic * * Successive calls to this method will override the previous setting. */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_chain(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, enum LDKNetwork network); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_chain(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, enum LDKNetwork network); /** * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is @@ -50130,7 +51763,7 @@ MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplic * * [`quantity`]: Self::quantity */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, uint64_t amount_msats); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_amount_msats(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, uint64_t amount_msats); /** * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity` @@ -50138,53 +51771,21 @@ MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplic * * Successive calls to this method will override the previous setting. */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithExplicitPayerIdBuilder_quantity(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, uint64_t quantity); +MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_quantity(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, uint64_t quantity); /** * Sets the [`InvoiceRequest::payer_note`]. * * Successive calls to this method will override the previous setting. */ -MUST_USE_RES void InvoiceRequestWithExplicitPayerIdBuilder_payer_note(struct LDKInvoiceRequestWithExplicitPayerIdBuilder this_arg, struct LDKStr payer_note); +MUST_USE_RES void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_payer_note(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, struct LDKStr payer_note); /** - * Builds a signed [`InvoiceRequest`] after checking for valid semantics. - */ -MUST_USE_RES struct LDKCResult_InvoiceRequestBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg); - -/** - * Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not - * called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported - * by the offer. - * - * Successive calls to this method will override the previous setting. - */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_chain(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, enum LDKNetwork network); - -/** - * Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is - * not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]). + * Sets the [`InvoiceRequest::offer_from_hrn`]. * * Successive calls to this method will override the previous setting. - * - * [`quantity`]: Self::quantity */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, uint64_t amount_msats); - -/** - * Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity` - * does not conform to [`Offer::is_valid_quantity`]. - * - * Successive calls to this method will override the previous setting. - */ -MUST_USE_RES struct LDKCResult_NoneBolt12SemanticErrorZ InvoiceRequestWithDerivedPayerIdBuilder_quantity(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, uint64_t quantity); - -/** - * Sets the [`InvoiceRequest::payer_note`]. - * - * Successive calls to this method will override the previous setting. - */ -MUST_USE_RES void InvoiceRequestWithDerivedPayerIdBuilder_payer_note(struct LDKInvoiceRequestWithDerivedPayerIdBuilder this_arg, struct LDKStr payer_note); +MUST_USE_RES void InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_sourced_from_human_readable_name(struct LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder this_arg, struct LDKHumanReadableName hrn); /** * Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL. @@ -50294,17 +51895,27 @@ MUST_USE_RES struct LDKCVec_BlindedMessagePathZ UnsignedInvoiceRequest_paths(con MUST_USE_RES struct LDKQuantity UnsignedInvoiceRequest_supported_quantity(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. + * + * See also [`Bolt12Invoice::signing_pubkey`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_issuer_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. + * [`payer_signing_pubkey`]. * - * [`payer_id`]: Self::payer_id + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ MUST_USE_RES struct LDKu8slice UnsignedInvoiceRequest_payer_metadata(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); @@ -50321,6 +51932,15 @@ MUST_USE_RES struct LDKThirtyTwoBytes UnsignedInvoiceRequest_chain(const struct */ MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +/** + * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` + * then it was inferred from the [`Offer::amount`] and [`quantity`]. + * + * [`amount_msats`]: Self::amount_msats + * [`quantity`]: Self::quantity + */ +MUST_USE_RES bool UnsignedInvoiceRequest_has_amount_msats(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + /** * Features pertaining to requesting an invoice. */ @@ -50334,7 +51954,7 @@ MUST_USE_RES struct LDKCOption_u64Z UnsignedInvoiceRequest_quantity(const struct /** * A possibly transient pubkey used to sign the invoice request. */ -MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_id(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_signing_pubkey(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); /** * A payer-provided note which will be seen by the recipient and reflected back in the invoice @@ -50344,6 +51964,14 @@ MUST_USE_RES struct LDKPublicKey UnsignedInvoiceRequest_payer_id(const struct LD */ MUST_USE_RES struct LDKPrintableString UnsignedInvoiceRequest_payer_note(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); +/** + * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the + * builder to indicate the original [`HumanReadableName`] which was resolved. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKHumanReadableName UnsignedInvoiceRequest_offer_from_hrn(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR this_arg); + /** * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) @@ -50402,17 +52030,27 @@ MUST_USE_RES struct LDKCVec_BlindedMessagePathZ InvoiceRequest_paths(const struc MUST_USE_RES struct LDKQuantity InvoiceRequest_supported_quantity(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. + * + * See also [`Bolt12Invoice::signing_pubkey`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPublicKey InvoiceRequest_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey InvoiceRequest_issuer_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. + * [`payer_signing_pubkey`]. * - * [`payer_id`]: Self::payer_id + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ MUST_USE_RES struct LDKu8slice InvoiceRequest_payer_metadata(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); @@ -50429,6 +52067,15 @@ MUST_USE_RES struct LDKThirtyTwoBytes InvoiceRequest_chain(const struct LDKInvoi */ MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +/** + * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` + * then it was inferred from the [`Offer::amount`] and [`quantity`]. + * + * [`amount_msats`]: Self::amount_msats + * [`quantity`]: Self::quantity + */ +MUST_USE_RES bool InvoiceRequest_has_amount_msats(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + /** * Features pertaining to requesting an invoice. */ @@ -50442,7 +52089,7 @@ MUST_USE_RES struct LDKCOption_u64Z InvoiceRequest_quantity(const struct LDKInvo /** * A possibly transient pubkey used to sign the invoice request. */ -MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_signing_pubkey(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); /** * A payer-provided note which will be seen by the recipient and reflected back in the invoice @@ -50452,6 +52099,14 @@ MUST_USE_RES struct LDKPublicKey InvoiceRequest_payer_id(const struct LDKInvoice */ MUST_USE_RES struct LDKPrintableString InvoiceRequest_payer_note(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); +/** + * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the + * builder to indicate the original [`HumanReadableName`] which was resolved. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKHumanReadableName InvoiceRequest_offer_from_hrn(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); + /** * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. @@ -50467,8 +52122,8 @@ MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12Sema * Creates an [`InvoiceBuilder`] for the request with the given required fields. * * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after - * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds - * where [`std::time::SystemTime`] is not available. + * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. + *Useful for non-`std` builds where [`std::time::SystemTime`] is not available. * * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment * for the invoice. @@ -50476,7 +52131,7 @@ MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12Sema * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It * must contain one or more elements ordered from most-preferred to least-preferred, if there's * a preference. Note, however, that any privacy is lost if a public node id was used for - * [`Offer::signing_pubkey`]. + * [`Offer::issuer_signing_pubkey`]. * * Errors if the request contains unknown required features. * @@ -50515,9 +52170,9 @@ MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify MUST_USE_RES struct LDKCResult_VerifiedInvoiceRequestNoneZ InvoiceRequest_verify_using_recipient_data(struct LDKInvoiceRequest this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR key); /** - * Signature of the invoice request using [`payer_id`]. + * Signature of the invoice request using [`payer_signing_pubkey`]. * - * [`payer_id`]: Self::payer_id + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ MUST_USE_RES struct LDKSchnorrSignature InvoiceRequest_signature(const struct LDKInvoiceRequest *NONNULL_PTR this_arg); @@ -50579,17 +52234,27 @@ MUST_USE_RES struct LDKCVec_BlindedMessagePathZ VerifiedInvoiceRequest_paths(con MUST_USE_RES struct LDKQuantity VerifiedInvoiceRequest_supported_quantity(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** - * The public key used by the recipient to sign invoices. + * The public key corresponding to the key used by the recipient to sign invoices. + * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for + * sending an [`InvoiceRequest`]. + * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. + * - If `None`, the signing pubkey will be the final blinded node id from the + * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. + * + * See also [`Bolt12Invoice::signing_pubkey`]. + * + * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest + * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_issuer_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. + * [`payer_signing_pubkey`]. * - * [`payer_id`]: Self::payer_id + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ MUST_USE_RES struct LDKu8slice VerifiedInvoiceRequest_payer_metadata(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); @@ -50606,6 +52271,15 @@ MUST_USE_RES struct LDKThirtyTwoBytes VerifiedInvoiceRequest_chain(const struct */ MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +/** + * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` + * then it was inferred from the [`Offer::amount`] and [`quantity`]. + * + * [`amount_msats`]: Self::amount_msats + * [`quantity`]: Self::quantity + */ +MUST_USE_RES bool VerifiedInvoiceRequest_has_amount_msats(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); + /** * Features pertaining to requesting an invoice. */ @@ -50619,7 +52293,7 @@ MUST_USE_RES struct LDKCOption_u64Z VerifiedInvoiceRequest_quantity(const struct /** * A possibly transient pubkey used to sign the invoice request. */ -MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_id(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_signing_pubkey(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); /** * A payer-provided note which will be seen by the recipient and reflected back in the invoice @@ -50629,6 +52303,14 @@ MUST_USE_RES struct LDKPublicKey VerifiedInvoiceRequest_payer_id(const struct LD */ MUST_USE_RES struct LDKPrintableString VerifiedInvoiceRequest_payer_note(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); +/** + * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the + * builder to indicate the original [`HumanReadableName`] which was resolved. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +MUST_USE_RES struct LDKHumanReadableName VerifiedInvoiceRequest_offer_from_hrn(const struct LDKVerifiedInvoiceRequest *NONNULL_PTR this_arg); + /** * Creates an [`InvoiceBuilder`] for the request with the given required fields and using the * [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. @@ -50644,8 +52326,8 @@ MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12Sema * Creates an [`InvoiceBuilder`] for the request with the given required fields. * * Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after - * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds - * where [`std::time::SystemTime`] is not available. + * `created_at`, which is used to set [`Bolt12Invoice::created_at`]. + *Useful for non-`std` builds where [`std::time::SystemTime`] is not available. * * The caller is expected to remember the preimage of `payment_hash` in order to claim a payment * for the invoice. @@ -50653,7 +52335,7 @@ MUST_USE_RES struct LDKCResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12Sema * The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It * must contain one or more elements ordered from most-preferred to least-preferred, if there's * a preference. Note, however, that any privacy is lost if a public node id was used for - * [`Offer::signing_pubkey`]. + * [`Offer::issuer_signing_pubkey`]. * * Errors if the request contains unknown required features. * @@ -50701,6 +52383,11 @@ struct LDKCVec_u8Z UnsignedInvoiceRequest_write(const struct LDKUnsignedInvoiceR */ struct LDKCVec_u8Z InvoiceRequest_write(const struct LDKInvoiceRequest *NONNULL_PTR obj); +/** + * Read a InvoiceRequest from a byte array, created by InvoiceRequest_write + */ +struct LDKCResult_InvoiceRequestDecodeErrorZ InvoiceRequest_read(struct LDKu8slice ser); + /** * Frees any resources used by the InvoiceRequestFields, if is_owned is set and inner is non-NULL. */ @@ -50709,12 +52396,12 @@ void InvoiceRequestFields_free(struct LDKInvoiceRequestFields this_obj); /** * A possibly transient pubkey used to sign the invoice request. */ -struct LDKPublicKey InvoiceRequestFields_get_payer_id(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); +struct LDKPublicKey InvoiceRequestFields_get_payer_signing_pubkey(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); /** * A possibly transient pubkey used to sign the invoice request. */ -void InvoiceRequestFields_set_payer_id(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); +void InvoiceRequestFields_set_payer_signing_pubkey(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKPublicKey val); /** * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. @@ -50742,12 +52429,27 @@ struct LDKUntrustedString InvoiceRequestFields_get_payer_note_truncated(const st */ void InvoiceRequestFields_set_payer_note_truncated(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKUntrustedString val); +/** + * The Human Readable Name which the sender indicated they were paying to. + * + * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +struct LDKHumanReadableName InvoiceRequestFields_get_human_readable_name(const struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr); + +/** + * The Human Readable Name which the sender indicated they were paying to. + * + * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None + */ +void InvoiceRequestFields_set_human_readable_name(struct LDKInvoiceRequestFields *NONNULL_PTR this_ptr, struct LDKHumanReadableName val); + /** * Constructs a new InvoiceRequestFields given each field * * Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None + * Note that human_readable_name_arg (or a relevant inner pointer) may be NULL or all-0s to represent None */ -MUST_USE_RES struct LDKInvoiceRequestFields InvoiceRequestFields_new(struct LDKPublicKey payer_id_arg, struct LDKCOption_u64Z quantity_arg, struct LDKUntrustedString payer_note_truncated_arg); +MUST_USE_RES struct LDKInvoiceRequestFields InvoiceRequestFields_new(struct LDKPublicKey payer_signing_pubkey_arg, struct LDKCOption_u64Z quantity_arg, struct LDKUntrustedString payer_note_truncated_arg, struct LDKHumanReadableName human_readable_name_arg); /** * Creates a copy of the InvoiceRequestFields @@ -50924,19 +52626,14 @@ enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_features(void); enum LDKBolt12SemanticError Bolt12SemanticError_missing_description(void); /** - * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError + * Utility method to constructs a new MissingIssuerSigningPubkey-variant Bolt12SemanticError */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_issuer_signing_pubkey(void); /** - * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError + * Utility method to constructs a new UnexpectedIssuerSigningPubkey-variant Bolt12SemanticError */ -enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void); - -/** - * Utility method to constructs a new UnexpectedSigningPubkey-variant Bolt12SemanticError - */ -enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_signing_pubkey(void); +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_issuer_signing_pubkey(void); /** * Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError @@ -50969,9 +52666,9 @@ enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_metadata(void); enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_metadata(void); /** - * Utility method to constructs a new MissingPayerId-variant Bolt12SemanticError + * Utility method to constructs a new MissingPayerSigningPubkey-variant Bolt12SemanticError */ -enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_id(void); +enum LDKBolt12SemanticError Bolt12SemanticError_missing_payer_signing_pubkey(void); /** * Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError @@ -51008,11 +52705,26 @@ enum LDKBolt12SemanticError Bolt12SemanticError_missing_payment_hash(void); */ enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_payment_hash(void); +/** + * Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError + */ +enum LDKBolt12SemanticError Bolt12SemanticError_missing_signing_pubkey(void); + +/** + * Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError + */ +enum LDKBolt12SemanticError Bolt12SemanticError_invalid_signing_pubkey(void); + /** * Utility method to constructs a new MissingSignature-variant Bolt12SemanticError */ enum LDKBolt12SemanticError Bolt12SemanticError_missing_signature(void); +/** + * Utility method to constructs a new UnexpectedHumanReadableName-variant Bolt12SemanticError + */ +enum LDKBolt12SemanticError Bolt12SemanticError_unexpected_human_readable_name(void); + /** * Frees any resources used by the RefundMaybeWithDerivedMetadataBuilder, if is_owned is set and inner is non-NULL. */ @@ -51024,8 +52736,8 @@ void RefundMaybeWithDerivedMetadataBuilder_free(struct LDKRefundMaybeWithDerived struct LDKRefundMaybeWithDerivedMetadataBuilder RefundMaybeWithDerivedMetadataBuilder_clone(const struct LDKRefundMaybeWithDerivedMetadataBuilder *NONNULL_PTR orig); /** - * Creates a new builder for a refund using the [`Refund::payer_id`] for the public node id to - * send to if no [`Refund::paths`] are set. Otherwise, it may be a transient pubkey. + * Creates a new builder for a refund using the `signing_pubkey` for the public node id to send + * to if no [`Refund::paths`] are set. Otherwise, `signing_pubkey` may be a transient pubkey. * * Additionally, sets the required (empty) [`Refund::description`], [`Refund::payer_metadata`], * and [`Refund::amount_msats`]. @@ -51038,7 +52750,7 @@ struct LDKRefundMaybeWithDerivedMetadataBuilder RefundMaybeWithDerivedMetadataBu * [`ChannelManager`]: crate::ln::channelmanager::ChannelManager * [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder */ -MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_new(struct LDKCVec_u8Z metadata, struct LDKPublicKey payer_id, uint64_t amount_msats); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_new(struct LDKCVec_u8Z metadata, struct LDKPublicKey signing_pubkey, uint64_t amount_msats); /** * Similar to [`RefundBuilder::new`] except, if [`RefundBuilder::path`] is called, the payer id @@ -51059,7 +52771,7 @@ MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12Semant * [`Bolt12Invoice::verify_using_payer_data`]: crate::offers::invoice::Bolt12Invoice::verify_using_payer_data * [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey */ -MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); +MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ RefundMaybeWithDerivedMetadataBuilder_deriving_signing_pubkey(struct LDKPublicKey node_id, const struct LDKExpandedKey *NONNULL_PTR expanded_key, struct LDKNonce nonce, uint64_t amount_msats, struct LDKThirtyTwoBytes payment_id); /** * Sets the [`Refund::description`]. @@ -51069,8 +52781,8 @@ MUST_USE_RES struct LDKCResult_RefundMaybeWithDerivedMetadataBuilderBolt12Semant MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_description(struct LDKRefundMaybeWithDerivedMetadataBuilder this_arg, struct LDKStr description); /** - * Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has - * already passed is valid and can be checked for using [`Refund::is_expired`]. + * Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. + *Any expiry that has already passed is valid and can be checked for using [`Refund::is_expired`]. * * Successive calls to this method will override the previous setting. */ @@ -51085,7 +52797,7 @@ MUST_USE_RES void RefundMaybeWithDerivedMetadataBuilder_issuer(struct LDKRefundM /** * Adds a blinded path to [`Refund::paths`]. Must include at least one path if only connected - * by private channels or if [`Refund::payer_id`] is not a public node id. + * by private channels or if [`Refund::payer_signing_pubkey`] is not a public node id. * * Successive calls to this method will add another blinded path. Caller is responsible for not * adding duplicate paths. @@ -51174,9 +52886,9 @@ MUST_USE_RES struct LDKCVec_BlindedMessagePathZ Refund_paths(const struct LDKRef /** * An unpredictable series of bytes, typically containing information about the derivation of - * [`payer_id`]. + * [`payer_signing_pubkey`]. * - * [`payer_id`]: Self::payer_id + * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ MUST_USE_RES struct LDKu8slice Refund_payer_metadata(const struct LDKRefund *NONNULL_PTR this_arg); @@ -51208,7 +52920,7 @@ MUST_USE_RES struct LDKCOption_u64Z Refund_quantity(const struct LDKRefund *NONN * * [`paths`]: Self::paths */ -MUST_USE_RES struct LDKPublicKey Refund_payer_id(const struct LDKRefund *NONNULL_PTR this_arg); +MUST_USE_RES struct LDKPublicKey Refund_payer_signing_pubkey(const struct LDKRefund *NONNULL_PTR this_arg); /** * Payer provided note to include in the invoice. @@ -52226,7 +53938,7 @@ void NetworkGraph_node_failed_permanent(const struct LDKNetworkGraph *NONNULL_PT * in the map for a while so that these can be resynced from gossip in the future. * * This method is only available with the `std` feature. See - * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use. + * [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for non-`std` use. */ void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGraph *NONNULL_PTR this_arg); @@ -52242,8 +53954,8 @@ void NetworkGraph_remove_stale_channels_and_tracking(const struct LDKNetworkGrap * This method will also cause us to stop tracking removed nodes and channels if they have been * in the map for a while so that these can be resynced from gossip in the future. * - * This function takes the current unix time as an argument. For users with the `std` feature - * enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. + *This function takes the current unix time as an argument. For users with the `std` feature + *enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. */ void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKNetworkGraph *NONNULL_PTR this_arg, uint64_t current_time_unix); @@ -52255,7 +53967,7 @@ void NetworkGraph_remove_stale_channels_and_tracking_with_time(const struct LDKN * [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept * routing messages from a source using a protocol other than the lightning P2P protocol. * - * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * If not built with `std`, any updates with a timestamp more than two weeks in the past or * materially in the future will be rejected. */ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); @@ -52265,7 +53977,7 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel(c * of the channel without verifying the associated signatures. Because we aren't given the * associated signatures here we cannot relay the channel update to any of our peers. * - * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * If not built with `std`, any updates with a timestamp more than two weeks in the past or * materially in the future will be rejected. */ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_unsigned(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKUnsignedChannelUpdate *NONNULL_PTR msg); @@ -52275,7 +53987,7 @@ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_update_channel_u * * This checks whether the update currently is applicable by [`Self::update_channel`]. * - * If built with `no-std`, any updates with a timestamp more than two weeks in the past or + * If not built with `std`, any updates with a timestamp more than two weeks in the past or * materially in the future will be rejected. */ MUST_USE_RES struct LDKCResult_NoneLightningErrorZ NetworkGraph_verify_channel_update(const struct LDKNetworkGraph *NONNULL_PTR this_arg, const struct LDKChannelUpdate *NONNULL_PTR msg); @@ -52327,12 +54039,6 @@ MUST_USE_RES struct LDKDefaultRouter DefaultRouter_new(const struct LDKNetworkGr */ struct LDKRouter DefaultRouter_as_Router(const struct LDKDefaultRouter *NONNULL_PTR this_arg); -/** - * Constructs a new MessageRouter which calls the relevant methods on this_arg. - * This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is - */ -struct LDKMessageRouter DefaultRouter_as_MessageRouter(const struct LDKDefaultRouter *NONNULL_PTR this_arg); - /** * Calls the free function if one is set */ @@ -53484,48 +55190,72 @@ void ProbabilisticScoringFeeParameters_free(struct LDKProbabilisticScoringFeePar /** * A fixed penalty in msats to apply to each channel. * - * Default value: 500 msat + * In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] + * (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the + * most accurate total success probabilities. + * + * Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). + * + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** * A fixed penalty in msats to apply to each channel. * - * Default value: 500 msat + * In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] + * (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the + * most accurate total success probabilities. + * + * Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). + * + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ void ProbabilisticScoringFeeParameters_set_base_penalty_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty - * applied to each channel, in excess of the [`base_penalty_msat`]. + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment - * amount plus the amount of any other HTLCs flowing we sent over the same channel). + * multiplier and `2^30`ths of the payment amount. * * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` * - * Default value: 8,192 msat + * In testing, a value of roughly ~100x (1/10th * 2^10) of + * [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated + * probabilities down by a factor of ~79%) resulted in the most accurate total success + * probabilities. + * + * Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional + * hop). * * [`base_penalty_msat`]: Self::base_penalty_msat + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ uint64_t ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used with the total amount flowing over a channel to calculate a fixed penalty - * applied to each channel, in excess of the [`base_penalty_msat`]. + * A multiplier used with the payment amount to calculate a fixed penalty applied to each + * channel, in excess of the [`base_penalty_msat`]. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment - * amount plus the amount of any other HTLCs flowing we sent over the same channel). + * multiplier and `2^30`ths of the payment amount. * * ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` * - * Default value: 8,192 msat + * In testing, a value of roughly ~100x (1/10th * 2^10) of + * [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated + * probabilities down by a factor of ~79%) resulted in the most accurate total success + * probabilities. + * + * Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional + * hop). * * [`base_penalty_msat`]: Self::base_penalty_msat + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); @@ -53543,9 +55273,14 @@ void ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(s * * `-log10(success_probability) * liquidity_penalty_multiplier_msat` * - * Default value: 30,000 msat + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled + * by default. + * + * Default value: 0 msat * * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); @@ -53563,21 +55298,26 @@ uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat * * `-log10(success_probability) * liquidity_penalty_multiplier_msat` * - * Default value: 30,000 msat + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled + * by default. + * + * Default value: 0 msat * * [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life + * [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat */ void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined by our - * latest estimates of the channel's liquidity, to determine the amount penalty. + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, as determined by + * our latest estimates of the channel's liquidity, to determine the amount penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative - * `log10` of the success probability. + * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the + * success probability. * * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * @@ -53587,19 +55327,25 @@ void ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(str * probabilities, the multiplier will have a decreasing effect as the negative `log10` will * fall below `1`. * - * Default value: 192 msat + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is + * disabled by default. + * + * Default value: 0 msat + * + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined by our - * latest estimates of the channel's liquidity, to determine the amount penalty. + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, as determined by + * our latest estimates of the channel's liquidity, to determine the amount penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., * fees plus penalty) for large payments. The penalty is computed as the product of this - * multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative - * `log10` of the success probability. + * multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the + * success probability. * * `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` * @@ -53609,7 +55355,13 @@ uint64_t ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multipli * probabilities, the multiplier will have a decreasing effect as the negative `log10` will * fall below `1`. * - * Default value: 192 msat + * In testing, this scoring model performs much worse than the historical scoring model + * configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is + * disabled by default. + * + * Default value: 0 msat + * + * [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat */ void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); @@ -53625,7 +55377,8 @@ void ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_m * track which of several buckets those bounds fall into, exponentially decaying the * probability of each bucket as new samples are added. * - * Default value: 10,000 msat + * Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, + * or 6 sats to avoid a 25% probability channel). * * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat */ @@ -53643,22 +55396,22 @@ uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_mult * track which of several buckets those bounds fall into, exponentially decaying the * probability of each bucket as new samples are added. * - * Default value: 10,000 msat + * Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, + * or 6 sats to avoid a 25% probability channel). * * [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat */ void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr, uint64_t val); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined based - * on the history of our estimates of the channel's available liquidity, to determine a + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, as determined + * based on the history of our estimates of the channel's available liquidity, to determine a * penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost for * large payments. The penalty is computed as the product of this multiplier and `2^20`ths - * of the amount flowing over this channel, weighted by the negative `log10` of the success - * probability. + * of the payment amount, weighted by the negative `log10` of the success probability. * * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead * of using only our latest estimate for the current liquidity available in the channel, it @@ -53667,22 +55420,23 @@ void ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multipli * channel, we track which of several buckets those bounds fall into, exponentially decaying * the probability of each bucket as new samples are added. * - * Default value: 64 msat + * Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% + * probability channels, or 0.5bps to avoid a 38% probability + * channel). * * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat */ uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amount_multiplier_msat(const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR this_ptr); /** - * A multiplier used in conjunction with the total amount flowing over a channel and the - * negative `log10` of the channel's success probability for the payment, as determined based - * on the history of our estimates of the channel's available liquidity, to determine a + * A multiplier used in conjunction with the payment amount and the negative `log10` of the + * channel's success probability for the total amount flowing over a channel, as determined + * based on the history of our estimates of the channel's available liquidity, to determine a * penalty. * * The purpose of the amount penalty is to avoid having fees dominate the channel cost for * large payments. The penalty is computed as the product of this multiplier and `2^20`ths - * of the amount flowing over this channel, weighted by the negative `log10` of the success - * probability. + * of the payment amount, weighted by the negative `log10` of the success probability. * * This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead * of using only our latest estimate for the current liquidity available in the channel, it @@ -53691,7 +55445,9 @@ uint64_t ProbabilisticScoringFeeParameters_get_historical_liquidity_penalty_amou * channel, we track which of several buckets those bounds fall into, exponentially decaying * the probability of each bucket as new samples are added. * - * Default value: 64 msat + * Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% + * probability channels, or 0.5bps to avoid a 38% probability + * channel). * * [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat */ @@ -53902,11 +55658,11 @@ void ProbabilisticScoringDecayParameters_set_historical_no_updates_half_life(str * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. * - * Default value: 6 hours + * Default value: 30 minutes * * # Note * - * When built with the `no-std` feature, time will never elapse. Therefore, the channel + * When not built with the `std` feature, time will never elapse. Therefore, the channel * liquidity knowledge will never decay except when the bounds cross. */ uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(const struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr); @@ -53925,11 +55681,11 @@ uint64_t ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(cons * liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper * and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. * - * Default value: 6 hours + * Default value: 30 minutes * * # Note * - * When built with the `no-std` feature, time will never elapse. Therefore, the channel + * When not built with the `std` feature, time will never elapse. Therefore, the channel * liquidity knowledge will never decay except when the bounds cross. */ void ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(struct LDKProbabilisticScoringDecayParameters *NONNULL_PTR this_ptr, uint64_t val); @@ -54004,11 +55760,26 @@ MUST_USE_RES struct LDKCOption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ Probabilisti * with `scid` towards the given `target` node, based on the historical estimated liquidity * bounds. * + * Returns `None` if: + * - the given channel is not in the network graph, the provided `target` is not a party to + * the channel, or we don't have forwarding parameters for either direction in the channel. + * - `allow_fallback_estimation` is *not* set and there is no (or insufficient) historical + * data for the given channel. + * * These are the same bounds as returned by * [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by * [`Self::estimated_channel_liquidity_range`]). */ -MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_historical_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params); +MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_historical_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params, bool allow_fallback_estimation); + +/** + * Query the probability of payment success sending the given `amount_msat` over the channel + * with `scid` towards the given `target` node, based on the live estimated liquidity bounds. + * + * This will return `Some` for any channel which is present in the [`NetworkGraph`], including + * if we have no bound information beside the channel's capacity. + */ +MUST_USE_RES struct LDKCOption_f64Z ProbabilisticScorer_live_estimated_payment_success_probability(const struct LDKProbabilisticScorer *NONNULL_PTR this_arg, uint64_t scid, const struct LDKNodeId *NONNULL_PTR target, uint64_t amount_msat, const struct LDKProbabilisticScoringFeeParameters *NONNULL_PTR params); /** * Constructs a new ScoreLookUp which calls the relevant methods on this_arg. @@ -55019,20 +56790,10 @@ struct LDKAsyncPaymentsMessage AsyncPaymentsMessage_release_held_htlc(struct LDK */ void HeldHtlcAvailable_free(struct LDKHeldHtlcAvailable this_obj); -/** - * The secret that will be used by the recipient of this message to release the held HTLC. - */ -const uint8_t (*HeldHtlcAvailable_get_payment_release_secret(const struct LDKHeldHtlcAvailable *NONNULL_PTR this_ptr))[32]; - -/** - * The secret that will be used by the recipient of this message to release the held HTLC. - */ -void HeldHtlcAvailable_set_payment_release_secret(struct LDKHeldHtlcAvailable *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - /** * Constructs a new HeldHtlcAvailable given each field */ -MUST_USE_RES struct LDKHeldHtlcAvailable HeldHtlcAvailable_new(struct LDKThirtyTwoBytes payment_release_secret_arg); +MUST_USE_RES struct LDKHeldHtlcAvailable HeldHtlcAvailable_new(void); /** * Creates a copy of the HeldHtlcAvailable @@ -55044,22 +56805,10 @@ struct LDKHeldHtlcAvailable HeldHtlcAvailable_clone(const struct LDKHeldHtlcAvai */ void ReleaseHeldHtlc_free(struct LDKReleaseHeldHtlc this_obj); -/** - * Used to release the HTLC held upstream if it matches the corresponding - * [`HeldHtlcAvailable::payment_release_secret`]. - */ -const uint8_t (*ReleaseHeldHtlc_get_payment_release_secret(const struct LDKReleaseHeldHtlc *NONNULL_PTR this_ptr))[32]; - -/** - * Used to release the HTLC held upstream if it matches the corresponding - * [`HeldHtlcAvailable::payment_release_secret`]. - */ -void ReleaseHeldHtlc_set_payment_release_secret(struct LDKReleaseHeldHtlc *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); - /** * Constructs a new ReleaseHeldHtlc given each field */ -MUST_USE_RES struct LDKReleaseHeldHtlc ReleaseHeldHtlc_new(struct LDKThirtyTwoBytes payment_release_secret_arg); +MUST_USE_RES struct LDKReleaseHeldHtlc ReleaseHeldHtlc_new(void); /** * Creates a copy of the ReleaseHeldHtlc @@ -55113,6 +56862,235 @@ struct LDKCVec_u8Z AsyncPaymentsMessage_write(const struct LDKAsyncPaymentsMessa */ struct LDKCResult_AsyncPaymentsMessageDecodeErrorZ AsyncPaymentsMessage_read(struct LDKu8slice ser, uint64_t arg); +/** + * Calls the free function if one is set + */ +void DNSResolverMessageHandler_free(struct LDKDNSResolverMessageHandler this_ptr); + +/** + * Frees any resources used by the DNSResolverMessage + */ +void DNSResolverMessage_free(struct LDKDNSResolverMessage this_ptr); + +/** + * Creates a copy of the DNSResolverMessage + */ +struct LDKDNSResolverMessage DNSResolverMessage_clone(const struct LDKDNSResolverMessage *NONNULL_PTR orig); + +/** + * Utility method to constructs a new DNSSECQuery-variant DNSResolverMessage + */ +struct LDKDNSResolverMessage DNSResolverMessage_dnssecquery(struct LDKDNSSECQuery a); + +/** + * Utility method to constructs a new DNSSECProof-variant DNSResolverMessage + */ +struct LDKDNSResolverMessage DNSResolverMessage_dnssecproof(struct LDKDNSSECProof a); + +/** + * Generates a non-cryptographic 64-bit hash of the DNSResolverMessage. + */ +uint64_t DNSResolverMessage_hash(const struct LDKDNSResolverMessage *NONNULL_PTR o); + +/** + * Checks if two DNSResolverMessages contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool DNSResolverMessage_eq(const struct LDKDNSResolverMessage *NONNULL_PTR a, const struct LDKDNSResolverMessage *NONNULL_PTR b); + +/** + * Frees any resources used by the DNSSECQuery, if is_owned is set and inner is non-NULL. + */ +void DNSSECQuery_free(struct LDKDNSSECQuery this_obj); + +/** + * Creates a copy of the DNSSECQuery + */ +struct LDKDNSSECQuery DNSSECQuery_clone(const struct LDKDNSSECQuery *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the DNSSECQuery. + */ +uint64_t DNSSECQuery_hash(const struct LDKDNSSECQuery *NONNULL_PTR o); + +/** + * Checks if two DNSSECQuerys 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 DNSSECQuery_eq(const struct LDKDNSSECQuery *NONNULL_PTR a, const struct LDKDNSSECQuery *NONNULL_PTR b); + +/** + * Frees any resources used by the DNSSECProof, if is_owned is set and inner is non-NULL. + */ +void DNSSECProof_free(struct LDKDNSSECProof this_obj); + +/** + * An [RFC 9102 DNSSEC AuthenticationChain] providing a DNSSEC proof. + * + * [RFC 9102 DNSSEC AuthenticationChain]: https://www.rfc-editor.org/rfc/rfc9102.html#name-dnssec-authentication-chain + * + * Returns a copy of the field. + */ +struct LDKCVec_u8Z DNSSECProof_get_proof(const struct LDKDNSSECProof *NONNULL_PTR this_ptr); + +/** + * An [RFC 9102 DNSSEC AuthenticationChain] providing a DNSSEC proof. + * + * [RFC 9102 DNSSEC AuthenticationChain]: https://www.rfc-editor.org/rfc/rfc9102.html#name-dnssec-authentication-chain + */ +void DNSSECProof_set_proof(struct LDKDNSSECProof *NONNULL_PTR this_ptr, struct LDKCVec_u8Z val); + +/** + * Creates a copy of the DNSSECProof + */ +struct LDKDNSSECProof DNSSECProof_clone(const struct LDKDNSSECProof *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the DNSSECProof. + */ +uint64_t DNSSECProof_hash(const struct LDKDNSSECProof *NONNULL_PTR o); + +/** + * Checks if two DNSSECProofs 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 DNSSECProof_eq(const struct LDKDNSSECProof *NONNULL_PTR a, const struct LDKDNSSECProof *NONNULL_PTR b); + +/** + * Returns whether `tlv_type` corresponds to a TLV record for DNS Resolvers. + */ +MUST_USE_RES bool DNSResolverMessage_is_known_type(uint64_t tlv_type); + +/** + * Serialize the DNSResolverMessage object into a byte array which can be read by DNSResolverMessage_read + */ +struct LDKCVec_u8Z DNSResolverMessage_write(const struct LDKDNSResolverMessage *NONNULL_PTR obj); + +/** + * Read a DNSResolverMessage from a byte array, created by DNSResolverMessage_write + */ +struct LDKCResult_DNSResolverMessageDecodeErrorZ DNSResolverMessage_read(struct LDKu8slice ser, uint64_t arg); + +/** + * Constructs a new OnionMessageContents which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is + */ +struct LDKOnionMessageContents DNSResolverMessage_as_OnionMessageContents(const struct LDKDNSResolverMessage *NONNULL_PTR this_arg); + +/** + * Frees any resources used by the HumanReadableName, if is_owned is set and inner is non-NULL. + */ +void HumanReadableName_free(struct LDKHumanReadableName this_obj); + +/** + * Creates a copy of the HumanReadableName + */ +struct LDKHumanReadableName HumanReadableName_clone(const struct LDKHumanReadableName *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the HumanReadableName. + */ +uint64_t HumanReadableName_hash(const struct LDKHumanReadableName *NONNULL_PTR o); + +/** + * Checks if two HumanReadableNames 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 HumanReadableName_eq(const struct LDKHumanReadableName *NONNULL_PTR a, const struct LDKHumanReadableName *NONNULL_PTR b); + +/** + * Constructs a new [`HumanReadableName`] from the `user` and `domain` parts. See the + * struct-level documentation for more on the requirements on each. + */ +MUST_USE_RES struct LDKCResult_HumanReadableNameNoneZ HumanReadableName_new(struct LDKStr user, struct LDKStr domain); + +/** + * Constructs a new [`HumanReadableName`] from the standard encoding - `user`@`domain`. + * + * If `user` includes the standard BIP 353 â‚¿ prefix it is automatically removed as required by + * BIP 353. + */ +MUST_USE_RES struct LDKCResult_HumanReadableNameNoneZ HumanReadableName_from_encoded(struct LDKStr encoded); + +/** + * Gets the `user` part of this Human Readable Name + */ +MUST_USE_RES struct LDKStr HumanReadableName_user(const struct LDKHumanReadableName *NONNULL_PTR this_arg); + +/** + * Gets the `domain` part of this Human Readable Name + */ +MUST_USE_RES struct LDKStr HumanReadableName_domain(const struct LDKHumanReadableName *NONNULL_PTR this_arg); + +/** + * Serialize the HumanReadableName object into a byte array which can be read by HumanReadableName_read + */ +struct LDKCVec_u8Z HumanReadableName_write(const struct LDKHumanReadableName *NONNULL_PTR obj); + +/** + * Read a HumanReadableName from a byte array, created by HumanReadableName_write + */ +struct LDKCResult_HumanReadableNameDecodeErrorZ HumanReadableName_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the OMNameResolver, if is_owned is set and inner is non-NULL. + */ +void OMNameResolver_free(struct LDKOMNameResolver this_obj); + +/** + * Builds a new [`OMNameResolver`]. + */ +MUST_USE_RES struct LDKOMNameResolver OMNameResolver_new(uint32_t latest_block_time, uint32_t latest_block_height); + +/** + * Informs the [`OMNameResolver`] of the passage of time in the form of a new best Bitcoin + * block. + * + * This will call back to resolve some pending queries which have timed out. + */ +void OMNameResolver_new_best_block(const struct LDKOMNameResolver *NONNULL_PTR this_arg, uint32_t height, uint32_t time); + +/** + * Begins the process of resolving a BIP 353 Human Readable Name. + * + * Returns a [`DNSSECQuery`] onion message and a [`DNSResolverContext`] which should be sent + * to a resolver (with the context used to generate the blinded response path) on success. + */ +MUST_USE_RES struct LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ OMNameResolver_resolve_name(const struct LDKOMNameResolver *NONNULL_PTR this_arg, struct LDKThirtyTwoBytes payment_id, struct LDKHumanReadableName name, const struct LDKEntropySource *NONNULL_PTR entropy_source); + +/** + * Handles a [`DNSSECProof`] message, attempting to verify it and match it against a pending + * query. + * + * If verification succeeds, the resulting bitcoin: URI is parsed to find a contained + * [`Offer`]. + * + * Note that a single proof for a wildcard DNS entry may complete several requests for + * different [`HumanReadableName`]s. + * + * If an [`Offer`] is found, it, as well as the [`PaymentId`] and original `name` passed to + * [`Self::resolve_name`] are returned. + */ +MUST_USE_RES struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ OMNameResolver_handle_dnssec_proof_for_offer(const struct LDKOMNameResolver *NONNULL_PTR this_arg, struct LDKDNSSECProof msg, struct LDKDNSResolverContext context); + +/** + * Handles a [`DNSSECProof`] message, attempting to verify it and match it against any pending + * queries. + * + * If verification succeeds, all matching [`PaymentId`] and [`HumanReadableName`]s passed to + * [`Self::resolve_name`], as well as the resolved bitcoin: URI are returned. + * + * Note that a single proof for a wildcard DNS entry may complete several requests for + * different [`HumanReadableName`]s. + * + * This method is useful for those who handle bitcoin: URIs already, handling more than just + * BOLT12 [`Offer`]s. + */ +MUST_USE_RES struct LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ OMNameResolver_handle_dnssec_proof_for_uri(const struct LDKOMNameResolver *NONNULL_PTR this_arg, struct LDKDNSSECProof msg, struct LDKDNSResolverContext context); + /** * Frees any resources used by the OnionMessenger, if is_owned is set and inner is non-NULL. */ @@ -55169,6 +57147,12 @@ void ResponseInstruction_free(struct LDKResponseInstruction this_obj); */ struct LDKResponseInstruction ResponseInstruction_clone(const struct LDKResponseInstruction *NONNULL_PTR orig); +/** + * Converts this [`ResponseInstruction`] into a [`MessageSendInstructions`] so that it can be + * used to send the response via a normal message sending method. + */ +MUST_USE_RES struct LDKMessageSendInstructions ResponseInstruction_into_instructions(struct LDKResponseInstruction this_arg); + /** * Frees any resources used by the MessageSendInstructions */ @@ -55488,7 +57472,7 @@ struct LDKCResult_PeeledOnionNoneZ peel_onion_message(const struct LDKOnionMessa * Constructs a new `OnionMessenger` to send, forward, and delegate received onion messages to * their respective handlers. */ -MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKNodeIdLookUp node_id_lookup, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKAsyncPaymentsMessageHandler async_payments_handler, struct LDKCustomOnionMessageHandler custom_handler); +MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKNodeIdLookUp node_id_lookup, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKAsyncPaymentsMessageHandler async_payments_handler, struct LDKDNSResolverMessageHandler dns_resolver, struct LDKCustomOnionMessageHandler custom_handler); /** * Similar to [`Self::new`], but rather than dropping onion messages that are @@ -55513,7 +57497,7 @@ MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new(struct LDKEntropySource * onion messages are persisted and only persist onion messages for relevant * peers. */ -MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new_with_offline_peer_interception(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKNodeIdLookUp node_id_lookup, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKAsyncPaymentsMessageHandler async_payments_handler, struct LDKCustomOnionMessageHandler custom_handler); +MUST_USE_RES struct LDKOnionMessenger OnionMessenger_new_with_offline_peer_interception(struct LDKEntropySource entropy_source, struct LDKNodeSigner node_signer, struct LDKLogger logger, struct LDKNodeIdLookUp node_id_lookup, struct LDKMessageRouter message_router, struct LDKOffersMessageHandler offers_handler, struct LDKAsyncPaymentsMessageHandler async_payments_handler, struct LDKDNSResolverMessageHandler dns_resolver, struct LDKCustomOnionMessageHandler custom_handler); /** * Sends an [`OnionMessage`] based on its [`MessageSendInstructions`]. @@ -55703,6 +57687,11 @@ struct LDKParsedOnionMessageContents ParsedOnionMessageContents_clone(const stru */ struct LDKParsedOnionMessageContents ParsedOnionMessageContents_offers(struct LDKOffersMessage a); +/** + * Utility method to constructs a new DNSResolver-variant ParsedOnionMessageContents + */ +struct LDKParsedOnionMessageContents ParsedOnionMessageContents_dnsresolver(struct LDKDNSResolverMessage a); + /** * Utility method to constructs a new Custom-variant ParsedOnionMessageContents */ @@ -56188,45 +58177,66 @@ struct LDKForwardTlvs ForwardTlvs_clone(const struct LDKForwardTlvs *NONNULL_PTR */ void ReceiveTlvs_free(struct LDKReceiveTlvs this_obj); +/** + * Creates a copy of the ReceiveTlvs + */ +struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); + +/** + * Returns the underlying TLVs. + */ +MUST_USE_RES struct LDKUnauthenticatedReceiveTlvs ReceiveTlvs_tlvs(const struct LDKReceiveTlvs *NONNULL_PTR this_arg); + +/** + * Frees any resources used by the UnauthenticatedReceiveTlvs, if is_owned is set and inner is non-NULL. + */ +void UnauthenticatedReceiveTlvs_free(struct LDKUnauthenticatedReceiveTlvs this_obj); + /** * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. */ -const uint8_t (*ReceiveTlvs_get_payment_secret(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr))[32]; +const uint8_t (*UnauthenticatedReceiveTlvs_get_payment_secret(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr))[32]; /** * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. */ -void ReceiveTlvs_set_payment_secret(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); +void UnauthenticatedReceiveTlvs_set_payment_secret(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKThirtyTwoBytes val); /** * Constraints for the receiver of this payment. */ -struct LDKPaymentConstraints ReceiveTlvs_get_payment_constraints(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr); +struct LDKPaymentConstraints UnauthenticatedReceiveTlvs_get_payment_constraints(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr); /** * Constraints for the receiver of this payment. */ -void ReceiveTlvs_set_payment_constraints(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); +void UnauthenticatedReceiveTlvs_set_payment_constraints(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentConstraints val); /** * Context for the receiver of this payment. */ -struct LDKPaymentContext ReceiveTlvs_get_payment_context(const struct LDKReceiveTlvs *NONNULL_PTR this_ptr); +struct LDKPaymentContext UnauthenticatedReceiveTlvs_get_payment_context(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr); /** * Context for the receiver of this payment. */ -void ReceiveTlvs_set_payment_context(struct LDKReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentContext val); +void UnauthenticatedReceiveTlvs_set_payment_context(struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR this_ptr, struct LDKPaymentContext val); /** - * Constructs a new ReceiveTlvs given each field + * Constructs a new UnauthenticatedReceiveTlvs given each field */ -MUST_USE_RES struct LDKReceiveTlvs ReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKPaymentContext payment_context_arg); +MUST_USE_RES struct LDKUnauthenticatedReceiveTlvs UnauthenticatedReceiveTlvs_new(struct LDKThirtyTwoBytes payment_secret_arg, struct LDKPaymentConstraints payment_constraints_arg, struct LDKPaymentContext payment_context_arg); /** - * Creates a copy of the ReceiveTlvs + * Creates a copy of the UnauthenticatedReceiveTlvs */ -struct LDKReceiveTlvs ReceiveTlvs_clone(const struct LDKReceiveTlvs *NONNULL_PTR orig); +struct LDKUnauthenticatedReceiveTlvs UnauthenticatedReceiveTlvs_clone(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR orig); + +/** + * Creates an authenticated [`ReceiveTlvs`], which includes an HMAC and the provide [`Nonce`] + * that can be use later to verify it authenticity. + */ +MUST_USE_RES struct LDKReceiveTlvs UnauthenticatedReceiveTlvs_authenticate(struct LDKUnauthenticatedReceiveTlvs this_arg, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); /** * Frees any resources used by the PaymentRelay, if is_owned is set and inner is non-NULL. @@ -56322,11 +58332,6 @@ void PaymentContext_free(struct LDKPaymentContext this_ptr); */ struct LDKPaymentContext PaymentContext_clone(const struct LDKPaymentContext *NONNULL_PTR orig); -/** - * Utility method to constructs a new Unknown-variant PaymentContext - */ -struct LDKPaymentContext PaymentContext_unknown(struct LDKUnknownPaymentContext a); - /** * Utility method to constructs a new Bolt12Offer-variant PaymentContext */ @@ -56343,23 +58348,6 @@ struct LDKPaymentContext PaymentContext_bolt12_refund(struct LDKBolt12RefundCont */ bool PaymentContext_eq(const struct LDKPaymentContext *NONNULL_PTR a, const struct LDKPaymentContext *NONNULL_PTR b); -/** - * Frees any resources used by the UnknownPaymentContext, if is_owned is set and inner is non-NULL. - */ -void UnknownPaymentContext_free(struct LDKUnknownPaymentContext this_obj); - -/** - * Creates a copy of the UnknownPaymentContext - */ -struct LDKUnknownPaymentContext UnknownPaymentContext_clone(const struct LDKUnknownPaymentContext *NONNULL_PTR orig); - -/** - * Checks if two UnknownPaymentContexts 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 UnknownPaymentContext_eq(const struct LDKUnknownPaymentContext *NONNULL_PTR a, const struct LDKUnknownPaymentContext *NONNULL_PTR b); - /** * Frees any resources used by the Bolt12OfferContext, if is_owned is set and inner is non-NULL. */ @@ -56444,6 +58432,11 @@ struct LDKCVec_u8Z ForwardTlvs_write(const struct LDKForwardTlvs *NONNULL_PTR ob */ struct LDKCVec_u8Z ReceiveTlvs_write(const struct LDKReceiveTlvs *NONNULL_PTR obj); +/** + * Serialize the UnauthenticatedReceiveTlvs object into a byte array which can be read by UnauthenticatedReceiveTlvs_read + */ +struct LDKCVec_u8Z UnauthenticatedReceiveTlvs_write(const struct LDKUnauthenticatedReceiveTlvs *NONNULL_PTR obj); + /** * Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read */ @@ -56474,16 +58467,6 @@ struct LDKCVec_u8Z PaymentContext_write(const struct LDKPaymentContext *NONNULL_ */ struct LDKCResult_PaymentContextDecodeErrorZ PaymentContext_read(struct LDKu8slice ser); -/** - * Serialize the UnknownPaymentContext object into a byte array which can be read by UnknownPaymentContext_read - */ -struct LDKCVec_u8Z UnknownPaymentContext_write(const struct LDKUnknownPaymentContext *NONNULL_PTR obj); - -/** - * Read a UnknownPaymentContext from a byte array, created by UnknownPaymentContext_write - */ -struct LDKCResult_UnknownPaymentContextDecodeErrorZ UnknownPaymentContext_read(struct LDKu8slice ser); - /** * Serialize the Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read */ @@ -56689,6 +58672,16 @@ struct LDKMessageContext MessageContext_clone(const struct LDKMessageContext *NO */ struct LDKMessageContext MessageContext_offers(struct LDKOffersContext a); +/** + * Utility method to constructs a new AsyncPayments-variant MessageContext + */ +struct LDKMessageContext MessageContext_async_payments(struct LDKAsyncPaymentsContext a); + +/** + * Utility method to constructs a new DNSResolver-variant MessageContext + */ +struct LDKMessageContext MessageContext_dnsresolver(struct LDKDNSResolverContext a); + /** * Utility method to constructs a new Custom-variant MessageContext */ @@ -56717,7 +58710,7 @@ struct LDKOffersContext OffersContext_outbound_payment(struct LDKThirtyTwoBytes /** * Utility method to constructs a new InboundPayment-variant OffersContext */ -struct LDKOffersContext OffersContext_inbound_payment(struct LDKThirtyTwoBytes payment_hash); +struct LDKOffersContext OffersContext_inbound_payment(struct LDKThirtyTwoBytes payment_hash, struct LDKNonce nonce, struct LDKThirtyTwoBytes hmac); /** * Checks if two OffersContexts contain equal inner contents. @@ -56725,6 +58718,21 @@ struct LDKOffersContext OffersContext_inbound_payment(struct LDKThirtyTwoBytes p */ bool OffersContext_eq(const struct LDKOffersContext *NONNULL_PTR a, const struct LDKOffersContext *NONNULL_PTR b); +/** + * Frees any resources used by the AsyncPaymentsContext + */ +void AsyncPaymentsContext_free(struct LDKAsyncPaymentsContext this_ptr); + +/** + * Creates a copy of the AsyncPaymentsContext + */ +struct LDKAsyncPaymentsContext AsyncPaymentsContext_clone(const struct LDKAsyncPaymentsContext *NONNULL_PTR orig); + +/** + * Utility method to constructs a new OutboundPayment-variant AsyncPaymentsContext + */ +struct LDKAsyncPaymentsContext AsyncPaymentsContext_outbound_payment(struct LDKThirtyTwoBytes payment_id, struct LDKNonce nonce, struct LDKThirtyTwoBytes hmac); + /** * Serialize the MessageContext object into a byte array which can be read by MessageContext_read */ @@ -56745,6 +58753,69 @@ struct LDKCVec_u8Z OffersContext_write(const struct LDKOffersContext *NONNULL_PT */ struct LDKCResult_OffersContextDecodeErrorZ OffersContext_read(struct LDKu8slice ser); +/** + * Serialize the AsyncPaymentsContext object into a byte array which can be read by AsyncPaymentsContext_read + */ +struct LDKCVec_u8Z AsyncPaymentsContext_write(const struct LDKAsyncPaymentsContext *NONNULL_PTR obj); + +/** + * Read a AsyncPaymentsContext from a byte array, created by AsyncPaymentsContext_write + */ +struct LDKCResult_AsyncPaymentsContextDecodeErrorZ AsyncPaymentsContext_read(struct LDKu8slice ser); + +/** + * Frees any resources used by the DNSResolverContext, if is_owned is set and inner is non-NULL. + */ +void DNSResolverContext_free(struct LDKDNSResolverContext this_obj); + +/** + * A nonce which uniquely describes a DNS resolution. + * + * When we receive a DNSSEC proof message, we should check that it was sent over the blinded + * path we included in the request by comparing a stored nonce with this one. + */ +const uint8_t (*DNSResolverContext_get_nonce(const struct LDKDNSResolverContext *NONNULL_PTR this_ptr))[16]; + +/** + * A nonce which uniquely describes a DNS resolution. + * + * When we receive a DNSSEC proof message, we should check that it was sent over the blinded + * path we included in the request by comparing a stored nonce with this one. + */ +void DNSResolverContext_set_nonce(struct LDKDNSResolverContext *NONNULL_PTR this_ptr, struct LDKSixteenBytes val); + +/** + * Constructs a new DNSResolverContext given each field + */ +MUST_USE_RES struct LDKDNSResolverContext DNSResolverContext_new(struct LDKSixteenBytes nonce_arg); + +/** + * Creates a copy of the DNSResolverContext + */ +struct LDKDNSResolverContext DNSResolverContext_clone(const struct LDKDNSResolverContext *NONNULL_PTR orig); + +/** + * Generates a non-cryptographic 64-bit hash of the DNSResolverContext. + */ +uint64_t DNSResolverContext_hash(const struct LDKDNSResolverContext *NONNULL_PTR o); + +/** + * Checks if two DNSResolverContexts 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 DNSResolverContext_eq(const struct LDKDNSResolverContext *NONNULL_PTR a, const struct LDKDNSResolverContext *NONNULL_PTR b); + +/** + * Serialize the DNSResolverContext object into a byte array which can be read by DNSResolverContext_read + */ +struct LDKCVec_u8Z DNSResolverContext_write(const struct LDKDNSResolverContext *NONNULL_PTR obj); + +/** + * Read a DNSResolverContext from a byte array, created by DNSResolverContext_write + */ +struct LDKCResult_DNSResolverContextDecodeErrorZ DNSResolverContext_read(struct LDKu8slice ser); + /** * Frees any resources used by the FundingInfo */ @@ -57182,6 +59253,11 @@ enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_expired(void); */ enum LDKPaymentFailureReason PaymentFailureReason_invoice_request_rejected(void); +/** + * Utility method to constructs a new BlindedPathCreationFailed-variant PaymentFailureReason + */ +enum LDKPaymentFailureReason PaymentFailureReason_blinded_path_creation_failed(void); + /** * Checks if two PaymentFailureReasons contain equal inner contents. * This ignores pointers and is_owned flags and looks at the values in fields. @@ -57198,6 +59274,32 @@ struct LDKCVec_u8Z PaymentFailureReason_write(const enum LDKPaymentFailureReason */ struct LDKCResult_COption_PaymentFailureReasonZDecodeErrorZ PaymentFailureReason_read(struct LDKu8slice ser); +/** + * Frees any resources used by the InboundChannelFunds + */ +void InboundChannelFunds_free(struct LDKInboundChannelFunds this_ptr); + +/** + * Creates a copy of the InboundChannelFunds + */ +struct LDKInboundChannelFunds InboundChannelFunds_clone(const struct LDKInboundChannelFunds *NONNULL_PTR orig); + +/** + * Utility method to constructs a new PushMsat-variant InboundChannelFunds + */ +struct LDKInboundChannelFunds InboundChannelFunds_push_msat(uint64_t a); + +/** + * Utility method to constructs a new DualFunded-variant InboundChannelFunds + */ +struct LDKInboundChannelFunds InboundChannelFunds_dual_funded(void); + +/** + * Checks if two InboundChannelFundss contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool InboundChannelFunds_eq(const struct LDKInboundChannelFunds *NONNULL_PTR a, const struct LDKInboundChannelFunds *NONNULL_PTR b); + /** * Frees any resources used by the Event */ @@ -57221,12 +59323,12 @@ struct LDKEvent Event_funding_tx_broadcast_safe(struct LDKChannelId channel_id, /** * Utility method to constructs a new PaymentClaimable-variant Event */ -struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKChannelId via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline); +struct LDKEvent Event_payment_claimable(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, struct LDKRecipientOnionFields onion_fields, uint64_t amount_msat, uint64_t counterparty_skimmed_fee_msat, struct LDKPaymentPurpose purpose, struct LDKChannelId via_channel_id, struct LDKCOption_U128Z via_user_channel_id, struct LDKCOption_u32Z claim_deadline, struct LDKCOption_ThirtyTwoBytesZ payment_id); /** * Utility method to constructs a new PaymentClaimed-variant Event */ -struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat, struct LDKRecipientOnionFields onion_fields); +struct LDKEvent Event_payment_claimed(struct LDKPublicKey receiver_node_id, struct LDKThirtyTwoBytes payment_hash, uint64_t amount_msat, struct LDKPaymentPurpose purpose, struct LDKCVec_ClaimedHTLCZ htlcs, struct LDKCOption_u64Z sender_intended_total_msat, struct LDKRecipientOnionFields onion_fields, struct LDKCOption_ThirtyTwoBytesZ payment_id); /** * Utility method to constructs a new ConnectionNeeded-variant Event @@ -57286,7 +59388,7 @@ struct LDKEvent Event_spendable_outputs(struct LDKCVec_SpendableOutputDescriptor /** * Utility method to constructs a new PaymentForwarded-variant Event */ -struct LDKEvent Event_payment_forwarded(struct LDKChannelId prev_channel_id, struct LDKChannelId next_channel_id, struct LDKCOption_U128Z prev_user_channel_id, struct LDKCOption_U128Z next_user_channel_id, struct LDKCOption_u64Z total_fee_earned_msat, struct LDKCOption_u64Z skimmed_fee_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); +struct LDKEvent Event_payment_forwarded(struct LDKChannelId prev_channel_id, struct LDKChannelId next_channel_id, struct LDKCOption_U128Z prev_user_channel_id, struct LDKCOption_U128Z next_user_channel_id, struct LDKPublicKey prev_node_id, struct LDKPublicKey next_node_id, struct LDKCOption_u64Z total_fee_earned_msat, struct LDKCOption_u64Z skimmed_fee_msat, bool claim_from_onchain_tx, struct LDKCOption_u64Z outbound_amount_forwarded_msat); /** * Utility method to constructs a new ChannelPending-variant Event @@ -57301,7 +59403,7 @@ struct LDKEvent Event_channel_ready(struct LDKChannelId channel_id, struct LDKU1 /** * Utility method to constructs a new ChannelClosed-variant Event */ -struct LDKEvent Event_channel_closed(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats, struct LDKOutPoint channel_funding_txo); +struct LDKEvent Event_channel_closed(struct LDKChannelId channel_id, struct LDKU128 user_channel_id, struct LDKClosureReason reason, struct LDKPublicKey counterparty_node_id, struct LDKCOption_u64Z channel_capacity_sats, struct LDKOutPoint channel_funding_txo, struct LDKCOption_u64Z last_local_balance_msat); /** * Utility method to constructs a new DiscardFunding-variant Event @@ -57311,7 +59413,7 @@ struct LDKEvent Event_discard_funding(struct LDKChannelId channel_id, struct LDK /** * Utility method to constructs a new OpenChannelRequest-variant Event */ -struct LDKEvent Event_open_channel_request(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, uint64_t push_msat, struct LDKChannelTypeFeatures channel_type, bool is_announced, struct LDKChannelParameters params); +struct LDKEvent Event_open_channel_request(struct LDKChannelId temporary_channel_id, struct LDKPublicKey counterparty_node_id, uint64_t funding_satoshis, struct LDKInboundChannelFunds channel_negotiation_type, struct LDKChannelTypeFeatures channel_type, bool is_announced, struct LDKChannelParameters params); /** * Utility method to constructs a new HTLCHandlingFailed-variant Event @@ -59534,6 +61636,46 @@ MUST_USE_RES bool InitFeatures_requires_shutdown_anysegwit(const struct LDKInitF */ MUST_USE_RES bool NodeFeatures_requires_shutdown_anysegwit(const struct LDKNodeFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void InitFeatures_set_dual_fund_optional(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void InitFeatures_set_dual_fund_required(struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool InitFeatures_supports_dual_fund(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_dual_fund_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_dual_fund_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_dual_fund(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool InitFeatures_requires_dual_fund(const struct LDKInitFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_dual_fund(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + /** * Set this feature as optional. */ @@ -59879,6 +62021,21 @@ void Bolt11InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt11Invoi */ MUST_USE_RES bool Bolt11InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +/** + * Set this feature as optional. + */ +void Bolt12InvoiceFeatures_set_trampoline_routing_optional(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void Bolt12InvoiceFeatures_set_trampoline_routing_required(struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool Bolt12InvoiceFeatures_supports_trampoline_routing(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + /** * Checks if this feature is required. */ @@ -59894,6 +62051,31 @@ MUST_USE_RES bool NodeFeatures_requires_trampoline_routing(const struct LDKNodeF */ MUST_USE_RES bool Bolt11InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt11InvoiceFeatures *NONNULL_PTR this_arg); +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool Bolt12InvoiceFeatures_requires_trampoline_routing(const struct LDKBolt12InvoiceFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as optional. + */ +void NodeFeatures_set_dns_resolution_optional(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Set this feature as required. + */ +void NodeFeatures_set_dns_resolution_required(struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is supported. + */ +MUST_USE_RES bool NodeFeatures_supports_dns_resolution(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + +/** + * Checks if this feature is required. + */ +MUST_USE_RES bool NodeFeatures_requires_dns_resolution(const struct LDKNodeFeatures *NONNULL_PTR this_arg); + /** * Frees any resources used by the RoutingFees, if is_owned is set and inner is non-NULL. */ @@ -60137,6 +62319,12 @@ MUST_USE_RES struct LDKStr FilesystemStore_get_data_dir(const struct LDKFilesyst */ struct LDKKVStore FilesystemStore_as_KVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg); +/** + * Constructs a new MigratableKVStore which calls the relevant methods on this_arg. + * This copies the `inner` pointer in this_arg and thus the returned MigratableKVStore must be freed before this_arg is + */ +struct LDKMigratableKVStore FilesystemStore_as_MigratableKVStore(const struct LDKFilesystemStore *NONNULL_PTR this_arg); + /** * Frees any resources used by the BackgroundProcessor, if is_owned is set and inner is non-NULL. */ @@ -60237,111 +62425,22 @@ MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_join(struct LDKB MUST_USE_RES struct LDKCResult_NoneIOErrorZ BackgroundProcessor_stop(struct LDKBackgroundProcessor this_arg); /** - * Frees any resources used by the Bolt11ParseError - */ -void Bolt11ParseError_free(struct LDKBolt11ParseError this_ptr); - -/** - * Creates a copy of the Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_clone(const struct LDKBolt11ParseError *NONNULL_PTR orig); - -/** - * Utility method to constructs a new Bech32Error-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_bech32_error(struct LDKBech32Error a); - -/** - * Utility method to constructs a new ParseAmountError-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_parse_amount_error(struct LDKError a); - -/** - * Utility method to constructs a new MalformedSignature-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_malformed_signature(enum LDKSecp256k1Error a); - -/** - * Utility method to constructs a new BadPrefix-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_bad_prefix(void); - -/** - * Utility method to constructs a new UnknownCurrency-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_unknown_currency(void); - -/** - * Utility method to constructs a new UnknownSiPrefix-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_unknown_si_prefix(void); - -/** - * Utility method to constructs a new MalformedHRP-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_malformed_hrp(void); - -/** - * Utility method to constructs a new TooShortDataPart-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_too_short_data_part(void); - -/** - * Utility method to constructs a new UnexpectedEndOfTaggedFields-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_unexpected_end_of_tagged_fields(void); - -/** - * Utility method to constructs a new DescriptionDecodeError-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_description_decode_error(struct LDKError a); - -/** - * Utility method to constructs a new PaddingError-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_padding_error(void); - -/** - * Utility method to constructs a new IntegerOverflowError-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_integer_overflow_error(void); - -/** - * Utility method to constructs a new InvalidSegWitProgramLength-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_invalid_seg_wit_program_length(void); - -/** - * Utility method to constructs a new InvalidPubKeyHashLength-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_invalid_pub_key_hash_length(void); - -/** - * Utility method to constructs a new InvalidScriptHashLength-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_invalid_script_hash_length(void); - -/** - * Utility method to constructs a new InvalidRecoveryId-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_invalid_recovery_id(void); - -/** - * Utility method to constructs a new InvalidSliceLength-variant Bolt11ParseError - */ -struct LDKBolt11ParseError Bolt11ParseError_invalid_slice_length(struct LDKStr a); - -/** - * Utility method to constructs a new Skip-variant Bolt11ParseError + * Frees any resources used by the Bolt11ParseError, if is_owned is set and inner is non-NULL. */ -struct LDKBolt11ParseError Bolt11ParseError_skip(void); +void Bolt11ParseError_free(struct LDKBolt11ParseError this_obj); /** * Checks if two Bolt11ParseErrors 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 Bolt11ParseError_eq(const struct LDKBolt11ParseError *NONNULL_PTR a, const struct LDKBolt11ParseError *NONNULL_PTR b); +/** + * Creates a copy of the Bolt11ParseError + */ +struct LDKBolt11ParseError Bolt11ParseError_clone(const struct LDKBolt11ParseError *NONNULL_PTR orig); + /** * Frees any resources used by the ParseOrSemanticError */ @@ -60390,6 +62489,37 @@ struct LDKBolt11Invoice Bolt11Invoice_clone(const struct LDKBolt11Invoice *NONNU */ uint64_t Bolt11Invoice_hash(const struct LDKBolt11Invoice *NONNULL_PTR o); +/** + * Frees any resources used by the Bolt11InvoiceDescription + */ +void Bolt11InvoiceDescription_free(struct LDKBolt11InvoiceDescription this_ptr); + +/** + * Creates a copy of the Bolt11InvoiceDescription + */ +struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_clone(const struct LDKBolt11InvoiceDescription *NONNULL_PTR orig); + +/** + * Utility method to constructs a new Direct-variant Bolt11InvoiceDescription + */ +struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_direct(struct LDKDescription a); + +/** + * Utility method to constructs a new Hash-variant Bolt11InvoiceDescription + */ +struct LDKBolt11InvoiceDescription Bolt11InvoiceDescription_hash(struct LDKSha256 a); + +/** + * Checks if two Bolt11InvoiceDescriptions contain equal inner contents. + * This ignores pointers and is_owned flags and looks at the values in fields. + */ +bool Bolt11InvoiceDescription_eq(const struct LDKBolt11InvoiceDescription *NONNULL_PTR a, const struct LDKBolt11InvoiceDescription *NONNULL_PTR b); + +/** + * Get the string representation of a Bolt11InvoiceDescription object + */ +struct LDKStr Bolt11InvoiceDescription_to_str(const struct LDKBolt11InvoiceDescription *NONNULL_PTR o); + /** * Frees any resources used by the SignedRawBolt11Invoice, if is_owned is set and inner is non-NULL. */ @@ -61101,6 +63231,11 @@ MUST_USE_RES struct LDKCOption_u64Z Bolt11Invoice_amount_milli_satoshis(const st */ MUST_USE_RES struct LDKCResult_DescriptionCreationErrorZ Description_new(struct LDKStr description); +/** + * Creates an empty `Description`. + */ +MUST_USE_RES struct LDKDescription Description_empty(void); + /** * Returns the underlying description [`UntrustedString`] */ diff --git a/lightning-c-bindings/include/lightningpp.hpp b/lightning-c-bindings/include/lightningpp.hpp index 0f8d1d7..6d6be13 100644 --- a/lightning-c-bindings/include/lightningpp.hpp +++ b/lightning-c-bindings/include/lightningpp.hpp @@ -6,10 +6,15 @@ class RefundMaybeWithDerivedMetadataBuilder; class Refund; class Retry; class RetryableSendFailure; -class PaymentSendFailure; class Bolt12PaymentError; class ProbeSendFailure; class RecipientOnionFields; +class DNSResolverMessageHandler; +class DNSResolverMessage; +class DNSSECQuery; +class DNSSECProof; +class HumanReadableName; +class OMNameResolver; class InvoiceWithExplicitSigningPubkeyBuilder; class InvoiceWithDerivedSigningPubkeyBuilder; class UnsignedBolt12Invoice; @@ -106,11 +111,13 @@ class PendingHTLCRouting; class BlindedForward; class PendingHTLCInfo; class BlindedFailure; +class Verification; class FailureCode; class ChannelManager; class ChainParameters; class RecentPaymentDetails; class PhantomRouteHints; +class Bolt11InvoiceParameters; class ChannelManagerReadArgs; class ChannelHandshakeConfig; class ChannelHandshakeLimits; @@ -140,10 +147,12 @@ class PeerManager; class GraphSyncError; class RapidGossipSync; class KVStore; +class MigratableKVStore; class Persister; class MonitorUpdatingPersister; -class InvoiceRequestWithExplicitPayerIdBuilder; -class InvoiceRequestWithDerivedPayerIdBuilder; +class MonitorName; +class UpdateName; +class InvoiceRequestWithDerivedPayerSigningPubkeyBuilder; class UnsignedInvoiceRequest; class SignInvoiceRequestFn; class InvoiceRequest; @@ -266,6 +275,7 @@ class PathFailure; class ClosureReason; class HTLCDestination; class PaymentFailureReason; +class InboundChannelFunds; class Event; class MessageSendEvent; class MessageSendEventsProvider; @@ -279,6 +289,7 @@ class RouteHintHop; class Bolt11ParseError; class ParseOrSemanticError; class Bolt11Invoice; +class Bolt11InvoiceDescription; class SignedRawBolt11Invoice; class RawBolt11Invoice; class RawDataPart; @@ -308,10 +319,10 @@ class BlindedPaymentPath; class PaymentForwardNode; class ForwardTlvs; class ReceiveTlvs; +class UnauthenticatedReceiveTlvs; class PaymentRelay; class PaymentConstraints; class PaymentContext; -class UnknownPaymentContext; class Bolt12OfferContext; class Bolt12RefundContext; class UtxoLookupError; @@ -365,18 +376,22 @@ class NextMessageHop; class MessageForwardNode; class MessageContext; class OffersContext; +class AsyncPaymentsContext; +class DNSResolverContext; class CResult_HtlcKeyDecodeErrorZ; +class CResult_HumanReadableNameDecodeErrorZ; class CResult_TransactionU16LenLimitedNoneZ; class CVec_TrackedSpendableOutputZ; -class CResult_LockedChannelMonitorNoneZ; class CResult_PhantomRouteHintsDecodeErrorZ; +class CResult_LockedChannelMonitorNoneZ; class CResult_FundingCreatedDecodeErrorZ; -class CVec_C2Tuple_u32TxOutZZ; +class COption_C2Tuple_DNSResolverMessageResponseInstructionZZ; class CResult_RetryDecodeErrorZ; class CResult_BlindedForwardDecodeErrorZ; class CResult_ChannelInfoDecodeErrorZ; class COption_PaymentContextZ; class COption_MaxDustHTLCExposureZ; +class CVec_C2Tuple_u32TxOutZZ; class CResult_NoneSendErrorZ; class CResult_CVec_u8ZPeerHandleErrorZ; class CResult_OnionPacketDecodeErrorZ; @@ -389,35 +404,38 @@ class COption_FilterZ; class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32CVec_u8ZZZZ; class COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ; class CResult_COption_APIErrorZDecodeErrorZ; +class CVec_C3Tuple_StrStrStrZZ; class CVec_UpdateAddHTLCZ; -class CResult_TxAbortDecodeErrorZ; class CResult_StaticPaymentOutputDescriptorDecodeErrorZ; class COption_u32Z; class CResult_RecipientOnionFieldsNoneZ; class C2Tuple__u1632_u1632Z; class CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ; -class C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ; +class C2Tuple_HumanReadableNameThirtyTwoBytesZ; class CResult_TransactionNoneZ; +class C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ; class CResult_CVec_StrZIOErrorZ; class CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ; class COption_ECDSASignatureZ; +class CResult_TxAbortDecodeErrorZ; class CResult_ClosingSignedFeeRangeDecodeErrorZ; class CResult_CommitmentSignedDecodeErrorZ; -class CResult_CommitmentTransactionDecodeErrorZ; -class CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ; class CResult_StfuDecodeErrorZ; class CResult_OpenChannelDecodeErrorZ; class CResult_ErrorMessageDecodeErrorZ; +class CResult_CommitmentTransactionDecodeErrorZ; +class CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ; class COption_APIErrorZ; class CVec_PeerDetailsZ; class CResult_u64ShortChannelIdErrorZ; class CResult_QueryChannelRangeDecodeErrorZ; class CVec_InputZ; -class CResult_ChannelFeaturesDecodeErrorZ; -class CResult_ChannelReadyDecodeErrorZ; class CVec_TransactionZ; +class C2Tuple_DNSResolverMessageResponseInstructionZ; +class CResult_ChannelReadyDecodeErrorZ; class CResult_UpdateFeeDecodeErrorZ; class CResult_NoneBolt11SemanticErrorZ; +class CResult_ChannelFeaturesDecodeErrorZ; class CResult_RevocationBasepointDecodeErrorZ; class COption_OnionMessageContentsZ; class CResult_NoneRetryableSendFailureZ; @@ -444,7 +462,6 @@ class CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ; class CVec_ThirtyTwoBytesZ; class CResult_ChannelMonitorUpdateStatusNoneZ; class CResult_ClosingSignedDecodeErrorZ; -class CVec_CResult_NoneAPIErrorZZ; class CResult_SchnorrSignatureNoneZ; class C2Tuple_ReleaseHeldHtlcResponseInstructionZ; class CResult_CounterpartyCommitmentSecretsDecodeErrorZ; @@ -457,7 +474,9 @@ class CResult_PaymentParametersDecodeErrorZ; class CResult_DelayedPaymentBasepointDecodeErrorZ; class C2Tuple_ThirtyTwoBytesChannelMonitorZ; class COption_U128Z; +class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ; class C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ; +class CResult_UpdateNameIOErrorZ; class CVec_MessageForwardNodeZ; class CResult_TxAckRbfDecodeErrorZ; class CResult_Bolt11InvoiceBolt11SemanticErrorZ; @@ -467,10 +486,10 @@ class CResult_PongDecodeErrorZ; class CResult_UnsignedChannelAnnouncementDecodeErrorZ; class CResult_ChannelIdAPIErrorZ; class CResult_CVec_u8ZNoneZ; +class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ; class CVec_C2Tuple_ChannelIdPublicKeyZZ; class C2Tuple_ThirtyTwoBytesCVec_C2Tuple_u32TxOutZZZ; class CResult_ChannelTransactionParametersDecodeErrorZ; -class CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ; class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ; class CResult_InFlightHtlcsDecodeErrorZ; class CResult_CommitmentSignedBatchDecodeErrorZ; @@ -488,6 +507,8 @@ class CResult_NonePeerHandleErrorZ; class CResult_TrustedCommitmentTransactionNoneZ; class CResult_FinalOnionHopDataDecodeErrorZ; class CResult_COption_EventZDecodeErrorZ; +class CResult_DNSResolverMessageDecodeErrorZ; +class C2Tuple_PublicKeyChannelIdZ; class COption_SocketAddressZ; class CResult_COption_MonitorEventZDecodeErrorZ; class COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ; @@ -499,14 +520,17 @@ class CResult_PaymentRelayDecodeErrorZ; class CResult_QueryShortChannelIdsDecodeErrorZ; class CResult_VerifiedInvoiceRequestNoneZ; class CResult_UpdateAddHTLCDecodeErrorZ; +class CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ; class COption_OutboundHTLCStateDetailsZ; class COption_MonitorEventZ; -class COption_TypeZ; class CResult_COption_TypeZDecodeErrorZ; +class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ; class CResult_OfferDecodeErrorZ; -class CResult_COption_PathFailureZDecodeErrorZ; +class COption_TypeZ; class CResult_Bolt11InvoiceSignOrCreationErrorZ; -class CResult_BlindedMessagePathNoneZ; +class CResult_COption_PathFailureZDecodeErrorZ; +class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ; +class COption_C2Tuple_PublicKeyChannelIdZZ; class CResult_UpdateFailHTLCDecodeErrorZ; class CResult_BlindedPaymentPathNoneZ; class CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ; @@ -514,9 +538,11 @@ class CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ; class CResult_SpendableOutputDescriptorDecodeErrorZ; class CResult_RevokeAndACKDecodeErrorZ; class CResult_UnsignedChannelUpdateDecodeErrorZ; +class CResult_MonitorNameIOErrorZ; class CResult_PayeePubKeySecp256k1ErrorZ; class C2Tuple__u832u16Z; class CResult_BlindedMessagePathDecodeErrorZ; +class CResult_BlindedMessagePathNoneZ; class CResult_CVec_BlindedMessagePathZNoneZ; class COption_BigEndianScalarZ; class CVec_ChannelIdZ; @@ -548,12 +574,15 @@ class CResult_ReplyShortChannelIdsEndDecodeErrorZ; class COption_PathFailureZ; class COption_MessageContextZ; class CVec_ECDSASignatureZ; +class C2Tuple_DNSResolverMessageMessageSendInstructionsZ; class CResult_ChannelUpdateInfoDecodeErrorZ; -class CVec_UpdateFailHTLCZ; class CVec_TxOutZ; +class CVec_DestinationZ; +class CVec_UpdateFailHTLCZ; class CVec_InboundHTLCDetailsZ; class CVec_OutboundHTLCDetailsZ; class CResult_BuiltCommitmentTransactionDecodeErrorZ; +class C2Tuple_boolboolZ; class CVec_PaymentForwardNodeZ; class CResult_TrackedSpendableOutputDecodeErrorZ; class CVec_SpendableOutputDescriptorZ; @@ -577,40 +606,41 @@ class CResult_ChannelMonitorUpdateDecodeErrorZ; class CResult_ReplyChannelRangeDecodeErrorZ; class CResult_UnsignedNodeAnnouncementDecodeErrorZ; class CResult_TrustedClosingTransactionNoneZ; -class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ; class C2Tuple_PublicKeyTypeZ; class CResult_TxRemoveOutputDecodeErrorZ; class CResult_ChannelReestablishDecodeErrorZ; class CResult_OnionMessageDecodeErrorZ; class CResult_Bolt11InvoiceParseOrSemanticErrorZ; class CResult_MessageContextDecodeErrorZ; +class CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ; class CResult_InitFeaturesDecodeErrorZ; class CResult_PublicKeyNoneZ; +class C3Tuple_StrStrStrZ; class CResult_PingDecodeErrorZ; class CResult_RevocationKeyDecodeErrorZ; class C2Tuple_OffersMessageMessageSendInstructionsZ; -class CResult_BlindedHopFeaturesDecodeErrorZ; class CResult_ChannelIdDecodeErrorZ; +class CResult_BlindedHopFeaturesDecodeErrorZ; class CVec_TransactionOutputsZ; class COption_HTLCClaimZ; -class COption_boolZ; class CVec_BlindedPaymentPathZ; +class CResult_HumanReadableNameNoneZ; +class COption_boolZ; class CResult_ProbabilisticScorerDecodeErrorZ; -class COption_StrZ; class CResult_CVec_BlindedPaymentPathZNoneZ; -class COption_C2Tuple_OffersMessageResponseInstructionZZ; +class COption_StrZ; class C2Tuple_usizeTransactionZ; class COption_OffersContextZ; -class CResult_NodeAnnouncementDecodeErrorZ; +class COption_C2Tuple_OffersMessageResponseInstructionZZ; class CVec_ChannelMonitorZ; class CResult_AcceptChannelV2DecodeErrorZ; -class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ; +class CResult_NodeAnnouncementDecodeErrorZ; class CResult_RouteHopDecodeErrorZ; class CResult_OfferIdDecodeErrorZ; class CVec_HTLCOutputInCommitmentZ; class CResult_CoinSelectionNoneZ; +class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ; class CVec_FutureZ; -class CResult_TxCreationKeysDecodeErrorZ; class CResult_RefundBolt12SemanticErrorZ; class CResult_NoneIOErrorZ; class CResult_MaxDustHTLCExposureDecodeErrorZ; @@ -620,28 +650,30 @@ class CResult_FundingSignedDecodeErrorZ; class CResult_RecoverableSignatureNoneZ; class CResult_SocketAddressDecodeErrorZ; class C2Tuple_Z; -class CResult_ShutdownScriptDecodeErrorZ; +class CResult_TxCreationKeysDecodeErrorZ; class CResult_InboundHTLCDetailsDecodeErrorZ; -class CResult_SiPrefixBolt11ParseErrorZ; +class CResult_ShutdownScriptDecodeErrorZ; class C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ; +class CResult_SiPrefixBolt11ParseErrorZ; class CVec_PathZ; class CResult_NetworkGraphDecodeErrorZ; class CResult_NodeInfoDecodeErrorZ; class CVec_NodeIdZ; class CVec_u8Z; class CResult_RouteLightningErrorZ; -class CResult_NonePaymentSendFailureZ; class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ; class CResult_ChannelPublicKeysDecodeErrorZ; class CVec_ClaimedHTLCZ; +class CResult_DelayedPaymentKeyDecodeErrorZ; class COption_CVec_ThirtyTwoBytesZZ; class CVec_SocketAddressZ; class CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ; -class CResult_ThirtyTwoBytesPaymentSendFailureZ; +class CResult_InvoiceRequestDecodeErrorZ; +class CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ; class CResult_WarningMessageDecodeErrorZ; class CResult_ChannelCounterpartyDecodeErrorZ; class CResult_HolderCommitmentTransactionDecodeErrorZ; -class CResult_DelayedPaymentKeyDecodeErrorZ; +class CResult_AsyncPaymentsContextDecodeErrorZ; class C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ; class CResult_OfferBolt12SemanticErrorZ; class CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ; @@ -650,8 +682,9 @@ class CResult_PaymentPurposeDecodeErrorZ; class CResult_ClaimedHTLCDecodeErrorZ; class CResult_OutPointDecodeErrorZ; class CVec_ChannelDetailsZ; -class CResult_Bolt11InvoiceFeaturesDecodeErrorZ; +class CResult_DNSResolverContextDecodeErrorZ; class CVec_MessageSendEventZ; +class CResult_Bolt11InvoiceFeaturesDecodeErrorZ; class CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ; class CResult_RouteHintHopDecodeErrorZ; class CResult_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ; @@ -661,6 +694,7 @@ class CResult_ThirtyTwoBytesAPIErrorZ; class COption_ChannelShutdownStateZ; class CResult_Bolt12InvoiceBolt12SemanticErrorZ; class CResult_InvoiceRequestFieldsDecodeErrorZ; +class CResult_NoneBolt12PaymentErrorZ; class CResult_AcceptChannelDecodeErrorZ; class CResult_RefundDecodeErrorZ; class CResult_HostnameDecodeErrorZ; @@ -668,13 +702,12 @@ class C2Tuple_u64u16Z; class COption_ThirtyTwoBytesZ; class CVec_u64Z; class CResult_NoneBolt12SemanticErrorZ; -class CResult_UnknownPaymentContextDecodeErrorZ; class COption_InboundHTLCStateDetailsZ; class CResult_OutputSweeperDecodeErrorZ; class CResult_C2Tuple_CVec_u8Zu64ZNoneZ; class COption_EventZ; -class CResult_ChannelTypeFeaturesDecodeErrorZ; class COption_CVec_SocketAddressZZ; +class CResult_ChannelTypeFeaturesDecodeErrorZ; class CVec_RouteHintZ; class COption_u16Z; class COption_PaymentFailureReasonZ; @@ -691,18 +724,18 @@ class CResult_COption_PaymentFailureReasonZDecodeErrorZ; class CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ; class CResult_ChannelDerivationParametersDecodeErrorZ; class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ; -class CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ; -class CResult_OnionMessagePathNoneZ; +class CResult_PaymentConstraintsDecodeErrorZ; class C2Tuple_u32CVec_u8ZZ; class CVec_C2Tuple_PublicKeyTypeZZ; class CResult_OutboundHTLCDetailsDecodeErrorZ; +class CResult_OnionMessagePathNoneZ; class CResult_RefundBolt12ParseErrorZ; class CResult_u32GraphSyncErrorZ; class CVec_C2Tuple_u64CVec_u8ZZZ; class CResult_OffersMessageDecodeErrorZ; -class CResult_PaymentConstraintsDecodeErrorZ; +class CVec_PhantomRouteHintsZ; class CResult_NoneAPIErrorZ; -class CResult_Bolt12InvoiceFeaturesDecodeErrorZ; +class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; class COption_f64Z; class CResult_TxRemoveInputDecodeErrorZ; class CVec_PublicKeyZ; @@ -716,16 +749,15 @@ class CResult_PendingHTLCRoutingDecodeErrorZ; class COption_C2Tuple_OnionMessageContentsResponseInstructionZZ; class CResult_RecipientOnionFieldsDecodeErrorZ; class C2Tuple_u32TxOutZ; -class CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ; class CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ; class CResult_ChannelDetailsDecodeErrorZ; +class CResult_Bolt12InvoiceFeaturesDecodeErrorZ; class CVec_UtxoZ; -class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ; +class CResult_PaymentContextDecodeErrorZ; +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ; class CResult_ChannelConfigDecodeErrorZ; -class CVec_PrivateRouteZ; class COption_i64Z; -class CResult_PaymentContextDecodeErrorZ; -class CVec_PhantomRouteHintsZ; +class CVec_PrivateRouteZ; class CVec_C2Tuple_OutPointCVec_u64ZZZ; class C2Tuple_ThirtyTwoBytesChannelManagerZ; class CResult_COption_OnionMessageContentsZDecodeErrorZ; @@ -733,6 +765,7 @@ class C2Tuple_u64CVec_u8ZZ; class CResult_OfferBolt12ParseErrorZ; class CResult_ThirtyTwoBytesRetryableSendFailureZ; class CVec_MonitorEventZ; +class CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ; class CResult_ShutdownDecodeErrorZ; class CResult_BigSizeDecodeErrorZ; class CResult_TxOutUtxoLookupErrorZ; @@ -742,21 +775,20 @@ class CResult_OffersContextDecodeErrorZ; class CResult_NoneNoneZ; class CResult_boolPeerHandleErrorZ; class CResult_ChannelUpdateDecodeErrorZ; -class CVec_APIErrorZ; class COption_TxOutZ; class COption_ClosureReasonZ; +class CResult_TransactionU16LenLimitedDecodeErrorZ; class CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ; class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ; -class CResult_TransactionU16LenLimitedDecodeErrorZ; class CResult_FundingInfoDecodeErrorZ; class COption_AmountZ; -class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ; +class C2Tuple_DNSSECQueryDNSResolverContextZ; class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ; -class CResult_OpenChannelV2DecodeErrorZ; +class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ; class CResult_BestBlockDecodeErrorZ; class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ; +class CResult_OpenChannelV2DecodeErrorZ; class CResult_CounterpartyForwardingInfoDecodeErrorZ; -class CResult_OutputSpendStatusDecodeErrorZ; class C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ; class CResult_RouteDecodeErrorZ; class CResult_BlindedFailureDecodeErrorZ; @@ -765,7 +797,9 @@ class COption_NoneZ; class CResult_SpliceLockedDecodeErrorZ; class COption_CVec_u8ZZ; class COption_QuantityZ; +class CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ; class CResult_TxAddOutputDecodeErrorZ; +class CResult_OutputSpendStatusDecodeErrorZ; class CResult_HtlcBasepointDecodeErrorZ; class C2Tuple_OutPointChannelIdZ; @@ -843,21 +877,6 @@ class RetryableSendFailure { const LDKRetryableSendFailure* operator &() const { return &self; } const LDKRetryableSendFailure* operator ->() const { return &self; } }; -class PaymentSendFailure { -private: - LDKPaymentSendFailure self; -public: - PaymentSendFailure(const PaymentSendFailure&) = delete; - PaymentSendFailure(PaymentSendFailure&& o) : self(o.self) { memset(&o, 0, sizeof(PaymentSendFailure)); } - PaymentSendFailure(LDKPaymentSendFailure&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKPaymentSendFailure)); } - operator LDKPaymentSendFailure() && { LDKPaymentSendFailure res = self; memset(&self, 0, sizeof(LDKPaymentSendFailure)); return res; } - ~PaymentSendFailure() { PaymentSendFailure_free(self); } - PaymentSendFailure& operator=(PaymentSendFailure&& o) { PaymentSendFailure_free(self); self = o.self; memset(&o, 0, sizeof(PaymentSendFailure)); return *this; } - LDKPaymentSendFailure* operator &() { return &self; } - LDKPaymentSendFailure* operator ->() { return &self; } - const LDKPaymentSendFailure* operator &() const { return &self; } - const LDKPaymentSendFailure* operator ->() const { return &self; } -}; class Bolt12PaymentError { private: LDKBolt12PaymentError self; @@ -903,6 +922,121 @@ class RecipientOnionFields { const LDKRecipientOnionFields* operator &() const { return &self; } const LDKRecipientOnionFields* operator ->() const { return &self; } }; +class DNSResolverMessageHandler { +private: + LDKDNSResolverMessageHandler self; +public: + DNSResolverMessageHandler(const DNSResolverMessageHandler&) = delete; + DNSResolverMessageHandler(DNSResolverMessageHandler&& o) : self(o.self) { memset(&o, 0, sizeof(DNSResolverMessageHandler)); } + DNSResolverMessageHandler(LDKDNSResolverMessageHandler&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDNSResolverMessageHandler)); } + operator LDKDNSResolverMessageHandler() && { LDKDNSResolverMessageHandler res = self; memset(&self, 0, sizeof(LDKDNSResolverMessageHandler)); return res; } + ~DNSResolverMessageHandler() { DNSResolverMessageHandler_free(self); } + DNSResolverMessageHandler& operator=(DNSResolverMessageHandler&& o) { DNSResolverMessageHandler_free(self); self = o.self; memset(&o, 0, sizeof(DNSResolverMessageHandler)); return *this; } + LDKDNSResolverMessageHandler* operator &() { return &self; } + LDKDNSResolverMessageHandler* operator ->() { return &self; } + const LDKDNSResolverMessageHandler* operator &() const { return &self; } + const LDKDNSResolverMessageHandler* operator ->() const { return &self; } + /** + * Handle a [`DNSSECQuery`] message. + * + * If we provide DNS resolution services to third parties, we should respond with a + * [`DNSSECProof`] message. + * + * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + */ + inline LDK::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ handle_dnssec_query(struct LDKDNSSECQuery message, struct LDKResponder responder); + /** + * Handle a [`DNSSECProof`] message (in response to a [`DNSSECQuery`] we presumably sent). + * + * With this, we should be able to validate the DNS record we requested. + */ + inline void handle_dnssec_proof(struct LDKDNSSECProof message, struct LDKDNSResolverContext context); + /** + * Gets the node feature flags which this handler itself supports. Useful for setting the + * `dns_resolver` flag if this handler supports returning [`DNSSECProof`] messages in response + * to [`DNSSECQuery`] messages. + */ + inline LDK::NodeFeatures provided_node_features(); + /** + * Release any [`DNSResolverMessage`]s that need to be sent. + */ + inline LDK::CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ release_pending_messages(); +}; +class DNSResolverMessage { +private: + LDKDNSResolverMessage self; +public: + DNSResolverMessage(const DNSResolverMessage&) = delete; + DNSResolverMessage(DNSResolverMessage&& o) : self(o.self) { memset(&o, 0, sizeof(DNSResolverMessage)); } + DNSResolverMessage(LDKDNSResolverMessage&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDNSResolverMessage)); } + operator LDKDNSResolverMessage() && { LDKDNSResolverMessage res = self; memset(&self, 0, sizeof(LDKDNSResolverMessage)); return res; } + ~DNSResolverMessage() { DNSResolverMessage_free(self); } + DNSResolverMessage& operator=(DNSResolverMessage&& o) { DNSResolverMessage_free(self); self = o.self; memset(&o, 0, sizeof(DNSResolverMessage)); return *this; } + LDKDNSResolverMessage* operator &() { return &self; } + LDKDNSResolverMessage* operator ->() { return &self; } + const LDKDNSResolverMessage* operator &() const { return &self; } + const LDKDNSResolverMessage* operator ->() const { return &self; } +}; +class DNSSECQuery { +private: + LDKDNSSECQuery self; +public: + DNSSECQuery(const DNSSECQuery&) = delete; + DNSSECQuery(DNSSECQuery&& o) : self(o.self) { memset(&o, 0, sizeof(DNSSECQuery)); } + DNSSECQuery(LDKDNSSECQuery&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDNSSECQuery)); } + operator LDKDNSSECQuery() && { LDKDNSSECQuery res = self; memset(&self, 0, sizeof(LDKDNSSECQuery)); return res; } + ~DNSSECQuery() { DNSSECQuery_free(self); } + DNSSECQuery& operator=(DNSSECQuery&& o) { DNSSECQuery_free(self); self = o.self; memset(&o, 0, sizeof(DNSSECQuery)); return *this; } + LDKDNSSECQuery* operator &() { return &self; } + LDKDNSSECQuery* operator ->() { return &self; } + const LDKDNSSECQuery* operator &() const { return &self; } + const LDKDNSSECQuery* operator ->() const { return &self; } +}; +class DNSSECProof { +private: + LDKDNSSECProof self; +public: + DNSSECProof(const DNSSECProof&) = delete; + DNSSECProof(DNSSECProof&& o) : self(o.self) { memset(&o, 0, sizeof(DNSSECProof)); } + DNSSECProof(LDKDNSSECProof&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDNSSECProof)); } + operator LDKDNSSECProof() && { LDKDNSSECProof res = self; memset(&self, 0, sizeof(LDKDNSSECProof)); return res; } + ~DNSSECProof() { DNSSECProof_free(self); } + DNSSECProof& operator=(DNSSECProof&& o) { DNSSECProof_free(self); self = o.self; memset(&o, 0, sizeof(DNSSECProof)); return *this; } + LDKDNSSECProof* operator &() { return &self; } + LDKDNSSECProof* operator ->() { return &self; } + const LDKDNSSECProof* operator &() const { return &self; } + const LDKDNSSECProof* operator ->() const { return &self; } +}; +class HumanReadableName { +private: + LDKHumanReadableName self; +public: + HumanReadableName(const HumanReadableName&) = delete; + HumanReadableName(HumanReadableName&& o) : self(o.self) { memset(&o, 0, sizeof(HumanReadableName)); } + HumanReadableName(LDKHumanReadableName&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKHumanReadableName)); } + operator LDKHumanReadableName() && { LDKHumanReadableName res = self; memset(&self, 0, sizeof(LDKHumanReadableName)); return res; } + ~HumanReadableName() { HumanReadableName_free(self); } + HumanReadableName& operator=(HumanReadableName&& o) { HumanReadableName_free(self); self = o.self; memset(&o, 0, sizeof(HumanReadableName)); return *this; } + LDKHumanReadableName* operator &() { return &self; } + LDKHumanReadableName* operator ->() { return &self; } + const LDKHumanReadableName* operator &() const { return &self; } + const LDKHumanReadableName* operator ->() const { return &self; } +}; +class OMNameResolver { +private: + LDKOMNameResolver self; +public: + OMNameResolver(const OMNameResolver&) = delete; + OMNameResolver(OMNameResolver&& o) : self(o.self) { memset(&o, 0, sizeof(OMNameResolver)); } + OMNameResolver(LDKOMNameResolver&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKOMNameResolver)); } + operator LDKOMNameResolver() && { LDKOMNameResolver res = self; memset(&self, 0, sizeof(LDKOMNameResolver)); return res; } + ~OMNameResolver() { OMNameResolver_free(self); } + OMNameResolver& operator=(OMNameResolver&& o) { OMNameResolver_free(self); self = o.self; memset(&o, 0, sizeof(OMNameResolver)); return *this; } + LDKOMNameResolver* operator &() { return &self; } + LDKOMNameResolver* operator ->() { return &self; } + const LDKOMNameResolver* operator &() const { return &self; } + const LDKOMNameResolver* operator ->() const { return &self; } +}; class InvoiceWithExplicitSigningPubkeyBuilder { private: LDKInvoiceWithExplicitSigningPubkeyBuilder self; @@ -1076,10 +1210,9 @@ class ChannelSigner { * * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. * - * If the signer returns `Err`, then the user is responsible for either force-closing the channel - * or calling `ChannelManager::signer_unblocked` (this method is only available when the - * `async_signing` cfg flag is enabled) once the signature is ready. - * + * This method is *not* asynchronous. This method is expected to always return `Ok` + * immediately after we reconnect to peers, and returning an `Err` may lead to an immediate + * `panic`. This method will be made asynchronous in a future release. */ inline LDK::CResult_PublicKeyNoneZ get_per_commitment_point(uint64_t idx); /** @@ -1091,6 +1224,12 @@ class ChannelSigner { * May be called more than once for the same index. * * Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ inline LDK::CResult__u832NoneZ release_commitment_secret(uint64_t idx); /** @@ -1107,6 +1246,10 @@ class ChannelSigner { * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + * and pause future signing operations until this validation completes. */ inline LDK::CResult_NoneNoneZ validate_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR holder_tx, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** @@ -1114,12 +1257,18 @@ class ChannelSigner { * * This is required in order for the signer to make sure that the state has moved * forward and it is safe to sign the next counterparty commitment. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + * and pause future signing operations until this validation completes. */ inline LDK::CResult_NoneNoneZ validate_counterparty_revocation(uint64_t idx, const uint8_t (*secret)[32]); /** * 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 * [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. + * + * This method is *not* asynchronous. Instead, the value must be cached locally. */ inline LDKThirtyTwoBytes channel_keys_id(); /** @@ -1184,7 +1333,7 @@ class NodeSigner { const LDKNodeSigner* operator &() const { return &self; } const LDKNodeSigner* operator ->() const { return &self; } /** - * Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + * Get the [`ExpandedKey`] for use in encrypting and decrypting inbound payment data. * * If the implementor of this trait supports [phantom node payments], then every node that is * intended to be included in the phantom invoice route hints must return the same value from @@ -1194,7 +1343,7 @@ class NodeSigner { * * [phantom node payments]: PhantomKeysManager */ - inline LDKThirtyTwoBytes get_inbound_payment_key_material(); + inline LDK::ExpandedKey get_inbound_payment_key(); /** * Get node id based on the provided [`Recipient`]. * @@ -1229,26 +1378,9 @@ class NodeSigner { * Errors if the [`Recipient`] variant is not supported by the implementation. */ inline LDK::CResult_RecoverableSignatureNoneZ sign_invoice(const struct LDKRawBolt11Invoice *NONNULL_PTR invoice, enum LDKRecipient recipient); - /** - * Signs the [`TaggedHash`] of a BOLT 12 invoice request. - * - * May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where - * `invoice_request` is the callee. - * - * Implementors may check that the `invoice_request` is expected rather than blindly signing - * the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with - * the node's signing key or an ephemeral key to preserve privacy, whichever is associated with - * [`UnsignedInvoiceRequest::payer_id`]. - * - * [`TaggedHash`]: crate::offers::merkle::TaggedHash - */ - inline LDK::CResult_SchnorrSignatureNoneZ sign_bolt12_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request); /** * Signs the [`TaggedHash`] of a BOLT 12 invoice. * - * May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the - * callee. - * * Implementors may check that the `invoice` is expected rather than blindly signing the tagged * hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing * key or an ephemeral key to preserve privacy, whichever is associated with @@ -2838,6 +2970,30 @@ class BlindedFailure { const LDKBlindedFailure* operator &() const { return &self; } const LDKBlindedFailure* operator ->() const { return &self; } }; +class Verification { +private: + LDKVerification self; +public: + Verification(const Verification&) = delete; + Verification(Verification&& o) : self(o.self) { memset(&o, 0, sizeof(Verification)); } + Verification(LDKVerification&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKVerification)); } + operator LDKVerification() && { LDKVerification res = self; memset(&self, 0, sizeof(LDKVerification)); return res; } + ~Verification() { Verification_free(self); } + Verification& operator=(Verification&& o) { Verification_free(self); self = o.self; memset(&o, 0, sizeof(Verification)); return *this; } + LDKVerification* operator &() { return &self; } + LDKVerification* operator ->() { return &self; } + const LDKVerification* operator &() const { return &self; } + const LDKVerification* operator ->() const { return &self; } + /** + * Constructs an HMAC to include in [`OffersContext`] for the data along with the given + * [`Nonce`]. + */ + inline LDKThirtyTwoBytes hmac_for_offer_payment(struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); + /** + * Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`]. + */ + inline LDK::CResult_NoneNoneZ verify_for_offer_payment(struct LDKThirtyTwoBytes hmac, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key); +}; class FailureCode { private: LDKFailureCode self; @@ -2913,6 +3069,21 @@ class PhantomRouteHints { const LDKPhantomRouteHints* operator &() const { return &self; } const LDKPhantomRouteHints* operator ->() const { return &self; } }; +class Bolt11InvoiceParameters { +private: + LDKBolt11InvoiceParameters self; +public: + Bolt11InvoiceParameters(const Bolt11InvoiceParameters&) = delete; + Bolt11InvoiceParameters(Bolt11InvoiceParameters&& o) : self(o.self) { memset(&o, 0, sizeof(Bolt11InvoiceParameters)); } + Bolt11InvoiceParameters(LDKBolt11InvoiceParameters&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBolt11InvoiceParameters)); } + operator LDKBolt11InvoiceParameters() && { LDKBolt11InvoiceParameters res = self; memset(&self, 0, sizeof(LDKBolt11InvoiceParameters)); return res; } + ~Bolt11InvoiceParameters() { Bolt11InvoiceParameters_free(self); } + Bolt11InvoiceParameters& operator=(Bolt11InvoiceParameters&& o) { Bolt11InvoiceParameters_free(self); self = o.self; memset(&o, 0, sizeof(Bolt11InvoiceParameters)); return *this; } + LDKBolt11InvoiceParameters* operator &() { return &self; } + LDKBolt11InvoiceParameters* operator ->() { return &self; } + const LDKBolt11InvoiceParameters* operator &() const { return &self; } + const LDKBolt11InvoiceParameters* operator ->() const { return &self; } +}; class ChannelManagerReadArgs { private: LDKChannelManagerReadArgs self; @@ -3080,8 +3251,6 @@ class EcdsaChannelSigner { /** * Create a signature for a counterparty's commitment transaction and associated HTLC transactions. * - * Note that if signing fails or is rejected, the channel will be force-closed. - * * Policy checks should be implemented in this function, including checking the amount * sent to us and checking the HTLCs. * @@ -3092,6 +3261,12 @@ class EcdsaChannelSigner { * * Note that all the relevant preimages will be provided, but there may also be additional * irrelevant or duplicate preimages. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages); /** @@ -3108,9 +3283,10 @@ class EcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ inline LDK::CResult_ECDSASignatureNoneZ sign_holder_commitment(const struct LDKHolderCommitmentTransaction *NONNULL_PTR commitment_tx); /** @@ -3132,9 +3308,10 @@ class EcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ inline LDK::CResult_ECDSASignatureNoneZ sign_justice_revoked_output(struct LDKTransaction justice_tx, uintptr_t input, uint64_t amount, const uint8_t (*per_commitment_key)[32]); /** @@ -3160,9 +3337,10 @@ class EcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ inline LDK::CResult_ECDSASignatureNoneZ 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); /** @@ -3177,11 +3355,12 @@ class EcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All * [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ inline LDK::CResult_ECDSASignatureNoneZ sign_holder_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, const struct LDKHTLCDescriptor *NONNULL_PTR htlc_descriptor); /** @@ -3206,9 +3385,10 @@ class EcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ inline LDK::CResult_ECDSASignatureNoneZ sign_counterparty_htlc_transaction(struct LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, struct LDKPublicKey per_commitment_point, const struct LDKHTLCOutputInCommitment *NONNULL_PTR htlc); /** @@ -3216,6 +3396,12 @@ class EcdsaChannelSigner { * * Note that, due to rounding, there may be one "missing" satoshi, and either party may have * chosen to forgo their output as dust. + * + * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + * signature and should be retried later. Once the signer is ready to provide a signature after + * previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + * + * [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked */ inline LDK::CResult_ECDSASignatureNoneZ sign_closing_transaction(const struct LDKClosingTransaction *NONNULL_PTR closing_tx); /** @@ -3225,9 +3411,10 @@ class EcdsaChannelSigner { * An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid * signature and should be retried later. Once the signer is ready to provide a signature after * previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - * monitor. + * monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. * * [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + * [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked */ inline LDK::CResult_ECDSASignatureNoneZ sign_holder_anchor_input(struct LDKTransaction anchor_tx, uintptr_t input); /** @@ -3237,13 +3424,28 @@ class EcdsaChannelSigner { * Channel announcements also require a signature from each node's network key. Our node * signature is computed through [`NodeSigner::sign_gossip_message`]. * - * Note that if this fails or is rejected, the channel will not be publicly announced and - * our counterparty may (though likely will not) close the channel on us for violating the - * protocol. + * This method is *not* asynchronous. If an `Err` is returned, the channel will not be + * publicly announced and our counterparty may (though likely will not) close the channel on + * us for violating the protocol. * * [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message */ inline LDK::CResult_ECDSASignatureNoneZ sign_channel_announcement_with_funding_key(const struct LDKUnsignedChannelAnnouncement *NONNULL_PTR msg); + /** + * Signs the input of a splicing funding transaction with our funding key. + * + * In splicing, the previous funding transaction output is spent as the input of + * the new funding transaction, and is a 2-of-2 multisig. + * + * `input_index`: The index of the input within the new funding transaction `tx`, + * spending the previous funding transaction's output + * + * `input_value`: The value of the previous funding transaction output. + * + * This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + * closed. + */ + inline LDK::CResult_ECDSASignatureNoneZ sign_splicing_funding_input(struct LDKTransaction tx, uintptr_t input_index, uint64_t input_value); }; class ChannelMonitorUpdate { private: @@ -3631,6 +3833,31 @@ class KVStore { */ inline LDK::CResult_CVec_StrZIOErrorZ list(struct LDKStr primary_namespace, struct LDKStr secondary_namespace); }; +class MigratableKVStore { +private: + LDKMigratableKVStore self; +public: + MigratableKVStore(const MigratableKVStore&) = delete; + MigratableKVStore(MigratableKVStore&& o) : self(o.self) { memset(&o, 0, sizeof(MigratableKVStore)); } + MigratableKVStore(LDKMigratableKVStore&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMigratableKVStore)); } + operator LDKMigratableKVStore() && { LDKMigratableKVStore res = self; memset(&self, 0, sizeof(LDKMigratableKVStore)); return res; } + ~MigratableKVStore() { MigratableKVStore_free(self); } + MigratableKVStore& operator=(MigratableKVStore&& o) { MigratableKVStore_free(self); self = o.self; memset(&o, 0, sizeof(MigratableKVStore)); return *this; } + LDKMigratableKVStore* operator &() { return &self; } + LDKMigratableKVStore* operator ->() { return &self; } + const LDKMigratableKVStore* operator &() const { return &self; } + const LDKMigratableKVStore* operator ->() const { return &self; } + /** + * Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples. + * + * This is useful for migrating data from [`KVStore`] implementation to [`KVStore`] + * implementation. + * + * Must exhaustively return all entries known to the store to ensure no data is missed, but + * may return the items in arbitrary order. + */ + inline LDK::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ list_all_keys(); +}; class Persister { private: LDKPersister self; @@ -3675,35 +3902,50 @@ class MonitorUpdatingPersister { const LDKMonitorUpdatingPersister* operator &() const { return &self; } const LDKMonitorUpdatingPersister* operator ->() const { return &self; } }; -class InvoiceRequestWithExplicitPayerIdBuilder { -private: - LDKInvoiceRequestWithExplicitPayerIdBuilder self; -public: - InvoiceRequestWithExplicitPayerIdBuilder(const InvoiceRequestWithExplicitPayerIdBuilder&) = delete; - InvoiceRequestWithExplicitPayerIdBuilder(InvoiceRequestWithExplicitPayerIdBuilder&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestWithExplicitPayerIdBuilder)); } - InvoiceRequestWithExplicitPayerIdBuilder(LDKInvoiceRequestWithExplicitPayerIdBuilder&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestWithExplicitPayerIdBuilder)); } - operator LDKInvoiceRequestWithExplicitPayerIdBuilder() && { LDKInvoiceRequestWithExplicitPayerIdBuilder res = self; memset(&self, 0, sizeof(LDKInvoiceRequestWithExplicitPayerIdBuilder)); return res; } - ~InvoiceRequestWithExplicitPayerIdBuilder() { InvoiceRequestWithExplicitPayerIdBuilder_free(self); } - InvoiceRequestWithExplicitPayerIdBuilder& operator=(InvoiceRequestWithExplicitPayerIdBuilder&& o) { InvoiceRequestWithExplicitPayerIdBuilder_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestWithExplicitPayerIdBuilder)); return *this; } - LDKInvoiceRequestWithExplicitPayerIdBuilder* operator &() { return &self; } - LDKInvoiceRequestWithExplicitPayerIdBuilder* operator ->() { return &self; } - const LDKInvoiceRequestWithExplicitPayerIdBuilder* operator &() const { return &self; } - const LDKInvoiceRequestWithExplicitPayerIdBuilder* operator ->() const { return &self; } -}; -class InvoiceRequestWithDerivedPayerIdBuilder { -private: - LDKInvoiceRequestWithDerivedPayerIdBuilder self; -public: - InvoiceRequestWithDerivedPayerIdBuilder(const InvoiceRequestWithDerivedPayerIdBuilder&) = delete; - InvoiceRequestWithDerivedPayerIdBuilder(InvoiceRequestWithDerivedPayerIdBuilder&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerIdBuilder)); } - InvoiceRequestWithDerivedPayerIdBuilder(LDKInvoiceRequestWithDerivedPayerIdBuilder&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerIdBuilder)); } - operator LDKInvoiceRequestWithDerivedPayerIdBuilder() && { LDKInvoiceRequestWithDerivedPayerIdBuilder res = self; memset(&self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerIdBuilder)); return res; } - ~InvoiceRequestWithDerivedPayerIdBuilder() { InvoiceRequestWithDerivedPayerIdBuilder_free(self); } - InvoiceRequestWithDerivedPayerIdBuilder& operator=(InvoiceRequestWithDerivedPayerIdBuilder&& o) { InvoiceRequestWithDerivedPayerIdBuilder_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerIdBuilder)); return *this; } - LDKInvoiceRequestWithDerivedPayerIdBuilder* operator &() { return &self; } - LDKInvoiceRequestWithDerivedPayerIdBuilder* operator ->() { return &self; } - const LDKInvoiceRequestWithDerivedPayerIdBuilder* operator &() const { return &self; } - const LDKInvoiceRequestWithDerivedPayerIdBuilder* operator ->() const { return &self; } +class MonitorName { +private: + LDKMonitorName self; +public: + MonitorName(const MonitorName&) = delete; + MonitorName(MonitorName&& o) : self(o.self) { memset(&o, 0, sizeof(MonitorName)); } + MonitorName(LDKMonitorName&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKMonitorName)); } + operator LDKMonitorName() && { LDKMonitorName res = self; memset(&self, 0, sizeof(LDKMonitorName)); return res; } + ~MonitorName() { MonitorName_free(self); } + MonitorName& operator=(MonitorName&& o) { MonitorName_free(self); self = o.self; memset(&o, 0, sizeof(MonitorName)); return *this; } + LDKMonitorName* operator &() { return &self; } + LDKMonitorName* operator ->() { return &self; } + const LDKMonitorName* operator &() const { return &self; } + const LDKMonitorName* operator ->() const { return &self; } +}; +class UpdateName { +private: + LDKUpdateName self; +public: + UpdateName(const UpdateName&) = delete; + UpdateName(UpdateName&& o) : self(o.self) { memset(&o, 0, sizeof(UpdateName)); } + UpdateName(LDKUpdateName&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUpdateName)); } + operator LDKUpdateName() && { LDKUpdateName res = self; memset(&self, 0, sizeof(LDKUpdateName)); return res; } + ~UpdateName() { UpdateName_free(self); } + UpdateName& operator=(UpdateName&& o) { UpdateName_free(self); self = o.self; memset(&o, 0, sizeof(UpdateName)); return *this; } + LDKUpdateName* operator &() { return &self; } + LDKUpdateName* operator ->() { return &self; } + const LDKUpdateName* operator &() const { return &self; } + const LDKUpdateName* operator ->() const { return &self; } +}; +class InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { +private: + LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder self; +public: + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(const InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&) = delete; + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& o) : self(o.self) { memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); } + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); } + operator LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder() && { LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder res = self; memset(&self, 0, sizeof(LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); return res; } + ~InvoiceRequestWithDerivedPayerSigningPubkeyBuilder() { InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(self); } + InvoiceRequestWithDerivedPayerSigningPubkeyBuilder& operator=(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder&& o) { InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(self); self = o.self; memset(&o, 0, sizeof(InvoiceRequestWithDerivedPayerSigningPubkeyBuilder)); return *this; } + LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator &() { return &self; } + LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator ->() { return &self; } + const LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator &() const { return &self; } + const LDKInvoiceRequestWithDerivedPayerSigningPubkeyBuilder* operator ->() const { return &self; } }; class UnsignedInvoiceRequest { private: @@ -4850,6 +5092,15 @@ class ChannelMessageHandler { * connecting to peers. */ inline LDK::COption_CVec_ThirtyTwoBytesZZ get_chain_hashes(); + /** + * Indicates that a message was received from any peer for any handler. + * Called before the message is passed to the appropriate handler. + * Useful for indicating that a network connection is active. + * + * Note: Since this function is called frequently, it should be as + * efficient as possible for its intended purpose. + */ + inline void message_received(); }; class RoutingMessageHandler { private: @@ -4868,18 +5119,30 @@ class RoutingMessageHandler { /** * Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, * `false` or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::CResult_boolLightningErrorZ handle_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg); + inline LDK::CResult_boolLightningErrorZ handle_node_announcement(struct LDKPublicKey their_node_id, const struct LDKNodeAnnouncement *NONNULL_PTR msg); /** * Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` * or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::CResult_boolLightningErrorZ handle_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg); + inline LDK::CResult_boolLightningErrorZ handle_channel_announcement(struct LDKPublicKey their_node_id, const struct LDKChannelAnnouncement *NONNULL_PTR msg); /** * Handle an incoming `channel_update` message, returning true if it should be forwarded on, * `false` or returning an `Err` otherwise. + * + * If `their_node_id` is `None`, the message was generated by our own local node. + * + * Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::CResult_boolLightningErrorZ handle_channel_update(const struct LDKChannelUpdate *NONNULL_PTR msg); + inline LDK::CResult_boolLightningErrorZ handle_channel_update(struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg); /** * Gets channel announcements and updates required to dump our routing table to a remote node, * starting at the `short_channel_id` indicated by `starting_point` and including announcements @@ -5288,12 +5551,12 @@ class AsyncPaymentsMessageHandler { * * Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None */ - inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKResponder responder); + inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ handle_held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKResponder responder); /** * Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC * should be released to the corresponding payee. */ - inline void release_held_htlc(struct LDKReleaseHeldHtlc message); + inline void handle_release_held_htlc(struct LDKReleaseHeldHtlc message, struct LDKAsyncPaymentsContext context); /** * Release any [`AsyncPaymentsMessage`]s that need to be sent. * @@ -5895,6 +6158,21 @@ class PaymentFailureReason { const LDKPaymentFailureReason* operator &() const { return &self; } const LDKPaymentFailureReason* operator ->() const { return &self; } }; +class InboundChannelFunds { +private: + LDKInboundChannelFunds self; +public: + InboundChannelFunds(const InboundChannelFunds&) = delete; + InboundChannelFunds(InboundChannelFunds&& o) : self(o.self) { memset(&o, 0, sizeof(InboundChannelFunds)); } + InboundChannelFunds(LDKInboundChannelFunds&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKInboundChannelFunds)); } + operator LDKInboundChannelFunds() && { LDKInboundChannelFunds res = self; memset(&self, 0, sizeof(LDKInboundChannelFunds)); return res; } + ~InboundChannelFunds() { InboundChannelFunds_free(self); } + InboundChannelFunds& operator=(InboundChannelFunds&& o) { InboundChannelFunds_free(self); self = o.self; memset(&o, 0, sizeof(InboundChannelFunds)); return *this; } + LDKInboundChannelFunds* operator &() { return &self; } + LDKInboundChannelFunds* operator ->() { return &self; } + const LDKInboundChannelFunds* operator &() const { return &self; } + const LDKInboundChannelFunds* operator ->() const { return &self; } +}; class Event { private: LDKEvent self; @@ -6107,6 +6385,21 @@ class Bolt11Invoice { const LDKBolt11Invoice* operator &() const { return &self; } const LDKBolt11Invoice* operator ->() const { return &self; } }; +class Bolt11InvoiceDescription { +private: + LDKBolt11InvoiceDescription self; +public: + Bolt11InvoiceDescription(const Bolt11InvoiceDescription&) = delete; + Bolt11InvoiceDescription(Bolt11InvoiceDescription&& o) : self(o.self) { memset(&o, 0, sizeof(Bolt11InvoiceDescription)); } + Bolt11InvoiceDescription(LDKBolt11InvoiceDescription&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKBolt11InvoiceDescription)); } + operator LDKBolt11InvoiceDescription() && { LDKBolt11InvoiceDescription res = self; memset(&self, 0, sizeof(LDKBolt11InvoiceDescription)); return res; } + ~Bolt11InvoiceDescription() { Bolt11InvoiceDescription_free(self); } + Bolt11InvoiceDescription& operator=(Bolt11InvoiceDescription&& o) { Bolt11InvoiceDescription_free(self); self = o.self; memset(&o, 0, sizeof(Bolt11InvoiceDescription)); return *this; } + LDKBolt11InvoiceDescription* operator &() { return &self; } + LDKBolt11InvoiceDescription* operator ->() { return &self; } + const LDKBolt11InvoiceDescription* operator &() const { return &self; } + const LDKBolt11InvoiceDescription* operator ->() const { return &self; } +}; class SignedRawBolt11Invoice { private: LDKSignedRawBolt11Invoice self; @@ -6553,6 +6846,21 @@ class ReceiveTlvs { const LDKReceiveTlvs* operator &() const { return &self; } const LDKReceiveTlvs* operator ->() const { return &self; } }; +class UnauthenticatedReceiveTlvs { +private: + LDKUnauthenticatedReceiveTlvs self; +public: + UnauthenticatedReceiveTlvs(const UnauthenticatedReceiveTlvs&) = delete; + UnauthenticatedReceiveTlvs(UnauthenticatedReceiveTlvs&& o) : self(o.self) { memset(&o, 0, sizeof(UnauthenticatedReceiveTlvs)); } + UnauthenticatedReceiveTlvs(LDKUnauthenticatedReceiveTlvs&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnauthenticatedReceiveTlvs)); } + operator LDKUnauthenticatedReceiveTlvs() && { LDKUnauthenticatedReceiveTlvs res = self; memset(&self, 0, sizeof(LDKUnauthenticatedReceiveTlvs)); return res; } + ~UnauthenticatedReceiveTlvs() { UnauthenticatedReceiveTlvs_free(self); } + UnauthenticatedReceiveTlvs& operator=(UnauthenticatedReceiveTlvs&& o) { UnauthenticatedReceiveTlvs_free(self); self = o.self; memset(&o, 0, sizeof(UnauthenticatedReceiveTlvs)); return *this; } + LDKUnauthenticatedReceiveTlvs* operator &() { return &self; } + LDKUnauthenticatedReceiveTlvs* operator ->() { return &self; } + const LDKUnauthenticatedReceiveTlvs* operator &() const { return &self; } + const LDKUnauthenticatedReceiveTlvs* operator ->() const { return &self; } +}; class PaymentRelay { private: LDKPaymentRelay self; @@ -6598,21 +6906,6 @@ class PaymentContext { const LDKPaymentContext* operator &() const { return &self; } const LDKPaymentContext* operator ->() const { return &self; } }; -class UnknownPaymentContext { -private: - LDKUnknownPaymentContext self; -public: - UnknownPaymentContext(const UnknownPaymentContext&) = delete; - UnknownPaymentContext(UnknownPaymentContext&& o) : self(o.self) { memset(&o, 0, sizeof(UnknownPaymentContext)); } - UnknownPaymentContext(LDKUnknownPaymentContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKUnknownPaymentContext)); } - operator LDKUnknownPaymentContext() && { LDKUnknownPaymentContext res = self; memset(&self, 0, sizeof(LDKUnknownPaymentContext)); return res; } - ~UnknownPaymentContext() { UnknownPaymentContext_free(self); } - UnknownPaymentContext& operator=(UnknownPaymentContext&& o) { UnknownPaymentContext_free(self); self = o.self; memset(&o, 0, sizeof(UnknownPaymentContext)); return *this; } - LDKUnknownPaymentContext* operator &() { return &self; } - LDKUnknownPaymentContext* operator ->() { return &self; } - const LDKUnknownPaymentContext* operator &() const { return &self; } - const LDKUnknownPaymentContext* operator ->() const { return &self; } -}; class Bolt12OfferContext { private: LDKBolt12OfferContext self; @@ -7430,6 +7723,13 @@ class Persist { * * Archiving the data in a backup location (rather than deleting it fully) is useful for * hedging against data loss in case of unexpected failure. + * + * Note that if a crash occurs during the archiving process, and its implementation is not + * atomic, a state may emerge with the archival operation only being partially complete. In + * that scenario, the monitor may still be loaded on startup pending successful completion of + * the archive process. Additionally, because the archive operation could be retried on + * restart, this method must in that case be idempotent, ensuring it can handle scenarios where + * the monitor already exists in the archive. */ inline void archive_persisted_channel(struct LDKOutPoint channel_funding_outpoint); }; @@ -7538,6 +7838,36 @@ class OffersContext { const LDKOffersContext* operator &() const { return &self; } const LDKOffersContext* operator ->() const { return &self; } }; +class AsyncPaymentsContext { +private: + LDKAsyncPaymentsContext self; +public: + AsyncPaymentsContext(const AsyncPaymentsContext&) = delete; + AsyncPaymentsContext(AsyncPaymentsContext&& o) : self(o.self) { memset(&o, 0, sizeof(AsyncPaymentsContext)); } + AsyncPaymentsContext(LDKAsyncPaymentsContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKAsyncPaymentsContext)); } + operator LDKAsyncPaymentsContext() && { LDKAsyncPaymentsContext res = self; memset(&self, 0, sizeof(LDKAsyncPaymentsContext)); return res; } + ~AsyncPaymentsContext() { AsyncPaymentsContext_free(self); } + AsyncPaymentsContext& operator=(AsyncPaymentsContext&& o) { AsyncPaymentsContext_free(self); self = o.self; memset(&o, 0, sizeof(AsyncPaymentsContext)); return *this; } + LDKAsyncPaymentsContext* operator &() { return &self; } + LDKAsyncPaymentsContext* operator ->() { return &self; } + const LDKAsyncPaymentsContext* operator &() const { return &self; } + const LDKAsyncPaymentsContext* operator ->() const { return &self; } +}; +class DNSResolverContext { +private: + LDKDNSResolverContext self; +public: + DNSResolverContext(const DNSResolverContext&) = delete; + DNSResolverContext(DNSResolverContext&& o) : self(o.self) { memset(&o, 0, sizeof(DNSResolverContext)); } + DNSResolverContext(LDKDNSResolverContext&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKDNSResolverContext)); } + operator LDKDNSResolverContext() && { LDKDNSResolverContext res = self; memset(&self, 0, sizeof(LDKDNSResolverContext)); return res; } + ~DNSResolverContext() { DNSResolverContext_free(self); } + DNSResolverContext& operator=(DNSResolverContext&& o) { DNSResolverContext_free(self); self = o.self; memset(&o, 0, sizeof(DNSResolverContext)); return *this; } + LDKDNSResolverContext* operator &() { return &self; } + LDKDNSResolverContext* operator ->() { return &self; } + const LDKDNSResolverContext* operator &() const { return &self; } + const LDKDNSResolverContext* operator ->() const { return &self; } +}; class CResult_HtlcKeyDecodeErrorZ { private: LDKCResult_HtlcKeyDecodeErrorZ self; @@ -7553,6 +7883,21 @@ class CResult_HtlcKeyDecodeErrorZ { const LDKCResult_HtlcKeyDecodeErrorZ* operator &() const { return &self; } const LDKCResult_HtlcKeyDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_HumanReadableNameDecodeErrorZ { +private: + LDKCResult_HumanReadableNameDecodeErrorZ self; +public: + CResult_HumanReadableNameDecodeErrorZ(const CResult_HumanReadableNameDecodeErrorZ&) = delete; + CResult_HumanReadableNameDecodeErrorZ(CResult_HumanReadableNameDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HumanReadableNameDecodeErrorZ)); } + CResult_HumanReadableNameDecodeErrorZ(LDKCResult_HumanReadableNameDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HumanReadableNameDecodeErrorZ)); } + operator LDKCResult_HumanReadableNameDecodeErrorZ() && { LDKCResult_HumanReadableNameDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_HumanReadableNameDecodeErrorZ)); return res; } + ~CResult_HumanReadableNameDecodeErrorZ() { CResult_HumanReadableNameDecodeErrorZ_free(self); } + CResult_HumanReadableNameDecodeErrorZ& operator=(CResult_HumanReadableNameDecodeErrorZ&& o) { CResult_HumanReadableNameDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HumanReadableNameDecodeErrorZ)); return *this; } + LDKCResult_HumanReadableNameDecodeErrorZ* operator &() { return &self; } + LDKCResult_HumanReadableNameDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_HumanReadableNameDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_HumanReadableNameDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_TransactionU16LenLimitedNoneZ { private: LDKCResult_TransactionU16LenLimitedNoneZ self; @@ -7583,21 +7928,6 @@ class CVec_TrackedSpendableOutputZ { const LDKCVec_TrackedSpendableOutputZ* operator &() const { return &self; } const LDKCVec_TrackedSpendableOutputZ* 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; @@ -7613,6 +7943,21 @@ class CResult_PhantomRouteHintsDecodeErrorZ { const LDKCResult_PhantomRouteHintsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_PhantomRouteHintsDecodeErrorZ* 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_FundingCreatedDecodeErrorZ { private: LDKCResult_FundingCreatedDecodeErrorZ self; @@ -7628,20 +7973,20 @@ class CResult_FundingCreatedDecodeErrorZ { const LDKCResult_FundingCreatedDecodeErrorZ* operator &() const { return &self; } const LDKCResult_FundingCreatedDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_C2Tuple_u32TxOutZZ { +class COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { private: - LDKCVec_C2Tuple_u32TxOutZZ self; + LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ 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; } + COption_C2Tuple_DNSResolverMessageResponseInstructionZZ(const COption_C2Tuple_DNSResolverMessageResponseInstructionZZ&) = delete; + COption_C2Tuple_DNSResolverMessageResponseInstructionZZ(COption_C2Tuple_DNSResolverMessageResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_DNSResolverMessageResponseInstructionZZ)); } + COption_C2Tuple_DNSResolverMessageResponseInstructionZZ(LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ() && { LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ)); return res; } + ~COption_C2Tuple_DNSResolverMessageResponseInstructionZZ() { COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_free(self); } + COption_C2Tuple_DNSResolverMessageResponseInstructionZZ& operator=(COption_C2Tuple_DNSResolverMessageResponseInstructionZZ&& o) { COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_DNSResolverMessageResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_DNSResolverMessageResponseInstructionZZ* operator ->() const { return &self; } }; class CResult_RetryDecodeErrorZ { private: @@ -7718,6 +8063,21 @@ class COption_MaxDustHTLCExposureZ { const LDKCOption_MaxDustHTLCExposureZ* operator &() const { return &self; } const LDKCOption_MaxDustHTLCExposureZ* 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_NoneSendErrorZ { private: LDKCResult_NoneSendErrorZ self; @@ -7898,6 +8258,21 @@ class CResult_COption_APIErrorZDecodeErrorZ { const LDKCResult_COption_APIErrorZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_APIErrorZDecodeErrorZ* operator ->() const { return &self; } }; +class CVec_C3Tuple_StrStrStrZZ { +private: + LDKCVec_C3Tuple_StrStrStrZZ self; +public: + CVec_C3Tuple_StrStrStrZZ(const CVec_C3Tuple_StrStrStrZZ&) = delete; + CVec_C3Tuple_StrStrStrZZ(CVec_C3Tuple_StrStrStrZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C3Tuple_StrStrStrZZ)); } + CVec_C3Tuple_StrStrStrZZ(LDKCVec_C3Tuple_StrStrStrZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C3Tuple_StrStrStrZZ)); } + operator LDKCVec_C3Tuple_StrStrStrZZ() && { LDKCVec_C3Tuple_StrStrStrZZ res = self; memset(&self, 0, sizeof(LDKCVec_C3Tuple_StrStrStrZZ)); return res; } + ~CVec_C3Tuple_StrStrStrZZ() { CVec_C3Tuple_StrStrStrZZ_free(self); } + CVec_C3Tuple_StrStrStrZZ& operator=(CVec_C3Tuple_StrStrStrZZ&& o) { CVec_C3Tuple_StrStrStrZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C3Tuple_StrStrStrZZ)); return *this; } + LDKCVec_C3Tuple_StrStrStrZZ* operator &() { return &self; } + LDKCVec_C3Tuple_StrStrStrZZ* operator ->() { return &self; } + const LDKCVec_C3Tuple_StrStrStrZZ* operator &() const { return &self; } + const LDKCVec_C3Tuple_StrStrStrZZ* operator ->() const { return &self; } +}; class CVec_UpdateAddHTLCZ { private: LDKCVec_UpdateAddHTLCZ self; @@ -7913,21 +8288,6 @@ class CVec_UpdateAddHTLCZ { const LDKCVec_UpdateAddHTLCZ* operator &() const { return &self; } const LDKCVec_UpdateAddHTLCZ* operator ->() const { return &self; } }; -class CResult_TxAbortDecodeErrorZ { -private: - LDKCResult_TxAbortDecodeErrorZ self; -public: - CResult_TxAbortDecodeErrorZ(const CResult_TxAbortDecodeErrorZ&) = delete; - CResult_TxAbortDecodeErrorZ(CResult_TxAbortDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); } - CResult_TxAbortDecodeErrorZ(LDKCResult_TxAbortDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); } - operator LDKCResult_TxAbortDecodeErrorZ() && { LDKCResult_TxAbortDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); return res; } - ~CResult_TxAbortDecodeErrorZ() { CResult_TxAbortDecodeErrorZ_free(self); } - CResult_TxAbortDecodeErrorZ& operator=(CResult_TxAbortDecodeErrorZ&& o) { CResult_TxAbortDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); return *this; } - LDKCResult_TxAbortDecodeErrorZ* operator &() { return &self; } - LDKCResult_TxAbortDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TxAbortDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TxAbortDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_StaticPaymentOutputDescriptorDecodeErrorZ { private: LDKCResult_StaticPaymentOutputDescriptorDecodeErrorZ self; @@ -8003,20 +8363,20 @@ class CVec_C2Tuple_OffersMessageMessageSendInstructionsZZ { const LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ* operator &() const { return &self; } const LDKCVec_C2Tuple_OffersMessageMessageSendInstructionsZZ* operator ->() const { return &self; } }; -class C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { +class C2Tuple_HumanReadableNameThirtyTwoBytesZ { private: - LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ self; + LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ self; public: - C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ(const C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&) = delete; - C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); } - C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ(LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); } - operator LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ() && { LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); return res; } - ~C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ() { C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(self); } - C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ& operator=(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&& o) { C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); return *this; } - LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator &() { return &self; } - LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator ->() { return &self; } - const LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator &() const { return &self; } - const LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator ->() const { return &self; } + C2Tuple_HumanReadableNameThirtyTwoBytesZ(const C2Tuple_HumanReadableNameThirtyTwoBytesZ&) = delete; + C2Tuple_HumanReadableNameThirtyTwoBytesZ(C2Tuple_HumanReadableNameThirtyTwoBytesZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_HumanReadableNameThirtyTwoBytesZ)); } + C2Tuple_HumanReadableNameThirtyTwoBytesZ(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ)); } + operator LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ() && { LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ)); return res; } + ~C2Tuple_HumanReadableNameThirtyTwoBytesZ() { C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(self); } + C2Tuple_HumanReadableNameThirtyTwoBytesZ& operator=(C2Tuple_HumanReadableNameThirtyTwoBytesZ&& o) { C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_HumanReadableNameThirtyTwoBytesZ)); return *this; } + LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator &() { return &self; } + LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator ->() { return &self; } + const LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator &() const { return &self; } + const LDKC2Tuple_HumanReadableNameThirtyTwoBytesZ* operator ->() const { return &self; } }; class CResult_TransactionNoneZ { private: @@ -8033,6 +8393,21 @@ class CResult_TransactionNoneZ { const LDKCResult_TransactionNoneZ* operator &() const { return &self; } const LDKCResult_TransactionNoneZ* operator ->() const { return &self; } }; +class C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ { +private: + LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ self; +public: + C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ(const C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&) = delete; + C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); } + C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ(LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); } + operator LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ() && { LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); return res; } + ~C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ() { C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(self); } + C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ& operator=(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ&& o) { C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ)); return *this; } + LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator &() { return &self; } + LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator ->() { return &self; } + const LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator &() const { return &self; } + const LDKC2Tuple_AsyncPaymentsMessageMessageSendInstructionsZ* operator ->() const { return &self; } +}; class CResult_CVec_StrZIOErrorZ { private: LDKCResult_CVec_StrZIOErrorZ self; @@ -8078,6 +8453,21 @@ class COption_ECDSASignatureZ { const LDKCOption_ECDSASignatureZ* operator &() const { return &self; } const LDKCOption_ECDSASignatureZ* operator ->() const { return &self; } }; +class CResult_TxAbortDecodeErrorZ { +private: + LDKCResult_TxAbortDecodeErrorZ self; +public: + CResult_TxAbortDecodeErrorZ(const CResult_TxAbortDecodeErrorZ&) = delete; + CResult_TxAbortDecodeErrorZ(CResult_TxAbortDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); } + CResult_TxAbortDecodeErrorZ(LDKCResult_TxAbortDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); } + operator LDKCResult_TxAbortDecodeErrorZ() && { LDKCResult_TxAbortDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TxAbortDecodeErrorZ)); return res; } + ~CResult_TxAbortDecodeErrorZ() { CResult_TxAbortDecodeErrorZ_free(self); } + CResult_TxAbortDecodeErrorZ& operator=(CResult_TxAbortDecodeErrorZ&& o) { CResult_TxAbortDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TxAbortDecodeErrorZ)); return *this; } + LDKCResult_TxAbortDecodeErrorZ* operator &() { return &self; } + LDKCResult_TxAbortDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TxAbortDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TxAbortDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_ClosingSignedFeeRangeDecodeErrorZ { private: LDKCResult_ClosingSignedFeeRangeDecodeErrorZ self; @@ -8108,36 +8498,6 @@ class CResult_CommitmentSignedDecodeErrorZ { const LDKCResult_CommitmentSignedDecodeErrorZ* operator &() const { return &self; } const LDKCResult_CommitmentSignedDecodeErrorZ* 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_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { -private: - LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ self; -public: - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(const CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&) = delete; - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); } - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); } - operator LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ() && { LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); return res; } - ~CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ() { CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(self); } - CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ& operator=(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& o) { CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); return *this; } - LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator &() { return &self; } - LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_StfuDecodeErrorZ { private: LDKCResult_StfuDecodeErrorZ self; @@ -8183,6 +8543,36 @@ class CResult_ErrorMessageDecodeErrorZ { const LDKCResult_ErrorMessageDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ErrorMessageDecodeErrorZ* 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_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ { +private: + LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ self; +public: + CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(const CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&) = delete; + CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); } + CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); } + operator LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ() && { LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); return res; } + ~CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ() { CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(self); } + CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ& operator=(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ&& o) { CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ)); return *this; } + LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator &() { return &self; } + LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_BestBlockOutputSweeperZDecodeErrorZ* operator ->() const { return &self; } +}; class COption_APIErrorZ { private: LDKCOption_APIErrorZ self; @@ -8258,20 +8648,35 @@ class CVec_InputZ { const LDKCVec_InputZ* operator &() const { return &self; } const LDKCVec_InputZ* operator ->() const { return &self; } }; -class CResult_ChannelFeaturesDecodeErrorZ { +class CVec_TransactionZ { private: - LDKCResult_ChannelFeaturesDecodeErrorZ self; + LDKCVec_TransactionZ 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; } + 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 C2Tuple_DNSResolverMessageResponseInstructionZ { +private: + LDKC2Tuple_DNSResolverMessageResponseInstructionZ self; +public: + C2Tuple_DNSResolverMessageResponseInstructionZ(const C2Tuple_DNSResolverMessageResponseInstructionZ&) = delete; + C2Tuple_DNSResolverMessageResponseInstructionZ(C2Tuple_DNSResolverMessageResponseInstructionZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageResponseInstructionZ)); } + C2Tuple_DNSResolverMessageResponseInstructionZ(LDKC2Tuple_DNSResolverMessageResponseInstructionZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_DNSResolverMessageResponseInstructionZ)); } + operator LDKC2Tuple_DNSResolverMessageResponseInstructionZ() && { LDKC2Tuple_DNSResolverMessageResponseInstructionZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_DNSResolverMessageResponseInstructionZ)); return res; } + ~C2Tuple_DNSResolverMessageResponseInstructionZ() { C2Tuple_DNSResolverMessageResponseInstructionZ_free(self); } + C2Tuple_DNSResolverMessageResponseInstructionZ& operator=(C2Tuple_DNSResolverMessageResponseInstructionZ&& o) { C2Tuple_DNSResolverMessageResponseInstructionZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageResponseInstructionZ)); return *this; } + LDKC2Tuple_DNSResolverMessageResponseInstructionZ* operator &() { return &self; } + LDKC2Tuple_DNSResolverMessageResponseInstructionZ* operator ->() { return &self; } + const LDKC2Tuple_DNSResolverMessageResponseInstructionZ* operator &() const { return &self; } + const LDKC2Tuple_DNSResolverMessageResponseInstructionZ* operator ->() const { return &self; } }; class CResult_ChannelReadyDecodeErrorZ { private: @@ -8288,21 +8693,6 @@ class CResult_ChannelReadyDecodeErrorZ { const LDKCResult_ChannelReadyDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelReadyDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_TransactionZ { -private: - LDKCVec_TransactionZ 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; } -}; class CResult_UpdateFeeDecodeErrorZ { private: LDKCResult_UpdateFeeDecodeErrorZ self; @@ -8333,6 +8723,21 @@ class CResult_NoneBolt11SemanticErrorZ { const LDKCResult_NoneBolt11SemanticErrorZ* operator &() const { return &self; } const LDKCResult_NoneBolt11SemanticErrorZ* operator ->() const { return &self; } }; +class CResult_ChannelFeaturesDecodeErrorZ { +private: + LDKCResult_ChannelFeaturesDecodeErrorZ 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; } +}; class CResult_RevocationBasepointDecodeErrorZ { private: LDKCResult_RevocationBasepointDecodeErrorZ self; @@ -8723,21 +9128,6 @@ class CResult_ClosingSignedDecodeErrorZ { const LDKCResult_ClosingSignedDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ClosingSignedDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_CResult_NoneAPIErrorZZ { -private: - LDKCVec_CResult_NoneAPIErrorZZ 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; } -}; class CResult_SchnorrSignatureNoneZ { private: LDKCResult_SchnorrSignatureNoneZ self; @@ -8918,6 +9308,21 @@ class COption_U128Z { const LDKCOption_U128Z* operator &() const { return &self; } const LDKCOption_U128Z* operator ->() const { return &self; } }; +class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { +private: + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ self; +public: + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(const COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&) = delete; + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); } + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); } + operator LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ() && { LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); return res; } + ~COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ() { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(self); } + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ& operator=(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ&& o) { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ)); return *this; } + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator &() { return &self; } + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ* operator ->() const { return &self; } +}; class C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { private: LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ self; @@ -8933,6 +9338,21 @@ class C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { const LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* operator &() const { return &self; } const LDKC2Tuple_ThirtyTwoBytesThirtyTwoBytesZ* operator ->() const { return &self; } }; +class CResult_UpdateNameIOErrorZ { +private: + LDKCResult_UpdateNameIOErrorZ self; +public: + CResult_UpdateNameIOErrorZ(const CResult_UpdateNameIOErrorZ&) = delete; + CResult_UpdateNameIOErrorZ(CResult_UpdateNameIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UpdateNameIOErrorZ)); } + CResult_UpdateNameIOErrorZ(LDKCResult_UpdateNameIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UpdateNameIOErrorZ)); } + operator LDKCResult_UpdateNameIOErrorZ() && { LDKCResult_UpdateNameIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UpdateNameIOErrorZ)); return res; } + ~CResult_UpdateNameIOErrorZ() { CResult_UpdateNameIOErrorZ_free(self); } + CResult_UpdateNameIOErrorZ& operator=(CResult_UpdateNameIOErrorZ&& o) { CResult_UpdateNameIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UpdateNameIOErrorZ)); return *this; } + LDKCResult_UpdateNameIOErrorZ* operator &() { return &self; } + LDKCResult_UpdateNameIOErrorZ* operator ->() { return &self; } + const LDKCResult_UpdateNameIOErrorZ* operator &() const { return &self; } + const LDKCResult_UpdateNameIOErrorZ* operator ->() const { return &self; } +}; class CVec_MessageForwardNodeZ { private: LDKCVec_MessageForwardNodeZ self; @@ -9068,6 +9488,21 @@ class CResult_CVec_u8ZNoneZ { const LDKCResult_CVec_u8ZNoneZ* operator &() const { return &self; } const LDKCResult_CVec_u8ZNoneZ* operator ->() const { return &self; } }; +class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { +private: + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ self; +public: + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(const C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&) = delete; + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); } + operator LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ() && { LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); return res; } + ~C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ() { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(self); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ& operator=(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ&& o) { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ)); return *this; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator &() { return &self; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator ->() { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator &() const { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ* operator ->() const { return &self; } +}; class CVec_C2Tuple_ChannelIdPublicKeyZZ { private: LDKCVec_C2Tuple_ChannelIdPublicKeyZZ self; @@ -9113,21 +9548,6 @@ class CResult_ChannelTransactionParametersDecodeErrorZ { const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { -private: - LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ self; -public: - CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ(const CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ&) = delete; - CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ)); } - CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ)); } - operator LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ() && { LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ)); return res; } - ~CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ() { CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(self); } - CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ& operator=(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ&& o) { CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ)); return *this; } - LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } -}; class CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { private: LDKCResult_DelayedPaymentOutputDescriptorDecodeErrorZ self; @@ -9383,6 +9803,36 @@ class CResult_COption_EventZDecodeErrorZ { const LDKCResult_COption_EventZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_EventZDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_DNSResolverMessageDecodeErrorZ { +private: + LDKCResult_DNSResolverMessageDecodeErrorZ self; +public: + CResult_DNSResolverMessageDecodeErrorZ(const CResult_DNSResolverMessageDecodeErrorZ&) = delete; + CResult_DNSResolverMessageDecodeErrorZ(CResult_DNSResolverMessageDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DNSResolverMessageDecodeErrorZ)); } + CResult_DNSResolverMessageDecodeErrorZ(LDKCResult_DNSResolverMessageDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DNSResolverMessageDecodeErrorZ)); } + operator LDKCResult_DNSResolverMessageDecodeErrorZ() && { LDKCResult_DNSResolverMessageDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DNSResolverMessageDecodeErrorZ)); return res; } + ~CResult_DNSResolverMessageDecodeErrorZ() { CResult_DNSResolverMessageDecodeErrorZ_free(self); } + CResult_DNSResolverMessageDecodeErrorZ& operator=(CResult_DNSResolverMessageDecodeErrorZ&& o) { CResult_DNSResolverMessageDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DNSResolverMessageDecodeErrorZ)); return *this; } + LDKCResult_DNSResolverMessageDecodeErrorZ* operator &() { return &self; } + LDKCResult_DNSResolverMessageDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DNSResolverMessageDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DNSResolverMessageDecodeErrorZ* operator ->() const { return &self; } +}; +class C2Tuple_PublicKeyChannelIdZ { +private: + LDKC2Tuple_PublicKeyChannelIdZ self; +public: + C2Tuple_PublicKeyChannelIdZ(const C2Tuple_PublicKeyChannelIdZ&) = delete; + C2Tuple_PublicKeyChannelIdZ(C2Tuple_PublicKeyChannelIdZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_PublicKeyChannelIdZ)); } + C2Tuple_PublicKeyChannelIdZ(LDKC2Tuple_PublicKeyChannelIdZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_PublicKeyChannelIdZ)); } + operator LDKC2Tuple_PublicKeyChannelIdZ() && { LDKC2Tuple_PublicKeyChannelIdZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_PublicKeyChannelIdZ)); return res; } + ~C2Tuple_PublicKeyChannelIdZ() { C2Tuple_PublicKeyChannelIdZ_free(self); } + C2Tuple_PublicKeyChannelIdZ& operator=(C2Tuple_PublicKeyChannelIdZ&& o) { C2Tuple_PublicKeyChannelIdZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_PublicKeyChannelIdZ)); return *this; } + LDKC2Tuple_PublicKeyChannelIdZ* operator &() { return &self; } + LDKC2Tuple_PublicKeyChannelIdZ* operator ->() { return &self; } + const LDKC2Tuple_PublicKeyChannelIdZ* operator &() const { return &self; } + const LDKC2Tuple_PublicKeyChannelIdZ* operator ->() const { return &self; } +}; class COption_SocketAddressZ { private: LDKCOption_SocketAddressZ self; @@ -9548,6 +9998,21 @@ class CResult_UpdateAddHTLCDecodeErrorZ { const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UpdateAddHTLCDecodeErrorZ* operator ->() const { return &self; } }; +class CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { +private: + LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ self; +public: + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(const CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&) = delete; + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); } + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); } + operator LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ() && { LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); return res; } + ~CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ() { CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(self); } + CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ& operator=(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ&& o) { CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ)); return *this; } + LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator &() { return &self; } + LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ* operator ->() const { return &self; } +}; class COption_OutboundHTLCStateDetailsZ { private: LDKCOption_OutboundHTLCStateDetailsZ self; @@ -9578,21 +10043,6 @@ class COption_MonitorEventZ { const LDKCOption_MonitorEventZ* operator &() const { return &self; } const LDKCOption_MonitorEventZ* 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; @@ -9608,6 +10058,21 @@ class CResult_COption_TypeZDecodeErrorZ { const LDKCResult_COption_TypeZDecodeErrorZ* operator &() const { return &self; } const LDKCResult_COption_TypeZDecodeErrorZ* operator ->() const { return &self; } }; +class C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { +private: + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ self; +public: + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(const C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&) = delete; + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); } + operator LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ() && { LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); return res; } + ~C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ() { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(self); } + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ& operator=(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ&& o) { C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ)); return *this; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator &() { return &self; } + LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator ->() { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator &() const { return &self; } + const LDKC2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ* operator ->() const { return &self; } +}; class CResult_OfferDecodeErrorZ { private: LDKCResult_OfferDecodeErrorZ self; @@ -9623,20 +10088,20 @@ class CResult_OfferDecodeErrorZ { const LDKCResult_OfferDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OfferDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_COption_PathFailureZDecodeErrorZ { +class COption_TypeZ { private: - LDKCResult_COption_PathFailureZDecodeErrorZ self; + LDKCOption_TypeZ self; public: - CResult_COption_PathFailureZDecodeErrorZ(const CResult_COption_PathFailureZDecodeErrorZ&) = delete; - CResult_COption_PathFailureZDecodeErrorZ(CResult_COption_PathFailureZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); } - CResult_COption_PathFailureZDecodeErrorZ(LDKCResult_COption_PathFailureZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); } - operator LDKCResult_COption_PathFailureZDecodeErrorZ() && { LDKCResult_COption_PathFailureZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); return res; } - ~CResult_COption_PathFailureZDecodeErrorZ() { CResult_COption_PathFailureZDecodeErrorZ_free(self); } - CResult_COption_PathFailureZDecodeErrorZ& operator=(CResult_COption_PathFailureZDecodeErrorZ&& o) { CResult_COption_PathFailureZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); return *this; } - LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_PathFailureZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_PathFailureZDecodeErrorZ* 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 CResult_Bolt11InvoiceSignOrCreationErrorZ { private: @@ -9653,20 +10118,50 @@ class CResult_Bolt11InvoiceSignOrCreationErrorZ { const LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* operator &() const { return &self; } const LDKCResult_Bolt11InvoiceSignOrCreationErrorZ* operator ->() const { return &self; } }; -class CResult_BlindedMessagePathNoneZ { +class CResult_COption_PathFailureZDecodeErrorZ { private: - LDKCResult_BlindedMessagePathNoneZ self; + LDKCResult_COption_PathFailureZDecodeErrorZ self; public: - CResult_BlindedMessagePathNoneZ(const CResult_BlindedMessagePathNoneZ&) = delete; - CResult_BlindedMessagePathNoneZ(CResult_BlindedMessagePathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedMessagePathNoneZ)); } - CResult_BlindedMessagePathNoneZ(LDKCResult_BlindedMessagePathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedMessagePathNoneZ)); } - operator LDKCResult_BlindedMessagePathNoneZ() && { LDKCResult_BlindedMessagePathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedMessagePathNoneZ)); return res; } - ~CResult_BlindedMessagePathNoneZ() { CResult_BlindedMessagePathNoneZ_free(self); } - CResult_BlindedMessagePathNoneZ& operator=(CResult_BlindedMessagePathNoneZ&& o) { CResult_BlindedMessagePathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedMessagePathNoneZ)); return *this; } - LDKCResult_BlindedMessagePathNoneZ* operator &() { return &self; } - LDKCResult_BlindedMessagePathNoneZ* operator ->() { return &self; } - const LDKCResult_BlindedMessagePathNoneZ* operator &() const { return &self; } - const LDKCResult_BlindedMessagePathNoneZ* operator ->() const { return &self; } + CResult_COption_PathFailureZDecodeErrorZ(const CResult_COption_PathFailureZDecodeErrorZ&) = delete; + CResult_COption_PathFailureZDecodeErrorZ(CResult_COption_PathFailureZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); } + CResult_COption_PathFailureZDecodeErrorZ(LDKCResult_COption_PathFailureZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); } + operator LDKCResult_COption_PathFailureZDecodeErrorZ() && { LDKCResult_COption_PathFailureZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_PathFailureZDecodeErrorZ)); return res; } + ~CResult_COption_PathFailureZDecodeErrorZ() { CResult_COption_PathFailureZDecodeErrorZ_free(self); } + CResult_COption_PathFailureZDecodeErrorZ& operator=(CResult_COption_PathFailureZDecodeErrorZ&& o) { CResult_COption_PathFailureZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_PathFailureZDecodeErrorZ)); return *this; } + LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_PathFailureZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_PathFailureZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_PathFailureZDecodeErrorZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { +private: + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ self; +public: + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ(const COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ&) = delete; + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ)); } + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ)); } + operator LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ() && { LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ)); return res; } + ~COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ() { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_free(self); } + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ& operator=(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ&& o) { COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ)); return *this; } + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ* operator &() { return &self; } + LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ* operator ->() const { return &self; } +}; +class COption_C2Tuple_PublicKeyChannelIdZZ { +private: + LDKCOption_C2Tuple_PublicKeyChannelIdZZ self; +public: + COption_C2Tuple_PublicKeyChannelIdZZ(const COption_C2Tuple_PublicKeyChannelIdZZ&) = delete; + COption_C2Tuple_PublicKeyChannelIdZZ(COption_C2Tuple_PublicKeyChannelIdZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_PublicKeyChannelIdZZ)); } + COption_C2Tuple_PublicKeyChannelIdZZ(LDKCOption_C2Tuple_PublicKeyChannelIdZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_PublicKeyChannelIdZZ)); } + operator LDKCOption_C2Tuple_PublicKeyChannelIdZZ() && { LDKCOption_C2Tuple_PublicKeyChannelIdZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_PublicKeyChannelIdZZ)); return res; } + ~COption_C2Tuple_PublicKeyChannelIdZZ() { COption_C2Tuple_PublicKeyChannelIdZZ_free(self); } + COption_C2Tuple_PublicKeyChannelIdZZ& operator=(COption_C2Tuple_PublicKeyChannelIdZZ&& o) { COption_C2Tuple_PublicKeyChannelIdZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_PublicKeyChannelIdZZ)); return *this; } + LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator &() { return &self; } + LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_PublicKeyChannelIdZZ* operator ->() const { return &self; } }; class CResult_UpdateFailHTLCDecodeErrorZ { private: @@ -9773,6 +10268,21 @@ class CResult_UnsignedChannelUpdateDecodeErrorZ { const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator &() const { return &self; } const LDKCResult_UnsignedChannelUpdateDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_MonitorNameIOErrorZ { +private: + LDKCResult_MonitorNameIOErrorZ self; +public: + CResult_MonitorNameIOErrorZ(const CResult_MonitorNameIOErrorZ&) = delete; + CResult_MonitorNameIOErrorZ(CResult_MonitorNameIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_MonitorNameIOErrorZ)); } + CResult_MonitorNameIOErrorZ(LDKCResult_MonitorNameIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_MonitorNameIOErrorZ)); } + operator LDKCResult_MonitorNameIOErrorZ() && { LDKCResult_MonitorNameIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_MonitorNameIOErrorZ)); return res; } + ~CResult_MonitorNameIOErrorZ() { CResult_MonitorNameIOErrorZ_free(self); } + CResult_MonitorNameIOErrorZ& operator=(CResult_MonitorNameIOErrorZ&& o) { CResult_MonitorNameIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_MonitorNameIOErrorZ)); return *this; } + LDKCResult_MonitorNameIOErrorZ* operator &() { return &self; } + LDKCResult_MonitorNameIOErrorZ* operator ->() { return &self; } + const LDKCResult_MonitorNameIOErrorZ* operator &() const { return &self; } + const LDKCResult_MonitorNameIOErrorZ* operator ->() const { return &self; } +}; class CResult_PayeePubKeySecp256k1ErrorZ { private: LDKCResult_PayeePubKeySecp256k1ErrorZ self; @@ -9818,14 +10328,29 @@ class CResult_BlindedMessagePathDecodeErrorZ { const LDKCResult_BlindedMessagePathDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BlindedMessagePathDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_CVec_BlindedMessagePathZNoneZ { +class CResult_BlindedMessagePathNoneZ { private: - LDKCResult_CVec_BlindedMessagePathZNoneZ self; + LDKCResult_BlindedMessagePathNoneZ self; public: - CResult_CVec_BlindedMessagePathZNoneZ(const CResult_CVec_BlindedMessagePathZNoneZ&) = delete; - CResult_CVec_BlindedMessagePathZNoneZ(CResult_CVec_BlindedMessagePathZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_BlindedMessagePathZNoneZ)); } - CResult_CVec_BlindedMessagePathZNoneZ(LDKCResult_CVec_BlindedMessagePathZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_BlindedMessagePathZNoneZ)); } - operator LDKCResult_CVec_BlindedMessagePathZNoneZ() && { LDKCResult_CVec_BlindedMessagePathZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_BlindedMessagePathZNoneZ)); return res; } + CResult_BlindedMessagePathNoneZ(const CResult_BlindedMessagePathNoneZ&) = delete; + CResult_BlindedMessagePathNoneZ(CResult_BlindedMessagePathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedMessagePathNoneZ)); } + CResult_BlindedMessagePathNoneZ(LDKCResult_BlindedMessagePathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedMessagePathNoneZ)); } + operator LDKCResult_BlindedMessagePathNoneZ() && { LDKCResult_BlindedMessagePathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedMessagePathNoneZ)); return res; } + ~CResult_BlindedMessagePathNoneZ() { CResult_BlindedMessagePathNoneZ_free(self); } + CResult_BlindedMessagePathNoneZ& operator=(CResult_BlindedMessagePathNoneZ&& o) { CResult_BlindedMessagePathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedMessagePathNoneZ)); return *this; } + LDKCResult_BlindedMessagePathNoneZ* operator &() { return &self; } + LDKCResult_BlindedMessagePathNoneZ* operator ->() { return &self; } + const LDKCResult_BlindedMessagePathNoneZ* operator &() const { return &self; } + const LDKCResult_BlindedMessagePathNoneZ* operator ->() const { return &self; } +}; +class CResult_CVec_BlindedMessagePathZNoneZ { +private: + LDKCResult_CVec_BlindedMessagePathZNoneZ self; +public: + CResult_CVec_BlindedMessagePathZNoneZ(const CResult_CVec_BlindedMessagePathZNoneZ&) = delete; + CResult_CVec_BlindedMessagePathZNoneZ(CResult_CVec_BlindedMessagePathZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_BlindedMessagePathZNoneZ)); } + CResult_CVec_BlindedMessagePathZNoneZ(LDKCResult_CVec_BlindedMessagePathZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_BlindedMessagePathZNoneZ)); } + operator LDKCResult_CVec_BlindedMessagePathZNoneZ() && { LDKCResult_CVec_BlindedMessagePathZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_BlindedMessagePathZNoneZ)); return res; } ~CResult_CVec_BlindedMessagePathZNoneZ() { CResult_CVec_BlindedMessagePathZNoneZ_free(self); } CResult_CVec_BlindedMessagePathZNoneZ& operator=(CResult_CVec_BlindedMessagePathZNoneZ&& o) { CResult_CVec_BlindedMessagePathZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_BlindedMessagePathZNoneZ)); return *this; } LDKCResult_CVec_BlindedMessagePathZNoneZ* operator &() { return &self; } @@ -10283,6 +10808,21 @@ class CVec_ECDSASignatureZ { const LDKCVec_ECDSASignatureZ* operator &() const { return &self; } const LDKCVec_ECDSASignatureZ* operator ->() const { return &self; } }; +class C2Tuple_DNSResolverMessageMessageSendInstructionsZ { +private: + LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ self; +public: + C2Tuple_DNSResolverMessageMessageSendInstructionsZ(const C2Tuple_DNSResolverMessageMessageSendInstructionsZ&) = delete; + C2Tuple_DNSResolverMessageMessageSendInstructionsZ(C2Tuple_DNSResolverMessageMessageSendInstructionsZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageMessageSendInstructionsZ)); } + C2Tuple_DNSResolverMessageMessageSendInstructionsZ(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ)); } + operator LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ() && { LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ)); return res; } + ~C2Tuple_DNSResolverMessageMessageSendInstructionsZ() { C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(self); } + C2Tuple_DNSResolverMessageMessageSendInstructionsZ& operator=(C2Tuple_DNSResolverMessageMessageSendInstructionsZ&& o) { C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_DNSResolverMessageMessageSendInstructionsZ)); return *this; } + LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator &() { return &self; } + LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator ->() { return &self; } + const LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator &() const { return &self; } + const LDKC2Tuple_DNSResolverMessageMessageSendInstructionsZ* operator ->() const { return &self; } +}; class CResult_ChannelUpdateInfoDecodeErrorZ { private: LDKCResult_ChannelUpdateInfoDecodeErrorZ self; @@ -10298,21 +10838,6 @@ class CResult_ChannelUpdateInfoDecodeErrorZ { const LDKCResult_ChannelUpdateInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelUpdateInfoDecodeErrorZ* 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 CVec_TxOutZ { private: LDKCVec_TxOutZ self; @@ -10328,6 +10853,36 @@ class CVec_TxOutZ { const LDKCVec_TxOutZ* operator &() const { return &self; } const LDKCVec_TxOutZ* operator ->() const { return &self; } }; +class CVec_DestinationZ { +private: + LDKCVec_DestinationZ self; +public: + CVec_DestinationZ(const CVec_DestinationZ&) = delete; + CVec_DestinationZ(CVec_DestinationZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_DestinationZ)); } + CVec_DestinationZ(LDKCVec_DestinationZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_DestinationZ)); } + operator LDKCVec_DestinationZ() && { LDKCVec_DestinationZ res = self; memset(&self, 0, sizeof(LDKCVec_DestinationZ)); return res; } + ~CVec_DestinationZ() { CVec_DestinationZ_free(self); } + CVec_DestinationZ& operator=(CVec_DestinationZ&& o) { CVec_DestinationZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_DestinationZ)); return *this; } + LDKCVec_DestinationZ* operator &() { return &self; } + LDKCVec_DestinationZ* operator ->() { return &self; } + const LDKCVec_DestinationZ* operator &() const { return &self; } + const LDKCVec_DestinationZ* 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 CVec_InboundHTLCDetailsZ { private: LDKCVec_InboundHTLCDetailsZ self; @@ -10373,6 +10928,21 @@ class CResult_BuiltCommitmentTransactionDecodeErrorZ { const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } const LDKCResult_BuiltCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } }; +class C2Tuple_boolboolZ { +private: + LDKC2Tuple_boolboolZ self; +public: + C2Tuple_boolboolZ(const C2Tuple_boolboolZ&) = delete; + C2Tuple_boolboolZ(C2Tuple_boolboolZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_boolboolZ)); } + C2Tuple_boolboolZ(LDKC2Tuple_boolboolZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_boolboolZ)); } + operator LDKC2Tuple_boolboolZ() && { LDKC2Tuple_boolboolZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_boolboolZ)); return res; } + ~C2Tuple_boolboolZ() { C2Tuple_boolboolZ_free(self); } + C2Tuple_boolboolZ& operator=(C2Tuple_boolboolZ&& o) { C2Tuple_boolboolZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_boolboolZ)); return *this; } + LDKC2Tuple_boolboolZ* operator &() { return &self; } + LDKC2Tuple_boolboolZ* operator ->() { return &self; } + const LDKC2Tuple_boolboolZ* operator &() const { return &self; } + const LDKC2Tuple_boolboolZ* operator ->() const { return &self; } +}; class CVec_PaymentForwardNodeZ { private: LDKCVec_PaymentForwardNodeZ self; @@ -10718,21 +11288,6 @@ class CResult_TrustedClosingTransactionNoneZ { const LDKCResult_TrustedClosingTransactionNoneZ* operator &() const { return &self; } const LDKCResult_TrustedClosingTransactionNoneZ* operator ->() const { return &self; } }; -class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { -private: - LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ self; -public: - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ(const CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&) = delete; - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); } - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); } - operator LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ() && { LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); return res; } - ~CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ() { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(self); } - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ& operator=(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ&& o) { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ)); return *this; } - LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator &() { return &self; } - LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator ->() { return &self; } - const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator &() const { return &self; } - const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ* operator ->() const { return &self; } -}; class C2Tuple_PublicKeyTypeZ { private: LDKC2Tuple_PublicKeyTypeZ self; @@ -10823,6 +11378,21 @@ class CResult_MessageContextDecodeErrorZ { const LDKCResult_MessageContextDecodeErrorZ* operator &() const { return &self; } const LDKCResult_MessageContextDecodeErrorZ* operator ->() const { return &self; } }; +class CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { +private: + LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ self; +public: + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(const CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&) = delete; + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); } + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); } + operator LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ() && { LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ res = self; memset(&self, 0, sizeof(LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); return res; } + ~CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ() { CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(self); } + CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ& operator=(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ&& o) { CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ)); return *this; } + LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator &() { return &self; } + LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator ->() { return &self; } + const LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator &() const { return &self; } + const LDKCVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ* operator ->() const { return &self; } +}; class CResult_InitFeaturesDecodeErrorZ { private: LDKCResult_InitFeaturesDecodeErrorZ self; @@ -10853,6 +11423,21 @@ class CResult_PublicKeyNoneZ { const LDKCResult_PublicKeyNoneZ* operator &() const { return &self; } const LDKCResult_PublicKeyNoneZ* operator ->() const { return &self; } }; +class C3Tuple_StrStrStrZ { +private: + LDKC3Tuple_StrStrStrZ self; +public: + C3Tuple_StrStrStrZ(const C3Tuple_StrStrStrZ&) = delete; + C3Tuple_StrStrStrZ(C3Tuple_StrStrStrZ&& o) : self(o.self) { memset(&o, 0, sizeof(C3Tuple_StrStrStrZ)); } + C3Tuple_StrStrStrZ(LDKC3Tuple_StrStrStrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC3Tuple_StrStrStrZ)); } + operator LDKC3Tuple_StrStrStrZ() && { LDKC3Tuple_StrStrStrZ res = self; memset(&self, 0, sizeof(LDKC3Tuple_StrStrStrZ)); return res; } + ~C3Tuple_StrStrStrZ() { C3Tuple_StrStrStrZ_free(self); } + C3Tuple_StrStrStrZ& operator=(C3Tuple_StrStrStrZ&& o) { C3Tuple_StrStrStrZ_free(self); self = o.self; memset(&o, 0, sizeof(C3Tuple_StrStrStrZ)); return *this; } + LDKC3Tuple_StrStrStrZ* operator &() { return &self; } + LDKC3Tuple_StrStrStrZ* operator ->() { return &self; } + const LDKC3Tuple_StrStrStrZ* operator &() const { return &self; } + const LDKC3Tuple_StrStrStrZ* operator ->() const { return &self; } +}; class CResult_PingDecodeErrorZ { private: LDKCResult_PingDecodeErrorZ self; @@ -10898,21 +11483,6 @@ class C2Tuple_OffersMessageMessageSendInstructionsZ { const LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator &() const { return &self; } const LDKC2Tuple_OffersMessageMessageSendInstructionsZ* operator ->() const { return &self; } }; -class CResult_BlindedHopFeaturesDecodeErrorZ { -private: - LDKCResult_BlindedHopFeaturesDecodeErrorZ self; -public: - CResult_BlindedHopFeaturesDecodeErrorZ(const CResult_BlindedHopFeaturesDecodeErrorZ&) = delete; - CResult_BlindedHopFeaturesDecodeErrorZ(CResult_BlindedHopFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); } - CResult_BlindedHopFeaturesDecodeErrorZ(LDKCResult_BlindedHopFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); } - operator LDKCResult_BlindedHopFeaturesDecodeErrorZ() && { LDKCResult_BlindedHopFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); return res; } - ~CResult_BlindedHopFeaturesDecodeErrorZ() { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); } - CResult_BlindedHopFeaturesDecodeErrorZ& operator=(CResult_BlindedHopFeaturesDecodeErrorZ&& o) { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); return *this; } - LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_ChannelIdDecodeErrorZ { private: LDKCResult_ChannelIdDecodeErrorZ self; @@ -10928,6 +11498,21 @@ class CResult_ChannelIdDecodeErrorZ { const LDKCResult_ChannelIdDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelIdDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_BlindedHopFeaturesDecodeErrorZ { +private: + LDKCResult_BlindedHopFeaturesDecodeErrorZ self; +public: + CResult_BlindedHopFeaturesDecodeErrorZ(const CResult_BlindedHopFeaturesDecodeErrorZ&) = delete; + CResult_BlindedHopFeaturesDecodeErrorZ(CResult_BlindedHopFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); } + CResult_BlindedHopFeaturesDecodeErrorZ(LDKCResult_BlindedHopFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); } + operator LDKCResult_BlindedHopFeaturesDecodeErrorZ() && { LDKCResult_BlindedHopFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_BlindedHopFeaturesDecodeErrorZ)); return res; } + ~CResult_BlindedHopFeaturesDecodeErrorZ() { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); } + CResult_BlindedHopFeaturesDecodeErrorZ& operator=(CResult_BlindedHopFeaturesDecodeErrorZ&& o) { CResult_BlindedHopFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_BlindedHopFeaturesDecodeErrorZ)); return *this; } + LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_BlindedHopFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_TransactionOutputsZ { private: LDKCVec_TransactionOutputsZ self; @@ -10958,21 +11543,6 @@ class COption_HTLCClaimZ { const LDKCOption_HTLCClaimZ* operator &() const { return &self; } const LDKCOption_HTLCClaimZ* operator ->() const { return &self; } }; -class COption_boolZ { -private: - LDKCOption_boolZ self; -public: - COption_boolZ(const COption_boolZ&) = delete; - COption_boolZ(COption_boolZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_boolZ)); } - COption_boolZ(LDKCOption_boolZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_boolZ)); } - operator LDKCOption_boolZ() && { LDKCOption_boolZ res = self; memset(&self, 0, sizeof(LDKCOption_boolZ)); return res; } - ~COption_boolZ() { COption_boolZ_free(self); } - COption_boolZ& operator=(COption_boolZ&& o) { COption_boolZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_boolZ)); return *this; } - LDKCOption_boolZ* operator &() { return &self; } - LDKCOption_boolZ* operator ->() { return &self; } - const LDKCOption_boolZ* operator &() const { return &self; } - const LDKCOption_boolZ* operator ->() const { return &self; } -}; class CVec_BlindedPaymentPathZ { private: LDKCVec_BlindedPaymentPathZ self; @@ -10988,6 +11558,36 @@ class CVec_BlindedPaymentPathZ { const LDKCVec_BlindedPaymentPathZ* operator &() const { return &self; } const LDKCVec_BlindedPaymentPathZ* operator ->() const { return &self; } }; +class CResult_HumanReadableNameNoneZ { +private: + LDKCResult_HumanReadableNameNoneZ self; +public: + CResult_HumanReadableNameNoneZ(const CResult_HumanReadableNameNoneZ&) = delete; + CResult_HumanReadableNameNoneZ(CResult_HumanReadableNameNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_HumanReadableNameNoneZ)); } + CResult_HumanReadableNameNoneZ(LDKCResult_HumanReadableNameNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_HumanReadableNameNoneZ)); } + operator LDKCResult_HumanReadableNameNoneZ() && { LDKCResult_HumanReadableNameNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_HumanReadableNameNoneZ)); return res; } + ~CResult_HumanReadableNameNoneZ() { CResult_HumanReadableNameNoneZ_free(self); } + CResult_HumanReadableNameNoneZ& operator=(CResult_HumanReadableNameNoneZ&& o) { CResult_HumanReadableNameNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_HumanReadableNameNoneZ)); return *this; } + LDKCResult_HumanReadableNameNoneZ* operator &() { return &self; } + LDKCResult_HumanReadableNameNoneZ* operator ->() { return &self; } + const LDKCResult_HumanReadableNameNoneZ* operator &() const { return &self; } + const LDKCResult_HumanReadableNameNoneZ* operator ->() const { return &self; } +}; +class COption_boolZ { +private: + LDKCOption_boolZ self; +public: + COption_boolZ(const COption_boolZ&) = delete; + COption_boolZ(COption_boolZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_boolZ)); } + COption_boolZ(LDKCOption_boolZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_boolZ)); } + operator LDKCOption_boolZ() && { LDKCOption_boolZ res = self; memset(&self, 0, sizeof(LDKCOption_boolZ)); return res; } + ~COption_boolZ() { COption_boolZ_free(self); } + COption_boolZ& operator=(COption_boolZ&& o) { COption_boolZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_boolZ)); return *this; } + LDKCOption_boolZ* operator &() { return &self; } + LDKCOption_boolZ* operator ->() { return &self; } + const LDKCOption_boolZ* operator &() const { return &self; } + const LDKCOption_boolZ* operator ->() const { return &self; } +}; class CResult_ProbabilisticScorerDecodeErrorZ { private: LDKCResult_ProbabilisticScorerDecodeErrorZ self; @@ -11003,21 +11603,6 @@ class CResult_ProbabilisticScorerDecodeErrorZ { const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ProbabilisticScorerDecodeErrorZ* operator ->() const { return &self; } }; -class COption_StrZ { -private: - LDKCOption_StrZ self; -public: - COption_StrZ(const COption_StrZ&) = delete; - COption_StrZ(COption_StrZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_StrZ)); } - COption_StrZ(LDKCOption_StrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_StrZ)); } - operator LDKCOption_StrZ() && { LDKCOption_StrZ res = self; memset(&self, 0, sizeof(LDKCOption_StrZ)); return res; } - ~COption_StrZ() { COption_StrZ_free(self); } - COption_StrZ& operator=(COption_StrZ&& o) { COption_StrZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_StrZ)); return *this; } - LDKCOption_StrZ* operator &() { return &self; } - LDKCOption_StrZ* operator ->() { return &self; } - const LDKCOption_StrZ* operator &() const { return &self; } - const LDKCOption_StrZ* operator ->() const { return &self; } -}; class CResult_CVec_BlindedPaymentPathZNoneZ { private: LDKCResult_CVec_BlindedPaymentPathZNoneZ self; @@ -11033,20 +11618,20 @@ class CResult_CVec_BlindedPaymentPathZNoneZ { const LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator &() const { return &self; } const LDKCResult_CVec_BlindedPaymentPathZNoneZ* operator ->() const { return &self; } }; -class COption_C2Tuple_OffersMessageResponseInstructionZZ { +class COption_StrZ { private: - LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ self; + LDKCOption_StrZ self; public: - COption_C2Tuple_OffersMessageResponseInstructionZZ(const COption_C2Tuple_OffersMessageResponseInstructionZZ&) = delete; - COption_C2Tuple_OffersMessageResponseInstructionZZ(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); } - COption_C2Tuple_OffersMessageResponseInstructionZZ(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); } - operator LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ() && { LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); return res; } - ~COption_C2Tuple_OffersMessageResponseInstructionZZ() { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); } - COption_C2Tuple_OffersMessageResponseInstructionZZ& operator=(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); return *this; } - LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() { return &self; } - LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() const { return &self; } + COption_StrZ(const COption_StrZ&) = delete; + COption_StrZ(COption_StrZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_StrZ)); } + COption_StrZ(LDKCOption_StrZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_StrZ)); } + operator LDKCOption_StrZ() && { LDKCOption_StrZ res = self; memset(&self, 0, sizeof(LDKCOption_StrZ)); return res; } + ~COption_StrZ() { COption_StrZ_free(self); } + COption_StrZ& operator=(COption_StrZ&& o) { COption_StrZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_StrZ)); return *this; } + LDKCOption_StrZ* operator &() { return &self; } + LDKCOption_StrZ* operator ->() { return &self; } + const LDKCOption_StrZ* operator &() const { return &self; } + const LDKCOption_StrZ* operator ->() const { return &self; } }; class C2Tuple_usizeTransactionZ { private: @@ -11078,20 +11663,20 @@ class COption_OffersContextZ { const LDKCOption_OffersContextZ* operator &() const { return &self; } const LDKCOption_OffersContextZ* operator ->() const { return &self; } }; -class CResult_NodeAnnouncementDecodeErrorZ { +class COption_C2Tuple_OffersMessageResponseInstructionZZ { private: - LDKCResult_NodeAnnouncementDecodeErrorZ self; + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ 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; } + COption_C2Tuple_OffersMessageResponseInstructionZZ(const COption_C2Tuple_OffersMessageResponseInstructionZZ&) = delete; + COption_C2Tuple_OffersMessageResponseInstructionZZ(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); } + COption_C2Tuple_OffersMessageResponseInstructionZZ(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ() && { LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ)); return res; } + ~COption_C2Tuple_OffersMessageResponseInstructionZZ() { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); } + COption_C2Tuple_OffersMessageResponseInstructionZZ& operator=(COption_C2Tuple_OffersMessageResponseInstructionZZ&& o) { COption_C2Tuple_OffersMessageResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_OffersMessageResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_OffersMessageResponseInstructionZZ* operator ->() const { return &self; } }; class CVec_ChannelMonitorZ { private: @@ -11123,20 +11708,20 @@ class CResult_AcceptChannelV2DecodeErrorZ { const LDKCResult_AcceptChannelV2DecodeErrorZ* operator &() const { return &self; } const LDKCResult_AcceptChannelV2DecodeErrorZ* operator ->() const { return &self; } }; -class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { +class CResult_NodeAnnouncementDecodeErrorZ { private: - LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ self; + LDKCResult_NodeAnnouncementDecodeErrorZ self; public: - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(const CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&) = delete; - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } - operator LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() && { LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return res; } - ~CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); } - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ& operator=(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return *this; } - LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() { return &self; } - LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* 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 CResult_RouteHopDecodeErrorZ { private: @@ -11198,6 +11783,21 @@ class CResult_CoinSelectionNoneZ { const LDKCResult_CoinSelectionNoneZ* operator &() const { return &self; } const LDKCResult_CoinSelectionNoneZ* operator ->() const { return &self; } }; +class CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { +private: + LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ self; +public: + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(const CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&) = delete; + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); } + operator LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() && { LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return res; } + ~CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ() { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ& operator=(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ&& o) { CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ)); return *this; } + LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() { return &self; } + LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_COption_InboundHTLCStateDetailsZDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_FutureZ { private: LDKCVec_FutureZ self; @@ -11213,21 +11813,6 @@ class CVec_FutureZ { const LDKCVec_FutureZ* operator &() const { return &self; } const LDKCVec_FutureZ* operator ->() const { return &self; } }; -class CResult_TxCreationKeysDecodeErrorZ { -private: - LDKCResult_TxCreationKeysDecodeErrorZ 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; } -}; class CResult_RefundBolt12SemanticErrorZ { private: LDKCResult_RefundBolt12SemanticErrorZ self; @@ -11363,20 +11948,20 @@ class C2Tuple_Z { const LDKC2Tuple_Z* operator &() const { return &self; } const LDKC2Tuple_Z* operator ->() const { return &self; } }; -class CResult_ShutdownScriptDecodeErrorZ { +class CResult_TxCreationKeysDecodeErrorZ { private: - LDKCResult_ShutdownScriptDecodeErrorZ self; + LDKCResult_TxCreationKeysDecodeErrorZ 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_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_InboundHTLCDetailsDecodeErrorZ { private: @@ -11393,20 +11978,20 @@ class CResult_InboundHTLCDetailsDecodeErrorZ { const LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_InboundHTLCDetailsDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_SiPrefixBolt11ParseErrorZ { +class CResult_ShutdownScriptDecodeErrorZ { private: - LDKCResult_SiPrefixBolt11ParseErrorZ self; + LDKCResult_ShutdownScriptDecodeErrorZ self; public: - CResult_SiPrefixBolt11ParseErrorZ(const CResult_SiPrefixBolt11ParseErrorZ&) = delete; - CResult_SiPrefixBolt11ParseErrorZ(CResult_SiPrefixBolt11ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); } - CResult_SiPrefixBolt11ParseErrorZ(LDKCResult_SiPrefixBolt11ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); } - operator LDKCResult_SiPrefixBolt11ParseErrorZ() && { LDKCResult_SiPrefixBolt11ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); return res; } - ~CResult_SiPrefixBolt11ParseErrorZ() { CResult_SiPrefixBolt11ParseErrorZ_free(self); } - CResult_SiPrefixBolt11ParseErrorZ& operator=(CResult_SiPrefixBolt11ParseErrorZ&& o) { CResult_SiPrefixBolt11ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); return *this; } - LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() { return &self; } - LDKCResult_SiPrefixBolt11ParseErrorZ* operator ->() { return &self; } - const LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() const { return &self; } - const LDKCResult_SiPrefixBolt11ParseErrorZ* 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 C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { private: @@ -11423,6 +12008,21 @@ class C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { const LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* operator &() const { return &self; } const LDKC2Tuple_ECDSASignatureCVec_ECDSASignatureZZ* operator ->() const { return &self; } }; +class CResult_SiPrefixBolt11ParseErrorZ { +private: + LDKCResult_SiPrefixBolt11ParseErrorZ self; +public: + CResult_SiPrefixBolt11ParseErrorZ(const CResult_SiPrefixBolt11ParseErrorZ&) = delete; + CResult_SiPrefixBolt11ParseErrorZ(CResult_SiPrefixBolt11ParseErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); } + CResult_SiPrefixBolt11ParseErrorZ(LDKCResult_SiPrefixBolt11ParseErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); } + operator LDKCResult_SiPrefixBolt11ParseErrorZ() && { LDKCResult_SiPrefixBolt11ParseErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_SiPrefixBolt11ParseErrorZ)); return res; } + ~CResult_SiPrefixBolt11ParseErrorZ() { CResult_SiPrefixBolt11ParseErrorZ_free(self); } + CResult_SiPrefixBolt11ParseErrorZ& operator=(CResult_SiPrefixBolt11ParseErrorZ&& o) { CResult_SiPrefixBolt11ParseErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_SiPrefixBolt11ParseErrorZ)); return *this; } + LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() { return &self; } + LDKCResult_SiPrefixBolt11ParseErrorZ* operator ->() { return &self; } + const LDKCResult_SiPrefixBolt11ParseErrorZ* operator &() const { return &self; } + const LDKCResult_SiPrefixBolt11ParseErrorZ* operator ->() const { return &self; } +}; class CVec_PathZ { private: LDKCVec_PathZ self; @@ -11513,21 +12113,6 @@ class CResult_RouteLightningErrorZ { const LDKCResult_RouteLightningErrorZ* operator &() const { return &self; } const LDKCResult_RouteLightningErrorZ* operator ->() const { return &self; } }; -class CResult_NonePaymentSendFailureZ { -private: - LDKCResult_NonePaymentSendFailureZ 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; } -}; class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { private: LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ self; @@ -11573,6 +12158,21 @@ class CVec_ClaimedHTLCZ { const LDKCVec_ClaimedHTLCZ* operator &() const { return &self; } const LDKCVec_ClaimedHTLCZ* operator ->() const { return &self; } }; +class CResult_DelayedPaymentKeyDecodeErrorZ { +private: + LDKCResult_DelayedPaymentKeyDecodeErrorZ self; +public: + CResult_DelayedPaymentKeyDecodeErrorZ(const CResult_DelayedPaymentKeyDecodeErrorZ&) = delete; + CResult_DelayedPaymentKeyDecodeErrorZ(CResult_DelayedPaymentKeyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); } + CResult_DelayedPaymentKeyDecodeErrorZ(LDKCResult_DelayedPaymentKeyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); } + operator LDKCResult_DelayedPaymentKeyDecodeErrorZ() && { LDKCResult_DelayedPaymentKeyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); return res; } + ~CResult_DelayedPaymentKeyDecodeErrorZ() { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); } + CResult_DelayedPaymentKeyDecodeErrorZ& operator=(CResult_DelayedPaymentKeyDecodeErrorZ&& o) { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); return *this; } + LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() { return &self; } + LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() const { return &self; } +}; class COption_CVec_ThirtyTwoBytesZZ { private: LDKCOption_CVec_ThirtyTwoBytesZZ self; @@ -11618,20 +12218,35 @@ class CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ* operator &() const { return &self; } const LDKCVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ* operator ->() const { return &self; } }; -class CResult_ThirtyTwoBytesPaymentSendFailureZ { +class CResult_InvoiceRequestDecodeErrorZ { +private: + LDKCResult_InvoiceRequestDecodeErrorZ self; +public: + CResult_InvoiceRequestDecodeErrorZ(const CResult_InvoiceRequestDecodeErrorZ&) = delete; + CResult_InvoiceRequestDecodeErrorZ(CResult_InvoiceRequestDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestDecodeErrorZ)); } + CResult_InvoiceRequestDecodeErrorZ(LDKCResult_InvoiceRequestDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestDecodeErrorZ)); } + operator LDKCResult_InvoiceRequestDecodeErrorZ() && { LDKCResult_InvoiceRequestDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestDecodeErrorZ)); return res; } + ~CResult_InvoiceRequestDecodeErrorZ() { CResult_InvoiceRequestDecodeErrorZ_free(self); } + CResult_InvoiceRequestDecodeErrorZ& operator=(CResult_InvoiceRequestDecodeErrorZ&& o) { CResult_InvoiceRequestDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestDecodeErrorZ)); return *this; } + LDKCResult_InvoiceRequestDecodeErrorZ* operator &() { return &self; } + LDKCResult_InvoiceRequestDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceRequestDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceRequestDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { private: - LDKCResult_ThirtyTwoBytesPaymentSendFailureZ self; + LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ self; public: - CResult_ThirtyTwoBytesPaymentSendFailureZ(const CResult_ThirtyTwoBytesPaymentSendFailureZ&) = delete; - CResult_ThirtyTwoBytesPaymentSendFailureZ(CResult_ThirtyTwoBytesPaymentSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_ThirtyTwoBytesPaymentSendFailureZ)); } - CResult_ThirtyTwoBytesPaymentSendFailureZ(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ)); } - operator LDKCResult_ThirtyTwoBytesPaymentSendFailureZ() && { LDKCResult_ThirtyTwoBytesPaymentSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_ThirtyTwoBytesPaymentSendFailureZ)); return res; } - ~CResult_ThirtyTwoBytesPaymentSendFailureZ() { CResult_ThirtyTwoBytesPaymentSendFailureZ_free(self); } - CResult_ThirtyTwoBytesPaymentSendFailureZ& operator=(CResult_ThirtyTwoBytesPaymentSendFailureZ&& o) { CResult_ThirtyTwoBytesPaymentSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_ThirtyTwoBytesPaymentSendFailureZ)); return *this; } - LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator &() { return &self; } - LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator ->() { return &self; } - const LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator &() const { return &self; } - const LDKCResult_ThirtyTwoBytesPaymentSendFailureZ* operator ->() const { return &self; } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(const CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&) = delete; + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); } + operator LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ() && { LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); return res; } + ~CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ() { CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(self); } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ& operator=(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ&& o) { CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ)); return *this; } + LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator &() { return &self; } + LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator ->() { return &self; } + const LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator &() const { return &self; } + const LDKCResult_CVec_C3Tuple_StrStrStrZZIOErrorZ* operator ->() const { return &self; } }; class CResult_WarningMessageDecodeErrorZ { private: @@ -11678,20 +12293,20 @@ class CResult_HolderCommitmentTransactionDecodeErrorZ { const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator &() const { return &self; } const LDKCResult_HolderCommitmentTransactionDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_DelayedPaymentKeyDecodeErrorZ { +class CResult_AsyncPaymentsContextDecodeErrorZ { private: - LDKCResult_DelayedPaymentKeyDecodeErrorZ self; + LDKCResult_AsyncPaymentsContextDecodeErrorZ self; public: - CResult_DelayedPaymentKeyDecodeErrorZ(const CResult_DelayedPaymentKeyDecodeErrorZ&) = delete; - CResult_DelayedPaymentKeyDecodeErrorZ(CResult_DelayedPaymentKeyDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); } - CResult_DelayedPaymentKeyDecodeErrorZ(LDKCResult_DelayedPaymentKeyDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); } - operator LDKCResult_DelayedPaymentKeyDecodeErrorZ() && { LDKCResult_DelayedPaymentKeyDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DelayedPaymentKeyDecodeErrorZ)); return res; } - ~CResult_DelayedPaymentKeyDecodeErrorZ() { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); } - CResult_DelayedPaymentKeyDecodeErrorZ& operator=(CResult_DelayedPaymentKeyDecodeErrorZ&& o) { CResult_DelayedPaymentKeyDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DelayedPaymentKeyDecodeErrorZ)); return *this; } - LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() { return &self; } - LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_DelayedPaymentKeyDecodeErrorZ* operator ->() const { return &self; } + CResult_AsyncPaymentsContextDecodeErrorZ(const CResult_AsyncPaymentsContextDecodeErrorZ&) = delete; + CResult_AsyncPaymentsContextDecodeErrorZ(CResult_AsyncPaymentsContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_AsyncPaymentsContextDecodeErrorZ)); } + CResult_AsyncPaymentsContextDecodeErrorZ(LDKCResult_AsyncPaymentsContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_AsyncPaymentsContextDecodeErrorZ)); } + operator LDKCResult_AsyncPaymentsContextDecodeErrorZ() && { LDKCResult_AsyncPaymentsContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_AsyncPaymentsContextDecodeErrorZ)); return res; } + ~CResult_AsyncPaymentsContextDecodeErrorZ() { CResult_AsyncPaymentsContextDecodeErrorZ_free(self); } + CResult_AsyncPaymentsContextDecodeErrorZ& operator=(CResult_AsyncPaymentsContextDecodeErrorZ&& o) { CResult_AsyncPaymentsContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_AsyncPaymentsContextDecodeErrorZ)); return *this; } + LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_AsyncPaymentsContextDecodeErrorZ* operator ->() const { return &self; } }; class C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { private: @@ -11813,20 +12428,20 @@ class CVec_ChannelDetailsZ { const LDKCVec_ChannelDetailsZ* operator &() const { return &self; } const LDKCVec_ChannelDetailsZ* operator ->() const { return &self; } }; -class CResult_Bolt11InvoiceFeaturesDecodeErrorZ { +class CResult_DNSResolverContextDecodeErrorZ { private: - LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ self; + LDKCResult_DNSResolverContextDecodeErrorZ self; public: - CResult_Bolt11InvoiceFeaturesDecodeErrorZ(const CResult_Bolt11InvoiceFeaturesDecodeErrorZ&) = delete; - CResult_Bolt11InvoiceFeaturesDecodeErrorZ(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } - CResult_Bolt11InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } - operator LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return res; } - ~CResult_Bolt11InvoiceFeaturesDecodeErrorZ() { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); } - CResult_Bolt11InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return *this; } - LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } + CResult_DNSResolverContextDecodeErrorZ(const CResult_DNSResolverContextDecodeErrorZ&) = delete; + CResult_DNSResolverContextDecodeErrorZ(CResult_DNSResolverContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_DNSResolverContextDecodeErrorZ)); } + CResult_DNSResolverContextDecodeErrorZ(LDKCResult_DNSResolverContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_DNSResolverContextDecodeErrorZ)); } + operator LDKCResult_DNSResolverContextDecodeErrorZ() && { LDKCResult_DNSResolverContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_DNSResolverContextDecodeErrorZ)); return res; } + ~CResult_DNSResolverContextDecodeErrorZ() { CResult_DNSResolverContextDecodeErrorZ_free(self); } + CResult_DNSResolverContextDecodeErrorZ& operator=(CResult_DNSResolverContextDecodeErrorZ&& o) { CResult_DNSResolverContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_DNSResolverContextDecodeErrorZ)); return *this; } + LDKCResult_DNSResolverContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_DNSResolverContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_DNSResolverContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_DNSResolverContextDecodeErrorZ* operator ->() const { return &self; } }; class CVec_MessageSendEventZ { private: @@ -11843,6 +12458,21 @@ class CVec_MessageSendEventZ { const LDKCVec_MessageSendEventZ* operator &() const { return &self; } const LDKCVec_MessageSendEventZ* operator ->() const { return &self; } }; +class CResult_Bolt11InvoiceFeaturesDecodeErrorZ { +private: + LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ self; +public: + CResult_Bolt11InvoiceFeaturesDecodeErrorZ(const CResult_Bolt11InvoiceFeaturesDecodeErrorZ&) = delete; + CResult_Bolt11InvoiceFeaturesDecodeErrorZ(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } + CResult_Bolt11InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); } + operator LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return res; } + ~CResult_Bolt11InvoiceFeaturesDecodeErrorZ() { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); } + CResult_Bolt11InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt11InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt11InvoiceFeaturesDecodeErrorZ)); return *this; } + LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_Bolt11InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { private: LDKCVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ self; @@ -11978,6 +12608,21 @@ class CResult_InvoiceRequestFieldsDecodeErrorZ { const LDKCResult_InvoiceRequestFieldsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_InvoiceRequestFieldsDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_NoneBolt12PaymentErrorZ { +private: + LDKCResult_NoneBolt12PaymentErrorZ self; +public: + CResult_NoneBolt12PaymentErrorZ(const CResult_NoneBolt12PaymentErrorZ&) = delete; + CResult_NoneBolt12PaymentErrorZ(CResult_NoneBolt12PaymentErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_NoneBolt12PaymentErrorZ)); } + CResult_NoneBolt12PaymentErrorZ(LDKCResult_NoneBolt12PaymentErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_NoneBolt12PaymentErrorZ)); } + operator LDKCResult_NoneBolt12PaymentErrorZ() && { LDKCResult_NoneBolt12PaymentErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_NoneBolt12PaymentErrorZ)); return res; } + ~CResult_NoneBolt12PaymentErrorZ() { CResult_NoneBolt12PaymentErrorZ_free(self); } + CResult_NoneBolt12PaymentErrorZ& operator=(CResult_NoneBolt12PaymentErrorZ&& o) { CResult_NoneBolt12PaymentErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_NoneBolt12PaymentErrorZ)); return *this; } + LDKCResult_NoneBolt12PaymentErrorZ* operator &() { return &self; } + LDKCResult_NoneBolt12PaymentErrorZ* operator ->() { return &self; } + const LDKCResult_NoneBolt12PaymentErrorZ* operator &() const { return &self; } + const LDKCResult_NoneBolt12PaymentErrorZ* operator ->() const { return &self; } +}; class CResult_AcceptChannelDecodeErrorZ { private: LDKCResult_AcceptChannelDecodeErrorZ self; @@ -12083,21 +12728,6 @@ class CResult_NoneBolt12SemanticErrorZ { const LDKCResult_NoneBolt12SemanticErrorZ* operator &() const { return &self; } const LDKCResult_NoneBolt12SemanticErrorZ* operator ->() const { return &self; } }; -class CResult_UnknownPaymentContextDecodeErrorZ { -private: - LDKCResult_UnknownPaymentContextDecodeErrorZ self; -public: - CResult_UnknownPaymentContextDecodeErrorZ(const CResult_UnknownPaymentContextDecodeErrorZ&) = delete; - CResult_UnknownPaymentContextDecodeErrorZ(CResult_UnknownPaymentContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnknownPaymentContextDecodeErrorZ)); } - CResult_UnknownPaymentContextDecodeErrorZ(LDKCResult_UnknownPaymentContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ)); } - operator LDKCResult_UnknownPaymentContextDecodeErrorZ() && { LDKCResult_UnknownPaymentContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnknownPaymentContextDecodeErrorZ)); return res; } - ~CResult_UnknownPaymentContextDecodeErrorZ() { CResult_UnknownPaymentContextDecodeErrorZ_free(self); } - CResult_UnknownPaymentContextDecodeErrorZ& operator=(CResult_UnknownPaymentContextDecodeErrorZ&& o) { CResult_UnknownPaymentContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnknownPaymentContextDecodeErrorZ)); return *this; } - LDKCResult_UnknownPaymentContextDecodeErrorZ* operator &() { return &self; } - LDKCResult_UnknownPaymentContextDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_UnknownPaymentContextDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_UnknownPaymentContextDecodeErrorZ* operator ->() const { return &self; } -}; class COption_InboundHTLCStateDetailsZ { private: LDKCOption_InboundHTLCStateDetailsZ self; @@ -12158,21 +12788,6 @@ class COption_EventZ { const LDKCOption_EventZ* operator &() const { return &self; } const LDKCOption_EventZ* operator ->() const { return &self; } }; -class CResult_ChannelTypeFeaturesDecodeErrorZ { -private: - LDKCResult_ChannelTypeFeaturesDecodeErrorZ 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; } -}; class COption_CVec_SocketAddressZZ { private: LDKCOption_CVec_SocketAddressZZ self; @@ -12188,6 +12803,21 @@ class COption_CVec_SocketAddressZZ { const LDKCOption_CVec_SocketAddressZZ* operator &() const { return &self; } const LDKCOption_CVec_SocketAddressZZ* operator ->() const { return &self; } }; +class CResult_ChannelTypeFeaturesDecodeErrorZ { +private: + LDKCResult_ChannelTypeFeaturesDecodeErrorZ 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; } +}; class CVec_RouteHintZ { private: LDKCVec_RouteHintZ self; @@ -12428,35 +13058,20 @@ class CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { const LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator &() const { return &self; } const LDKCResult_SignedRawBolt11InvoiceBolt11ParseErrorZ* operator ->() const { return &self; } }; -class CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { -private: - LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ self; -public: - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ(const CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ&) = delete; - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ)); } - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ)); } - operator LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ() && { LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ)); return res; } - ~CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ() { CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(self); } - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ& operator=(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ&& o) { CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ)); return *this; } - LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_UnsignedInvoiceRequestBolt12SemanticErrorZ* operator ->() const { return &self; } -}; -class CResult_OnionMessagePathNoneZ { +class CResult_PaymentConstraintsDecodeErrorZ { private: - LDKCResult_OnionMessagePathNoneZ self; + LDKCResult_PaymentConstraintsDecodeErrorZ self; public: - CResult_OnionMessagePathNoneZ(const CResult_OnionMessagePathNoneZ&) = delete; - CResult_OnionMessagePathNoneZ(CResult_OnionMessagePathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OnionMessagePathNoneZ)); } - CResult_OnionMessagePathNoneZ(LDKCResult_OnionMessagePathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OnionMessagePathNoneZ)); } - operator LDKCResult_OnionMessagePathNoneZ() && { LDKCResult_OnionMessagePathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_OnionMessagePathNoneZ)); return res; } - ~CResult_OnionMessagePathNoneZ() { CResult_OnionMessagePathNoneZ_free(self); } - CResult_OnionMessagePathNoneZ& operator=(CResult_OnionMessagePathNoneZ&& o) { CResult_OnionMessagePathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OnionMessagePathNoneZ)); return *this; } - LDKCResult_OnionMessagePathNoneZ* operator &() { return &self; } - LDKCResult_OnionMessagePathNoneZ* operator ->() { return &self; } - const LDKCResult_OnionMessagePathNoneZ* operator &() const { return &self; } - const LDKCResult_OnionMessagePathNoneZ* operator ->() const { return &self; } + CResult_PaymentConstraintsDecodeErrorZ(const CResult_PaymentConstraintsDecodeErrorZ&) = delete; + CResult_PaymentConstraintsDecodeErrorZ(CResult_PaymentConstraintsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentConstraintsDecodeErrorZ)); } + CResult_PaymentConstraintsDecodeErrorZ(LDKCResult_PaymentConstraintsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ)); } + operator LDKCResult_PaymentConstraintsDecodeErrorZ() && { LDKCResult_PaymentConstraintsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ)); return res; } + ~CResult_PaymentConstraintsDecodeErrorZ() { CResult_PaymentConstraintsDecodeErrorZ_free(self); } + CResult_PaymentConstraintsDecodeErrorZ& operator=(CResult_PaymentConstraintsDecodeErrorZ&& o) { CResult_PaymentConstraintsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentConstraintsDecodeErrorZ)); return *this; } + LDKCResult_PaymentConstraintsDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentConstraintsDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentConstraintsDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentConstraintsDecodeErrorZ* operator ->() const { return &self; } }; class C2Tuple_u32CVec_u8ZZ { private: @@ -12503,6 +13118,21 @@ class CResult_OutboundHTLCDetailsDecodeErrorZ { const LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OutboundHTLCDetailsDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_OnionMessagePathNoneZ { +private: + LDKCResult_OnionMessagePathNoneZ self; +public: + CResult_OnionMessagePathNoneZ(const CResult_OnionMessagePathNoneZ&) = delete; + CResult_OnionMessagePathNoneZ(CResult_OnionMessagePathNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OnionMessagePathNoneZ)); } + CResult_OnionMessagePathNoneZ(LDKCResult_OnionMessagePathNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OnionMessagePathNoneZ)); } + operator LDKCResult_OnionMessagePathNoneZ() && { LDKCResult_OnionMessagePathNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_OnionMessagePathNoneZ)); return res; } + ~CResult_OnionMessagePathNoneZ() { CResult_OnionMessagePathNoneZ_free(self); } + CResult_OnionMessagePathNoneZ& operator=(CResult_OnionMessagePathNoneZ&& o) { CResult_OnionMessagePathNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OnionMessagePathNoneZ)); return *this; } + LDKCResult_OnionMessagePathNoneZ* operator &() { return &self; } + LDKCResult_OnionMessagePathNoneZ* operator ->() { return &self; } + const LDKCResult_OnionMessagePathNoneZ* operator &() const { return &self; } + const LDKCResult_OnionMessagePathNoneZ* operator ->() const { return &self; } +}; class CResult_RefundBolt12ParseErrorZ { private: LDKCResult_RefundBolt12ParseErrorZ self; @@ -12563,20 +13193,20 @@ class CResult_OffersMessageDecodeErrorZ { const LDKCResult_OffersMessageDecodeErrorZ* operator &() const { return &self; } const LDKCResult_OffersMessageDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_PaymentConstraintsDecodeErrorZ { +class CVec_PhantomRouteHintsZ { private: - LDKCResult_PaymentConstraintsDecodeErrorZ self; + LDKCVec_PhantomRouteHintsZ self; public: - CResult_PaymentConstraintsDecodeErrorZ(const CResult_PaymentConstraintsDecodeErrorZ&) = delete; - CResult_PaymentConstraintsDecodeErrorZ(CResult_PaymentConstraintsDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentConstraintsDecodeErrorZ)); } - CResult_PaymentConstraintsDecodeErrorZ(LDKCResult_PaymentConstraintsDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ)); } - operator LDKCResult_PaymentConstraintsDecodeErrorZ() && { LDKCResult_PaymentConstraintsDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentConstraintsDecodeErrorZ)); return res; } - ~CResult_PaymentConstraintsDecodeErrorZ() { CResult_PaymentConstraintsDecodeErrorZ_free(self); } - CResult_PaymentConstraintsDecodeErrorZ& operator=(CResult_PaymentConstraintsDecodeErrorZ&& o) { CResult_PaymentConstraintsDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentConstraintsDecodeErrorZ)); return *this; } - LDKCResult_PaymentConstraintsDecodeErrorZ* operator &() { return &self; } - LDKCResult_PaymentConstraintsDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentConstraintsDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentConstraintsDecodeErrorZ* operator ->() const { return &self; } + 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_NoneAPIErrorZ { private: @@ -12593,20 +13223,20 @@ class CResult_NoneAPIErrorZ { const LDKCResult_NoneAPIErrorZ* operator &() const { return &self; } const LDKCResult_NoneAPIErrorZ* operator ->() const { return &self; } }; -class CResult_Bolt12InvoiceFeaturesDecodeErrorZ { +class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { private: - LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ self; + LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ self; public: - CResult_Bolt12InvoiceFeaturesDecodeErrorZ(const CResult_Bolt12InvoiceFeaturesDecodeErrorZ&) = delete; - CResult_Bolt12InvoiceFeaturesDecodeErrorZ(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } - CResult_Bolt12InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } - operator LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return res; } - ~CResult_Bolt12InvoiceFeaturesDecodeErrorZ() { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); } - CResult_Bolt12InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return *this; } - LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } - LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(const CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&) = delete; + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } + operator LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ() && { LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return res; } + ~CResult_CounterpartyChannelTransactionParametersDecodeErrorZ() { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZ& operator=(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return *this; } + LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } + LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } }; class COption_f64Z { private: @@ -12803,21 +13433,6 @@ class C2Tuple_u32TxOutZ { const LDKC2Tuple_u32TxOutZ* operator &() const { return &self; } const LDKC2Tuple_u32TxOutZ* operator ->() const { return &self; } }; -class CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { -private: - LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ self; -public: - CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ(const CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ&) = delete; - CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ)); } - CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ)); } - operator LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ() && { LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ)); return res; } - ~CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ() { CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(self); } - CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ& operator=(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ&& o) { CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ)); return *this; } - LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* operator &() { return &self; } - LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* operator ->() { return &self; } - const LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* operator &() const { return &self; } - const LDKCResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } -}; class CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { private: LDKCResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ self; @@ -12848,6 +13463,21 @@ class CResult_ChannelDetailsDecodeErrorZ { const LDKCResult_ChannelDetailsDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelDetailsDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_Bolt12InvoiceFeaturesDecodeErrorZ { +private: + LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ self; +public: + CResult_Bolt12InvoiceFeaturesDecodeErrorZ(const CResult_Bolt12InvoiceFeaturesDecodeErrorZ&) = delete; + CResult_Bolt12InvoiceFeaturesDecodeErrorZ(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } + CResult_Bolt12InvoiceFeaturesDecodeErrorZ(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); } + operator LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ() && { LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return res; } + ~CResult_Bolt12InvoiceFeaturesDecodeErrorZ() { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); } + CResult_Bolt12InvoiceFeaturesDecodeErrorZ& operator=(CResult_Bolt12InvoiceFeaturesDecodeErrorZ&& o) { CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_Bolt12InvoiceFeaturesDecodeErrorZ)); return *this; } + LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() { return &self; } + LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_Bolt12InvoiceFeaturesDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_UtxoZ { private: LDKCVec_UtxoZ self; @@ -12863,20 +13493,35 @@ class CVec_UtxoZ { const LDKCVec_UtxoZ* operator &() const { return &self; } const LDKCVec_UtxoZ* operator ->() const { return &self; } }; -class CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { +class CResult_PaymentContextDecodeErrorZ { private: - LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ self; + LDKCResult_PaymentContextDecodeErrorZ self; public: - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(const CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&) = delete; - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); } - operator LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ() && { LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return res; } - ~CResult_CounterpartyChannelTransactionParametersDecodeErrorZ() { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); } - CResult_CounterpartyChannelTransactionParametersDecodeErrorZ& operator=(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ&& o) { CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_CounterpartyChannelTransactionParametersDecodeErrorZ)); return *this; } - LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() { return &self; } - LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_CounterpartyChannelTransactionParametersDecodeErrorZ* operator ->() const { return &self; } + CResult_PaymentContextDecodeErrorZ(const CResult_PaymentContextDecodeErrorZ&) = delete; + CResult_PaymentContextDecodeErrorZ(CResult_PaymentContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); } + CResult_PaymentContextDecodeErrorZ(LDKCResult_PaymentContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); } + operator LDKCResult_PaymentContextDecodeErrorZ() && { LDKCResult_PaymentContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); return res; } + ~CResult_PaymentContextDecodeErrorZ() { CResult_PaymentContextDecodeErrorZ_free(self); } + CResult_PaymentContextDecodeErrorZ& operator=(CResult_PaymentContextDecodeErrorZ&& o) { CResult_PaymentContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); return *this; } + LDKCResult_PaymentContextDecodeErrorZ* operator &() { return &self; } + LDKCResult_PaymentContextDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_PaymentContextDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_PaymentContextDecodeErrorZ* operator ->() const { return &self; } +}; +class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { +private: + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ self; +public: + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ(const CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ&) = delete; + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ)); } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ)); } + operator LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ() && { LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ)); return res; } + ~CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ() { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(self); } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ& operator=(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ&& o) { CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ)); return *this; } + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ* operator &() { return &self; } + LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ* operator ->() const { return &self; } }; class CResult_ChannelConfigDecodeErrorZ { private: @@ -12893,21 +13538,6 @@ class CResult_ChannelConfigDecodeErrorZ { const LDKCResult_ChannelConfigDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelConfigDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_PrivateRouteZ { -private: - LDKCVec_PrivateRouteZ self; -public: - CVec_PrivateRouteZ(const CVec_PrivateRouteZ&) = delete; - CVec_PrivateRouteZ(CVec_PrivateRouteZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PrivateRouteZ)); } - CVec_PrivateRouteZ(LDKCVec_PrivateRouteZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PrivateRouteZ)); } - operator LDKCVec_PrivateRouteZ() && { LDKCVec_PrivateRouteZ res = self; memset(&self, 0, sizeof(LDKCVec_PrivateRouteZ)); return res; } - ~CVec_PrivateRouteZ() { CVec_PrivateRouteZ_free(self); } - CVec_PrivateRouteZ& operator=(CVec_PrivateRouteZ&& o) { CVec_PrivateRouteZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PrivateRouteZ)); return *this; } - LDKCVec_PrivateRouteZ* operator &() { return &self; } - LDKCVec_PrivateRouteZ* operator ->() { return &self; } - const LDKCVec_PrivateRouteZ* operator &() const { return &self; } - const LDKCVec_PrivateRouteZ* operator ->() const { return &self; } -}; class COption_i64Z { private: LDKCOption_i64Z self; @@ -12923,35 +13553,20 @@ class COption_i64Z { const LDKCOption_i64Z* operator &() const { return &self; } const LDKCOption_i64Z* operator ->() const { return &self; } }; -class CResult_PaymentContextDecodeErrorZ { -private: - LDKCResult_PaymentContextDecodeErrorZ self; -public: - CResult_PaymentContextDecodeErrorZ(const CResult_PaymentContextDecodeErrorZ&) = delete; - CResult_PaymentContextDecodeErrorZ(CResult_PaymentContextDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); } - CResult_PaymentContextDecodeErrorZ(LDKCResult_PaymentContextDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); } - operator LDKCResult_PaymentContextDecodeErrorZ() && { LDKCResult_PaymentContextDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_PaymentContextDecodeErrorZ)); return res; } - ~CResult_PaymentContextDecodeErrorZ() { CResult_PaymentContextDecodeErrorZ_free(self); } - CResult_PaymentContextDecodeErrorZ& operator=(CResult_PaymentContextDecodeErrorZ&& o) { CResult_PaymentContextDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_PaymentContextDecodeErrorZ)); return *this; } - LDKCResult_PaymentContextDecodeErrorZ* operator &() { return &self; } - LDKCResult_PaymentContextDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_PaymentContextDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_PaymentContextDecodeErrorZ* operator ->() const { return &self; } -}; -class CVec_PhantomRouteHintsZ { +class CVec_PrivateRouteZ { private: - LDKCVec_PhantomRouteHintsZ self; + LDKCVec_PrivateRouteZ 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; } + CVec_PrivateRouteZ(const CVec_PrivateRouteZ&) = delete; + CVec_PrivateRouteZ(CVec_PrivateRouteZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_PrivateRouteZ)); } + CVec_PrivateRouteZ(LDKCVec_PrivateRouteZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_PrivateRouteZ)); } + operator LDKCVec_PrivateRouteZ() && { LDKCVec_PrivateRouteZ res = self; memset(&self, 0, sizeof(LDKCVec_PrivateRouteZ)); return res; } + ~CVec_PrivateRouteZ() { CVec_PrivateRouteZ_free(self); } + CVec_PrivateRouteZ& operator=(CVec_PrivateRouteZ&& o) { CVec_PrivateRouteZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_PrivateRouteZ)); return *this; } + LDKCVec_PrivateRouteZ* operator &() { return &self; } + LDKCVec_PrivateRouteZ* operator ->() { return &self; } + const LDKCVec_PrivateRouteZ* operator &() const { return &self; } + const LDKCVec_PrivateRouteZ* operator ->() const { return &self; } }; class CVec_C2Tuple_OutPointCVec_u64ZZZ { private: @@ -13058,6 +13673,21 @@ class CVec_MonitorEventZ { const LDKCVec_MonitorEventZ* operator &() const { return &self; } const LDKCVec_MonitorEventZ* operator ->() const { return &self; } }; +class CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { +private: + LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ self; +public: + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ(const CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ&) = delete; + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ(CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ)); } + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ(LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ)); } + operator LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ() && { LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ)); return res; } + ~CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ() { CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); } + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ& operator=(CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ&& o) { CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ)); return *this; } + LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() { return &self; } + LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() { return &self; } + const LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ* operator &() const { return &self; } + const LDKCResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ* operator ->() const { return &self; } +}; class CResult_ShutdownDecodeErrorZ { private: LDKCResult_ShutdownDecodeErrorZ self; @@ -13193,21 +13823,6 @@ class CResult_ChannelUpdateDecodeErrorZ { const LDKCResult_ChannelUpdateDecodeErrorZ* operator &() const { return &self; } const LDKCResult_ChannelUpdateDecodeErrorZ* operator ->() const { return &self; } }; -class CVec_APIErrorZ { -private: - LDKCVec_APIErrorZ self; -public: - CVec_APIErrorZ(const CVec_APIErrorZ&) = delete; - CVec_APIErrorZ(CVec_APIErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CVec_APIErrorZ)); } - CVec_APIErrorZ(LDKCVec_APIErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCVec_APIErrorZ)); } - operator LDKCVec_APIErrorZ() && { LDKCVec_APIErrorZ res = self; memset(&self, 0, sizeof(LDKCVec_APIErrorZ)); return res; } - ~CVec_APIErrorZ() { CVec_APIErrorZ_free(self); } - CVec_APIErrorZ& operator=(CVec_APIErrorZ&& o) { CVec_APIErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CVec_APIErrorZ)); return *this; } - LDKCVec_APIErrorZ* operator &() { return &self; } - LDKCVec_APIErrorZ* operator ->() { return &self; } - const LDKCVec_APIErrorZ* operator &() const { return &self; } - const LDKCVec_APIErrorZ* operator ->() const { return &self; } -}; class COption_TxOutZ { private: LDKCOption_TxOutZ self; @@ -13238,6 +13853,21 @@ class COption_ClosureReasonZ { const LDKCOption_ClosureReasonZ* operator &() const { return &self; } const LDKCOption_ClosureReasonZ* operator ->() const { return &self; } }; +class CResult_TransactionU16LenLimitedDecodeErrorZ { +private: + LDKCResult_TransactionU16LenLimitedDecodeErrorZ self; +public: + CResult_TransactionU16LenLimitedDecodeErrorZ(const CResult_TransactionU16LenLimitedDecodeErrorZ&) = delete; + CResult_TransactionU16LenLimitedDecodeErrorZ(CResult_TransactionU16LenLimitedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedDecodeErrorZ)); } + CResult_TransactionU16LenLimitedDecodeErrorZ(LDKCResult_TransactionU16LenLimitedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ)); } + operator LDKCResult_TransactionU16LenLimitedDecodeErrorZ() && { LDKCResult_TransactionU16LenLimitedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ)); return res; } + ~CResult_TransactionU16LenLimitedDecodeErrorZ() { CResult_TransactionU16LenLimitedDecodeErrorZ_free(self); } + CResult_TransactionU16LenLimitedDecodeErrorZ& operator=(CResult_TransactionU16LenLimitedDecodeErrorZ&& o) { CResult_TransactionU16LenLimitedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedDecodeErrorZ)); return *this; } + LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator &() { return &self; } + LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator ->() const { return &self; } +}; class CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { private: LDKCVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ self; @@ -13268,21 +13898,6 @@ class CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ* operator ->() const { return &self; } }; -class CResult_TransactionU16LenLimitedDecodeErrorZ { -private: - LDKCResult_TransactionU16LenLimitedDecodeErrorZ self; -public: - CResult_TransactionU16LenLimitedDecodeErrorZ(const CResult_TransactionU16LenLimitedDecodeErrorZ&) = delete; - CResult_TransactionU16LenLimitedDecodeErrorZ(CResult_TransactionU16LenLimitedDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedDecodeErrorZ)); } - CResult_TransactionU16LenLimitedDecodeErrorZ(LDKCResult_TransactionU16LenLimitedDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ)); } - operator LDKCResult_TransactionU16LenLimitedDecodeErrorZ() && { LDKCResult_TransactionU16LenLimitedDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_TransactionU16LenLimitedDecodeErrorZ)); return res; } - ~CResult_TransactionU16LenLimitedDecodeErrorZ() { CResult_TransactionU16LenLimitedDecodeErrorZ_free(self); } - CResult_TransactionU16LenLimitedDecodeErrorZ& operator=(CResult_TransactionU16LenLimitedDecodeErrorZ&& o) { CResult_TransactionU16LenLimitedDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_TransactionU16LenLimitedDecodeErrorZ)); return *this; } - LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator &() { return &self; } - LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_TransactionU16LenLimitedDecodeErrorZ* operator ->() const { return &self; } -}; class CResult_FundingInfoDecodeErrorZ { private: LDKCResult_FundingInfoDecodeErrorZ self; @@ -13313,20 +13928,20 @@ class COption_AmountZ { const LDKCOption_AmountZ* operator &() const { return &self; } const LDKCOption_AmountZ* operator ->() const { return &self; } }; -class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +class C2Tuple_DNSSECQueryDNSResolverContextZ { private: - LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ self; + LDKC2Tuple_DNSSECQueryDNSResolverContextZ self; public: - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(const COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&) = delete; - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } - operator LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() && { LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return res; } - ~COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); } - COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ& operator=(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return *this; } - LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() { return &self; } - LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() { return &self; } - const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() const { return &self; } - const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() const { return &self; } + C2Tuple_DNSSECQueryDNSResolverContextZ(const C2Tuple_DNSSECQueryDNSResolverContextZ&) = delete; + C2Tuple_DNSSECQueryDNSResolverContextZ(C2Tuple_DNSSECQueryDNSResolverContextZ&& o) : self(o.self) { memset(&o, 0, sizeof(C2Tuple_DNSSECQueryDNSResolverContextZ)); } + C2Tuple_DNSSECQueryDNSResolverContextZ(LDKC2Tuple_DNSSECQueryDNSResolverContextZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKC2Tuple_DNSSECQueryDNSResolverContextZ)); } + operator LDKC2Tuple_DNSSECQueryDNSResolverContextZ() && { LDKC2Tuple_DNSSECQueryDNSResolverContextZ res = self; memset(&self, 0, sizeof(LDKC2Tuple_DNSSECQueryDNSResolverContextZ)); return res; } + ~C2Tuple_DNSSECQueryDNSResolverContextZ() { C2Tuple_DNSSECQueryDNSResolverContextZ_free(self); } + C2Tuple_DNSSECQueryDNSResolverContextZ& operator=(C2Tuple_DNSSECQueryDNSResolverContextZ&& o) { C2Tuple_DNSSECQueryDNSResolverContextZ_free(self); self = o.self; memset(&o, 0, sizeof(C2Tuple_DNSSECQueryDNSResolverContextZ)); return *this; } + LDKC2Tuple_DNSSECQueryDNSResolverContextZ* operator &() { return &self; } + LDKC2Tuple_DNSSECQueryDNSResolverContextZ* operator ->() { return &self; } + const LDKC2Tuple_DNSSECQueryDNSResolverContextZ* operator &() const { return &self; } + const LDKC2Tuple_DNSSECQueryDNSResolverContextZ* operator ->() const { return &self; } }; class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { private: @@ -13343,20 +13958,20 @@ class CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ* operator ->() const { return &self; } }; -class CResult_OpenChannelV2DecodeErrorZ { +class COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { private: - LDKCResult_OpenChannelV2DecodeErrorZ self; + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ self; public: - CResult_OpenChannelV2DecodeErrorZ(const CResult_OpenChannelV2DecodeErrorZ&) = delete; - CResult_OpenChannelV2DecodeErrorZ(CResult_OpenChannelV2DecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); } - CResult_OpenChannelV2DecodeErrorZ(LDKCResult_OpenChannelV2DecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); } - operator LDKCResult_OpenChannelV2DecodeErrorZ() && { LDKCResult_OpenChannelV2DecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); return res; } - ~CResult_OpenChannelV2DecodeErrorZ() { CResult_OpenChannelV2DecodeErrorZ_free(self); } - CResult_OpenChannelV2DecodeErrorZ& operator=(CResult_OpenChannelV2DecodeErrorZ&& o) { CResult_OpenChannelV2DecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); return *this; } - LDKCResult_OpenChannelV2DecodeErrorZ* operator &() { return &self; } - LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OpenChannelV2DecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() const { return &self; } + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(const COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&) = delete; + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) : self(o.self) { memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); } + operator LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() && { LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ res = self; memset(&self, 0, sizeof(LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return res; } + ~COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ() { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); } + COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ& operator=(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ&& o) { COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ_free(self); self = o.self; memset(&o, 0, sizeof(COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ)); return *this; } + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() { return &self; } + LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() { return &self; } + const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator &() const { return &self; } + const LDKCOption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ* operator ->() const { return &self; } }; class CResult_BestBlockDecodeErrorZ { private: @@ -13388,6 +14003,21 @@ class CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator &() const { return &self; } const LDKCResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ* operator ->() const { return &self; } }; +class CResult_OpenChannelV2DecodeErrorZ { +private: + LDKCResult_OpenChannelV2DecodeErrorZ self; +public: + CResult_OpenChannelV2DecodeErrorZ(const CResult_OpenChannelV2DecodeErrorZ&) = delete; + CResult_OpenChannelV2DecodeErrorZ(CResult_OpenChannelV2DecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); } + CResult_OpenChannelV2DecodeErrorZ(LDKCResult_OpenChannelV2DecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); } + operator LDKCResult_OpenChannelV2DecodeErrorZ() && { LDKCResult_OpenChannelV2DecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OpenChannelV2DecodeErrorZ)); return res; } + ~CResult_OpenChannelV2DecodeErrorZ() { CResult_OpenChannelV2DecodeErrorZ_free(self); } + CResult_OpenChannelV2DecodeErrorZ& operator=(CResult_OpenChannelV2DecodeErrorZ&& o) { CResult_OpenChannelV2DecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OpenChannelV2DecodeErrorZ)); return *this; } + LDKCResult_OpenChannelV2DecodeErrorZ* operator &() { return &self; } + LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OpenChannelV2DecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OpenChannelV2DecodeErrorZ* operator ->() const { return &self; } +}; class CResult_CounterpartyForwardingInfoDecodeErrorZ { private: LDKCResult_CounterpartyForwardingInfoDecodeErrorZ self; @@ -13403,21 +14033,6 @@ class CResult_CounterpartyForwardingInfoDecodeErrorZ { const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator &() const { return &self; } const LDKCResult_CounterpartyForwardingInfoDecodeErrorZ* operator ->() const { return &self; } }; -class CResult_OutputSpendStatusDecodeErrorZ { -private: - LDKCResult_OutputSpendStatusDecodeErrorZ self; -public: - CResult_OutputSpendStatusDecodeErrorZ(const CResult_OutputSpendStatusDecodeErrorZ&) = delete; - CResult_OutputSpendStatusDecodeErrorZ(CResult_OutputSpendStatusDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); } - CResult_OutputSpendStatusDecodeErrorZ(LDKCResult_OutputSpendStatusDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); } - operator LDKCResult_OutputSpendStatusDecodeErrorZ() && { LDKCResult_OutputSpendStatusDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); return res; } - ~CResult_OutputSpendStatusDecodeErrorZ() { CResult_OutputSpendStatusDecodeErrorZ_free(self); } - CResult_OutputSpendStatusDecodeErrorZ& operator=(CResult_OutputSpendStatusDecodeErrorZ&& o) { CResult_OutputSpendStatusDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); return *this; } - LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() { return &self; } - LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() { return &self; } - const LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() const { return &self; } - const LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() const { return &self; } -}; class C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { private: LDKC4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ self; @@ -13538,6 +14153,21 @@ class COption_QuantityZ { const LDKCOption_QuantityZ* operator &() const { return &self; } const LDKCOption_QuantityZ* operator ->() const { return &self; } }; +class CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { +private: + LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ self; +public: + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ(const CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ&) = delete; + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ(CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ)); } + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ(LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ)); } + operator LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ() && { LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ res = self; memset(&self, 0, sizeof(LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ)); return res; } + ~CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ() { CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_free(self); } + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ& operator=(CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ&& o) { CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ)); return *this; } + LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ* operator &() { return &self; } + LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ* operator ->() { return &self; } + const LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ* operator &() const { return &self; } + const LDKCResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ* operator ->() const { return &self; } +}; class CResult_TxAddOutputDecodeErrorZ { private: LDKCResult_TxAddOutputDecodeErrorZ self; @@ -13553,6 +14183,21 @@ class CResult_TxAddOutputDecodeErrorZ { const LDKCResult_TxAddOutputDecodeErrorZ* operator &() const { return &self; } const LDKCResult_TxAddOutputDecodeErrorZ* operator ->() const { return &self; } }; +class CResult_OutputSpendStatusDecodeErrorZ { +private: + LDKCResult_OutputSpendStatusDecodeErrorZ self; +public: + CResult_OutputSpendStatusDecodeErrorZ(const CResult_OutputSpendStatusDecodeErrorZ&) = delete; + CResult_OutputSpendStatusDecodeErrorZ(CResult_OutputSpendStatusDecodeErrorZ&& o) : self(o.self) { memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); } + CResult_OutputSpendStatusDecodeErrorZ(LDKCResult_OutputSpendStatusDecodeErrorZ&& m_self) : self(m_self) { memset(&m_self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); } + operator LDKCResult_OutputSpendStatusDecodeErrorZ() && { LDKCResult_OutputSpendStatusDecodeErrorZ res = self; memset(&self, 0, sizeof(LDKCResult_OutputSpendStatusDecodeErrorZ)); return res; } + ~CResult_OutputSpendStatusDecodeErrorZ() { CResult_OutputSpendStatusDecodeErrorZ_free(self); } + CResult_OutputSpendStatusDecodeErrorZ& operator=(CResult_OutputSpendStatusDecodeErrorZ&& o) { CResult_OutputSpendStatusDecodeErrorZ_free(self); self = o.self; memset(&o, 0, sizeof(CResult_OutputSpendStatusDecodeErrorZ)); return *this; } + LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() { return &self; } + LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() { return &self; } + const LDKCResult_OutputSpendStatusDecodeErrorZ* operator &() const { return &self; } + const LDKCResult_OutputSpendStatusDecodeErrorZ* operator ->() const { return &self; } +}; class CResult_HtlcBasepointDecodeErrorZ { private: LDKCResult_HtlcBasepointDecodeErrorZ self; @@ -13584,6 +14229,21 @@ class C2Tuple_OutPointChannelIdZ { const LDKC2Tuple_OutPointChannelIdZ* operator ->() const { return &self; } }; +inline LDK::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ DNSResolverMessageHandler::handle_dnssec_query(struct LDKDNSSECQuery message, struct LDKResponder responder) { + LDK::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ ret = (self.handle_dnssec_query)(self.this_arg, message, responder); + return ret; +} +inline void DNSResolverMessageHandler::handle_dnssec_proof(struct LDKDNSSECProof message, struct LDKDNSResolverContext context) { + (self.handle_dnssec_proof)(self.this_arg, message, context); +} +inline LDK::NodeFeatures DNSResolverMessageHandler::provided_node_features() { + LDK::NodeFeatures ret = (self.provided_node_features)(self.this_arg); + return ret; +} +inline LDK::CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ DNSResolverMessageHandler::release_pending_messages() { + LDK::CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ ret = (self.release_pending_messages)(self.this_arg); + return ret; +} inline LDK::CResult_SchnorrSignatureNoneZ SignBolt12InvoiceFn::sign_invoice(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR message) { LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_invoice)(self.this_arg, message); return ret; @@ -13615,8 +14275,8 @@ inline LDKThirtyTwoBytes EntropySource::get_secure_random_bytes() { LDKThirtyTwoBytes ret = (self.get_secure_random_bytes)(self.this_arg); return ret; } -inline LDKThirtyTwoBytes NodeSigner::get_inbound_payment_key_material() { - LDKThirtyTwoBytes ret = (self.get_inbound_payment_key_material)(self.this_arg); +inline LDK::ExpandedKey NodeSigner::get_inbound_payment_key() { + LDK::ExpandedKey ret = (self.get_inbound_payment_key)(self.this_arg); return ret; } inline LDK::CResult_PublicKeyNoneZ NodeSigner::get_node_id(enum LDKRecipient recipient) { @@ -13631,10 +14291,6 @@ inline LDK::CResult_RecoverableSignatureNoneZ NodeSigner::sign_invoice(const str LDK::CResult_RecoverableSignatureNoneZ ret = (self.sign_invoice)(self.this_arg, invoice, recipient); return ret; } -inline LDK::CResult_SchnorrSignatureNoneZ NodeSigner::sign_bolt12_invoice_request(const struct LDKUnsignedInvoiceRequest *NONNULL_PTR invoice_request) { - LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_bolt12_invoice_request)(self.this_arg, invoice_request); - return ret; -} inline LDK::CResult_SchnorrSignatureNoneZ NodeSigner::sign_bolt12_invoice(const struct LDKUnsignedBolt12Invoice *NONNULL_PTR invoice) { LDK::CResult_SchnorrSignatureNoneZ ret = (self.sign_bolt12_invoice)(self.this_arg, invoice); return ret; @@ -13770,6 +14426,14 @@ inline LDK::CResult_TransactionNoneZ WalletSource::sign_psbt(struct LDKCVec_u8Z LDK::CResult_TransactionNoneZ ret = (self.sign_psbt)(self.this_arg, psbt); return ret; } +inline LDKThirtyTwoBytes Verification::hmac_for_offer_payment(struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key) { + LDKThirtyTwoBytes ret = (self.hmac_for_offer_payment)(self.this_arg, nonce, expanded_key); + return ret; +} +inline LDK::CResult_NoneNoneZ Verification::verify_for_offer_payment(struct LDKThirtyTwoBytes hmac, struct LDKNonce nonce, const struct LDKExpandedKey *NONNULL_PTR expanded_key) { + LDK::CResult_NoneNoneZ ret = (self.verify_for_offer_payment)(self.this_arg, hmac, nonce, expanded_key); + return ret; +} inline LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ EcdsaChannelSigner::sign_counterparty_commitment(const struct LDKCommitmentTransaction *NONNULL_PTR commitment_tx, struct LDKCVec_ThirtyTwoBytesZ inbound_htlc_preimages, struct LDKCVec_ThirtyTwoBytesZ outbound_htlc_preimages) { LDK::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ ret = (self.sign_counterparty_commitment)(self.this_arg, commitment_tx, inbound_htlc_preimages, outbound_htlc_preimages); return ret; @@ -13806,6 +14470,10 @@ inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_channel_announc LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_channel_announcement_with_funding_key)(self.this_arg, msg); return ret; } +inline LDK::CResult_ECDSASignatureNoneZ EcdsaChannelSigner::sign_splicing_funding_input(struct LDKTransaction tx, uintptr_t input_index, uint64_t input_value) { + LDK::CResult_ECDSASignatureNoneZ ret = (self.sign_splicing_funding_input)(self.this_arg, tx, input_index, input_value); + return ret; +} 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; @@ -13860,6 +14528,10 @@ inline LDK::CResult_CVec_StrZIOErrorZ KVStore::list(struct LDKStr primary_namesp LDK::CResult_CVec_StrZIOErrorZ ret = (self.list)(self.this_arg, primary_namespace, secondary_namespace); return ret; } +inline LDK::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ MigratableKVStore::list_all_keys() { + LDK::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ ret = (self.list_all_keys)(self.this_arg); + return ret; +} inline LDK::CResult_NoneIOErrorZ Persister::persist_manager(const struct LDKChannelManager *NONNULL_PTR channel_manager) { LDK::CResult_NoneIOErrorZ ret = (self.persist_manager)(self.this_arg, channel_manager); return ret; @@ -13985,16 +14657,19 @@ inline LDK::COption_CVec_ThirtyTwoBytesZZ ChannelMessageHandler::get_chain_hashe LDK::COption_CVec_ThirtyTwoBytesZZ ret = (self.get_chain_hashes)(self.this_arg); return ret; } -inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_node_announcement(const struct LDKNodeAnnouncement *NONNULL_PTR msg) { - LDK::CResult_boolLightningErrorZ ret = (self.handle_node_announcement)(self.this_arg, msg); +inline void ChannelMessageHandler::message_received() { + (self.message_received)(self.this_arg); +} +inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_node_announcement(struct LDKPublicKey their_node_id, const struct LDKNodeAnnouncement *NONNULL_PTR msg) { + LDK::CResult_boolLightningErrorZ ret = (self.handle_node_announcement)(self.this_arg, their_node_id, msg); return ret; } -inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_channel_announcement(const struct LDKChannelAnnouncement *NONNULL_PTR msg) { - LDK::CResult_boolLightningErrorZ ret = (self.handle_channel_announcement)(self.this_arg, msg); +inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_channel_announcement(struct LDKPublicKey their_node_id, const struct LDKChannelAnnouncement *NONNULL_PTR msg) { + LDK::CResult_boolLightningErrorZ ret = (self.handle_channel_announcement)(self.this_arg, their_node_id, msg); return ret; } -inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_channel_update(const struct LDKChannelUpdate *NONNULL_PTR msg) { - LDK::CResult_boolLightningErrorZ ret = (self.handle_channel_update)(self.this_arg, msg); +inline LDK::CResult_boolLightningErrorZ RoutingMessageHandler::handle_channel_update(struct LDKPublicKey their_node_id, const struct LDKChannelUpdate *NONNULL_PTR msg) { + LDK::CResult_boolLightningErrorZ ret = (self.handle_channel_update)(self.this_arg, their_node_id, msg); return ret; } inline LDK::COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ RoutingMessageHandler::get_next_channel_announcement(uint64_t starting_point) { @@ -14068,12 +14743,12 @@ inline void Logger::log(struct LDKRecord record) { inline void FutureCallback::call() { (self.call)(self.this_arg); } -inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ AsyncPaymentsMessageHandler::held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKResponder responder) { - LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ ret = (self.held_htlc_available)(self.this_arg, message, responder); +inline LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ AsyncPaymentsMessageHandler::handle_held_htlc_available(struct LDKHeldHtlcAvailable message, struct LDKResponder responder) { + LDK::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ ret = (self.handle_held_htlc_available)(self.this_arg, message, responder); return ret; } -inline void AsyncPaymentsMessageHandler::release_held_htlc(struct LDKReleaseHeldHtlc message) { - (self.release_held_htlc)(self.this_arg, message); +inline void AsyncPaymentsMessageHandler::handle_release_held_htlc(struct LDKReleaseHeldHtlc message, struct LDKAsyncPaymentsContext context) { + (self.handle_release_held_htlc)(self.this_arg, message, context); } inline LDK::CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ AsyncPaymentsMessageHandler::release_pending_messages() { LDK::CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ ret = (self.release_pending_messages)(self.this_arg); diff --git a/lightning-c-bindings/src/c_types/derived.rs b/lightning-c-bindings/src/c_types/derived.rs index 1dc119a..07c6ef1 100644 --- a/lightning-c-bindings/src/c_types/derived.rs +++ b/lightning-c-bindings/src/c_types/derived.rs @@ -618,190 +618,6 @@ impl Clone for CResult_RetryDecodeErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RetryDecodeErrorZ_clone(orig: &CResult_RetryDecodeErrorZ) -> CResult_RetryDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneAPIErrorZ -pub union CResult_NoneAPIErrorZPtr { - /// 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::util::errors::APIError, -} -#[repr(C)] -/// A CResult_NoneAPIErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::util::errors::APIError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NoneAPIErrorZ { - /// The contents of this CResult_NoneAPIErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneAPIErrorZPtr, - /// Whether this CResult_NoneAPIErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_NoneAPIErrorZ in the success state. -pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ { - CResult_NoneAPIErrorZ { - contents: CResult_NoneAPIErrorZPtr { - result: core::ptr::null_mut(), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_NoneAPIErrorZ in the error state. -pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ { - CResult_NoneAPIErrorZ { - contents: CResult_NoneAPIErrorZPtr { - 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_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_NoneAPIErrorZ. -pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { } -impl Drop for CResult_NoneAPIErrorZ { - 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) }; - } - } - } -} -impl From> for CResult_NoneAPIErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self { - let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneAPIErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_NoneAPIErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr { - result: core::ptr::null_mut() - } } - } else { - Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::CResult_NoneAPIErrorZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_CResult_NoneAPIErrorZZ { - /// 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::CResult_NoneAPIErrorZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_CResult_NoneAPIErrorZZ { - #[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::CResult_NoneAPIErrorZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_CResult_NoneAPIErrorZZ { - 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_CResult_NoneAPIErrorZZ_free(_res: CVec_CResult_NoneAPIErrorZZ) { } -impl Drop for CVec_CResult_NoneAPIErrorZZ { - 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_CResult_NoneAPIErrorZZ { - 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::errors::APIErrors of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_APIErrorZ { - /// 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::errors::APIError, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_APIErrorZ { - #[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::errors::APIError] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_APIErrorZ { - 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_APIErrorZ_free(_res: CVec_APIErrorZ) { } -impl Drop for CVec_APIErrorZ { - 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_APIErrorZ { - 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)] #[derive(Clone)] /// An enum which can either contain a crate::c_types::ThirtyTwoBytes or not pub enum COption_ThirtyTwoBytesZ { @@ -1152,137 +968,208 @@ impl Clone for CResult_RecipientOnionFieldsNoneZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_RecipientOnionFieldsNoneZ_clone(orig: &CResult_RecipientOnionFieldsNoneZ) -> CResult_RecipientOnionFieldsNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ -pub union CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { - /// 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::offers::invoice::UnsignedBolt12Invoice, - /// 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::offers::parse::Bolt12SemanticError, -} -#[repr(C)] -/// A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - /// The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr, - /// Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { - 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_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> bool { - o.result_ok +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_DNSResolverMessageResponseInstructionZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::dns_resolution::DNSResolverMessage, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::ResponseInstruction, } -#[no_mangle] -/// Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ. -pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) { } -impl Drop for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - 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<(crate::lightning::onion_message::dns_resolution::DNSResolverMessage, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_DNSResolverMessageResponseInstructionZ { + fn from (tup: (crate::lightning::onion_message::dns_resolution::DNSResolverMessage, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { + Self { + a: tup.0, + b: tup.1, } } } -impl From> for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { - 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_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl C2Tuple_DNSResolverMessageResponseInstructionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::dns_resolution::DNSResolverMessage, crate::lightning::onion_message::messenger::ResponseInstruction) { + (self.a, self.b) } } -impl Clone for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { +impl Clone for C2Tuple_DNSResolverMessageResponseInstructionZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { - 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_UnsignedBolt12InvoiceBolt12SemanticErrorZ 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_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn C2Tuple_DNSResolverMessageResponseInstructionZ_clone(orig: &C2Tuple_DNSResolverMessageResponseInstructionZ) -> C2Tuple_DNSResolverMessageResponseInstructionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_DNSResolverMessageResponseInstructionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_DNSResolverMessageResponseInstructionZ_new(a: crate::lightning::onion_message::dns_resolution::DNSResolverMessage, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_DNSResolverMessageResponseInstructionZ { + C2Tuple_DNSResolverMessageResponseInstructionZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_DNSResolverMessageResponseInstructionZ. +pub extern "C" fn C2Tuple_DNSResolverMessageResponseInstructionZ_free(_res: C2Tuple_DNSResolverMessageResponseInstructionZ) { } #[repr(C)] -/// The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ -pub union CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ or not +pub enum COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { + /// When we're in this state, this COption_C2Tuple_DNSResolverMessageResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ + Some(crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ), + /// When we're in this state, this COption_C2Tuple_DNSResolverMessageResponseInstructionZZ contains nothing + None +} +impl COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { + #[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::derived::C2Tuple_DNSResolverMessageResponseInstructionZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ +pub extern "C" fn COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ) -> COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { + COption_C2Tuple_DNSResolverMessageResponseInstructionZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ containing nothing +pub extern "C" fn COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_none() -> COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { + COption_C2Tuple_DNSResolverMessageResponseInstructionZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_DNSResolverMessageResponseInstructionZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_free(_res: COption_C2Tuple_DNSResolverMessageResponseInstructionZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_DNSResolverMessageResponseInstructionZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_DNSResolverMessageResponseInstructionZZ_clone(orig: &COption_C2Tuple_DNSResolverMessageResponseInstructionZZ) -> COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_DNSResolverMessageMessageSendInstructionsZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::dns_resolution::DNSResolverMessage, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, +} +impl From<(crate::lightning::onion_message::dns_resolution::DNSResolverMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_DNSResolverMessageMessageSendInstructionsZ { + fn from (tup: (crate::lightning::onion_message::dns_resolution::DNSResolverMessage, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_DNSResolverMessageMessageSendInstructionsZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::dns_resolution::DNSResolverMessage, crate::lightning::onion_message::messenger::MessageSendInstructions) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_DNSResolverMessageMessageSendInstructionsZ { + 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_DNSResolverMessageMessageSendInstructionsZ_clone(orig: &C2Tuple_DNSResolverMessageMessageSendInstructionsZ) -> C2Tuple_DNSResolverMessageMessageSendInstructionsZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_DNSResolverMessageMessageSendInstructionsZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_DNSResolverMessageMessageSendInstructionsZ_new(a: crate::lightning::onion_message::dns_resolution::DNSResolverMessage, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_DNSResolverMessageMessageSendInstructionsZ { + C2Tuple_DNSResolverMessageMessageSendInstructionsZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_DNSResolverMessageMessageSendInstructionsZ. +pub extern "C" fn C2Tuple_DNSResolverMessageMessageSendInstructionsZ_free(_res: C2Tuple_DNSResolverMessageMessageSendInstructionsZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_DNSResolverMessageMessageSendInstructionsZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + /// 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_DNSResolverMessageMessageSendInstructionsZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + #[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_DNSResolverMessageMessageSendInstructionsZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + 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_DNSResolverMessageMessageSendInstructionsZZ_free(_res: CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ) { } +impl Drop for CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + 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_DNSResolverMessageMessageSendInstructionsZZ { + 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_DNSResolverMessageDecodeErrorZ +pub union CResult_DNSResolverMessageDecodeErrorZPtr { /// 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::offers::invoice::Bolt12Invoice, + pub result: *mut crate::lightning::onion_message::dns_resolution::DNSResolverMessage, /// 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_DNSResolverMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::dns_resolution::DNSResolverMessage 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_Bolt12InvoiceBolt12SemanticErrorZ { - /// The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either +pub struct CResult_DNSResolverMessageDecodeErrorZ { + /// The contents of this CResult_DNSResolverMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr, - /// Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state. + pub contents: CResult_DNSResolverMessageDecodeErrorZPtr, + /// Whether this CResult_DNSResolverMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { - CResult_Bolt12InvoiceBolt12SemanticErrorZ { - contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { +/// Creates a new CResult_DNSResolverMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_DNSResolverMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::dns_resolution::DNSResolverMessage) -> CResult_DNSResolverMessageDecodeErrorZ { + CResult_DNSResolverMessageDecodeErrorZ { + contents: CResult_DNSResolverMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { - CResult_Bolt12InvoiceBolt12SemanticErrorZ { - contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { +/// Creates a new CResult_DNSResolverMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_DNSResolverMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DNSResolverMessageDecodeErrorZ { + CResult_DNSResolverMessageDecodeErrorZ { + contents: CResult_DNSResolverMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1290,13 +1177,13 @@ pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_DNSResolverMessageDecodeErrorZ_is_ok(o: &CResult_DNSResolverMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ. -pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_Bolt12InvoiceBolt12SemanticErrorZ) { } -impl Drop for CResult_Bolt12InvoiceBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_DNSResolverMessageDecodeErrorZ. +pub extern "C" fn CResult_DNSResolverMessageDecodeErrorZ_free(_res: CResult_DNSResolverMessageDecodeErrorZ) { } +impl Drop for CResult_DNSResolverMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1309,16 +1196,16 @@ impl Drop for CResult_Bolt12InvoiceBolt12SemanticErrorZ { } } } -impl From> for CResult_Bolt12InvoiceBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_DNSResolverMessageDecodeErrorZ { + 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_Bolt12InvoiceBolt12SemanticErrorZPtr { result } + CResult_DNSResolverMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { err } + CResult_DNSResolverMessageDecodeErrorZPtr { err } }; Self { contents, @@ -1326,58 +1213,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_DNSResolverMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_DNSResolverMessageDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_DNSResolverMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_DNSResolverMessageDecodeErrorZ_clone(orig: &CResult_DNSResolverMessageDecodeErrorZ) -> CResult_DNSResolverMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SchnorrSignatureNoneZ -pub union CResult_SchnorrSignatureNoneZPtr { +/// The contents of CResult_HumanReadableNameNoneZ +pub union CResult_HumanReadableNameNoneZPtr { /// 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::SchnorrSignature, + pub result: *mut crate::lightning::onion_message::dns_resolution::HumanReadableName, /// 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_SchnorrSignatureNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::SchnorrSignature on success and a () on failure. +/// A CResult_HumanReadableNameNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::dns_resolution::HumanReadableName on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SchnorrSignatureNoneZ { - /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either +pub struct CResult_HumanReadableNameNoneZ { + /// The contents of this CResult_HumanReadableNameNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SchnorrSignatureNoneZPtr, - /// Whether this CResult_SchnorrSignatureNoneZ represents a success state. + pub contents: CResult_HumanReadableNameNoneZPtr, + /// Whether this CResult_HumanReadableNameNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SchnorrSignatureNoneZ in the success state. -pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ { - CResult_SchnorrSignatureNoneZ { - contents: CResult_SchnorrSignatureNoneZPtr { +/// Creates a new CResult_HumanReadableNameNoneZ in the success state. +pub extern "C" fn CResult_HumanReadableNameNoneZ_ok(o: crate::lightning::onion_message::dns_resolution::HumanReadableName) -> CResult_HumanReadableNameNoneZ { + CResult_HumanReadableNameNoneZ { + contents: CResult_HumanReadableNameNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SchnorrSignatureNoneZ in the error state. -pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ { - CResult_SchnorrSignatureNoneZ { - contents: CResult_SchnorrSignatureNoneZPtr { +/// Creates a new CResult_HumanReadableNameNoneZ in the error state. +pub extern "C" fn CResult_HumanReadableNameNoneZ_err() -> CResult_HumanReadableNameNoneZ { + CResult_HumanReadableNameNoneZ { + contents: CResult_HumanReadableNameNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -1385,13 +1272,13 @@ pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatur } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool { +pub extern "C" fn CResult_HumanReadableNameNoneZ_is_ok(o: &CResult_HumanReadableNameNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SchnorrSignatureNoneZ. -pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { } -impl Drop for CResult_SchnorrSignatureNoneZ { +/// Frees any resources used by the CResult_HumanReadableNameNoneZ. +pub extern "C" fn CResult_HumanReadableNameNoneZ_free(_res: CResult_HumanReadableNameNoneZ) { } +impl Drop for CResult_HumanReadableNameNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1401,16 +1288,16 @@ impl Drop for CResult_SchnorrSignatureNoneZ { } } } -impl From> for CResult_SchnorrSignatureNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HumanReadableNameNoneZ { + 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_SchnorrSignatureNoneZPtr { result } + CResult_HumanReadableNameNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() } + CResult_HumanReadableNameNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1418,261 +1305,196 @@ impl From> fo } } } -impl Clone for CResult_SchnorrSignatureNoneZ { +impl Clone for CResult_HumanReadableNameNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HumanReadableNameNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr { + Self { result_ok: false, contents: CResult_HumanReadableNameNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` +/// Creates a new CResult_HumanReadableNameNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HumanReadableNameNoneZ_clone(orig: &CResult_HumanReadableNameNoneZ) -> CResult_HumanReadableNameNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::Strs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_StrZ { - /// 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::Str, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// The contents of CResult_HumanReadableNameDecodeErrorZ +pub union CResult_HumanReadableNameDecodeErrorZPtr { + /// 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::dns_resolution::HumanReadableName, + /// 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, } -impl CVec_StrZ { - #[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::Str] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[repr(C)] +/// A CResult_HumanReadableNameDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::dns_resolution::HumanReadableName 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_HumanReadableNameDecodeErrorZ { + /// The contents of this CResult_HumanReadableNameDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_HumanReadableNameDecodeErrorZPtr, + /// Whether this CResult_HumanReadableNameDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_HumanReadableNameDecodeErrorZ in the success state. +pub extern "C" fn CResult_HumanReadableNameDecodeErrorZ_ok(o: crate::lightning::onion_message::dns_resolution::HumanReadableName) -> CResult_HumanReadableNameDecodeErrorZ { + CResult_HumanReadableNameDecodeErrorZ { + contents: CResult_HumanReadableNameDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl From> for CVec_StrZ { - 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_HumanReadableNameDecodeErrorZ in the error state. +pub extern "C" fn CResult_HumanReadableNameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HumanReadableNameDecodeErrorZ { + CResult_HumanReadableNameDecodeErrorZ { + contents: CResult_HumanReadableNameDecodeErrorZPtr { + 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_StrZ_free(_res: CVec_StrZ) { } -impl Drop for CVec_StrZ { +pub extern "C" fn CResult_HumanReadableNameDecodeErrorZ_is_ok(o: &CResult_HumanReadableNameDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_HumanReadableNameDecodeErrorZ. +pub extern "C" fn CResult_HumanReadableNameDecodeErrorZ_free(_res: CResult_HumanReadableNameDecodeErrorZ) { } +impl Drop for CResult_HumanReadableNameDecodeErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = 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_StrZ { +impl From> for CResult_HumanReadableNameDecodeErrorZ { + 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_HumanReadableNameDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_HumanReadableNameDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_HumanReadableNameDecodeErrorZ { 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_HumanReadableNameDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_HumanReadableNameDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_HumanReadableNameDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_HumanReadableNameDecodeErrorZ_clone(orig: &CResult_HumanReadableNameDecodeErrorZ) -> CResult_HumanReadableNameDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::ThirtyTwoBytess of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ThirtyTwoBytesZ { - /// 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, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_DNSSECQueryDNSResolverContextZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::dns_resolution::DNSSECQuery, + /// The element at position 1 + pub b: crate::lightning::blinded_path::message::DNSResolverContext, } -impl CVec_ThirtyTwoBytesZ { - #[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] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_ThirtyTwoBytesZ { - 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() } } +impl From<(crate::lightning::onion_message::dns_resolution::DNSSECQuery, crate::lightning::blinded_path::message::DNSResolverContext)> for C2Tuple_DNSSECQueryDNSResolverContextZ { + fn from (tup: (crate::lightning::onion_message::dns_resolution::DNSSECQuery, crate::lightning::blinded_path::message::DNSResolverContext)) -> Self { + Self { + a: tup.0, + b: tup.1, + } } } -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { } -impl Drop for CVec_ThirtyTwoBytesZ { - 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 C2Tuple_DNSSECQueryDNSResolverContextZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::dns_resolution::DNSSECQuery, crate::lightning::blinded_path::message::DNSResolverContext) { + (self.a, self.b) } } -impl Clone for CVec_ThirtyTwoBytesZ { +impl Clone for C2Tuple_DNSSECQueryDNSResolverContextZ { 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)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not -pub enum COption_CVec_ThirtyTwoBytesZZ { - /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ - Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ), - /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing - None -} -impl COption_CVec_ThirtyTwoBytesZZ { - #[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::derived::CVec_ThirtyTwoBytesZ { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ -pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ { - COption_CVec_ThirtyTwoBytesZZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing -pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ { - COption_CVec_ThirtyTwoBytesZZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state -pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { } -#[no_mangle] -/// Creates a new COption_CVec_ThirtyTwoBytesZZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::offers::offer::Amount or not -pub enum COption_AmountZ { - /// When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount - Some(crate::lightning::offers::offer::Amount), - /// When we're in this state, this COption_AmountZ contains nothing - None -} -impl COption_AmountZ { - #[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::offers::offer::Amount { - if let Self::Some(v) = self { v } else { unreachable!() } + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } #[no_mangle] -/// Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount -pub extern "C" fn COption_AmountZ_some(o: crate::lightning::offers::offer::Amount) -> COption_AmountZ { - COption_AmountZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_AmountZ containing nothing -pub extern "C" fn COption_AmountZ_none() -> COption_AmountZ { - COption_AmountZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state -pub extern "C" fn COption_AmountZ_free(_res: COption_AmountZ) { } -#[no_mangle] -/// Creates a new COption_AmountZ 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 COption_AmountZ_clone(orig: &COption_AmountZ) -> COption_AmountZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::offers::offer::Quantity or not -pub enum COption_QuantityZ { - /// When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity - Some(crate::lightning::offers::offer::Quantity), - /// When we're in this state, this COption_QuantityZ contains nothing - None -} -impl COption_QuantityZ { - #[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::offers::offer::Quantity { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity -pub extern "C" fn COption_QuantityZ_some(o: crate::lightning::offers::offer::Quantity) -> COption_QuantityZ { - COption_QuantityZ::Some(o) -} +pub extern "C" fn C2Tuple_DNSSECQueryDNSResolverContextZ_clone(orig: &C2Tuple_DNSSECQueryDNSResolverContextZ) -> C2Tuple_DNSSECQueryDNSResolverContextZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_DNSSECQueryDNSResolverContextZ from the contained elements. #[no_mangle] -/// Constructs a new COption_QuantityZ containing nothing -pub extern "C" fn COption_QuantityZ_none() -> COption_QuantityZ { - COption_QuantityZ::None +pub extern "C" fn C2Tuple_DNSSECQueryDNSResolverContextZ_new(a: crate::lightning::onion_message::dns_resolution::DNSSECQuery, b: crate::lightning::blinded_path::message::DNSResolverContext) -> C2Tuple_DNSSECQueryDNSResolverContextZ { + C2Tuple_DNSSECQueryDNSResolverContextZ { a, b, } } + #[no_mangle] -/// Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state -pub extern "C" fn COption_QuantityZ_free(_res: COption_QuantityZ) { } -#[no_mangle] -/// Creates a new COption_QuantityZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_QuantityZ_clone(orig: &COption_QuantityZ) -> COption_QuantityZ { Clone::clone(&orig) } +/// Frees any resources used by the C2Tuple_DNSSECQueryDNSResolverContextZ. +pub extern "C" fn C2Tuple_DNSSECQueryDNSResolverContextZ_free(_res: C2Tuple_DNSSECQueryDNSResolverContextZ) { } #[repr(C)] -/// The contents of CResult_ThirtyTwoBytesNoneZ -pub union CResult_ThirtyTwoBytesNoneZPtr { +/// The contents of CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ +pub union CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { /// 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, + pub result: *mut crate::c_types::derived::C2Tuple_DNSSECQueryDNSResolverContextZ, /// 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_ThirtyTwoBytesNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. +/// A CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_DNSSECQueryDNSResolverContextZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ThirtyTwoBytesNoneZ { - /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either +pub struct CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + /// The contents of this CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ThirtyTwoBytesNoneZPtr, - /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state. + pub contents: CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr, + /// Whether this CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. -pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ { - CResult_ThirtyTwoBytesNoneZ { - contents: CResult_ThirtyTwoBytesNoneZPtr { +/// Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_ok(o: crate::c_types::derived::C2Tuple_DNSSECQueryDNSResolverContextZ) -> CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + contents: CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. -pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ { - CResult_ThirtyTwoBytesNoneZ { - contents: CResult_ThirtyTwoBytesNoneZPtr { +/// Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_err() -> CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + contents: CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -1680,13 +1502,13 @@ pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNon } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool { +pub extern "C" fn CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_is_ok(o: &CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. -pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { } -impl Drop for CResult_ThirtyTwoBytesNoneZ { +/// Frees any resources used by the CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ. +pub extern "C" fn CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_free(_res: CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ) { } +impl Drop for CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1696,16 +1518,16 @@ impl Drop for CResult_ThirtyTwoBytesNoneZ { } } } -impl From> for CResult_ThirtyTwoBytesNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + 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_ThirtyTwoBytesNoneZPtr { result } + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() } + CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -1713,155 +1535,305 @@ impl From> for } } } -impl Clone for CResult_ThirtyTwoBytesNoneZ { +impl Clone for CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr { + Self { result_ok: false, contents: CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ_clone(orig: &CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ) -> CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt12InvoiceDecodeErrorZ -pub union CResult_Bolt12InvoiceDecodeErrorZPtr { - /// 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::offers::invoice::Bolt12Invoice, - /// 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, +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_HumanReadableNameThirtyTwoBytesZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::dns_resolution::HumanReadableName, + /// The element at position 1 + pub b: crate::c_types::ThirtyTwoBytes, } -#[repr(C)] -/// A CResult_Bolt12InvoiceDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::Bolt12Invoice 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_Bolt12InvoiceDecodeErrorZ { - /// The contents of this CResult_Bolt12InvoiceDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt12InvoiceDecodeErrorZPtr, - /// Whether this CResult_Bolt12InvoiceDecodeErrorZ represents a success state. - pub result_ok: bool, +impl From<(crate::lightning::onion_message::dns_resolution::HumanReadableName, crate::c_types::ThirtyTwoBytes)> for C2Tuple_HumanReadableNameThirtyTwoBytesZ { + fn from (tup: (crate::lightning::onion_message::dns_resolution::HumanReadableName, crate::c_types::ThirtyTwoBytes)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } } -#[no_mangle] -/// Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the success state. -pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceDecodeErrorZ { - CResult_Bolt12InvoiceDecodeErrorZ { - contents: CResult_Bolt12InvoiceDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl C2Tuple_HumanReadableNameThirtyTwoBytesZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::dns_resolution::HumanReadableName, crate::c_types::ThirtyTwoBytes) { + (self.a, self.b) } } -#[no_mangle] -/// Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the error state. -pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceDecodeErrorZ { - CResult_Bolt12InvoiceDecodeErrorZ { - contents: CResult_Bolt12InvoiceDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +impl Clone for C2Tuple_HumanReadableNameThirtyTwoBytesZ { + 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_Bolt12InvoiceDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceDecodeErrorZ) -> 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_HumanReadableNameThirtyTwoBytesZ_clone(orig: &C2Tuple_HumanReadableNameThirtyTwoBytesZ) -> C2Tuple_HumanReadableNameThirtyTwoBytesZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_HumanReadableNameThirtyTwoBytesZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_HumanReadableNameThirtyTwoBytesZ_new(a: crate::lightning::onion_message::dns_resolution::HumanReadableName, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_HumanReadableNameThirtyTwoBytesZ { + C2Tuple_HumanReadableNameThirtyTwoBytesZ { a, b, } } + #[no_mangle] -/// Frees any resources used by the CResult_Bolt12InvoiceDecodeErrorZ. -pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_free(_res: CResult_Bolt12InvoiceDecodeErrorZ) { } -impl Drop for CResult_Bolt12InvoiceDecodeErrorZ { - 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) }; - } - } +/// Frees any resources used by the C2Tuple_HumanReadableNameThirtyTwoBytesZ. +pub extern "C" fn C2Tuple_HumanReadableNameThirtyTwoBytesZ_free(_res: C2Tuple_HumanReadableNameThirtyTwoBytesZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_HumanReadableNameThirtyTwoBytesZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { + /// 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_HumanReadableNameThirtyTwoBytesZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { + #[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_HumanReadableNameThirtyTwoBytesZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CResult_Bolt12InvoiceDecodeErrorZ { - 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_Bolt12InvoiceDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt12InvoiceDecodeErrorZPtr { err } - }; +impl From> for CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { + 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_HumanReadableNameThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ) { } +impl Drop for CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ { + 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_HumanReadableNameThirtyTwoBytesZZ { + 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_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { + /// The element at position 0 + pub a: crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, + /// The element at position 1 + pub b: crate::lightning::offers::offer::Offer, +} +impl From<(crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, crate::lightning::offers::offer::Offer)> for C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { + fn from (tup: (crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, crate::lightning::offers::offer::Offer)) -> Self { Self { - contents, - result_ok: o.result_ok, + a: tup.0, + b: tup.1, } } } -impl Clone for CResult_Bolt12InvoiceDecodeErrorZ { +impl C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, crate::lightning::offers::offer::Offer) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt12InvoiceDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_Bolt12InvoiceDecodeErrorZPtr { - 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_Bolt12InvoiceDecodeErrorZ 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_Bolt12InvoiceDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceDecodeErrorZ) -> CResult_Bolt12InvoiceDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_clone(orig: &C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ) -> C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_new(a: crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, b: crate::lightning::offers::offer::Offer) -> C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ. +pub extern "C" fn C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ_free(_res: C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ) { } #[repr(C)] -/// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ -pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ or not +pub enum COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { + /// When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ contains a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ + Some(crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ), + /// When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ contains nothing + None +} +impl COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { + #[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::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_some(o: crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ) -> COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ containing nothing +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_none() -> COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_free(_res: COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ_clone(orig: &COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ) -> COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { + /// The element at position 0 + pub a: crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, + /// The element at position 1 + pub b: crate::c_types::Str, +} +impl From<(crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, crate::c_types::Str)> for C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { + fn from (tup: (crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, crate::c_types::Str)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, crate::c_types::Str) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { + 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_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_clone(orig: &C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ) -> C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_new(a: crate::c_types::derived::CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZ, b: crate::c_types::Str) -> C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { + C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ. +pub extern "C" fn C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ_free(_res: C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ or not +pub enum COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { + /// When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ contains a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ + Some(crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ), + /// When we're in this state, this COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ contains nothing + None +} +impl COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { + #[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::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing a crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_some(o: crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ) -> COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ containing nothing +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_none() -> COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { + COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_free(_res: COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ_clone(orig: &COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ) -> COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ +pub union CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { /// 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::sign::DelayedPaymentOutputDescriptor, + pub result: *mut crate::lightning::offers::invoice::UnsignedBolt12Invoice, /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::UnsignedBolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either +pub struct CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + /// The contents of this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr, - /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state. + pub contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr, + /// Whether this CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. -pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { +/// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. -pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { +/// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1869,13 +1841,13 @@ pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crat } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. -pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { } -impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { +/// Frees any resources used by the CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ. +pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) { } +impl Drop for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1888,16 +1860,16 @@ impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { } } } -impl From> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { + 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_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result } + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err } + CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -1905,59 +1877,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ) -> CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ -pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { +/// The contents of CResult_Bolt12InvoiceBolt12SemanticErrorZ +pub union CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { /// 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::sign::StaticPaymentOutputDescriptor, + pub result: *mut crate::lightning::offers::invoice::Bolt12Invoice, /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt12InvoiceBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::Bolt12Invoice on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ { - /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either +pub struct CResult_Bolt12InvoiceBolt12SemanticErrorZ { + /// The contents of this CResult_Bolt12InvoiceBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr, - /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state. + pub contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr, + /// Whether this CResult_Bolt12InvoiceBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. -pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { - CResult_StaticPaymentOutputDescriptorDecodeErrorZ { - contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { +/// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { + CResult_Bolt12InvoiceBolt12SemanticErrorZ { + contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. -pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { - CResult_StaticPaymentOutputDescriptorDecodeErrorZ { - contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { +/// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { + CResult_Bolt12InvoiceBolt12SemanticErrorZ { + contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -1965,13 +1937,13 @@ pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_is_ok(o: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. -pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { } -impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt12InvoiceBolt12SemanticErrorZ. +pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_free(_res: CResult_Bolt12InvoiceBolt12SemanticErrorZ) { } +impl Drop for CResult_Bolt12InvoiceBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -1984,16 +1956,16 @@ impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ { } } } -impl From> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt12InvoiceBolt12SemanticErrorZ { + 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_StaticPaymentOutputDescriptorDecodeErrorZPtr { result } + CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err } + CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -2001,95 +1973,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_Bolt12InvoiceBolt12SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_Bolt12InvoiceBolt12SemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt12InvoiceBolt12SemanticErrorZ_clone(orig: &CResult_Bolt12InvoiceBolt12SemanticErrorZ) -> CResult_Bolt12InvoiceBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ -pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr { +/// The contents of CResult_SchnorrSignatureNoneZ +pub union CResult_SchnorrSignatureNoneZPtr { /// 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::sign::SpendableOutputDescriptor, - /// 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::c_types::SchnorrSignature, + /// 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_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_SchnorrSignatureNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::SchnorrSignature on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SpendableOutputDescriptorDecodeErrorZ { - /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either +pub struct CResult_SchnorrSignatureNoneZ { + /// The contents of this CResult_SchnorrSignatureNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr, - /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state. + pub contents: CResult_SchnorrSignatureNoneZPtr, + /// Whether this CResult_SchnorrSignatureNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ { - CResult_SpendableOutputDescriptorDecodeErrorZ { - contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { +/// Creates a new CResult_SchnorrSignatureNoneZ in the success state. +pub extern "C" fn CResult_SchnorrSignatureNoneZ_ok(o: crate::c_types::SchnorrSignature) -> CResult_SchnorrSignatureNoneZ { + CResult_SchnorrSignatureNoneZ { + contents: CResult_SchnorrSignatureNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ { - CResult_SpendableOutputDescriptorDecodeErrorZ { - contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_SchnorrSignatureNoneZ in the error state. +pub extern "C" fn CResult_SchnorrSignatureNoneZ_err() -> CResult_SchnorrSignatureNoneZ { + CResult_SchnorrSignatureNoneZ { + contents: CResult_SchnorrSignatureNoneZPtr { + 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_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SchnorrSignatureNoneZ_is_ok(o: &CResult_SchnorrSignatureNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. -pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { } -impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ { +/// Frees any resources used by the CResult_SchnorrSignatureNoneZ. +pub extern "C" fn CResult_SchnorrSignatureNoneZ_free(_res: CResult_SchnorrSignatureNoneZ) { } +impl Drop for CResult_SchnorrSignatureNoneZ { 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_SpendableOutputDescriptorDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SchnorrSignatureNoneZ { + 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_SpendableOutputDescriptorDecodeErrorZPtr { result } + CResult_SchnorrSignatureNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpendableOutputDescriptorDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_SchnorrSignatureNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -2097,47 +2065,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SchnorrSignatureNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SchnorrSignatureNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_SchnorrSignatureNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SchnorrSignatureNoneZ_clone(orig: &CResult_SchnorrSignatureNoneZ) -> CResult_SchnorrSignatureNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size. +/// A dynamically-allocated array of crate::lightning::blinded_path::payment::BlindedPaymentPaths of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_SpendableOutputDescriptorZ { +pub struct CVec_BlindedPaymentPathZ { /// 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::sign::SpendableOutputDescriptor, + pub data: *mut crate::lightning::blinded_path::payment::BlindedPaymentPath, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_SpendableOutputDescriptorZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_BlindedPaymentPathZ { + #[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::sign::SpendableOutputDescriptor] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::payment::BlindedPaymentPath] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_SpendableOutputDescriptorZ { - fn from(v: Vec) -> Self { +impl From> for CVec_BlindedPaymentPathZ { + 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() } } @@ -2145,14 +2113,14 @@ impl From> for CVec_Spend } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { } -impl Drop for CVec_SpendableOutputDescriptorZ { +pub extern "C" fn CVec_BlindedPaymentPathZ_free(_res: CVec_BlindedPaymentPathZ) { } +impl Drop for CVec_BlindedPaymentPathZ { 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_SpendableOutputDescriptorZ { +impl Clone for CVec_BlindedPaymentPathZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -2161,29 +2129,29 @@ impl Clone for CVec_SpendableOutputDescriptorZ { } } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size. +/// A dynamically-allocated array of crate::c_types::Strs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_TxOutZ { +pub struct CVec_StrZ { /// 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::TxOut, + pub data: *mut crate::c_types::Str, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_TxOutZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_StrZ { + #[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::TxOut] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::Str] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_TxOutZ { - fn from(v: Vec) -> Self { +impl From> for CVec_StrZ { + 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() } } @@ -2191,14 +2159,60 @@ impl From> for CVec_TxOutZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_TxOutZ_free(_res: CVec_TxOutZ) { } -impl Drop for CVec_TxOutZ { +pub extern "C" fn CVec_StrZ_free(_res: CVec_StrZ) { } +impl Drop for CVec_StrZ { 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_TxOutZ { +impl Clone for CVec_StrZ { + 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::ThirtyTwoBytess of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_ThirtyTwoBytesZ { + /// 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, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_ThirtyTwoBytesZ { + #[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] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_ThirtyTwoBytesZ { + 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_ThirtyTwoBytesZ_free(_res: CVec_ThirtyTwoBytesZ) { } +impl Drop for CVec_ThirtyTwoBytesZ { + 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_ThirtyTwoBytesZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -2208,118 +2222,150 @@ impl Clone for CVec_TxOutZ { } #[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 +/// An enum which can either contain a crate::c_types::derived::CVec_ThirtyTwoBytesZ or not +pub enum COption_CVec_ThirtyTwoBytesZZ { + /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains a crate::c_types::derived::CVec_ThirtyTwoBytesZ + Some(crate::c_types::derived::CVec_ThirtyTwoBytesZ), + /// When we're in this state, this COption_CVec_ThirtyTwoBytesZZ contains nothing None } -impl COption_u32Z { +impl COption_CVec_ThirtyTwoBytesZZ { #[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 { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ { 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) +/// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing a crate::c_types::derived::CVec_ThirtyTwoBytesZ +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_some(o: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> COption_CVec_ThirtyTwoBytesZZ { + COption_CVec_ThirtyTwoBytesZZ::Some(o) } #[no_mangle] -/// Constructs a new COption_u32Z containing nothing -pub extern "C" fn COption_u32Z_none() -> COption_u32Z { - COption_u32Z::None +/// Constructs a new COption_CVec_ThirtyTwoBytesZZ containing nothing +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_none() -> COption_CVec_ThirtyTwoBytesZZ { + COption_CVec_ThirtyTwoBytesZZ::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) { } +/// Frees any resources associated with the crate::c_types::derived::CVec_ThirtyTwoBytesZ, if we are in the Some state +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_free(_res: COption_CVec_ThirtyTwoBytesZZ) { } #[no_mangle] -/// Creates a new COption_u32Z which has the same data as `orig` +/// Creates a new COption_CVec_ThirtyTwoBytesZZ 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) } +pub extern "C" fn COption_CVec_ThirtyTwoBytesZZ_clone(orig: &COption_CVec_ThirtyTwoBytesZZ) -> COption_CVec_ThirtyTwoBytesZZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_CVec_u8Zu64Z { - /// The element at position 0 - pub a: crate::c_types::derived::CVec_u8Z, - /// The element at position 1 - pub b: u64, +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::offers::offer::Amount or not +pub enum COption_AmountZ { + /// When we're in this state, this COption_AmountZ contains a crate::lightning::offers::offer::Amount + Some(crate::lightning::offers::offer::Amount), + /// When we're in this state, this COption_AmountZ contains nothing + None } -impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z { - fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self { - Self { - a: tup.0, - b: tup.1, - } +impl COption_AmountZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -impl C2Tuple_CVec_u8Zu64Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) { - (self.a, self.b) + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl Clone for C2Tuple_CVec_u8Zu64Z { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::offers::offer::Amount { + 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 C2Tuple_CVec_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) } -/// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z { - C2Tuple_CVec_u8Zu64Z { a, b, } +/// Constructs a new COption_AmountZ containing a crate::lightning::offers::offer::Amount +pub extern "C" fn COption_AmountZ_some(o: crate::lightning::offers::offer::Amount) -> COption_AmountZ { + COption_AmountZ::Some(o) } - #[no_mangle] -/// Frees any resources used by the C2Tuple_CVec_u8Zu64Z. -pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { } +/// Constructs a new COption_AmountZ containing nothing +pub extern "C" fn COption_AmountZ_none() -> COption_AmountZ { + COption_AmountZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::offers::offer::Amount, if we are in the Some state +pub extern "C" fn COption_AmountZ_free(_res: COption_AmountZ) { } +#[no_mangle] +/// Creates a new COption_AmountZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_AmountZ_clone(orig: &COption_AmountZ) -> COption_AmountZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ -pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::offers::offer::Quantity or not +pub enum COption_QuantityZ { + /// When we're in this state, this COption_QuantityZ contains a crate::lightning::offers::offer::Quantity + Some(crate::lightning::offers::offer::Quantity), + /// When we're in this state, this COption_QuantityZ contains nothing + None +} +impl COption_QuantityZ { + #[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::offers::offer::Quantity { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_QuantityZ containing a crate::lightning::offers::offer::Quantity +pub extern "C" fn COption_QuantityZ_some(o: crate::lightning::offers::offer::Quantity) -> COption_QuantityZ { + COption_QuantityZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_QuantityZ containing nothing +pub extern "C" fn COption_QuantityZ_none() -> COption_QuantityZ { + COption_QuantityZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::offers::offer::Quantity, if we are in the Some state +pub extern "C" fn COption_QuantityZ_free(_res: COption_QuantityZ) { } +#[no_mangle] +/// Creates a new COption_QuantityZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_QuantityZ_clone(orig: &COption_QuantityZ) -> COption_QuantityZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_ThirtyTwoBytesNoneZ +pub union CResult_ThirtyTwoBytesNoneZPtr { /// 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_CVec_u8Zu64Z, + pub result: *mut crate::c_types::ThirtyTwoBytes, /// 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_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure. +/// A CResult_ThirtyTwoBytesNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_CVec_u8Zu64ZNoneZ { - /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either +pub struct CResult_ThirtyTwoBytesNoneZ { + /// The contents of this CResult_ThirtyTwoBytesNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr, - /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state. + pub contents: CResult_ThirtyTwoBytesNoneZPtr, + /// Whether this CResult_ThirtyTwoBytesNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state. -pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { - CResult_C2Tuple_CVec_u8Zu64ZNoneZ { - contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { +/// Creates a new CResult_ThirtyTwoBytesNoneZ in the success state. +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesNoneZ { + CResult_ThirtyTwoBytesNoneZ { + contents: CResult_ThirtyTwoBytesNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state. -pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { - CResult_C2Tuple_CVec_u8Zu64ZNoneZ { - contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { +/// Creates a new CResult_ThirtyTwoBytesNoneZ in the error state. +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_err() -> CResult_ThirtyTwoBytesNoneZ { + CResult_ThirtyTwoBytesNoneZ { + contents: CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -2327,13 +2373,13 @@ pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVe } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool { +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_is_ok(o: &CResult_ThirtyTwoBytesNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ. -pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { } -impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ { +/// Frees any resources used by the CResult_ThirtyTwoBytesNoneZ. +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_free(_res: CResult_ThirtyTwoBytesNoneZ) { } +impl Drop for CResult_ThirtyTwoBytesNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2343,16 +2389,16 @@ impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ { } } } -impl From> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ThirtyTwoBytesNoneZ { + 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_CVec_u8Zu64ZNoneZPtr { result } + CResult_ThirtyTwoBytesNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() } + CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -2360,59 +2406,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ThirtyTwoBytesNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { + Self { result_ok: false, contents: CResult_ThirtyTwoBytesNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig` +/// Creates a new CResult_ThirtyTwoBytesNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ThirtyTwoBytesNoneZ_clone(orig: &CResult_ThirtyTwoBytesNoneZ) -> CResult_ThirtyTwoBytesNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelDerivationParametersDecodeErrorZ -pub union CResult_ChannelDerivationParametersDecodeErrorZPtr { +/// The contents of CResult_Bolt12InvoiceDecodeErrorZ +pub union CResult_Bolt12InvoiceDecodeErrorZPtr { /// 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::sign::ChannelDerivationParameters, + pub result: *mut crate::lightning::offers::invoice::Bolt12Invoice, /// 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_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::ChannelDerivationParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt12InvoiceDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::Bolt12Invoice 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_ChannelDerivationParametersDecodeErrorZ { - /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either +pub struct CResult_Bolt12InvoiceDecodeErrorZ { + /// The contents of this CResult_Bolt12InvoiceDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr, - /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state. + pub contents: CResult_Bolt12InvoiceDecodeErrorZPtr, + /// Whether this CResult_Bolt12InvoiceDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ { - CResult_ChannelDerivationParametersDecodeErrorZ { - contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { +/// Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the success state. +pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_ok(o: crate::lightning::offers::invoice::Bolt12Invoice) -> CResult_Bolt12InvoiceDecodeErrorZ { + CResult_Bolt12InvoiceDecodeErrorZ { + contents: CResult_Bolt12InvoiceDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ { - CResult_ChannelDerivationParametersDecodeErrorZ { - contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { +/// Creates a new CResult_Bolt12InvoiceDecodeErrorZ in the error state. +pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceDecodeErrorZ { + CResult_Bolt12InvoiceDecodeErrorZ { + contents: CResult_Bolt12InvoiceDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -2420,13 +2466,13 @@ pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. -pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { } -impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt12InvoiceDecodeErrorZ. +pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_free(_res: CResult_Bolt12InvoiceDecodeErrorZ) { } +impl Drop for CResult_Bolt12InvoiceDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2439,16 +2485,16 @@ impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ { } } } -impl From> for CResult_ChannelDerivationParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt12InvoiceDecodeErrorZ { + 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_ChannelDerivationParametersDecodeErrorZPtr { result } + CResult_Bolt12InvoiceDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelDerivationParametersDecodeErrorZPtr { err } + CResult_Bolt12InvoiceDecodeErrorZPtr { err } }; Self { contents, @@ -2456,59 +2502,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt12InvoiceDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_Bolt12InvoiceDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_Bolt12InvoiceDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt12InvoiceDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceDecodeErrorZ) -> CResult_Bolt12InvoiceDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HTLCDescriptorDecodeErrorZ -pub union CResult_HTLCDescriptorDecodeErrorZPtr { +/// The contents of CResult_DelayedPaymentOutputDescriptorDecodeErrorZ +pub union CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { /// 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::sign::HTLCDescriptor, + pub result: *mut crate::lightning::sign::DelayedPaymentOutputDescriptor, /// 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_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::HTLCDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::DelayedPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_HTLCDescriptorDecodeErrorZ { - /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either +pub struct CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { + /// The contents of this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_HTLCDescriptorDecodeErrorZPtr, - /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state. + pub contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr, + /// Whether this CResult_DelayedPaymentOutputDescriptorDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. -pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ { - CResult_HTLCDescriptorDecodeErrorZ { - contents: CResult_HTLCDescriptorDecodeErrorZPtr { +/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the success state. +pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::DelayedPaymentOutputDescriptor) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { + contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. -pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ { - CResult_HTLCDescriptorDecodeErrorZ { - contents: CResult_HTLCDescriptorDecodeErrorZPtr { +/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ in the error state. +pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { + CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { + contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -2516,13 +2562,13 @@ pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool { +pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. -pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { } -impl Drop for CResult_HTLCDescriptorDecodeErrorZ { +/// Frees any resources used by the CResult_DelayedPaymentOutputDescriptorDecodeErrorZ. +pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) { } +impl Drop for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2535,16 +2581,16 @@ impl Drop for CResult_HTLCDescriptorDecodeErrorZ { } } } -impl From> for CResult_HTLCDescriptorDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { + 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_HTLCDescriptorDecodeErrorZPtr { result } + CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HTLCDescriptorDecodeErrorZPtr { err } + CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err } }; Self { contents, @@ -2552,91 +2598,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_DelayedPaymentOutputDescriptorDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_DelayedPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_DelayedPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_DelayedPaymentOutputDescriptorDecodeErrorZ) -> CResult_DelayedPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PublicKeyNoneZ -pub union CResult_PublicKeyNoneZPtr { +/// The contents of CResult_StaticPaymentOutputDescriptorDecodeErrorZ +pub union CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { /// 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, - /// 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::sign::StaticPaymentOutputDescriptor, + /// 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_PublicKeyNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::PublicKey on success and a () on failure. +/// A CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::StaticPaymentOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PublicKeyNoneZ { - /// The contents of this CResult_PublicKeyNoneZ, accessible via either +pub struct CResult_StaticPaymentOutputDescriptorDecodeErrorZ { + /// The contents of this CResult_StaticPaymentOutputDescriptorDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PublicKeyNoneZPtr, - /// Whether this CResult_PublicKeyNoneZ represents a success state. - pub result_ok: bool, + pub contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr, + /// Whether this CResult_StaticPaymentOutputDescriptorDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PublicKeyNoneZ in the success state. -pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ { - CResult_PublicKeyNoneZ { - contents: CResult_PublicKeyNoneZPtr { +/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the success state. +pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::StaticPaymentOutputDescriptor) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { + CResult_StaticPaymentOutputDescriptorDecodeErrorZ { + contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PublicKeyNoneZ in the error state. -pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ { - CResult_PublicKeyNoneZ { - contents: CResult_PublicKeyNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ in the error state. +pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { + CResult_StaticPaymentOutputDescriptorDecodeErrorZ { + contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { + 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_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool { +pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PublicKeyNoneZ. -pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { } -impl Drop for CResult_PublicKeyNoneZ { +/// Frees any resources used by the CResult_StaticPaymentOutputDescriptorDecodeErrorZ. +pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_free(_res: CResult_StaticPaymentOutputDescriptorDecodeErrorZ) { } +impl Drop for CResult_StaticPaymentOutputDescriptorDecodeErrorZ { 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_PublicKeyNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StaticPaymentOutputDescriptorDecodeErrorZ { + 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_PublicKeyNoneZPtr { result } + CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { err } }; Self { contents, @@ -2644,91 +2694,95 @@ impl From> for CResu } } } -impl Clone for CResult_PublicKeyNoneZ { +impl Clone for CResult_StaticPaymentOutputDescriptorDecodeErrorZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_StaticPaymentOutputDescriptorDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig` +/// Creates a new CResult_StaticPaymentOutputDescriptorDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_StaticPaymentOutputDescriptorDecodeErrorZ_clone(orig: &CResult_StaticPaymentOutputDescriptorDecodeErrorZ) -> CResult_StaticPaymentOutputDescriptorDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult__u832NoneZ -pub union CResult__u832NoneZPtr { +/// The contents of CResult_SpendableOutputDescriptorDecodeErrorZ +pub union CResult_SpendableOutputDescriptorDecodeErrorZPtr { /// 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, - /// 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::sign::SpendableOutputDescriptor, + /// 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__u832NoneZ represents the result of a fallible operation, -/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. +/// A CResult_SpendableOutputDescriptorDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::SpendableOutputDescriptor on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult__u832NoneZ { - /// The contents of this CResult__u832NoneZ, accessible via either +pub struct CResult_SpendableOutputDescriptorDecodeErrorZ { + /// The contents of this CResult_SpendableOutputDescriptorDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult__u832NoneZPtr, - /// Whether this CResult__u832NoneZ represents a success state. + pub contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr, + /// Whether this CResult_SpendableOutputDescriptorDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult__u832NoneZ in the success state. -pub extern "C" fn CResult__u832NoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832NoneZ { - CResult__u832NoneZ { - contents: CResult__u832NoneZPtr { +/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::SpendableOutputDescriptor) -> CResult_SpendableOutputDescriptorDecodeErrorZ { + CResult_SpendableOutputDescriptorDecodeErrorZ { + contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult__u832NoneZ in the error state. -pub extern "C" fn CResult__u832NoneZ_err() -> CResult__u832NoneZ { - CResult__u832NoneZ { - contents: CResult__u832NoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpendableOutputDescriptorDecodeErrorZ { + CResult_SpendableOutputDescriptorDecodeErrorZ { + contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { + 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__u832NoneZ_is_ok(o: &CResult__u832NoneZ) -> bool { +pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_is_ok(o: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult__u832NoneZ. -pub extern "C" fn CResult__u832NoneZ_free(_res: CResult__u832NoneZ) { } -impl Drop for CResult__u832NoneZ { +/// Frees any resources used by the CResult_SpendableOutputDescriptorDecodeErrorZ. +pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_free(_res: CResult_SpendableOutputDescriptorDecodeErrorZ) { } +impl Drop for CResult_SpendableOutputDescriptorDecodeErrorZ { 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__u832NoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SpendableOutputDescriptorDecodeErrorZ { + 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__u832NoneZPtr { result } + CResult_SpendableOutputDescriptorDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult__u832NoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_SpendableOutputDescriptorDecodeErrorZPtr { err } }; Self { contents, @@ -2736,183 +2790,229 @@ impl From> for } } } -impl Clone for CResult__u832NoneZ { +impl Clone for CResult_SpendableOutputDescriptorDecodeErrorZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult__u832NoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult__u832NoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_SpendableOutputDescriptorDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult__u832NoneZ which has the same data as `orig` +/// Creates a new CResult_SpendableOutputDescriptorDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult__u832NoneZ_clone(orig: &CResult__u832NoneZ) -> CResult__u832NoneZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_NoneNoneZ -pub union CResult_NoneNoneZPtr { - /// Note that this value is always NULL, as there are no contents in the OK variant - pub result: *mut core::ffi::c_void, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, -} +pub extern "C" fn CResult_SpendableOutputDescriptorDecodeErrorZ_clone(orig: &CResult_SpendableOutputDescriptorDecodeErrorZ) -> CResult_SpendableOutputDescriptorDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// 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`. -pub struct CResult_NoneNoneZ { - /// The contents of this CResult_NoneNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneNoneZPtr, - /// Whether this CResult_NoneNoneZ represents a success state. - pub result_ok: bool, +/// A dynamically-allocated array of crate::lightning::sign::SpendableOutputDescriptors of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_SpendableOutputDescriptorZ { + /// 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::sign::SpendableOutputDescriptor, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[no_mangle] -/// Creates a new CResult_NoneNoneZ in the success state. -pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ { - CResult_NoneNoneZ { - contents: CResult_NoneNoneZPtr { - result: core::ptr::null_mut(), - }, - result_ok: true, +impl CVec_SpendableOutputDescriptorZ { + #[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_NoneNoneZ in the error state. -pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ { - CResult_NoneNoneZ { - contents: CResult_NoneNoneZPtr { - err: core::ptr::null_mut(), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::sign::SpendableOutputDescriptor] { + 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_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool { - o.result_ok +impl From> for CVec_SpendableOutputDescriptorZ { + 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_NoneNoneZ. -pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { } -impl Drop for CResult_NoneNoneZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_SpendableOutputDescriptorZ_free(_res: CVec_SpendableOutputDescriptorZ) { } +impl Drop for CVec_SpendableOutputDescriptorZ { fn drop(&mut self) { - if self.result_ok { - } else { - } - } -} -impl From> for CResult_NoneNoneZ { - 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_NoneNoneZPtr { result: core::ptr::null_mut() } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_NoneNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CResult_NoneNoneZ { +impl Clone for CVec_SpendableOutputDescriptorZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NoneNoneZPtr { - result: core::ptr::null_mut() - } } - } else { - Self { result_ok: false, contents: CResult_NoneNoneZPtr { - err: core::ptr::null_mut() - } } - } + 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] -/// Creates a new CResult_NoneNoneZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::BigEndianScalar or not -pub enum COption_BigEndianScalarZ { - /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar - Some(crate::c_types::BigEndianScalar), - /// When we're in this state, this COption_BigEndianScalarZ contains nothing - None -} -impl COption_BigEndianScalarZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } - } +/// A dynamically-allocated array of crate::c_types::TxOuts of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_TxOutZ { + /// 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::TxOut, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_TxOutZ { + #[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::TxOut] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_TxOutZ { + 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_TxOutZ_free(_res: CVec_TxOutZ) { } +impl Drop for CVec_TxOutZ { + 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_TxOutZ { + 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)] +#[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) -> crate::c_types::BigEndianScalar { + #[allow(unused)] pub(crate) fn take(mut self) -> u32 { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar -pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ { - COption_BigEndianScalarZ::Some(o) +/// 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_BigEndianScalarZ containing nothing -pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ { - COption_BigEndianScalarZ::None +/// 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 crate::c_types::BigEndianScalar, if we are in the Some state -pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { } +/// 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_BigEndianScalarZ which has the same data as `orig` +/// 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_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) } +pub extern "C" fn COption_u32Z_clone(orig: &COption_u32Z) -> COption_u32Z { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RecoverableSignatureNoneZ -pub union CResult_RecoverableSignatureNoneZPtr { +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_CVec_u8Zu64Z { + /// The element at position 0 + pub a: crate::c_types::derived::CVec_u8Z, + /// The element at position 1 + pub b: u64, +} +impl From<(crate::c_types::derived::CVec_u8Z, u64)> for C2Tuple_CVec_u8Zu64Z { + fn from (tup: (crate::c_types::derived::CVec_u8Z, u64)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_CVec_u8Zu64Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::derived::CVec_u8Z, u64) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_CVec_u8Zu64Z { + 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_CVec_u8Zu64Z_clone(orig: &C2Tuple_CVec_u8Zu64Z) -> C2Tuple_CVec_u8Zu64Z { Clone::clone(&orig) } +/// Creates a new C2Tuple_CVec_u8Zu64Z from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_CVec_u8Zu64Z_new(a: crate::c_types::derived::CVec_u8Z, b: u64) -> C2Tuple_CVec_u8Zu64Z { + C2Tuple_CVec_u8Zu64Z { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_CVec_u8Zu64Z. +pub extern "C" fn C2Tuple_CVec_u8Zu64Z_free(_res: C2Tuple_CVec_u8Zu64Z) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_CVec_u8Zu64ZNoneZ +pub union CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { /// 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::RecoverableSignature, + pub result: *mut crate::c_types::derived::C2Tuple_CVec_u8Zu64Z, /// 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_RecoverableSignatureNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::RecoverableSignature on success and a () on failure. +/// A CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_CVec_u8Zu64Z on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_RecoverableSignatureNoneZ { - /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either +pub struct CResult_C2Tuple_CVec_u8Zu64ZNoneZ { + /// The contents of this CResult_C2Tuple_CVec_u8Zu64ZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RecoverableSignatureNoneZPtr, - /// Whether this CResult_RecoverableSignatureNoneZ represents a success state. + pub contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr, + /// Whether this CResult_C2Tuple_CVec_u8Zu64ZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RecoverableSignatureNoneZ in the success state. -pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ { - CResult_RecoverableSignatureNoneZ { - contents: CResult_RecoverableSignatureNoneZPtr { +/// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_ok(o: crate::c_types::derived::C2Tuple_CVec_u8Zu64Z) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { + CResult_C2Tuple_CVec_u8Zu64ZNoneZ { + contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RecoverableSignatureNoneZ in the error state. -pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ { - CResult_RecoverableSignatureNoneZ { - contents: CResult_RecoverableSignatureNoneZPtr { +/// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_err() -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { + CResult_C2Tuple_CVec_u8Zu64ZNoneZ { + contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -2920,13 +3020,13 @@ pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_Recoverable } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool { +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_is_ok(o: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RecoverableSignatureNoneZ. -pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { } -impl Drop for CResult_RecoverableSignatureNoneZ { +/// Frees any resources used by the CResult_C2Tuple_CVec_u8Zu64ZNoneZ. +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_free(_res: CResult_C2Tuple_CVec_u8Zu64ZNoneZ) { } +impl Drop for CResult_C2Tuple_CVec_u8Zu64ZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -2936,16 +3036,16 @@ impl Drop for CResult_RecoverableSignatureNoneZ { } } } -impl From> for CResult_RecoverableSignatureNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_CVec_u8Zu64ZNoneZ { + 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_RecoverableSignatureNoneZPtr { result } + CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() } + CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -2953,91 +3053,95 @@ impl From } } } -impl Clone for CResult_RecoverableSignatureNoneZ { +impl Clone for CResult_C2Tuple_CVec_u8Zu64ZNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr { + Self { result_ok: false, contents: CResult_C2Tuple_CVec_u8Zu64ZNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_CVec_u8Zu64ZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C2Tuple_CVec_u8Zu64ZNoneZ_clone(orig: &CResult_C2Tuple_CVec_u8Zu64ZNoneZ) -> CResult_C2Tuple_CVec_u8Zu64ZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ECDSASignatureNoneZ -pub union CResult_ECDSASignatureNoneZPtr { +/// The contents of CResult_ChannelDerivationParametersDecodeErrorZ +pub union CResult_ChannelDerivationParametersDecodeErrorZPtr { /// 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::ECDSASignature, - /// 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::sign::ChannelDerivationParameters, + /// 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_ECDSASignatureNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::ECDSASignature on success and a () on failure. +/// A CResult_ChannelDerivationParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::ChannelDerivationParameters 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_ECDSASignatureNoneZ { - /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either +pub struct CResult_ChannelDerivationParametersDecodeErrorZ { + /// The contents of this CResult_ChannelDerivationParametersDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ECDSASignatureNoneZPtr, - /// Whether this CResult_ECDSASignatureNoneZ represents a success state. + pub contents: CResult_ChannelDerivationParametersDecodeErrorZPtr, + /// Whether this CResult_ChannelDerivationParametersDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ECDSASignatureNoneZ in the success state. -pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ { - CResult_ECDSASignatureNoneZ { - contents: CResult_ECDSASignatureNoneZPtr { +/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_ok(o: crate::lightning::sign::ChannelDerivationParameters) -> CResult_ChannelDerivationParametersDecodeErrorZ { + CResult_ChannelDerivationParametersDecodeErrorZ { + contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ECDSASignatureNoneZ in the error state. -pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ { - CResult_ECDSASignatureNoneZ { - contents: CResult_ECDSASignatureNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDerivationParametersDecodeErrorZ { + CResult_ChannelDerivationParametersDecodeErrorZ { + contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + 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_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool { +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_is_ok(o: &CResult_ChannelDerivationParametersDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ECDSASignatureNoneZ. -pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { } -impl Drop for CResult_ECDSASignatureNoneZ { +/// Frees any resources used by the CResult_ChannelDerivationParametersDecodeErrorZ. +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_free(_res: CResult_ChannelDerivationParametersDecodeErrorZ) { } +impl Drop for CResult_ChannelDerivationParametersDecodeErrorZ { 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_ECDSASignatureNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelDerivationParametersDecodeErrorZ { + 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_ECDSASignatureNoneZPtr { result } + CResult_ChannelDerivationParametersDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelDerivationParametersDecodeErrorZPtr { err } }; Self { contents, @@ -3045,91 +3149,95 @@ impl From> for } } } -impl Clone for CResult_ECDSASignatureNoneZ { +impl Clone for CResult_ChannelDerivationParametersDecodeErrorZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_ChannelDerivationParametersDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` +/// Creates a new CResult_ChannelDerivationParametersDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelDerivationParametersDecodeErrorZ_clone(orig: &CResult_ChannelDerivationParametersDecodeErrorZ) -> CResult_ChannelDerivationParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TransactionNoneZ -pub union CResult_TransactionNoneZPtr { +/// The contents of CResult_HTLCDescriptorDecodeErrorZ +pub union CResult_HTLCDescriptorDecodeErrorZPtr { /// 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::Transaction, - /// 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::sign::HTLCDescriptor, + /// 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_TransactionNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::Transaction on success and a () on failure. +/// A CResult_HTLCDescriptorDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::HTLCDescriptor 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_TransactionNoneZ { - /// The contents of this CResult_TransactionNoneZ, accessible via either +pub struct CResult_HTLCDescriptorDecodeErrorZ { + /// The contents of this CResult_HTLCDescriptorDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TransactionNoneZPtr, - /// Whether this CResult_TransactionNoneZ represents a success state. + pub contents: CResult_HTLCDescriptorDecodeErrorZPtr, + /// Whether this CResult_HTLCDescriptorDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TransactionNoneZ in the success state. -pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ { - CResult_TransactionNoneZ { - contents: CResult_TransactionNoneZPtr { +/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the success state. +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_ok(o: crate::lightning::sign::HTLCDescriptor) -> CResult_HTLCDescriptorDecodeErrorZ { + CResult_HTLCDescriptorDecodeErrorZ { + contents: CResult_HTLCDescriptorDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TransactionNoneZ in the error state. -pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ { - CResult_TransactionNoneZ { - contents: CResult_TransactionNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_HTLCDescriptorDecodeErrorZ in the error state. +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HTLCDescriptorDecodeErrorZ { + CResult_HTLCDescriptorDecodeErrorZ { + contents: CResult_HTLCDescriptorDecodeErrorZPtr { + 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_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool { +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_is_ok(o: &CResult_HTLCDescriptorDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TransactionNoneZ. -pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { } -impl Drop for CResult_TransactionNoneZ { +/// Frees any resources used by the CResult_HTLCDescriptorDecodeErrorZ. +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_free(_res: CResult_HTLCDescriptorDecodeErrorZ) { } +impl Drop for CResult_HTLCDescriptorDecodeErrorZ { 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_TransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HTLCDescriptorDecodeErrorZ { + 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_TransactionNoneZPtr { result } + CResult_HTLCDescriptorDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_TransactionNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_HTLCDescriptorDecodeErrorZPtr { err } }; Self { contents, @@ -3137,95 +3245,91 @@ impl From> for CRe } } } -impl Clone for CResult_TransactionNoneZ { +impl Clone for CResult_HTLCDescriptorDecodeErrorZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TransactionNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HTLCDescriptorDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TransactionNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_HTLCDescriptorDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TransactionNoneZ which has the same data as `orig` +/// Creates a new CResult_HTLCDescriptorDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HTLCDescriptorDecodeErrorZ_clone(orig: &CResult_HTLCDescriptorDecodeErrorZ) -> CResult_HTLCDescriptorDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_EcdsaChannelSignerDecodeErrorZ -pub union CResult_EcdsaChannelSignerDecodeErrorZPtr { +/// The contents of CResult_PublicKeyNoneZ +pub union CResult_PublicKeyNoneZPtr { /// 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::sign::ecdsa::EcdsaChannelSigner, - /// 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::c_types::PublicKey, + /// 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_EcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::ecdsa::EcdsaChannelSigner on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PublicKeyNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::PublicKey on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_EcdsaChannelSignerDecodeErrorZ { - /// The contents of this CResult_EcdsaChannelSignerDecodeErrorZ, accessible via either +pub struct CResult_PublicKeyNoneZ { + /// The contents of this CResult_PublicKeyNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_EcdsaChannelSignerDecodeErrorZPtr, - /// Whether this CResult_EcdsaChannelSignerDecodeErrorZ represents a success state. + pub contents: CResult_PublicKeyNoneZPtr, + /// Whether this CResult_PublicKeyNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the success state. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::EcdsaChannelSigner) -> CResult_EcdsaChannelSignerDecodeErrorZ { - CResult_EcdsaChannelSignerDecodeErrorZ { - contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { +/// Creates a new CResult_PublicKeyNoneZ in the success state. +pub extern "C" fn CResult_PublicKeyNoneZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeyNoneZ { + CResult_PublicKeyNoneZ { + contents: CResult_PublicKeyNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the error state. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_EcdsaChannelSignerDecodeErrorZ { - CResult_EcdsaChannelSignerDecodeErrorZ { - contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_PublicKeyNoneZ in the error state. +pub extern "C" fn CResult_PublicKeyNoneZ_err() -> CResult_PublicKeyNoneZ { + CResult_PublicKeyNoneZ { + contents: CResult_PublicKeyNoneZPtr { + 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_EcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_EcdsaChannelSignerDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PublicKeyNoneZ_is_ok(o: &CResult_PublicKeyNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_EcdsaChannelSignerDecodeErrorZ. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_free(_res: CResult_EcdsaChannelSignerDecodeErrorZ) { } -impl Drop for CResult_EcdsaChannelSignerDecodeErrorZ { +/// Frees any resources used by the CResult_PublicKeyNoneZ. +pub extern "C" fn CResult_PublicKeyNoneZ_free(_res: CResult_PublicKeyNoneZ) { } +impl Drop for CResult_PublicKeyNoneZ { 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_EcdsaChannelSignerDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PublicKeyNoneZ { + 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_EcdsaChannelSignerDecodeErrorZPtr { result } + CResult_PublicKeyNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_EcdsaChannelSignerDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_PublicKeyNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3233,58 +3337,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PublicKeyNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PublicKeyNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_EcdsaChannelSignerDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PublicKeyNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_EcdsaChannelSignerDecodeErrorZ) -> CResult_EcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PublicKeyNoneZ_clone(orig: &CResult_PublicKeyNoneZ) -> CResult_PublicKeyNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_u8ZNoneZ -pub union CResult_CVec_u8ZNoneZPtr { +/// The contents of CResult__u832NoneZ +pub union CResult__u832NoneZPtr { /// 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, + pub result: *mut crate::c_types::ThirtyTwoBytes, /// 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_CVec_u8ZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. +/// A CResult__u832NoneZ represents the result of a fallible operation, +/// containing a crate::c_types::ThirtyTwoBytes on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_u8ZNoneZ { - /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either +pub struct CResult__u832NoneZ { + /// The contents of this CResult__u832NoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_u8ZNoneZPtr, - /// Whether this CResult_CVec_u8ZNoneZ represents a success state. + pub contents: CResult__u832NoneZPtr, + /// Whether this CResult__u832NoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_u8ZNoneZ in the success state. -pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ { - CResult_CVec_u8ZNoneZ { - contents: CResult_CVec_u8ZNoneZPtr { +/// Creates a new CResult__u832NoneZ in the success state. +pub extern "C" fn CResult__u832NoneZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult__u832NoneZ { + CResult__u832NoneZ { + contents: CResult__u832NoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZNoneZ in the error state. -pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ { - CResult_CVec_u8ZNoneZ { - contents: CResult_CVec_u8ZNoneZPtr { +/// Creates a new CResult__u832NoneZ in the error state. +pub extern "C" fn CResult__u832NoneZ_err() -> CResult__u832NoneZ { + CResult__u832NoneZ { + contents: CResult__u832NoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -3292,13 +3396,13 @@ pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ { } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool { +pub extern "C" fn CResult__u832NoneZ_is_ok(o: &CResult__u832NoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_u8ZNoneZ. -pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { } -impl Drop for CResult_CVec_u8ZNoneZ { +/// Frees any resources used by the CResult__u832NoneZ. +pub extern "C" fn CResult__u832NoneZ_free(_res: CResult__u832NoneZ) { } +impl Drop for CResult__u832NoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -3308,16 +3412,16 @@ impl Drop for CResult_CVec_u8ZNoneZ { } } } -impl From> for CResult_CVec_u8ZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult__u832NoneZ { + 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_u8ZNoneZPtr { result } + CResult__u832NoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() } + CResult__u832NoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3325,58 +3429,57 @@ impl From> f } } } -impl Clone for CResult_CVec_u8ZNoneZ { +impl Clone for CResult__u832NoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult__u832NoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr { + Self { result_ok: false, contents: CResult__u832NoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` +/// Creates a new CResult__u832NoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult__u832NoneZ_clone(orig: &CResult__u832NoneZ) -> CResult__u832NoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownScriptNoneZ -pub union CResult_ShutdownScriptNoneZPtr { - /// 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, +/// The contents of CResult_NoneNoneZ +pub union CResult_NoneNoneZPtr { + /// Note that this value is always NULL, as there are no contents in the OK variant + pub result: *mut core::ffi::c_void, /// 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_ShutdownScriptNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure. +/// 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`. -pub struct CResult_ShutdownScriptNoneZ { - /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either +pub struct CResult_NoneNoneZ { + /// The contents of this CResult_NoneNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ShutdownScriptNoneZPtr, - /// Whether this CResult_ShutdownScriptNoneZ represents a success state. + pub contents: CResult_NoneNoneZPtr, + /// Whether this CResult_NoneNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ShutdownScriptNoneZ in the success state. -pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ { - CResult_ShutdownScriptNoneZ { - contents: CResult_ShutdownScriptNoneZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneNoneZ in the success state. +pub extern "C" fn CResult_NoneNoneZ_ok() -> CResult_NoneNoneZ { + CResult_NoneNoneZ { + contents: CResult_NoneNoneZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptNoneZ in the error state. -pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ { - CResult_ShutdownScriptNoneZ { - contents: CResult_ShutdownScriptNoneZPtr { +/// Creates a new CResult_NoneNoneZ in the error state. +pub extern "C" fn CResult_NoneNoneZ_err() -> CResult_NoneNoneZ { + CResult_NoneNoneZ { + contents: CResult_NoneNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -3384,32 +3487,29 @@ pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNon } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool { +pub extern "C" fn CResult_NoneNoneZ_is_ok(o: &CResult_NoneNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ShutdownScriptNoneZ. -pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { } -impl Drop for CResult_ShutdownScriptNoneZ { +/// Frees any resources used by the CResult_NoneNoneZ. +pub extern "C" fn CResult_NoneNoneZ_free(_res: CResult_NoneNoneZ) { } +impl Drop for CResult_NoneNoneZ { 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_ShutdownScriptNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneNoneZ { + 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_ShutdownScriptNoneZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneNoneZPtr { result: core::ptr::null_mut() } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() } + CResult_NoneNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3417,132 +3517,187 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneNoneZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr { + Self { result_ok: false, contents: CResult_NoneNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig` +/// Creates a new CResult_NoneNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneNoneZ_clone(orig: &CResult_NoneNoneZ) -> CResult_NoneNoneZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a u16 or not -pub enum COption_u16Z { - /// When we're in this state, this COption_u16Z contains a u16 - Some(u16), - /// When we're in this state, this COption_u16Z contains nothing +/// An enum which can either contain a crate::c_types::BigEndianScalar or not +pub enum COption_BigEndianScalarZ { + /// When we're in this state, this COption_BigEndianScalarZ contains a crate::c_types::BigEndianScalar + Some(crate::c_types::BigEndianScalar), + /// When we're in this state, this COption_BigEndianScalarZ contains nothing None } -impl COption_u16Z { +impl COption_BigEndianScalarZ { #[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) -> u16 { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::BigEndianScalar { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_u16Z containing a u16 -pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z { - COption_u16Z::Some(o) +/// Constructs a new COption_BigEndianScalarZ containing a crate::c_types::BigEndianScalar +pub extern "C" fn COption_BigEndianScalarZ_some(o: crate::c_types::BigEndianScalar) -> COption_BigEndianScalarZ { + COption_BigEndianScalarZ::Some(o) } #[no_mangle] -/// Constructs a new COption_u16Z containing nothing -pub extern "C" fn COption_u16Z_none() -> COption_u16Z { - COption_u16Z::None +/// Constructs a new COption_BigEndianScalarZ containing nothing +pub extern "C" fn COption_BigEndianScalarZ_none() -> COption_BigEndianScalarZ { + COption_BigEndianScalarZ::None } #[no_mangle] -/// Frees any resources associated with the u16, if we are in the Some state -pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { } +/// Frees any resources associated with the crate::c_types::BigEndianScalar, if we are in the Some state +pub extern "C" fn COption_BigEndianScalarZ_free(_res: COption_BigEndianScalarZ) { } #[no_mangle] -/// Creates a new COption_u16Z which has the same data as `orig` +/// Creates a new COption_BigEndianScalarZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) } +pub extern "C" fn COption_BigEndianScalarZ_clone(orig: &COption_BigEndianScalarZ) -> COption_BigEndianScalarZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a bool or not -pub enum COption_boolZ { - /// When we're in this state, this COption_boolZ contains a bool - Some(bool), - /// When we're in this state, this COption_boolZ contains nothing - None +/// The contents of CResult_RecoverableSignatureNoneZ +pub union CResult_RecoverableSignatureNoneZPtr { + /// 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::RecoverableSignature, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, } -impl COption_boolZ { - #[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) -> bool { - if let Self::Some(v) = self { v } else { unreachable!() } +#[repr(C)] +/// A CResult_RecoverableSignatureNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::RecoverableSignature on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_RecoverableSignatureNoneZ { + /// The contents of this CResult_RecoverableSignatureNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_RecoverableSignatureNoneZPtr, + /// Whether this CResult_RecoverableSignatureNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_RecoverableSignatureNoneZ in the success state. +pub extern "C" fn CResult_RecoverableSignatureNoneZ_ok(o: crate::c_types::RecoverableSignature) -> CResult_RecoverableSignatureNoneZ { + CResult_RecoverableSignatureNoneZ { + contents: CResult_RecoverableSignatureNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } #[no_mangle] -/// Constructs a new COption_boolZ containing a bool -pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ { - COption_boolZ::Some(o) +/// Creates a new CResult_RecoverableSignatureNoneZ in the error state. +pub extern "C" fn CResult_RecoverableSignatureNoneZ_err() -> CResult_RecoverableSignatureNoneZ { + CResult_RecoverableSignatureNoneZ { + contents: CResult_RecoverableSignatureNoneZPtr { + err: core::ptr::null_mut(), + }, + result_ok: false, + } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Constructs a new COption_boolZ containing nothing -pub extern "C" fn COption_boolZ_none() -> COption_boolZ { - COption_boolZ::None +pub extern "C" fn CResult_RecoverableSignatureNoneZ_is_ok(o: &CResult_RecoverableSignatureNoneZ) -> bool { + o.result_ok } #[no_mangle] -/// Frees any resources associated with the bool, if we are in the Some state -pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { } +/// Frees any resources used by the CResult_RecoverableSignatureNoneZ. +pub extern "C" fn CResult_RecoverableSignatureNoneZ_free(_res: CResult_RecoverableSignatureNoneZ) { } +impl Drop for CResult_RecoverableSignatureNoneZ { + 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_RecoverableSignatureNoneZ { + 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_RecoverableSignatureNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_RecoverableSignatureNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_RecoverableSignatureNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_RecoverableSignatureNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_RecoverableSignatureNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} #[no_mangle] -/// Creates a new COption_boolZ which has the same data as `orig` +/// Creates a new CResult_RecoverableSignatureNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RecoverableSignatureNoneZ_clone(orig: &CResult_RecoverableSignatureNoneZ) -> CResult_RecoverableSignatureNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_WitnessNoneZ -pub union CResult_WitnessNoneZPtr { +/// The contents of CResult_ECDSASignatureNoneZ +pub union CResult_ECDSASignatureNoneZPtr { /// 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::Witness, + pub result: *mut crate::c_types::ECDSASignature, /// 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_WitnessNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::Witness on success and a () on failure. +/// A CResult_ECDSASignatureNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::ECDSASignature on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_WitnessNoneZ { - /// The contents of this CResult_WitnessNoneZ, accessible via either +pub struct CResult_ECDSASignatureNoneZ { + /// The contents of this CResult_ECDSASignatureNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_WitnessNoneZPtr, - /// Whether this CResult_WitnessNoneZ represents a success state. + pub contents: CResult_ECDSASignatureNoneZPtr, + /// Whether this CResult_ECDSASignatureNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_WitnessNoneZ in the success state. -pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ { - CResult_WitnessNoneZ { - contents: CResult_WitnessNoneZPtr { +/// Creates a new CResult_ECDSASignatureNoneZ in the success state. +pub extern "C" fn CResult_ECDSASignatureNoneZ_ok(o: crate::c_types::ECDSASignature) -> CResult_ECDSASignatureNoneZ { + CResult_ECDSASignatureNoneZ { + contents: CResult_ECDSASignatureNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_WitnessNoneZ in the error state. -pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ { - CResult_WitnessNoneZ { - contents: CResult_WitnessNoneZPtr { +/// Creates a new CResult_ECDSASignatureNoneZ in the error state. +pub extern "C" fn CResult_ECDSASignatureNoneZ_err() -> CResult_ECDSASignatureNoneZ { + CResult_ECDSASignatureNoneZ { + contents: CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -3550,13 +3705,13 @@ pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ { } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> bool { +pub extern "C" fn CResult_ECDSASignatureNoneZ_is_ok(o: &CResult_ECDSASignatureNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_WitnessNoneZ. -pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { } -impl Drop for CResult_WitnessNoneZ { +/// Frees any resources used by the CResult_ECDSASignatureNoneZ. +pub extern "C" fn CResult_ECDSASignatureNoneZ_free(_res: CResult_ECDSASignatureNoneZ) { } +impl Drop for CResult_ECDSASignatureNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -3566,16 +3721,16 @@ impl Drop for CResult_WitnessNoneZ { } } } -impl From> for CResult_WitnessNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ECDSASignatureNoneZ { + 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_WitnessNoneZPtr { result } + CResult_ECDSASignatureNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_WitnessNoneZPtr { err: core::ptr::null_mut() } + CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3583,146 +3738,58 @@ impl From> for CResult } } } -impl Clone for CResult_WitnessNoneZ { +impl Clone for CResult_ECDSASignatureNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_WitnessNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ECDSASignatureNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_WitnessNoneZPtr { + Self { result_ok: false, contents: CResult_ECDSASignatureNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_WitnessNoneZ which has the same data as `orig` +/// Creates a new CResult_ECDSASignatureNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ECDSASignatureNoneZ_clone(orig: &CResult_ECDSASignatureNoneZ) -> CResult_ECDSASignatureNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ECDSASignatureZ { - /// 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::ECDSASignature, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_ECDSASignatureZ { - #[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::ECDSASignature] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_ECDSASignatureZ { - 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_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { } -impl Drop for CVec_ECDSASignatureZ { - 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_ECDSASignatureZ { - 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_ECDSASignatureCVec_ECDSASignatureZZ { - /// The element at position 0 - pub a: crate::c_types::ECDSASignature, - /// The element at position 1 - pub b: crate::c_types::derived::CVec_ECDSASignatureZ, -} -impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { - fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { - 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_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { - C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. -pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { } -#[repr(C)] -/// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ -pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { +/// The contents of CResult_TransactionNoneZ +pub union CResult_TransactionNoneZPtr { /// 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_ECDSASignatureCVec_ECDSASignatureZZ, + pub result: *mut crate::c_types::Transaction, /// 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_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure. +/// A CResult_TransactionNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::Transaction on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either +pub struct CResult_TransactionNoneZ { + /// The contents of this CResult_TransactionNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr, - /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state. + pub contents: CResult_TransactionNoneZPtr, + /// Whether this CResult_TransactionNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. -pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { +/// Creates a new CResult_TransactionNoneZ in the success state. +pub extern "C" fn CResult_TransactionNoneZ_ok(o: crate::c_types::Transaction) -> CResult_TransactionNoneZ { + CResult_TransactionNoneZ { + contents: CResult_TransactionNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. -pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { +/// Creates a new CResult_TransactionNoneZ in the error state. +pub extern "C" fn CResult_TransactionNoneZ_err() -> CResult_TransactionNoneZ { + CResult_TransactionNoneZ { + contents: CResult_TransactionNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -3730,13 +3797,13 @@ pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool { +pub extern "C" fn CResult_TransactionNoneZ_is_ok(o: &CResult_TransactionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. -pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { } -impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { +/// Frees any resources used by the CResult_TransactionNoneZ. +pub extern "C" fn CResult_TransactionNoneZ_free(_res: CResult_TransactionNoneZ) { } +impl Drop for CResult_TransactionNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -3746,16 +3813,16 @@ impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { } } } -impl From> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TransactionNoneZ { + 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_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result } + CResult_TransactionNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() } + CResult_TransactionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3763,59 +3830,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TransactionNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { + Self { result_ok: false, contents: CResult_TransactionNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` +/// Creates a new CResult_TransactionNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TransactionNoneZ_clone(orig: &CResult_TransactionNoneZ) -> CResult_TransactionNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InMemorySignerDecodeErrorZ -pub union CResult_InMemorySignerDecodeErrorZPtr { +/// The contents of CResult_EcdsaChannelSignerDecodeErrorZ +pub union CResult_EcdsaChannelSignerDecodeErrorZPtr { /// 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::sign::InMemorySigner, + pub result: *mut crate::lightning::sign::ecdsa::EcdsaChannelSigner, /// 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_InMemorySignerDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_EcdsaChannelSignerDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::ecdsa::EcdsaChannelSigner 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_InMemorySignerDecodeErrorZ { - /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either +pub struct CResult_EcdsaChannelSignerDecodeErrorZ { + /// The contents of this CResult_EcdsaChannelSignerDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InMemorySignerDecodeErrorZPtr, - /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. + pub contents: CResult_EcdsaChannelSignerDecodeErrorZPtr, + /// Whether this CResult_EcdsaChannelSignerDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ { - CResult_InMemorySignerDecodeErrorZ { - contents: CResult_InMemorySignerDecodeErrorZPtr { +/// Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the success state. +pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_ok(o: crate::lightning::sign::ecdsa::EcdsaChannelSigner) -> CResult_EcdsaChannelSignerDecodeErrorZ { + CResult_EcdsaChannelSignerDecodeErrorZ { + contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ { - CResult_InMemorySignerDecodeErrorZ { - contents: CResult_InMemorySignerDecodeErrorZPtr { +/// Creates a new CResult_EcdsaChannelSignerDecodeErrorZ in the error state. +pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_EcdsaChannelSignerDecodeErrorZ { + CResult_EcdsaChannelSignerDecodeErrorZ { + contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -3823,13 +3890,13 @@ pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool { +pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_is_ok(o: &CResult_EcdsaChannelSignerDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { } -impl Drop for CResult_InMemorySignerDecodeErrorZ { +/// Frees any resources used by the CResult_EcdsaChannelSignerDecodeErrorZ. +pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_free(_res: CResult_EcdsaChannelSignerDecodeErrorZ) { } +impl Drop for CResult_EcdsaChannelSignerDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -3842,16 +3909,16 @@ impl Drop for CResult_InMemorySignerDecodeErrorZ { } } } -impl From> for CResult_InMemorySignerDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_EcdsaChannelSignerDecodeErrorZ { + 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_InMemorySignerDecodeErrorZPtr { result } + CResult_EcdsaChannelSignerDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InMemorySignerDecodeErrorZPtr { err } + CResult_EcdsaChannelSignerDecodeErrorZPtr { err } }; Self { contents, @@ -3859,123 +3926,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_EcdsaChannelSignerDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_EcdsaChannelSignerDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_EcdsaChannelSignerDecodeErrorZ_clone(orig: &CResult_EcdsaChannelSignerDecodeErrorZ) -> CResult_EcdsaChannelSignerDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not -pub enum COption_WriteableScoreZ { - /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore - Some(crate::lightning::routing::scoring::WriteableScore), - /// When we're in this state, this COption_WriteableScoreZ contains nothing - None +/// The contents of CResult_CVec_u8ZNoneZ +pub union CResult_CVec_u8ZNoneZPtr { + /// 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, + /// Note that this value is always NULL, as there are no contents in the Err variant + pub err: *mut core::ffi::c_void, } -impl COption_WriteableScoreZ { - #[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() +#[repr(C)] +/// A CResult_CVec_u8ZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_u8Z on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CVec_u8ZNoneZ { + /// The contents of this CResult_CVec_u8ZNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CVec_u8ZNoneZPtr, + /// Whether this CResult_CVec_u8ZNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_CVec_u8ZNoneZ in the success state. +pub extern "C" fn CResult_CVec_u8ZNoneZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZNoneZ { + CResult_CVec_u8ZNoneZ { + contents: CResult_CVec_u8ZNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::scoring::WriteableScore { - if let Self::Some(v) = self { v } else { unreachable!() } +} +#[no_mangle] +/// Creates a new CResult_CVec_u8ZNoneZ in the error state. +pub extern "C" fn CResult_CVec_u8ZNoneZ_err() -> CResult_CVec_u8ZNoneZ { + CResult_CVec_u8ZNoneZ { + contents: CResult_CVec_u8ZNoneZPtr { + err: core::ptr::null_mut(), + }, + result_ok: false, } } +/// Checks if the given object is currently in the success state #[no_mangle] -/// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore -pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ { - COption_WriteableScoreZ::Some(o) +pub extern "C" fn CResult_CVec_u8ZNoneZ_is_ok(o: &CResult_CVec_u8ZNoneZ) -> bool { + o.result_ok } #[no_mangle] -/// Constructs a new COption_WriteableScoreZ containing nothing -pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ { - COption_WriteableScoreZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state -pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { } -#[repr(C)] -/// The contents of CResult_NoneIOErrorZ -pub union CResult_NoneIOErrorZPtr { - /// 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::c_types::IOError, -} -#[repr(C)] -/// A CResult_NoneIOErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::c_types::IOError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NoneIOErrorZ { - /// The contents of this CResult_NoneIOErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneIOErrorZPtr, - /// Whether this CResult_NoneIOErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_NoneIOErrorZ in the success state. -pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ { - CResult_NoneIOErrorZ { - contents: CResult_NoneIOErrorZPtr { - result: core::ptr::null_mut(), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_NoneIOErrorZ in the error state. -pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ { - CResult_NoneIOErrorZ { - contents: CResult_NoneIOErrorZPtr { - 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_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_NoneIOErrorZ. -pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { } -impl Drop for CResult_NoneIOErrorZ { +/// Frees any resources used by the CResult_CVec_u8ZNoneZ. +pub extern "C" fn CResult_CVec_u8ZNoneZ_free(_res: CResult_CVec_u8ZNoneZ) { } +impl Drop for CResult_CVec_u8ZNoneZ { 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) }; + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; } + } else { } } } -impl From> for CResult_NoneIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self { +impl From> for CResult_CVec_u8ZNoneZ { + 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_NoneIOErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_CVec_u8ZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneIOErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_u8ZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -3983,104 +4018,58 @@ impl From> for CResult } } } -impl Clone for CResult_NoneIOErrorZ { +impl Clone for CResult_CVec_u8ZNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneIOErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_CVec_u8ZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_u8ZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_NoneIOErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields, - /// The element at position 2 - pub c: crate::lightning::routing::router::RouteParameters, -} -impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } - } -} -impl C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) { - (self.a, self.b, self.c) - } -} -impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - 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` +/// Creates a new CResult_CVec_u8ZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::outbound_payment::RecipientOnionFields, c: crate::lightning::routing::router::RouteParameters) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { - C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ. -pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { } +pub extern "C" fn CResult_CVec_u8ZNoneZ_clone(orig: &CResult_CVec_u8ZNoneZ) -> CResult_CVec_u8ZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ -pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { +/// The contents of CResult_ShutdownScriptNoneZ +pub union CResult_ShutdownScriptNoneZPtr { /// 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::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, + pub result: *mut crate::lightning::ln::script::ShutdownScript, /// 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () on failure. +/// A CResult_ShutdownScriptNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::script::ShutdownScript on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, accessible via either +pub struct CResult_ShutdownScriptNoneZ { + /// The contents of this CResult_ShutdownScriptNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr, - /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents a success state. + pub contents: CResult_ShutdownScriptNoneZPtr, + /// Whether this CResult_ShutdownScriptNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { +/// Creates a new CResult_ShutdownScriptNoneZ in the success state. +pub extern "C" fn CResult_ShutdownScriptNoneZ_ok(o: crate::lightning::ln::script::ShutdownScript) -> CResult_ShutdownScriptNoneZ { + CResult_ShutdownScriptNoneZ { + contents: CResult_ShutdownScriptNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { +/// Creates a new CResult_ShutdownScriptNoneZ in the error state. +pub extern "C" fn CResult_ShutdownScriptNoneZ_err() -> CResult_ShutdownScriptNoneZ { + CResult_ShutdownScriptNoneZ { + contents: CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -4088,13 +4077,13 @@ pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParamet } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> bool { +pub extern "C" fn CResult_ShutdownScriptNoneZ_is_ok(o: &CResult_ShutdownScriptNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { } -impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { +/// Frees any resources used by the CResult_ShutdownScriptNoneZ. +pub extern "C" fn CResult_ShutdownScriptNoneZ_free(_res: CResult_ShutdownScriptNoneZ) { } +impl Drop for CResult_ShutdownScriptNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -4104,16 +4093,16 @@ impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ } } } -impl From> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ShutdownScriptNoneZ { + 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result } + CResult_ShutdownScriptNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() } + CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -4121,141 +4110,165 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ShutdownScriptNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { + Self { result_ok: false, contents: CResult_ShutdownScriptNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ which has the same data as `orig` +/// Creates a new CResult_ShutdownScriptNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ShutdownScriptNoneZ_clone(orig: &CResult_ShutdownScriptNoneZ) -> CResult_ShutdownScriptNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channel_state::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::channel_state::ChannelDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize +#[derive(Clone)] +/// An enum which can either contain a u16 or not +pub enum COption_u16Z { + /// When we're in this state, this COption_u16Z contains a u16 + Some(u16), + /// When we're in this state, this COption_u16Z contains nothing + None } -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 +impl COption_u16Z { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channel_state::ChannelDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -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() } } + #[allow(unused)] pub(crate) fn take(mut self) -> u16 { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[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)) }; - } +/// Constructs a new COption_u16Z containing a u16 +pub extern "C" fn COption_u16Z_some(o: u16) -> COption_u16Z { + COption_u16Z::Some(o) } -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) +#[no_mangle] +/// Constructs a new COption_u16Z containing nothing +pub extern "C" fn COption_u16Z_none() -> COption_u16Z { + COption_u16Z::None +} +#[no_mangle] +/// Frees any resources associated with the u16, if we are in the Some state +pub extern "C" fn COption_u16Z_free(_res: COption_u16Z) { } +#[no_mangle] +/// Creates a new COption_u16Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_u16Z_clone(orig: &COption_u16Z) -> COption_u16Z { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a bool or not +pub enum COption_boolZ { + /// When we're in this state, this COption_boolZ contains a bool + Some(bool), + /// When we're in this state, this COption_boolZ contains nothing + None +} +impl COption_boolZ { + #[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) -> bool { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_boolZ containing a bool +pub extern "C" fn COption_boolZ_some(o: bool) -> COption_boolZ { + COption_boolZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_boolZ containing nothing +pub extern "C" fn COption_boolZ_none() -> COption_boolZ { + COption_boolZ::None } +#[no_mangle] +/// Frees any resources associated with the bool, if we are in the Some state +pub extern "C" fn COption_boolZ_free(_res: COption_boolZ) { } +#[no_mangle] +/// Creates a new COption_boolZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_boolZ_clone(orig: &COption_boolZ) -> COption_boolZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RouteLightningErrorZ -pub union CResult_RouteLightningErrorZPtr { +/// The contents of CResult_WitnessNoneZ +pub union CResult_WitnessNoneZPtr { /// 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, + pub result: *mut crate::c_types::Witness, + /// 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_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. +/// A CResult_WitnessNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::Witness on success and a () 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 +pub struct CResult_WitnessNoneZ { + /// The contents of this CResult_WitnessNoneZ, 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 contents: CResult_WitnessNoneZPtr, + /// Whether this CResult_WitnessNoneZ 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 { +/// Creates a new CResult_WitnessNoneZ in the success state. +pub extern "C" fn CResult_WitnessNoneZ_ok(o: crate::c_types::Witness) -> CResult_WitnessNoneZ { + CResult_WitnessNoneZ { + contents: CResult_WitnessNoneZPtr { 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)), +/// Creates a new CResult_WitnessNoneZ in the error state. +pub extern "C" fn CResult_WitnessNoneZ_err() -> CResult_WitnessNoneZ { + CResult_WitnessNoneZ { + contents: CResult_WitnessNoneZPtr { + 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_RouteLightningErrorZ_is_ok(o: &CResult_RouteLightningErrorZ) -> bool { +pub extern "C" fn CResult_WitnessNoneZ_is_ok(o: &CResult_WitnessNoneZ) -> 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 { +/// Frees any resources used by the CResult_WitnessNoneZ. +pub extern "C" fn CResult_WitnessNoneZ_free(_res: CResult_WitnessNoneZ) { } +impl Drop for CResult_WitnessNoneZ { 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 { +impl From> for CResult_WitnessNoneZ { + 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 } + CResult_WitnessNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteLightningErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_WitnessNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -4263,47 +4276,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RouteLightningErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_WitnessNoneZPtr { + 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 }))) + Self { result_ok: false, contents: CResult_WitnessNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_RouteLightningErrorZ which has the same data as `orig` +/// Creates a new CResult_WitnessNoneZ 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) } +pub extern "C" fn CResult_WitnessNoneZ_clone(orig: &CResult_WitnessNoneZ) -> CResult_WitnessNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::blinded_path::payment::BlindedPaymentPaths of arbitrary size. +/// A dynamically-allocated array of crate::c_types::ECDSASignatures of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_BlindedPaymentPathZ { +pub struct CVec_ECDSASignatureZ { /// 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::blinded_path::payment::BlindedPaymentPath, + pub data: *mut crate::c_types::ECDSASignature, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_BlindedPaymentPathZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_ECDSASignatureZ { + #[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::blinded_path::payment::BlindedPaymentPath] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::ECDSASignature] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_BlindedPaymentPathZ { - fn from(v: Vec) -> Self { +impl From> for CVec_ECDSASignatureZ { + 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() } } @@ -4311,14 +4324,14 @@ impl From> for } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_BlindedPaymentPathZ_free(_res: CVec_BlindedPaymentPathZ) { } -impl Drop for CVec_BlindedPaymentPathZ { +pub extern "C" fn CVec_ECDSASignatureZ_free(_res: CVec_ECDSASignatureZ) { } +impl Drop for CVec_ECDSASignatureZ { 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_BlindedPaymentPathZ { +impl Clone for CVec_ECDSASignatureZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -4327,40 +4340,82 @@ impl Clone for CVec_BlindedPaymentPathZ { } } #[repr(C)] -/// The contents of CResult_CVec_BlindedPaymentPathZNoneZ -pub union CResult_CVec_BlindedPaymentPathZNoneZPtr { +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + /// The element at position 0 + pub a: crate::c_types::ECDSASignature, + /// The element at position 1 + pub b: crate::c_types::derived::CVec_ECDSASignatureZ, +} +impl From<(crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)> for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + fn from (tup: (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ECDSASignature, crate::c_types::derived::CVec_ECDSASignatureZ) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + 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_ECDSASignatureCVec_ECDSASignatureZZ_clone(orig: &C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_new(a: crate::c_types::ECDSASignature, b: crate::c_types::derived::CVec_ECDSASignatureZ) -> C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { + C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ. +pub extern "C" fn C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ_free(_res: C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ +pub union CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { /// 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_BlindedPaymentPathZ, + pub result: *mut crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ, /// 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_CVec_BlindedPaymentPathZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_BlindedPaymentPathZ on success and a () on failure. +/// A CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_BlindedPaymentPathZNoneZ { - /// The contents of this CResult_CVec_BlindedPaymentPathZNoneZ, accessible via either +pub struct CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + /// The contents of this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_BlindedPaymentPathZNoneZPtr, - /// Whether this CResult_CVec_BlindedPaymentPathZNoneZ represents a success state. + pub contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr, + /// Whether this CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the success state. -pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPaymentPathZ) -> CResult_CVec_BlindedPaymentPathZNoneZ { - CResult_CVec_BlindedPaymentPathZNoneZ { - contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { +/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the success state. +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_ok(o: crate::c_types::derived::C2Tuple_ECDSASignatureCVec_ECDSASignatureZZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the error state. -pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_err() -> CResult_CVec_BlindedPaymentPathZNoneZ { - CResult_CVec_BlindedPaymentPathZNoneZ { - contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { +/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ in the error state. +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_err() -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut(), }, result_ok: false, @@ -4368,13 +4423,13 @@ pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_err() -> CResult_CVec_Bl } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPaymentPathZNoneZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_is_ok(o: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_BlindedPaymentPathZNoneZ. -pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_free(_res: CResult_CVec_BlindedPaymentPathZNoneZ) { } -impl Drop for CResult_CVec_BlindedPaymentPathZNoneZ { +/// Frees any resources used by the CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ. +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_free(_res: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) { } +impl Drop for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -4384,16 +4439,16 @@ impl Drop for CResult_CVec_BlindedPaymentPathZNoneZ { } } } -impl From> for CResult_CVec_BlindedPaymentPathZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { + 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_BlindedPaymentPathZNoneZPtr { result } + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { result } } else { let _ = unsafe { Box::from_raw(o.contents.err) }; o.contents.err = core::ptr::null_mut(); - CResult_CVec_BlindedPaymentPathZNoneZPtr { err: core::ptr::null_mut() } + CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -4401,137 +4456,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { + Self { result_ok: false, contents: CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZPtr { err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_CVec_BlindedPaymentPathZNoneZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_clone(orig: &CResult_CVec_BlindedPaymentPathZNoneZ) -> CResult_CVec_BlindedPaymentPathZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ_clone(orig: &CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ) -> CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { 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_OnionMessagePathNoneZ -pub union CResult_OnionMessagePathNoneZPtr { +/// The contents of CResult_InMemorySignerDecodeErrorZ +pub union CResult_InMemorySignerDecodeErrorZPtr { /// 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::messenger::OnionMessagePath, - /// 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::sign::InMemorySigner, + /// 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_OnionMessagePathNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. +/// A CResult_InMemorySignerDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::sign::InMemorySigner on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OnionMessagePathNoneZ { - /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either +pub struct CResult_InMemorySignerDecodeErrorZ { + /// The contents of this CResult_InMemorySignerDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OnionMessagePathNoneZPtr, - /// Whether this CResult_OnionMessagePathNoneZ represents a success state. + pub contents: CResult_InMemorySignerDecodeErrorZPtr, + /// Whether this CResult_InMemorySignerDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OnionMessagePathNoneZ in the success state. -pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ { - CResult_OnionMessagePathNoneZ { - contents: CResult_OnionMessagePathNoneZPtr { +/// Creates a new CResult_InMemorySignerDecodeErrorZ in the success state. +pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_ok(o: crate::lightning::sign::InMemorySigner) -> CResult_InMemorySignerDecodeErrorZ { + CResult_InMemorySignerDecodeErrorZ { + contents: CResult_InMemorySignerDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OnionMessagePathNoneZ in the error state. -pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ { - CResult_OnionMessagePathNoneZ { - contents: CResult_OnionMessagePathNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_InMemorySignerDecodeErrorZ in the error state. +pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InMemorySignerDecodeErrorZ { + CResult_InMemorySignerDecodeErrorZ { + contents: CResult_InMemorySignerDecodeErrorZPtr { + 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_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool { +pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_is_ok(o: &CResult_InMemorySignerDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OnionMessagePathNoneZ. -pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { } -impl Drop for CResult_OnionMessagePathNoneZ { +/// Frees any resources used by the CResult_InMemorySignerDecodeErrorZ. +pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_free(_res: CResult_InMemorySignerDecodeErrorZ) { } +impl Drop for CResult_InMemorySignerDecodeErrorZ { 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_OnionMessagePathNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InMemorySignerDecodeErrorZ { + 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_OnionMessagePathNoneZPtr { result } + CResult_InMemorySignerDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_InMemorySignerDecodeErrorZPtr { err } }; Self { contents, @@ -4539,91 +4552,123 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InMemorySignerDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_InMemorySignerDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` +/// Creates a new CResult_InMemorySignerDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InMemorySignerDecodeErrorZ_clone(orig: &CResult_InMemorySignerDecodeErrorZ) -> CResult_InMemorySignerDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_BlindedMessagePathZNoneZ -pub union CResult_CVec_BlindedMessagePathZNoneZPtr { - /// 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_BlindedMessagePathZ, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, +/// An enum which can either contain a crate::lightning::routing::scoring::WriteableScore or not +pub enum COption_WriteableScoreZ { + /// When we're in this state, this COption_WriteableScoreZ contains a crate::lightning::routing::scoring::WriteableScore + Some(crate::lightning::routing::scoring::WriteableScore), + /// When we're in this state, this COption_WriteableScoreZ contains nothing + None +} +impl COption_WriteableScoreZ { + #[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::routing::scoring::WriteableScore { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_WriteableScoreZ containing a crate::lightning::routing::scoring::WriteableScore +pub extern "C" fn COption_WriteableScoreZ_some(o: crate::lightning::routing::scoring::WriteableScore) -> COption_WriteableScoreZ { + COption_WriteableScoreZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_WriteableScoreZ containing nothing +pub extern "C" fn COption_WriteableScoreZ_none() -> COption_WriteableScoreZ { + COption_WriteableScoreZ::None } +#[no_mangle] +/// Frees any resources associated with the crate::lightning::routing::scoring::WriteableScore, if we are in the Some state +pub extern "C" fn COption_WriteableScoreZ_free(_res: COption_WriteableScoreZ) { } #[repr(C)] -/// A CResult_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. +/// The contents of CResult_NoneIOErrorZ +pub union CResult_NoneIOErrorZPtr { + /// 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::c_types::IOError, +} +#[repr(C)] +/// A CResult_NoneIOErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::c_types::IOError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_BlindedMessagePathZNoneZ { - /// The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either +pub struct CResult_NoneIOErrorZ { + /// The contents of this CResult_NoneIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_BlindedMessagePathZNoneZPtr, - /// Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. + pub contents: CResult_NoneIOErrorZPtr, + /// Whether this CResult_NoneIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedMessagePathZ) -> CResult_CVec_BlindedMessagePathZNoneZ { - CResult_CVec_BlindedMessagePathZNoneZ { - contents: CResult_CVec_BlindedMessagePathZNoneZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneIOErrorZ in the success state. +pub extern "C" fn CResult_NoneIOErrorZ_ok() -> CResult_NoneIOErrorZ { + CResult_NoneIOErrorZ { + contents: CResult_NoneIOErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_err() -> CResult_CVec_BlindedMessagePathZNoneZ { - CResult_CVec_BlindedMessagePathZNoneZ { - contents: CResult_CVec_BlindedMessagePathZNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_NoneIOErrorZ in the error state. +pub extern "C" fn CResult_NoneIOErrorZ_err(e: crate::c_types::IOError) -> CResult_NoneIOErrorZ { + CResult_NoneIOErrorZ { + contents: CResult_NoneIOErrorZPtr { + 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_CVec_BlindedMessagePathZNoneZ_is_ok(o: &CResult_CVec_BlindedMessagePathZNoneZ) -> bool { +pub extern "C" fn CResult_NoneIOErrorZ_is_ok(o: &CResult_NoneIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_free(_res: CResult_CVec_BlindedMessagePathZNoneZ) { } -impl Drop for CResult_CVec_BlindedMessagePathZNoneZ { +/// Frees any resources used by the CResult_NoneIOErrorZ. +pub extern "C" fn CResult_NoneIOErrorZ_free(_res: CResult_NoneIOErrorZ) { } +impl Drop for CResult_NoneIOErrorZ { 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_CVec_BlindedMessagePathZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneIOErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::c_types::IOError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CVec_BlindedMessagePathZNoneZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneIOErrorZPtr { result: core::ptr::null_mut() } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CVec_BlindedMessagePathZNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneIOErrorZPtr { err } }; Self { contents, @@ -4631,141 +4676,137 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneIOErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_NoneIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` +/// Creates a new CResult_NoneIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_clone(orig: &CResult_CVec_BlindedMessagePathZNoneZ) -> CResult_CVec_BlindedMessagePathZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneIOErrorZ_clone(orig: &CResult_NoneIOErrorZ) -> CResult_NoneIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::blinded_path::message::MessageForwardNodes of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_MessageForwardNodeZ { - /// 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::blinded_path::message::MessageForwardNode, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_MessageForwardNodeZ { - #[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::blinded_path::message::MessageForwardNode] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::lightning::ln::outbound_payment::RecipientOnionFields, + /// The element at position 2 + pub c: crate::lightning::routing::router::RouteParameters, } -impl From> for CVec_MessageForwardNodeZ { - 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() } } +impl From<(crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)> for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + } } } -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_MessageForwardNodeZ_free(_res: CVec_MessageForwardNodeZ) { } -impl Drop for CVec_MessageForwardNodeZ { - 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 C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::lightning::ln::outbound_payment::RecipientOnionFields, crate::lightning::routing::router::RouteParameters) { + (self.a, self.b, self.c) } } -impl Clone for CVec_MessageForwardNodeZ { +impl Clone for C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { 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) + 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 C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_clone(orig: &C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ from the contained elements. +#[no_mangle] +pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::ln::outbound_payment::RecipientOnionFields, c: crate::lightning::routing::router::RouteParameters) -> C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { + C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ { a, b, c, } +} + +#[no_mangle] +/// Frees any resources used by the C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ. +pub extern "C" fn C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ_free(_res: C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) { } #[repr(C)] -/// The contents of CResult_InFlightHtlcsDecodeErrorZ -pub union CResult_InFlightHtlcsDecodeErrorZPtr { +/// The contents of CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ +pub union CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { /// 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, + pub result: *mut crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ, + /// 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_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. +/// A CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ on success and a () 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + /// The contents of this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ, 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr, + /// Whether this CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ 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 { +/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the success state. +pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_ok(o: crate::c_types::derived::C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { 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)), +/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ in the error state. +pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_err() -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { + 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_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_is_ok(o: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> 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_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ. +pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_free(_res: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) { } +impl Drop for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { 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 { +impl From> for CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + 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 } + CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InFlightHtlcsDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -4773,59 +4814,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InFlightHtlcsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { + 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 }))) + Self { result_ok: false, contents: CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_InFlightHtlcsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ 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) } +pub extern "C" fn CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ_clone(orig: &CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ) -> CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RouteHopDecodeErrorZ -pub union CResult_RouteHopDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::ln::channel_state::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::channel_state::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::channel_state::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, @@ -4833,13 +4920,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() } { @@ -4852,16 +4939,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, @@ -4869,141 +4956,91 @@ 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::blinded_path::BlindedHops of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_BlindedHopZ { - /// 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::blinded_path::BlindedHop, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_BlindedHopZ { - #[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::blinded_path::BlindedHop] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_BlindedHopZ { - 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_BlindedHopZ_free(_res: CVec_BlindedHopZ) { } -impl Drop for CVec_BlindedHopZ { - 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_BlindedHopZ { - 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_BlindedTailDecodeErrorZ -pub union CResult_BlindedTailDecodeErrorZPtr { +/// The contents of CResult_CVec_BlindedPaymentPathZNoneZ +pub union CResult_CVec_BlindedPaymentPathZNoneZPtr { /// 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::BlindedTail, - /// 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::c_types::derived::CVec_BlindedPaymentPathZ, + /// 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_BlindedTailDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CVec_BlindedPaymentPathZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_BlindedPaymentPathZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BlindedTailDecodeErrorZ { - /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either +pub struct CResult_CVec_BlindedPaymentPathZNoneZ { + /// The contents of this CResult_CVec_BlindedPaymentPathZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedTailDecodeErrorZPtr, - /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state. + pub contents: CResult_CVec_BlindedPaymentPathZNoneZPtr, + /// Whether this CResult_CVec_BlindedPaymentPathZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedTailDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ { - CResult_BlindedTailDecodeErrorZ { - contents: CResult_BlindedTailDecodeErrorZPtr { +/// Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the success state. +pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedPaymentPathZ) -> CResult_CVec_BlindedPaymentPathZNoneZ { + CResult_CVec_BlindedPaymentPathZNoneZ { + contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedTailDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ { - CResult_BlindedTailDecodeErrorZ { - contents: CResult_BlindedTailDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_CVec_BlindedPaymentPathZNoneZ in the error state. +pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_err() -> CResult_CVec_BlindedPaymentPathZNoneZ { + CResult_CVec_BlindedPaymentPathZNoneZ { + contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { + 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_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_is_ok(o: &CResult_CVec_BlindedPaymentPathZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedTailDecodeErrorZ. -pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { } -impl Drop for CResult_BlindedTailDecodeErrorZ { +/// Frees any resources used by the CResult_CVec_BlindedPaymentPathZNoneZ. +pub extern "C" fn CResult_CVec_BlindedPaymentPathZNoneZ_free(_res: CResult_CVec_BlindedPaymentPathZNoneZ) { } +impl Drop for CResult_CVec_BlindedPaymentPathZNoneZ { 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_BlindedTailDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_BlindedPaymentPathZNoneZ { + 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_BlindedTailDecodeErrorZPtr { result } + CResult_CVec_BlindedPaymentPathZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedTailDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_BlindedPaymentPathZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -5011,151 +5048,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_BlindedPaymentPathZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CVec_BlindedPaymentPathZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { 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++ -pub struct CVec_RouteHopZ { - /// 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::routing::router::RouteHop, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_RouteHopZ { - #[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::routing::router::RouteHop] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_RouteHopZ { - 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_RouteHopZ_free(_res: CVec_RouteHopZ) { } -impl Drop for CVec_RouteHopZ { - 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_RouteHopZ { - 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::routing::router::Paths of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PathZ { - /// 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::routing::router::Path, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PathZ { - #[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::routing::router::Path] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PathZ { - 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_PathZ_free(_res: CVec_PathZ) { } -impl Drop for CVec_PathZ { - 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_PathZ { - 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_CVec_BlindedPaymentPathZNoneZ_clone(orig: &CResult_CVec_BlindedPaymentPathZNoneZ) -> CResult_CVec_BlindedPaymentPathZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RouteDecodeErrorZ -pub union CResult_RouteDecodeErrorZPtr { +/// 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::Route, + 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_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_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_RouteDecodeErrorZ { - /// The contents of this CResult_RouteDecodeErrorZ, accessible via either +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_RouteDecodeErrorZPtr, - /// Whether this CResult_RouteDecodeErrorZ represents a success state. + pub contents: CResult_InFlightHtlcsDecodeErrorZPtr, + /// Whether this CResult_InFlightHtlcsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RouteDecodeErrorZ in the success state. -pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ { - CResult_RouteDecodeErrorZ { - contents: CResult_RouteDecodeErrorZPtr { +/// 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_RouteDecodeErrorZ in the error state. -pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ { - CResult_RouteDecodeErrorZ { - contents: CResult_RouteDecodeErrorZPtr { +/// 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, @@ -5163,13 +5108,13 @@ pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::D } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_is_ok(o: &CResult_InFlightHtlcsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RouteDecodeErrorZ. -pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { } -impl Drop for CResult_RouteDecodeErrorZ { +/// 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() } { @@ -5182,16 +5127,16 @@ impl Drop for CResult_RouteDecodeErrorZ { } } } -impl From> for CResult_RouteDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_RouteDecodeErrorZPtr { result } + CResult_InFlightHtlcsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteDecodeErrorZPtr { err } + CResult_InFlightHtlcsDecodeErrorZPtr { err } }; Self { contents, @@ -5199,59 +5144,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_RouteDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InFlightHtlcsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RouteDecodeErrorZ 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. -pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InFlightHtlcsDecodeErrorZ_clone(orig: &CResult_InFlightHtlcsDecodeErrorZ) -> CResult_InFlightHtlcsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RouteParametersDecodeErrorZ -pub union CResult_RouteParametersDecodeErrorZPtr { +/// 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::RouteParameters, + 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_RouteParametersDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::router::RouteParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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_RouteParametersDecodeErrorZ { - /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either +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_RouteParametersDecodeErrorZPtr, - /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state. + pub contents: CResult_RouteHopDecodeErrorZPtr, + /// Whether this CResult_RouteHopDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RouteParametersDecodeErrorZ in the success state. -pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ { - CResult_RouteParametersDecodeErrorZ { - contents: CResult_RouteParametersDecodeErrorZPtr { +/// 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_RouteParametersDecodeErrorZ in the error state. -pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ { - CResult_RouteParametersDecodeErrorZ { - contents: CResult_RouteParametersDecodeErrorZPtr { +/// 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, @@ -5259,13 +5204,13 @@ pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RouteHopDecodeErrorZ_is_ok(o: &CResult_RouteHopDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RouteParametersDecodeErrorZ. -pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { } -impl Drop for CResult_RouteParametersDecodeErrorZ { +/// 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() } { @@ -5278,16 +5223,16 @@ impl Drop for CResult_RouteParametersDecodeErrorZ { } } } -impl From> for CResult_RouteParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_RouteParametersDecodeErrorZPtr { result } + CResult_RouteHopDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteParametersDecodeErrorZPtr { err } + CResult_RouteHopDecodeErrorZPtr { err } }; Self { contents, @@ -5295,47 +5240,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_RouteParametersDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_RouteHopDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_RouteHopDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RouteHopDecodeErrorZ_clone(orig: &CResult_RouteHopDecodeErrorZ) -> CResult_RouteHopDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of u64s of arbitrary size. +/// A dynamically-allocated array of crate::lightning::blinded_path::BlindedHops of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_u64Z { +pub struct CVec_BlindedHopZ { /// The elements in the array. /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). - pub data: *mut u64, + pub data: *mut crate::lightning::blinded_path::BlindedHop, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_u64Z { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_BlindedHopZ { + #[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) -> &[u64] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::blinded_path::BlindedHop] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_u64Z { - fn from(v: Vec) -> Self { +impl From> for CVec_BlindedHopZ { + 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() } } @@ -5343,14 +5288,14 @@ impl From> for CVec_u64Z { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_u64Z_free(_res: CVec_u64Z) { } -impl Drop for CVec_u64Z { +pub extern "C" fn CVec_BlindedHopZ_free(_res: CVec_BlindedHopZ) { } +impl Drop for CVec_BlindedHopZ { 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_u64Z { +impl Clone for CVec_BlindedHopZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -5359,41 +5304,41 @@ impl Clone for CVec_u64Z { } } #[repr(C)] -/// The contents of CResult_PaymentParametersDecodeErrorZ -pub union CResult_PaymentParametersDecodeErrorZPtr { +/// The contents of CResult_BlindedTailDecodeErrorZ +pub union CResult_BlindedTailDecodeErrorZPtr { /// 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::PaymentParameters, + pub result: *mut crate::lightning::routing::router::BlindedTail, /// 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_PaymentParametersDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::router::PaymentParameters on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BlindedTailDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::BlindedTail on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentParametersDecodeErrorZ { - /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either +pub struct CResult_BlindedTailDecodeErrorZ { + /// The contents of this CResult_BlindedTailDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentParametersDecodeErrorZPtr, - /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state. + pub contents: CResult_BlindedTailDecodeErrorZPtr, + /// Whether this CResult_BlindedTailDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. -pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ { - CResult_PaymentParametersDecodeErrorZ { - contents: CResult_PaymentParametersDecodeErrorZPtr { +/// Creates a new CResult_BlindedTailDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedTailDecodeErrorZ_ok(o: crate::lightning::routing::router::BlindedTail) -> CResult_BlindedTailDecodeErrorZ { + CResult_BlindedTailDecodeErrorZ { + contents: CResult_BlindedTailDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. -pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ { - CResult_PaymentParametersDecodeErrorZ { - contents: CResult_PaymentParametersDecodeErrorZPtr { +/// Creates a new CResult_BlindedTailDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedTailDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedTailDecodeErrorZ { + CResult_BlindedTailDecodeErrorZ { + contents: CResult_BlindedTailDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -5401,13 +5346,13 @@ pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BlindedTailDecodeErrorZ_is_ok(o: &CResult_BlindedTailDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. -pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { } -impl Drop for CResult_PaymentParametersDecodeErrorZ { +/// Frees any resources used by the CResult_BlindedTailDecodeErrorZ. +pub extern "C" fn CResult_BlindedTailDecodeErrorZ_free(_res: CResult_BlindedTailDecodeErrorZ) { } +impl Drop for CResult_BlindedTailDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -5420,16 +5365,16 @@ impl Drop for CResult_PaymentParametersDecodeErrorZ { } } } -impl From> for CResult_PaymentParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedTailDecodeErrorZ { + 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_PaymentParametersDecodeErrorZPtr { result } + CResult_BlindedTailDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentParametersDecodeErrorZPtr { err } + CResult_BlindedTailDecodeErrorZPtr { err } }; Self { contents, @@ -5437,47 +5382,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BlindedTailDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BlindedTailDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_BlindedTailDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedTailDecodeErrorZ_clone(orig: &CResult_BlindedTailDecodeErrorZ) -> CResult_BlindedTailDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning_types::routing::RouteHints of arbitrary size. +/// A dynamically-allocated array of crate::lightning::routing::router::RouteHops of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_RouteHintZ { +pub struct CVec_RouteHopZ { /// 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_types::routing::RouteHint, + pub data: *mut crate::lightning::routing::router::RouteHop, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_RouteHintZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_RouteHopZ { + #[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_types::routing::RouteHint] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::router::RouteHop] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_RouteHintZ { - fn from(v: Vec) -> Self { +impl From> for CVec_RouteHopZ { + 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() } } @@ -5485,14 +5430,14 @@ impl From> for CVec_RouteHintZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { } -impl Drop for CVec_RouteHintZ { +pub extern "C" fn CVec_RouteHopZ_free(_res: CVec_RouteHopZ) { } +impl Drop for CVec_RouteHopZ { 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_RouteHintZ { +impl Clone for CVec_RouteHopZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -5501,41 +5446,87 @@ impl Clone for CVec_RouteHintZ { } } #[repr(C)] -/// The contents of CResult_RouteHintDecodeErrorZ -pub union CResult_RouteHintDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::routing::router::Paths of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_PathZ { + /// 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::routing::router::Path, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_PathZ { + #[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::routing::router::Path] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_PathZ { + 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_PathZ_free(_res: CVec_PathZ) { } +impl Drop for CVec_PathZ { + 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_PathZ { + 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_RouteDecodeErrorZ +pub union CResult_RouteDecodeErrorZPtr { /// 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_types::routing::RouteHint, + 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, } #[repr(C)] -/// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::routing::RouteHint on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// 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`. -pub struct CResult_RouteHintDecodeErrorZ { - /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either +pub struct CResult_RouteDecodeErrorZ { + /// The contents of this CResult_RouteDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RouteHintDecodeErrorZPtr, - /// Whether this CResult_RouteHintDecodeErrorZ represents a success state. + pub contents: CResult_RouteDecodeErrorZPtr, + /// Whether this CResult_RouteDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RouteHintDecodeErrorZ in the success state. -pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning_types::routing::RouteHint) -> CResult_RouteHintDecodeErrorZ { - CResult_RouteHintDecodeErrorZ { - contents: CResult_RouteHintDecodeErrorZPtr { +/// Creates a new CResult_RouteDecodeErrorZ in the success state. +pub extern "C" fn CResult_RouteDecodeErrorZ_ok(o: crate::lightning::routing::router::Route) -> CResult_RouteDecodeErrorZ { + CResult_RouteDecodeErrorZ { + contents: CResult_RouteDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RouteHintDecodeErrorZ in the error state. -pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ { - CResult_RouteHintDecodeErrorZ { - contents: CResult_RouteHintDecodeErrorZPtr { +/// Creates a new CResult_RouteDecodeErrorZ in the error state. +pub extern "C" fn CResult_RouteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteDecodeErrorZ { + CResult_RouteDecodeErrorZ { + contents: CResult_RouteDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -5543,13 +5534,13 @@ pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RouteDecodeErrorZ_is_ok(o: &CResult_RouteDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RouteHintDecodeErrorZ. -pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { } -impl Drop for CResult_RouteHintDecodeErrorZ { +/// Frees any resources used by the CResult_RouteDecodeErrorZ. +pub extern "C" fn CResult_RouteDecodeErrorZ_free(_res: CResult_RouteDecodeErrorZ) { } +impl Drop for CResult_RouteDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -5562,16 +5553,16 @@ impl Drop for CResult_RouteHintDecodeErrorZ { } } } -impl From> for CResult_RouteHintDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RouteDecodeErrorZ { + 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_RouteHintDecodeErrorZPtr { result } + CResult_RouteDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteHintDecodeErrorZPtr { err } + CResult_RouteDecodeErrorZPtr { err } }; Self { contents, @@ -5579,59 +5570,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RouteDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_RouteDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_RouteDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RouteDecodeErrorZ_clone(orig: &CResult_RouteDecodeErrorZ) -> CResult_RouteDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RouteHintHopDecodeErrorZ -pub union CResult_RouteHintHopDecodeErrorZPtr { +/// The contents of CResult_RouteParametersDecodeErrorZ +pub union CResult_RouteParametersDecodeErrorZPtr { /// 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_types::routing::RouteHintHop, + pub result: *mut crate::lightning::routing::router::RouteParameters, /// 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_RouteHintHopDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::routing::RouteHintHop on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_RouteParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::RouteParameters 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_RouteHintHopDecodeErrorZ { - /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either +pub struct CResult_RouteParametersDecodeErrorZ { + /// The contents of this CResult_RouteParametersDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RouteHintHopDecodeErrorZPtr, - /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state. + pub contents: CResult_RouteParametersDecodeErrorZPtr, + /// Whether this CResult_RouteParametersDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. -pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning_types::routing::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ { - CResult_RouteHintHopDecodeErrorZ { - contents: CResult_RouteHintHopDecodeErrorZPtr { +/// Creates a new CResult_RouteParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_RouteParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::RouteParameters) -> CResult_RouteParametersDecodeErrorZ { + CResult_RouteParametersDecodeErrorZ { + contents: CResult_RouteParametersDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. -pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ { - CResult_RouteHintHopDecodeErrorZ { - contents: CResult_RouteHintHopDecodeErrorZPtr { +/// Creates a new CResult_RouteParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_RouteParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteParametersDecodeErrorZ { + CResult_RouteParametersDecodeErrorZ { + contents: CResult_RouteParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -5639,13 +5630,13 @@ pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RouteParametersDecodeErrorZ_is_ok(o: &CResult_RouteParametersDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. -pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { } -impl Drop for CResult_RouteHintHopDecodeErrorZ { +/// Frees any resources used by the CResult_RouteParametersDecodeErrorZ. +pub extern "C" fn CResult_RouteParametersDecodeErrorZ_free(_res: CResult_RouteParametersDecodeErrorZ) { } +impl Drop for CResult_RouteParametersDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -5658,16 +5649,16 @@ impl Drop for CResult_RouteHintHopDecodeErrorZ { } } } -impl From> for CResult_RouteHintHopDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RouteParametersDecodeErrorZ { + 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_RouteHintHopDecodeErrorZPtr { result } + CResult_RouteParametersDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RouteHintHopDecodeErrorZPtr { err } + CResult_RouteParametersDecodeErrorZPtr { err } }; Self { contents, @@ -5675,59 +5666,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RouteParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_RouteParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_RouteParametersDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RouteParametersDecodeErrorZ_clone(orig: &CResult_RouteParametersDecodeErrorZ) -> CResult_RouteParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FixedPenaltyScorerDecodeErrorZ -pub union CResult_FixedPenaltyScorerDecodeErrorZPtr { +/// A dynamically-allocated array of u64s of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_u64Z { + /// The elements in the array. + /// If datalen is non-0 this must be a valid, non-NULL pointer allocated by malloc(). + pub data: *mut u64, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_u64Z { + #[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) -> &[u64] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_u64Z { + 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_u64Z_free(_res: CVec_u64Z) { } +impl Drop for CVec_u64Z { + 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_u64Z { + 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_PaymentParametersDecodeErrorZ +pub union CResult_PaymentParametersDecodeErrorZPtr { /// 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::scoring::FixedPenaltyScorer, + pub result: *mut crate::lightning::routing::router::PaymentParameters, /// 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_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PaymentParametersDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::router::PaymentParameters 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_FixedPenaltyScorerDecodeErrorZ { - /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either +pub struct CResult_PaymentParametersDecodeErrorZ { + /// The contents of this CResult_PaymentParametersDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr, - /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state. + pub contents: CResult_PaymentParametersDecodeErrorZPtr, + /// Whether this CResult_PaymentParametersDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. -pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ { - CResult_FixedPenaltyScorerDecodeErrorZ { - contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { +/// Creates a new CResult_PaymentParametersDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_ok(o: crate::lightning::routing::router::PaymentParameters) -> CResult_PaymentParametersDecodeErrorZ { + CResult_PaymentParametersDecodeErrorZ { + contents: CResult_PaymentParametersDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. -pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ { - CResult_FixedPenaltyScorerDecodeErrorZ { - contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { +/// Creates a new CResult_PaymentParametersDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentParametersDecodeErrorZ { + CResult_PaymentParametersDecodeErrorZ { + contents: CResult_PaymentParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -5735,13 +5772,13 @@ pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_is_ok(o: &CResult_PaymentParametersDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. -pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { } -impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ { +/// Frees any resources used by the CResult_PaymentParametersDecodeErrorZ. +pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_free(_res: CResult_PaymentParametersDecodeErrorZ) { } +impl Drop for CResult_PaymentParametersDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -5754,16 +5791,16 @@ impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ { } } } -impl From> for CResult_FixedPenaltyScorerDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaymentParametersDecodeErrorZ { + 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_FixedPenaltyScorerDecodeErrorZPtr { result } + CResult_PaymentParametersDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FixedPenaltyScorerDecodeErrorZPtr { err } + CResult_PaymentParametersDecodeErrorZPtr { err } }; Self { contents, @@ -5771,47 +5808,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PaymentParametersDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PaymentParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PaymentParametersDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaymentParametersDecodeErrorZ_clone(orig: &CResult_PaymentParametersDecodeErrorZ) -> CResult_PaymentParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. +/// A dynamically-allocated array of crate::lightning_types::routing::RouteHints of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_NodeIdZ { +pub struct CVec_RouteHintZ { /// 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::routing::gossip::NodeId, + pub data: *mut crate::lightning_types::routing::RouteHint, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_NodeIdZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_RouteHintZ { + #[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::routing::gossip::NodeId] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning_types::routing::RouteHint] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_NodeIdZ { - fn from(v: Vec) -> Self { +impl From> for CVec_RouteHintZ { + 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() } } @@ -5819,14 +5856,14 @@ impl From> for CVec_NodeIdZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_NodeIdZ_free(_res: CVec_NodeIdZ) { } -impl Drop for CVec_NodeIdZ { +pub extern "C" fn CVec_RouteHintZ_free(_res: CVec_RouteHintZ) { } +impl Drop for CVec_RouteHintZ { 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_NodeIdZ { +impl Clone for CVec_RouteHintZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -5835,249 +5872,41 @@ impl Clone for CVec_NodeIdZ { } } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_u64u64Z { - /// The element at position 0 - pub a: u64, - /// The element at position 1 - pub b: u64, -} -impl From<(u64, u64)> for C2Tuple_u64u64Z { - fn from (tup: (u64, u64)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_u64u64Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_u64u64Z { - 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_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) } -/// Creates a new C2Tuple_u64u64Z from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z { - C2Tuple_u64u64Z { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_u64u64Z. -pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not -pub enum COption_C2Tuple_u64u64ZZ { - /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z - Some(crate::c_types::derived::C2Tuple_u64u64Z), - /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing - None -} -impl COption_C2Tuple_u64u64ZZ { - #[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::derived::C2Tuple_u64u64Z { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z -pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ { - COption_C2Tuple_u64u64ZZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing -pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ { - COption_C2Tuple_u64u64ZZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state -pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { } -#[no_mangle] -/// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_Z { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoU16s, - /// The element at position 1 - pub b: crate::c_types::ThirtyTwoU16s, -} -impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z { - fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) { - (self.a, self.b) - } -} -/// Creates a new C2Tuple_Z from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z { - C2Tuple_Z { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_Z. -pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple__u1632_u1632Z { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoU16s, - /// The element at position 1 - pub b: crate::c_types::ThirtyTwoU16s, -} -impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z { - fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple__u1632_u1632Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) { - (self.a, self.b) - } -} -/// Creates a new C2Tuple__u1632_u1632Z from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z { - C2Tuple__u1632_u1632Z { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple__u1632_u1632Z. -pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { } -#[repr(C)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not -pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { - /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z - Some(crate::c_types::derived::C2Tuple__u1632_u1632Z), - /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing - None -} -impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { - #[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::derived::C2Tuple__u1632_u1632Z { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z -pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { - COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing -pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { - COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state -pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a f64 or not -pub enum COption_f64Z { - /// When we're in this state, this COption_f64Z contains a f64 - Some(f64), - /// When we're in this state, this COption_f64Z contains nothing - None -} -impl COption_f64Z { - #[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) -> f64 { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_f64Z containing a f64 -pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z { - COption_f64Z::Some(o) -} -#[no_mangle] -/// Constructs a new COption_f64Z containing nothing -pub extern "C" fn COption_f64Z_none() -> COption_f64Z { - COption_f64Z::None -} -#[no_mangle] -/// Frees any resources associated with the f64, if we are in the Some state -pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { } -#[no_mangle] -/// Creates a new COption_f64Z which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_ProbabilisticScorerDecodeErrorZ -pub union CResult_ProbabilisticScorerDecodeErrorZPtr { - /// 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::scoring::ProbabilisticScorer, - /// 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, +/// The contents of CResult_RouteHintDecodeErrorZ +pub union CResult_RouteHintDecodeErrorZPtr { + /// 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_types::routing::RouteHint, + /// 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_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_RouteHintDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::routing::RouteHint 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_ProbabilisticScorerDecodeErrorZ { - /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either +pub struct CResult_RouteHintDecodeErrorZ { + /// The contents of this CResult_RouteHintDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr, - /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state. + pub contents: CResult_RouteHintDecodeErrorZPtr, + /// Whether this CResult_RouteHintDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. -pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ { - CResult_ProbabilisticScorerDecodeErrorZ { - contents: CResult_ProbabilisticScorerDecodeErrorZPtr { +/// Creates a new CResult_RouteHintDecodeErrorZ in the success state. +pub extern "C" fn CResult_RouteHintDecodeErrorZ_ok(o: crate::lightning_types::routing::RouteHint) -> CResult_RouteHintDecodeErrorZ { + CResult_RouteHintDecodeErrorZ { + contents: CResult_RouteHintDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. -pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ { - CResult_ProbabilisticScorerDecodeErrorZ { - contents: CResult_ProbabilisticScorerDecodeErrorZPtr { +/// Creates a new CResult_RouteHintDecodeErrorZ in the error state. +pub extern "C" fn CResult_RouteHintDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintDecodeErrorZ { + CResult_RouteHintDecodeErrorZ { + contents: CResult_RouteHintDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -6085,13 +5914,13 @@ pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RouteHintDecodeErrorZ_is_ok(o: &CResult_RouteHintDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. -pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { } -impl Drop for CResult_ProbabilisticScorerDecodeErrorZ { +/// Frees any resources used by the CResult_RouteHintDecodeErrorZ. +pub extern "C" fn CResult_RouteHintDecodeErrorZ_free(_res: CResult_RouteHintDecodeErrorZ) { } +impl Drop for CResult_RouteHintDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -6104,16 +5933,16 @@ impl Drop for CResult_ProbabilisticScorerDecodeErrorZ { } } } -impl From> for CResult_ProbabilisticScorerDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RouteHintDecodeErrorZ { + 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_ProbabilisticScorerDecodeErrorZPtr { result } + CResult_RouteHintDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ProbabilisticScorerDecodeErrorZPtr { err } + CResult_RouteHintDecodeErrorZPtr { err } }; Self { contents, @@ -6121,42 +5950,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_RouteHintDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_RouteHintDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_RouteHintDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_RouteHintDecodeErrorZ_clone(orig: &CResult_RouteHintDecodeErrorZ) -> CResult_RouteHintDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BestBlockDecodeErrorZ -pub union CResult_BestBlockDecodeErrorZPtr { +/// The contents of CResult_RouteHintHopDecodeErrorZ +pub union CResult_RouteHintHopDecodeErrorZPtr { /// 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::BestBlock, + pub result: *mut crate::lightning_types::routing::RouteHintHop, /// 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_BestBlockDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::BestBlock on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_RouteHintHopDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::routing::RouteHintHop 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_BestBlockDecodeErrorZ { - /// The contents of this CResult_BestBlockDecodeErrorZ, accessible via either +pub struct CResult_RouteHintHopDecodeErrorZ { + /// The contents of this CResult_RouteHintHopDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BestBlockDecodeErrorZPtr, - /// Whether this CResult_BestBlockDecodeErrorZ represents a success state. + pub contents: CResult_RouteHintHopDecodeErrorZPtr, + /// Whether this CResult_RouteHintHopDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BestBlockDecodeErrorZ in the success state. -pub extern "C" fn CResult_BestBlockDecodeErrorZ_ok(o: crate::lightning::chain::BestBlock) -> CResult_BestBlockDecodeErrorZ { - CResult_BestBlockDecodeErrorZ { - contents: CResult_BestBlockDecodeErrorZPtr { +/// Creates a new CResult_RouteHintHopDecodeErrorZ in the success state. +pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_ok(o: crate::lightning_types::routing::RouteHintHop) -> CResult_RouteHintHopDecodeErrorZ { + CResult_RouteHintHopDecodeErrorZ { + contents: CResult_RouteHintHopDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BestBlockDecodeErrorZ in the error state. -pub extern "C" fn CResult_BestBlockDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BestBlockDecodeErrorZ { - CResult_BestBlockDecodeErrorZ { - contents: CResult_BestBlockDecodeErrorZPtr { +/// Creates a new CResult_RouteHintHopDecodeErrorZ in the error state. +pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RouteHintHopDecodeErrorZ { + CResult_RouteHintHopDecodeErrorZ { + contents: CResult_RouteHintHopDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -6164,13 +6010,13 @@ pub extern "C" fn CResult_BestBlockDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BestBlockDecodeErrorZ_is_ok(o: &CResult_BestBlockDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_is_ok(o: &CResult_RouteHintHopDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BestBlockDecodeErrorZ. -pub extern "C" fn CResult_BestBlockDecodeErrorZ_free(_res: CResult_BestBlockDecodeErrorZ) { } -impl Drop for CResult_BestBlockDecodeErrorZ { +/// Frees any resources used by the CResult_RouteHintHopDecodeErrorZ. +pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_free(_res: CResult_RouteHintHopDecodeErrorZ) { } +impl Drop for CResult_RouteHintHopDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -6183,16 +6029,16 @@ impl Drop for CResult_BestBlockDecodeErrorZ { } } } -impl From> for CResult_BestBlockDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RouteHintHopDecodeErrorZ { + 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_BestBlockDecodeErrorZPtr { result } + CResult_RouteHintHopDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BestBlockDecodeErrorZPtr { err } + CResult_RouteHintHopDecodeErrorZPtr { err } }; Self { contents, @@ -6200,89 +6046,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BestBlockDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RouteHintHopDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BestBlockDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_RouteHintHopDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BestBlockDecodeErrorZ_clone(orig: &CResult_BestBlockDecodeErrorZ) -> CResult_BestBlockDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_usizeTransactionZ { - /// The element at position 0 - pub a: usize, - /// The element at position 1 - pub b: crate::c_types::Transaction, -} -impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ { - fn from (tup: (usize, crate::c_types::Transaction)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_usizeTransactionZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_usizeTransactionZ { - 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` +/// Creates a new CResult_RouteHintHopDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_usizeTransactionZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ { - C2Tuple_usizeTransactionZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_usizeTransactionZ. -pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { } +pub extern "C" fn CResult_RouteHintHopDecodeErrorZ_clone(orig: &CResult_RouteHintHopDecodeErrorZ) -> CResult_RouteHintHopDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::PublicKeys of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_usizeTransactionZZ { +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::derived::C2Tuple_usizeTransactionZ, + pub data: *mut crate::c_types::PublicKey, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_usizeTransactionZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +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::derived::C2Tuple_usizeTransactionZ] { + #[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_C2Tuple_usizeTransactionZZ { - fn from(v: Vec) -> Self { +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() } } @@ -6290,14 +6094,14 @@ impl From> for CVec_C2Tu } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { } -impl Drop for CVec_C2Tuple_usizeTransactionZZ { +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_C2Tuple_usizeTransactionZZ { +impl Clone for CVec_PublicKeyZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -6306,75 +6110,125 @@ impl Clone for CVec_C2Tuple_usizeTransactionZZ { } } #[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { - /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, - /// The element at position 1 - pub b: u32, - /// The element at position 2 - pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ, +/// The contents of CResult_FixedPenaltyScorerDecodeErrorZ +pub union CResult_FixedPenaltyScorerDecodeErrorZPtr { + /// 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::scoring::FixedPenaltyScorer, + /// 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, } -impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, +#[repr(C)] +/// A CResult_FixedPenaltyScorerDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::scoring::FixedPenaltyScorer on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_FixedPenaltyScorerDecodeErrorZ { + /// The contents of this CResult_FixedPenaltyScorerDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_FixedPenaltyScorerDecodeErrorZPtr, + /// Whether this CResult_FixedPenaltyScorerDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the success state. +pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::FixedPenaltyScorer) -> CResult_FixedPenaltyScorerDecodeErrorZ { + CResult_FixedPenaltyScorerDecodeErrorZ { + contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_FixedPenaltyScorerDecodeErrorZ in the error state. +pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FixedPenaltyScorerDecodeErrorZ { + CResult_FixedPenaltyScorerDecodeErrorZ { + contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { + 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_FixedPenaltyScorerDecodeErrorZ_is_ok(o: &CResult_FixedPenaltyScorerDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_FixedPenaltyScorerDecodeErrorZ. +pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_free(_res: CResult_FixedPenaltyScorerDecodeErrorZ) { } +impl Drop for CResult_FixedPenaltyScorerDecodeErrorZ { + 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 C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) { - (self.a, self.b, self.c) +impl From> for CResult_FixedPenaltyScorerDecodeErrorZ { + 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_FixedPenaltyScorerDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_FixedPenaltyScorerDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { +impl Clone for CResult_FixedPenaltyScorerDecodeErrorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), + if self.result_ok { + Self { result_ok: true, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_FixedPenaltyScorerDecodeErrorZPtr { + 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_FixedPenaltyScorerDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: u32, c: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { - C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ. -pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { } +pub extern "C" fn CResult_FixedPenaltyScorerDecodeErrorZ_clone(orig: &CResult_FixedPenaltyScorerDecodeErrorZ) -> CResult_FixedPenaltyScorerDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size. +/// A dynamically-allocated array of crate::lightning::routing::gossip::NodeIds of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { +pub struct CVec_NodeIdZ { /// 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::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ, + pub data: *mut crate::lightning::routing::gossip::NodeId, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_NodeIdZ { + #[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::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::routing::gossip::NodeId] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_NodeIdZ { + 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() } } @@ -6382,14 +6236,14 @@ impl From Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -6398,275 +6252,249 @@ impl Clone for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { } } #[repr(C)] -/// The contents of CResult_ChannelMonitorUpdateStatusNoneZ -pub union CResult_ChannelMonitorUpdateStatusNoneZPtr { - /// 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::ChannelMonitorUpdateStatus, - /// 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_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelMonitorUpdateStatusNoneZ { - /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr, - /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. -pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ { - CResult_ChannelMonitorUpdateStatusNoneZ { - contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. -pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ { - CResult_ChannelMonitorUpdateStatusNoneZ { - contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { - 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_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool { - o.result_ok +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u64u64Z { + /// The element at position 0 + pub a: u64, + /// The element at position 1 + pub b: u64, } -#[no_mangle] -/// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. -pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { } -impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ { - 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<(u64, u64)> for C2Tuple_u64u64Z { + fn from (tup: (u64, u64)) -> Self { + Self { + a: tup.0, + b: tup.1, } } } -impl From> for CResult_ChannelMonitorUpdateStatusNoneZ { - 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_ChannelMonitorUpdateStatusNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl C2Tuple_u64u64Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u64) { + (self.a, self.b) } } -impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ { +impl Clone for C2Tuple_u64u64Z { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { - err: core::ptr::null_mut() - } } + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), } } } #[no_mangle] -/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ 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_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) } +pub extern "C" fn C2Tuple_u64u64Z_clone(orig: &C2Tuple_u64u64Z) -> C2Tuple_u64u64Z { Clone::clone(&orig) } +/// Creates a new C2Tuple_u64u64Z from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_u64u64Z_new(a: u64, b: u64) -> C2Tuple_u64u64Z { + C2Tuple_u64u64Z { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_u64u64Z. +pub extern "C" fn C2Tuple_u64u64Z_free(_res: C2Tuple_u64u64Z) { } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_MonitorEventZ { - /// 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::MonitorEvent, - /// The number of elements pointed to by `data`. - pub datalen: usize +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u64Z or not +pub enum COption_C2Tuple_u64u64ZZ { + /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains a crate::c_types::derived::C2Tuple_u64u64Z + Some(crate::c_types::derived::C2Tuple_u64u64Z), + /// When we're in this state, this COption_C2Tuple_u64u64ZZ contains nothing + None } -impl CVec_MonitorEventZ { - #[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 +impl COption_C2Tuple_u64u64ZZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::chain::channelmonitor::MonitorEvent] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl From> for CVec_MonitorEventZ { - 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() } } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u64Z { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_MonitorEventZ_free(_res: CVec_MonitorEventZ) { } -impl Drop for CVec_MonitorEventZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } +/// Constructs a new COption_C2Tuple_u64u64ZZ containing a crate::c_types::derived::C2Tuple_u64u64Z +pub extern "C" fn COption_C2Tuple_u64u64ZZ_some(o: crate::c_types::derived::C2Tuple_u64u64Z) -> COption_C2Tuple_u64u64ZZ { + COption_C2Tuple_u64u64ZZ::Some(o) } -impl Clone for CVec_MonitorEventZ { - 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] +/// Constructs a new COption_C2Tuple_u64u64ZZ containing nothing +pub extern "C" fn COption_C2Tuple_u64u64ZZ_none() -> COption_C2Tuple_u64u64ZZ { + COption_C2Tuple_u64u64ZZ::None } +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u64Z, if we are in the Some state +pub extern "C" fn COption_C2Tuple_u64u64ZZ_free(_res: COption_C2Tuple_u64u64ZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_u64u64ZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_u64u64ZZ_clone(orig: &COption_C2Tuple_u64u64ZZ) -> COption_C2Tuple_u64u64ZZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 4 elements. See the individual fields for the types contained. -pub struct C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_Z { /// The element at position 0 - pub a: crate::lightning::chain::transaction::OutPoint, + pub a: crate::c_types::ThirtyTwoU16s, /// The element at position 1 - pub b: crate::lightning::ln::types::ChannelId, - /// The element at position 2 - pub c: crate::c_types::derived::CVec_MonitorEventZ, - /// The element at position 3 - pub d: crate::c_types::PublicKey, + pub b: crate::c_types::ThirtyTwoU16s, } -impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { - fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self { +impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple_Z { + fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self { Self { a: tup.0, b: tup.1, - c: tup.2, - d: tup.3, } } } -impl C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) { - (self.a, self.b, self.c, self.d) +impl C2Tuple_Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) { + (self.a, self.b) } } -impl Clone for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { - fn clone(&self) -> Self { +/// Creates a new C2Tuple_Z from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple_Z { + C2Tuple_Z { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_Z. +pub extern "C" fn C2Tuple_Z_free(_res: C2Tuple_Z) { } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple__u1632_u1632Z { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoU16s, + /// The element at position 1 + pub b: crate::c_types::ThirtyTwoU16s, +} +impl From<(crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)> for C2Tuple__u1632_u1632Z { + fn from (tup: (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s)) -> Self { Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), - d: Clone::clone(&self.d), + a: tup.0, + b: tup.1, } } } +impl C2Tuple__u1632_u1632Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoU16s, crate::c_types::ThirtyTwoU16s) { + (self.a, self.b) + } +} +/// Creates a new C2Tuple__u1632_u1632Z from the contained elements. #[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 C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig: &C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) } -/// Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements. -#[no_mangle] -pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId, c: crate::c_types::derived::CVec_MonitorEventZ, d: crate::c_types::PublicKey) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { - C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { a, b, c, d, } +pub extern "C" fn C2Tuple__u1632_u1632Z_new(a: crate::c_types::ThirtyTwoU16s, b: crate::c_types::ThirtyTwoU16s) -> C2Tuple__u1632_u1632Z { + C2Tuple__u1632_u1632Z { a, b, } } #[no_mangle] -/// Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ. -pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res: C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) { } +/// Frees any resources used by the C2Tuple__u1632_u1632Z. +pub extern "C" fn C2Tuple__u1632_u1632Z_free(_res: C2Tuple__u1632_u1632Z) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { - /// 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::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// An enum which can either contain a crate::c_types::derived::C2Tuple__u1632_u1632Z or not +pub enum COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains a crate::c_types::derived::C2Tuple__u1632_u1632Z + Some(crate::c_types::derived::C2Tuple__u1632_u1632Z), + /// When we're in this state, this COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ contains nothing + None } -impl CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { - #[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 +impl COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl From> for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { - 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() } } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple__u1632_u1632Z { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ) { } -impl Drop for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } +/// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing a crate::c_types::derived::C2Tuple__u1632_u1632Z +pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_some(o: crate::c_types::derived::C2Tuple__u1632_u1632Z) -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::Some(o) } -impl Clone for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { - 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] +/// Constructs a new COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ containing nothing +pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_none() -> COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ { + COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple__u1632_u1632Z, if we are in the Some state +pub extern "C" fn COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ_free(_res: COption_C2Tuple_ThirtyTwoU16sThirtyTwoU16sZZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a f64 or not +pub enum COption_f64Z { + /// When we're in this state, this COption_f64Z contains a f64 + Some(f64), + /// When we're in this state, this COption_f64Z contains nothing + None +} +impl COption_f64Z { + #[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) -> f64 { + if let Self::Some(v) = self { v } else { unreachable!() } } } +#[no_mangle] +/// Constructs a new COption_f64Z containing a f64 +pub extern "C" fn COption_f64Z_some(o: f64) -> COption_f64Z { + COption_f64Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_f64Z containing nothing +pub extern "C" fn COption_f64Z_none() -> COption_f64Z { + COption_f64Z::None +} +#[no_mangle] +/// Frees any resources associated with the f64, if we are in the Some state +pub extern "C" fn COption_f64Z_free(_res: COption_f64Z) { } +#[no_mangle] +/// Creates a new COption_f64Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_f64Z_clone(orig: &COption_f64Z) -> COption_f64Z { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InitFeaturesDecodeErrorZ -pub union CResult_InitFeaturesDecodeErrorZPtr { +/// The contents of CResult_ProbabilisticScorerDecodeErrorZ +pub union CResult_ProbabilisticScorerDecodeErrorZPtr { /// 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_types::features::InitFeatures, + pub result: *mut crate::lightning::routing::scoring::ProbabilisticScorer, /// 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_InitFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ProbabilisticScorerDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::scoring::ProbabilisticScorer on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_InitFeaturesDecodeErrorZ { - /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either +pub struct CResult_ProbabilisticScorerDecodeErrorZ { + /// The contents of this CResult_ProbabilisticScorerDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InitFeaturesDecodeErrorZPtr, - /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_ProbabilisticScorerDecodeErrorZPtr, + /// Whether this CResult_ProbabilisticScorerDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ { - CResult_InitFeaturesDecodeErrorZ { - contents: CResult_InitFeaturesDecodeErrorZPtr { +/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the success state. +pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_ok(o: crate::lightning::routing::scoring::ProbabilisticScorer) -> CResult_ProbabilisticScorerDecodeErrorZ { + CResult_ProbabilisticScorerDecodeErrorZ { + contents: CResult_ProbabilisticScorerDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ { - CResult_InitFeaturesDecodeErrorZ { - contents: CResult_InitFeaturesDecodeErrorZPtr { +/// Creates a new CResult_ProbabilisticScorerDecodeErrorZ in the error state. +pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ProbabilisticScorerDecodeErrorZ { + CResult_ProbabilisticScorerDecodeErrorZ { + contents: CResult_ProbabilisticScorerDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -6674,13 +6502,13 @@ pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_is_ok(o: &CResult_ProbabilisticScorerDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { } -impl Drop for CResult_InitFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_ProbabilisticScorerDecodeErrorZ. +pub extern "C" fn CResult_ProbabilisticScorerDecodeErrorZ_free(_res: CResult_ProbabilisticScorerDecodeErrorZ) { } +impl Drop for CResult_ProbabilisticScorerDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -6693,16 +6521,16 @@ impl Drop for CResult_InitFeaturesDecodeErrorZ { } } } -impl From> for CResult_InitFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ProbabilisticScorerDecodeErrorZ { + 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_InitFeaturesDecodeErrorZPtr { result } + CResult_ProbabilisticScorerDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InitFeaturesDecodeErrorZPtr { err } + CResult_ProbabilisticScorerDecodeErrorZPtr { err } }; Self { contents, @@ -6710,59 +6538,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelFeaturesDecodeErrorZ -pub union CResult_ChannelFeaturesDecodeErrorZPtr { +/// The contents of CResult_BestBlockDecodeErrorZ +pub union CResult_BestBlockDecodeErrorZPtr { /// 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_types::features::ChannelFeatures, + pub result: *mut crate::lightning::chain::BestBlock, /// 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_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BestBlockDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::BestBlock 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_ChannelFeaturesDecodeErrorZ { - /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either +pub struct CResult_BestBlockDecodeErrorZ { + /// The contents of this CResult_BestBlockDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelFeaturesDecodeErrorZPtr, - /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_BestBlockDecodeErrorZPtr, + /// Whether this CResult_BestBlockDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ { - CResult_ChannelFeaturesDecodeErrorZ { - contents: CResult_ChannelFeaturesDecodeErrorZPtr { +/// Creates a new CResult_BestBlockDecodeErrorZ in the success state. +pub extern "C" fn CResult_BestBlockDecodeErrorZ_ok(o: crate::lightning::chain::BestBlock) -> CResult_BestBlockDecodeErrorZ { + CResult_BestBlockDecodeErrorZ { + contents: CResult_BestBlockDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ { - CResult_ChannelFeaturesDecodeErrorZ { - contents: CResult_ChannelFeaturesDecodeErrorZPtr { +/// Creates a new CResult_BestBlockDecodeErrorZ in the error state. +pub extern "C" fn CResult_BestBlockDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BestBlockDecodeErrorZ { + CResult_BestBlockDecodeErrorZ { + contents: CResult_BestBlockDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -6770,13 +6581,13 @@ pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BestBlockDecodeErrorZ_is_ok(o: &CResult_BestBlockDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { } -impl Drop for CResult_ChannelFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_BestBlockDecodeErrorZ. +pub extern "C" fn CResult_BestBlockDecodeErrorZ_free(_res: CResult_BestBlockDecodeErrorZ) { } +impl Drop for CResult_BestBlockDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -6789,16 +6600,16 @@ impl Drop for CResult_ChannelFeaturesDecodeErrorZ { } } } -impl From> for CResult_ChannelFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BestBlockDecodeErrorZ { + 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_ChannelFeaturesDecodeErrorZPtr { result } + CResult_BestBlockDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelFeaturesDecodeErrorZPtr { err } + CResult_BestBlockDecodeErrorZPtr { err } }; Self { contents, @@ -6806,251 +6617,473 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BestBlockDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BestBlockDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_BestBlockDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BestBlockDecodeErrorZ_clone(orig: &CResult_BestBlockDecodeErrorZ) -> CResult_BestBlockDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeFeaturesDecodeErrorZ -pub union CResult_NodeFeaturesDecodeErrorZPtr { - /// 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_types::features::NodeFeatures, - /// 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, +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_usizeTransactionZ { + /// The element at position 0 + pub a: usize, + /// The element at position 1 + pub b: crate::c_types::Transaction, } -#[repr(C)] -/// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeFeaturesDecodeErrorZ { - /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeFeaturesDecodeErrorZPtr, - /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. - pub result_ok: bool, +impl From<(usize, crate::c_types::Transaction)> for C2Tuple_usizeTransactionZ { + fn from (tup: (usize, crate::c_types::Transaction)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } } -#[no_mangle] -/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ { - CResult_NodeFeaturesDecodeErrorZ { - contents: CResult_NodeFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl C2Tuple_usizeTransactionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (usize, crate::c_types::Transaction) { + (self.a, self.b) } } -#[no_mangle] -/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ { - CResult_NodeFeaturesDecodeErrorZ { - contents: CResult_NodeFeaturesDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +impl Clone for C2Tuple_usizeTransactionZ { + 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_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> 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_usizeTransactionZ_clone(orig: &C2Tuple_usizeTransactionZ) -> C2Tuple_usizeTransactionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_usizeTransactionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_usizeTransactionZ_new(a: usize, b: crate::c_types::Transaction) -> C2Tuple_usizeTransactionZ { + C2Tuple_usizeTransactionZ { a, b, } } + #[no_mangle] -/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. -pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { } -impl Drop for CResult_NodeFeaturesDecodeErrorZ { +/// Frees any resources used by the C2Tuple_usizeTransactionZ. +pub extern "C" fn C2Tuple_usizeTransactionZ_free(_res: C2Tuple_usizeTransactionZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_usizeTransactionZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_usizeTransactionZZ { + /// 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_usizeTransactionZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_usizeTransactionZZ { + #[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_usizeTransactionZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_usizeTransactionZZ { + 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_usizeTransactionZZ_free(_res: CVec_C2Tuple_usizeTransactionZZ) { } +impl Drop for CVec_C2Tuple_usizeTransactionZZ { 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_NodeFeaturesDecodeErrorZ { - 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_NodeFeaturesDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeFeaturesDecodeErrorZPtr { err } - }; +impl Clone for CVec_C2Tuple_usizeTransactionZZ { + 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 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: u32, + /// The element at position 2 + pub c: crate::c_types::derived::COption_ThirtyTwoBytesZ, +} +impl From<(crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)> for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ)) -> Self { Self { - contents, - result_ok: o.result_ok, + a: tup.0, + b: tup.1, + c: tup.2, } } } -impl Clone for CResult_NodeFeaturesDecodeErrorZ { +impl C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, u32, crate::c_types::derived::COption_ThirtyTwoBytesZ) { + (self.a, self.b, self.c) + } +} +impl Clone for C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), } } } #[no_mangle] -/// Creates a new CResult_NodeFeaturesDecodeErrorZ 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_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_clone(orig: &C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ from the contained elements. +#[no_mangle] +pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_new(a: crate::c_types::ThirtyTwoBytes, b: u32, c: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { + C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ { a, b, c, } +} + +#[no_mangle] +/// Frees any resources used by the C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ. +pub extern "C" fn C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ_free(_res: C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ) { } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ -pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { +/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { + /// 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::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { + #[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::C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { + 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_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ_free(_res: CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ) { } +impl Drop for CVec_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { + 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_C3Tuple_ThirtyTwoBytesu32COption_ThirtyTwoBytesZZZ { + 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_ChannelMonitorUpdateStatusNoneZ +pub union CResult_ChannelMonitorUpdateStatusNoneZPtr { /// 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_types::features::Bolt11InvoiceFeatures, - /// 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::chain::ChannelMonitorUpdateStatus, + /// 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_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::Bolt11InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelMonitorUpdateStatusNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::ChannelMonitorUpdateStatus on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either +pub struct CResult_ChannelMonitorUpdateStatusNoneZ { + /// The contents of this CResult_ChannelMonitorUpdateStatusNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr, - /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_ChannelMonitorUpdateStatusNoneZPtr, + /// Whether this CResult_ChannelMonitorUpdateStatusNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { +/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the success state. +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_ok(o: crate::lightning::chain::ChannelMonitorUpdateStatus) -> CResult_ChannelMonitorUpdateStatusNoneZ { + CResult_ChannelMonitorUpdateStatusNoneZ { + contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ in the error state. +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_err() -> CResult_ChannelMonitorUpdateStatusNoneZ { + CResult_ChannelMonitorUpdateStatusNoneZ { + contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { + 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_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_is_ok(o: &CResult_ChannelMonitorUpdateStatusNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { } -impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelMonitorUpdateStatusNoneZ. +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_free(_res: CResult_ChannelMonitorUpdateStatusNoneZ) { } +impl Drop for CResult_ChannelMonitorUpdateStatusNoneZ { 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_Bolt11InvoiceFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelMonitorUpdateStatusNoneZ { + 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_Bolt11InvoiceFeaturesDecodeErrorZPtr { result } + CResult_ChannelMonitorUpdateStatusNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err } - }; - Self { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_ChannelMonitorUpdateStatusNoneZPtr { err: core::ptr::null_mut() } + }; + Self { contents, result_ok: o.result_ok, } } } -impl Clone for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { +impl Clone for CResult_ChannelMonitorUpdateStatusNoneZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelMonitorUpdateStatusNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelMonitorUpdateStatusNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelMonitorUpdateStatusNoneZ_clone(orig: &CResult_ChannelMonitorUpdateStatusNoneZ) -> CResult_ChannelMonitorUpdateStatusNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ -pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::chain::channelmonitor::MonitorEvents of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_MonitorEventZ { + /// 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::MonitorEvent, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_MonitorEventZ { + #[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::MonitorEvent] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_MonitorEventZ { + 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_MonitorEventZ_free(_res: CVec_MonitorEventZ) { } +impl Drop for CVec_MonitorEventZ { + 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_MonitorEventZ { + 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 4 elements. See the individual fields for the types contained. +pub struct C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { + /// The element at position 0 + pub a: crate::lightning::chain::transaction::OutPoint, + /// The element at position 1 + pub b: crate::lightning::ln::types::ChannelId, + /// The element at position 2 + pub c: crate::c_types::derived::CVec_MonitorEventZ, + /// The element at position 3 + pub d: crate::c_types::PublicKey, +} +impl From<(crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)> for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { + fn from (tup: (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + d: tup.3, + } + } +} +impl C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::chain::transaction::OutPoint, crate::lightning::ln::types::ChannelId, crate::c_types::derived::CVec_MonitorEventZ, crate::c_types::PublicKey) { + (self.a, self.b, self.c, self.d) + } +} +impl Clone for C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), + d: Clone::clone(&self.d), + } + } +} +#[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 C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_clone(orig: &C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { Clone::clone(&orig) } +/// Creates a new C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ from the contained elements. +#[no_mangle] +pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_new(a: crate::lightning::chain::transaction::OutPoint, b: crate::lightning::ln::types::ChannelId, c: crate::c_types::derived::CVec_MonitorEventZ, d: crate::c_types::PublicKey) -> C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { + C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ { a, b, c, d, } +} + +#[no_mangle] +/// Frees any resources used by the C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ. +pub extern "C" fn C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ_free(_res: C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { + /// 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::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { + #[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::C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { + 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_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ_free(_res: CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ) { } +impl Drop for CVec_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { + 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_C4Tuple_OutPointChannelIdCVec_MonitorEventZPublicKeyZZ { + 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_OfferIdDecodeErrorZ +pub union CResult_OfferIdDecodeErrorZPtr { /// 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_types::features::Bolt12InvoiceFeatures, + pub result: *mut crate::lightning::offers::offer::OfferId, /// 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_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::Bolt12InvoiceFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::OfferId 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_Bolt12InvoiceFeaturesDecodeErrorZ { - /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either +pub struct CResult_OfferIdDecodeErrorZ { + /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr, - /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_OfferIdDecodeErrorZPtr, + /// Whether this CResult_OfferIdDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { +/// Creates a new CResult_OfferIdDecodeErrorZ in the success state. +pub extern "C" fn CResult_OfferIdDecodeErrorZ_ok(o: crate::lightning::offers::offer::OfferId) -> CResult_OfferIdDecodeErrorZ { + CResult_OfferIdDecodeErrorZ { + contents: CResult_OfferIdDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { +/// Creates a new CResult_OfferIdDecodeErrorZ in the error state. +pub extern "C" fn CResult_OfferIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferIdDecodeErrorZ { + CResult_OfferIdDecodeErrorZ { + contents: CResult_OfferIdDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7058,13 +7091,13 @@ pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OfferIdDecodeErrorZ_is_ok(o: &CResult_OfferIdDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { } -impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_OfferIdDecodeErrorZ. +pub extern "C" fn CResult_OfferIdDecodeErrorZ_free(_res: CResult_OfferIdDecodeErrorZ) { } +impl Drop for CResult_OfferIdDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7077,16 +7110,16 @@ impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { } } } -impl From> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OfferIdDecodeErrorZ { + 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_Bolt12InvoiceFeaturesDecodeErrorZPtr { result } + CResult_OfferIdDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err } + CResult_OfferIdDecodeErrorZPtr { err } }; Self { contents, @@ -7094,59 +7127,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OfferIdDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OfferIdDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OfferIdDecodeErrorZ_clone(orig: &CResult_OfferIdDecodeErrorZ) -> CResult_OfferIdDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BlindedHopFeaturesDecodeErrorZ -pub union CResult_BlindedHopFeaturesDecodeErrorZPtr { - /// 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_types::features::BlindedHopFeatures, +/// The contents of CResult_NoneBolt12SemanticErrorZ +pub union CResult_NoneBolt12SemanticErrorZPtr { + /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BlindedHopFeaturesDecodeErrorZ { - /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either +pub struct CResult_NoneBolt12SemanticErrorZ { + /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr, - /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_NoneBolt12SemanticErrorZPtr, + /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ { - CResult_BlindedHopFeaturesDecodeErrorZ { - contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ { + CResult_NoneBolt12SemanticErrorZ { + contents: CResult_NoneBolt12SemanticErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ { - CResult_BlindedHopFeaturesDecodeErrorZ { - contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { +/// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ { + CResult_NoneBolt12SemanticErrorZ { + contents: CResult_NoneBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7154,18 +7186,15 @@ pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { } -impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ. +pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { } +impl Drop for CResult_NoneBolt12SemanticErrorZ { 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) }; @@ -7173,16 +7202,16 @@ impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ { } } } -impl From> for CResult_BlindedHopFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneBolt12SemanticErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_BlindedHopFeaturesDecodeErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BlindedHopFeaturesDecodeErrorZPtr { err } + CResult_NoneBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -7190,59 +7219,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ -pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr { +/// The contents of CResult_OfferBolt12SemanticErrorZ +pub union CResult_OfferBolt12SemanticErrorZPtr { /// 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_types::features::ChannelTypeFeatures, + pub result: *mut crate::lightning::offers::offer::Offer, /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OfferBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelTypeFeaturesDecodeErrorZ { - /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either +pub struct CResult_OfferBolt12SemanticErrorZ { + /// The contents of this CResult_OfferBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr, - /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. + pub contents: CResult_OfferBolt12SemanticErrorZPtr, + /// Whether this CResult_OfferBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ { - CResult_ChannelTypeFeaturesDecodeErrorZ { - contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { +/// Creates a new CResult_OfferBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12SemanticErrorZ { + CResult_OfferBolt12SemanticErrorZ { + contents: CResult_OfferBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ { - CResult_ChannelTypeFeaturesDecodeErrorZ { - contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { +/// Creates a new CResult_OfferBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferBolt12SemanticErrorZ { + CResult_OfferBolt12SemanticErrorZ { + contents: CResult_OfferBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7250,13 +7279,13 @@ pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_is_ok(o: &CResult_OfferBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. -pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { } -impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ { +/// Frees any resources used by the CResult_OfferBolt12SemanticErrorZ. +pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_free(_res: CResult_OfferBolt12SemanticErrorZ) { } +impl Drop for CResult_OfferBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7269,16 +7298,16 @@ impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ { } } } -impl From> for CResult_ChannelTypeFeaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OfferBolt12SemanticErrorZ { + 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_ChannelTypeFeaturesDecodeErrorZPtr { result } + CResult_OfferBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelTypeFeaturesDecodeErrorZPtr { err } + CResult_OfferBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -7286,59 +7315,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OfferBolt12SemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_OfferBolt12SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig` /// 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) } +pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_clone(orig: &CResult_OfferBolt12SemanticErrorZ) -> CResult_OfferBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OfferIdDecodeErrorZ -pub union CResult_OfferIdDecodeErrorZPtr { +/// The contents of CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ +pub union CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr { /// 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::offers::offer::OfferId, + pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_OfferIdDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::offer::OfferId on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OfferIdDecodeErrorZ { - /// The contents of this CResult_OfferIdDecodeErrorZ, accessible via either +pub struct CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + /// The contents of this CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OfferIdDecodeErrorZPtr, - /// Whether this CResult_OfferIdDecodeErrorZ represents a success state. + pub contents: CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OfferIdDecodeErrorZ in the success state. -pub extern "C" fn CResult_OfferIdDecodeErrorZ_ok(o: crate::lightning::offers::offer::OfferId) -> CResult_OfferIdDecodeErrorZ { - CResult_OfferIdDecodeErrorZ { - contents: CResult_OfferIdDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder) -> CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OfferIdDecodeErrorZ in the error state. -pub extern "C" fn CResult_OfferIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferIdDecodeErrorZ { - CResult_OfferIdDecodeErrorZ { - contents: CResult_OfferIdDecodeErrorZPtr { +/// Creates a new CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7346,13 +7375,13 @@ pub extern "C" fn CResult_OfferIdDecodeErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OfferIdDecodeErrorZ_is_ok(o: &CResult_OfferIdDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OfferIdDecodeErrorZ. -pub extern "C" fn CResult_OfferIdDecodeErrorZ_free(_res: CResult_OfferIdDecodeErrorZ) { } -impl Drop for CResult_OfferIdDecodeErrorZ { +/// Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ. +pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ) { } +impl Drop for CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7365,16 +7394,16 @@ impl Drop for CResult_OfferIdDecodeErrorZ { } } } -impl From> for CResult_OfferIdDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + 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_OfferIdDecodeErrorZPtr { result } + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OfferIdDecodeErrorZPtr { err } + CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -7382,58 +7411,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_OfferIdDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_OfferIdDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_OfferIdDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OfferIdDecodeErrorZ_clone(orig: &CResult_OfferIdDecodeErrorZ) -> CResult_OfferIdDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneBolt12SemanticErrorZ -pub union CResult_NoneBolt12SemanticErrorZPtr { - /// 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_OfferDecodeErrorZ +pub union CResult_OfferDecodeErrorZPtr { + /// 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::offers::offer::Offer, /// 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_NoneBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_OfferDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::Offer 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_NoneBolt12SemanticErrorZ { - /// The contents of this CResult_NoneBolt12SemanticErrorZ, accessible via either +pub struct CResult_OfferDecodeErrorZ { + /// The contents of this CResult_OfferDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneBolt12SemanticErrorZPtr, - /// Whether this CResult_NoneBolt12SemanticErrorZ represents a success state. + pub contents: CResult_OfferDecodeErrorZPtr, + /// Whether this CResult_OfferDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_ok() -> CResult_NoneBolt12SemanticErrorZ { - CResult_NoneBolt12SemanticErrorZ { - contents: CResult_NoneBolt12SemanticErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_OfferDecodeErrorZ in the success state. +pub extern "C" fn CResult_OfferDecodeErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferDecodeErrorZ { + CResult_OfferDecodeErrorZ { + contents: CResult_OfferDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_NoneBolt12SemanticErrorZ { - CResult_NoneBolt12SemanticErrorZ { - contents: CResult_NoneBolt12SemanticErrorZPtr { +/// Creates a new CResult_OfferDecodeErrorZ in the error state. +pub extern "C" fn CResult_OfferDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferDecodeErrorZ { + CResult_OfferDecodeErrorZ { + contents: CResult_OfferDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7441,15 +7454,18 @@ pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_err(e: crate::lightning::offe } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_is_ok(o: &CResult_NoneBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_OfferDecodeErrorZ_is_ok(o: &CResult_OfferDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneBolt12SemanticErrorZ. -pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_free(_res: CResult_NoneBolt12SemanticErrorZ) { } -impl Drop for CResult_NoneBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_OfferDecodeErrorZ. +pub extern "C" fn CResult_OfferDecodeErrorZ_free(_res: CResult_OfferDecodeErrorZ) { } +impl Drop for CResult_OfferDecodeErrorZ { 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) }; @@ -7457,16 +7473,16 @@ impl Drop for CResult_NoneBolt12SemanticErrorZ { } } } -impl From> for CResult_NoneBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::offers::parse::Bolt12SemanticError>) -> Self { +impl From> for CResult_OfferDecodeErrorZ { + 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_NoneBolt12SemanticErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_OfferDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneBolt12SemanticErrorZPtr { err } + CResult_OfferDecodeErrorZPtr { err } }; Self { contents, @@ -7474,59 +7490,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneBolt12SemanticErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_OfferDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_OfferDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneBolt12SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneBolt12SemanticErrorZ_clone(orig: &CResult_NoneBolt12SemanticErrorZ) -> CResult_NoneBolt12SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OfferDecodeErrorZ_clone(orig: &CResult_OfferDecodeErrorZ) -> CResult_OfferDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OfferBolt12SemanticErrorZ -pub union CResult_OfferBolt12SemanticErrorZPtr { +/// The contents of CResult_OfferBolt12ParseErrorZ +pub union CResult_OfferBolt12ParseErrorZPtr { /// 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::offers::offer::Offer, /// 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::offers::parse::Bolt12ParseError, } #[repr(C)] -/// A CResult_OfferBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OfferBolt12SemanticErrorZ { - /// The contents of this CResult_OfferBolt12SemanticErrorZ, accessible via either +pub struct CResult_OfferBolt12ParseErrorZ { + /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OfferBolt12SemanticErrorZPtr, - /// Whether this CResult_OfferBolt12SemanticErrorZ represents a success state. + pub contents: CResult_OfferBolt12ParseErrorZPtr, + /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OfferBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12SemanticErrorZ { - CResult_OfferBolt12SemanticErrorZ { - contents: CResult_OfferBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_OfferBolt12ParseErrorZ in the success state. +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ { + CResult_OfferBolt12ParseErrorZ { + contents: CResult_OfferBolt12ParseErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OfferBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_OfferBolt12SemanticErrorZ { - CResult_OfferBolt12SemanticErrorZ { - contents: CResult_OfferBolt12SemanticErrorZPtr { +/// Creates a new CResult_OfferBolt12ParseErrorZ in the error state. +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ { + CResult_OfferBolt12ParseErrorZ { + contents: CResult_OfferBolt12ParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7534,13 +7550,13 @@ pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_err(e: crate::lightning::off } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_is_ok(o: &CResult_OfferBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OfferBolt12SemanticErrorZ. -pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_free(_res: CResult_OfferBolt12SemanticErrorZ) { } -impl Drop for CResult_OfferBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_OfferBolt12ParseErrorZ. +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { } +impl Drop for CResult_OfferBolt12ParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7553,16 +7569,16 @@ impl Drop for CResult_OfferBolt12SemanticErrorZ { } } } -impl From> for CResult_OfferBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OfferBolt12ParseErrorZ { + 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_OfferBolt12SemanticErrorZPtr { result } + CResult_OfferBolt12ParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OfferBolt12SemanticErrorZPtr { err } + CResult_OfferBolt12ParseErrorZPtr { err } }; Self { contents, @@ -7570,59 +7586,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OfferBolt12SemanticErrorZPtr { + Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr { result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OfferBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OfferBolt12SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OfferBolt12SemanticErrorZ_clone(orig: &CResult_OfferBolt12SemanticErrorZ) -> CResult_OfferBolt12SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { +/// 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::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, + 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_NodeIdDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeId on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ, accessible via either +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_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ represents a success state. + pub contents: CResult_NodeIdDecodeErrorZPtr, + /// Whether this CResult_NodeIdDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { +/// 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_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { +/// 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, @@ -7630,13 +7646,13 @@ pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticE } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_NodeIdDecodeErrorZ_is_ok(o: &CResult_NodeIdDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { +/// 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() } { @@ -7649,16 +7665,16 @@ impl Drop for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticError } } } -impl From> for CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { result } + CResult_NodeIdDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZPtr { err } + CResult_NodeIdDecodeErrorZPtr { err } }; Self { contents, @@ -7666,42 +7682,59 @@ 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 }))) + } } + } 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_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { +/// The contents of CResult_PublicKeySecp256k1ErrorZ +pub union CResult_PublicKeySecp256k1ErrorZPtr { /// 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::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, + 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::c_types::Secp256k1Error, } #[repr(C)] -/// A CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_PublicKeySecp256k1ErrorZ 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_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ, accessible via either +pub struct CResult_PublicKeySecp256k1ErrorZ { + /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ represents a success state. + pub contents: CResult_PublicKeySecp256k1ErrorZPtr, + /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ { + CResult_PublicKeySecp256k1ErrorZ { + contents: CResult_PublicKeySecp256k1ErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ { + CResult_PublicKeySecp256k1ErrorZ { + contents: CResult_PublicKeySecp256k1ErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7709,13 +7742,13 @@ pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12Semantic } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { } +impl Drop for CResult_PublicKeySecp256k1ErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7728,16 +7761,16 @@ impl Drop for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErro } } } -impl From> for CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PublicKeySecp256k1ErrorZ { + 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_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { result } + CResult_PublicKeySecp256k1ErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZPtr { err } + CResult_PublicKeySecp256k1ErrorZPtr { err } }; Self { contents, @@ -7745,42 +7778,96 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { 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 + Some(crate::lightning::routing::gossip::NetworkUpdate), + /// When we're in this state, this COption_NetworkUpdateZ contains nothing + None +} +impl COption_NetworkUpdateZ { + #[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::routing::gossip::NetworkUpdate { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate +pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ { + COption_NetworkUpdateZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_NetworkUpdateZ containing nothing +pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ { + COption_NetworkUpdateZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state +pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { } +#[no_mangle] +/// Creates a new COption_NetworkUpdateZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OfferDecodeErrorZ -pub union CResult_OfferDecodeErrorZPtr { +/// 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. - pub result: *mut crate::lightning::offers::offer::Offer, + pub result: *mut crate::c_types::derived::COption_NetworkUpdateZ, /// 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_OfferDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OfferDecodeErrorZ { - /// The contents of this CResult_OfferDecodeErrorZ, accessible via either +pub struct CResult_COption_NetworkUpdateZDecodeErrorZ { + /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OfferDecodeErrorZPtr, - /// Whether this CResult_OfferDecodeErrorZ represents a success state. + pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr, + /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OfferDecodeErrorZ in the success state. -pub extern "C" fn CResult_OfferDecodeErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferDecodeErrorZ { - CResult_OfferDecodeErrorZ { - contents: CResult_OfferDecodeErrorZPtr { +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { + CResult_COption_NetworkUpdateZDecodeErrorZ { + contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OfferDecodeErrorZ in the error state. -pub extern "C" fn CResult_OfferDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OfferDecodeErrorZ { - CResult_OfferDecodeErrorZ { - contents: CResult_OfferDecodeErrorZPtr { +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ { + CResult_COption_NetworkUpdateZDecodeErrorZ { + contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7788,13 +7875,13 @@ pub extern "C" fn CResult_OfferDecodeErrorZ_err(e: crate::lightning::ln::msgs::D } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OfferDecodeErrorZ_is_ok(o: &CResult_OfferDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OfferDecodeErrorZ. -pub extern "C" fn CResult_OfferDecodeErrorZ_free(_res: CResult_OfferDecodeErrorZ) { } -impl Drop for CResult_OfferDecodeErrorZ { +/// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { } +impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -7807,16 +7894,16 @@ impl Drop for CResult_OfferDecodeErrorZ { } } } -impl From> for CResult_OfferDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_NetworkUpdateZDecodeErrorZ { + 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_OfferDecodeErrorZPtr { result } + CResult_COption_NetworkUpdateZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OfferDecodeErrorZPtr { err } + CResult_COption_NetworkUpdateZDecodeErrorZPtr { err } }; Self { contents, @@ -7824,155 +7911,90 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OfferDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OfferDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OfferDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OfferDecodeErrorZ_clone(orig: &CResult_OfferDecodeErrorZ) -> CResult_OfferDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_OfferBolt12ParseErrorZ -pub union CResult_OfferBolt12ParseErrorZPtr { - /// 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::offers::offer::Offer, - /// 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::offers::parse::Bolt12ParseError, -} +pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A CResult_OfferBolt12ParseErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::offer::Offer on success and a crate::lightning::offers::parse::Bolt12ParseError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OfferBolt12ParseErrorZ { - /// The contents of this CResult_OfferBolt12ParseErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OfferBolt12ParseErrorZPtr, - /// Whether this CResult_OfferBolt12ParseErrorZ represents a success state. - pub result_ok: bool, +/// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not +pub enum COption_UtxoLookupZ { + /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup + Some(crate::lightning::routing::utxo::UtxoLookup), + /// When we're in this state, this COption_UtxoLookupZ contains nothing + None } -#[no_mangle] -/// Creates a new CResult_OfferBolt12ParseErrorZ in the success state. -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_ok(o: crate::lightning::offers::offer::Offer) -> CResult_OfferBolt12ParseErrorZ { - CResult_OfferBolt12ParseErrorZ { - contents: CResult_OfferBolt12ParseErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl COption_UtxoLookupZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } -} -#[no_mangle] -/// Creates a new CResult_OfferBolt12ParseErrorZ in the error state. -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_err(e: crate::lightning::offers::parse::Bolt12ParseError) -> CResult_OfferBolt12ParseErrorZ { - CResult_OfferBolt12ParseErrorZ { - contents: CResult_OfferBolt12ParseErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() + } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::routing::utxo::UtxoLookup { + if let Self::Some(v) = self { v } else { unreachable!() } } } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_is_ok(o: &CResult_OfferBolt12ParseErrorZ) -> bool { - o.result_ok +/// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup +pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ { + COption_UtxoLookupZ::Some(o) } #[no_mangle] -/// Frees any resources used by the CResult_OfferBolt12ParseErrorZ. -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_free(_res: CResult_OfferBolt12ParseErrorZ) { } -impl Drop for CResult_OfferBolt12ParseErrorZ { - 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_OfferBolt12ParseErrorZ { - 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_OfferBolt12ParseErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OfferBolt12ParseErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_OfferBolt12ParseErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_OfferBolt12ParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_OfferBolt12ParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } +/// Constructs a new COption_UtxoLookupZ containing nothing +pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ { + COption_UtxoLookupZ::None } #[no_mangle] -/// Creates a new CResult_OfferBolt12ParseErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OfferBolt12ParseErrorZ_clone(orig: &CResult_OfferBolt12ParseErrorZ) -> CResult_OfferBolt12ParseErrorZ { Clone::clone(&orig) } +/// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state +pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { } #[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, +/// The contents of CResult_NoneLightningErrorZ +pub union CResult_NoneLightningErrorZPtr { + /// 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::msgs::LightningError, } #[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_NoneLightningErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeIdDecodeErrorZ { - /// The contents of this CResult_NodeIdDecodeErrorZ, accessible via either +pub struct CResult_NoneLightningErrorZ { + /// The contents of this CResult_NoneLightningErrorZ, 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_NoneLightningErrorZPtr, + /// Whether this CResult_NoneLightningErrorZ 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)), +/// Creates a new CResult_NoneLightningErrorZ in the success state. +pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ { + CResult_NoneLightningErrorZ { + contents: CResult_NoneLightningErrorZPtr { + result: core::ptr::null_mut(), }, 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_NoneLightningErrorZ in the error state. +pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ { + CResult_NoneLightningErrorZ { + contents: CResult_NoneLightningErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -7980,18 +8002,15 @@ 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_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> 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_NoneLightningErrorZ. +pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { } +impl Drop for CResult_NoneLightningErrorZ { 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) }; @@ -7999,16 +8018,16 @@ impl Drop for CResult_NodeIdDecodeErrorZ { } } } -impl From> for CResult_NodeIdDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneLightningErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_NodeIdDecodeErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneLightningErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeIdDecodeErrorZPtr { err } + CResult_NoneLightningErrorZPtr { err } }; Self { contents, @@ -8016,59 +8035,59 @@ 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_NoneLightningErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_NodeIdDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr { + 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_NoneLightningErrorZ 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_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PublicKeySecp256k1ErrorZ -pub union CResult_PublicKeySecp256k1ErrorZPtr { +/// The contents of CResult_boolLightningErrorZ +pub union CResult_boolLightningErrorZPtr { /// 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 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::c_types::Secp256k1Error, + pub err: *mut crate::lightning::ln::msgs::LightningError, } #[repr(C)] -/// A CResult_PublicKeySecp256k1ErrorZ 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_boolLightningErrorZ represents the result of a fallible operation, +/// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PublicKeySecp256k1ErrorZ { - /// The contents of this CResult_PublicKeySecp256k1ErrorZ, accessible via either +pub struct CResult_boolLightningErrorZ { + /// The contents of this CResult_boolLightningErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PublicKeySecp256k1ErrorZPtr, - /// Whether this CResult_PublicKeySecp256k1ErrorZ represents a success state. + pub contents: CResult_boolLightningErrorZPtr, + /// Whether this CResult_boolLightningErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PublicKeySecp256k1ErrorZ in the success state. -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_ok(o: crate::c_types::PublicKey) -> CResult_PublicKeySecp256k1ErrorZ { - CResult_PublicKeySecp256k1ErrorZ { - contents: CResult_PublicKeySecp256k1ErrorZPtr { +/// Creates a new CResult_boolLightningErrorZ in the success state. +pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ { + CResult_boolLightningErrorZ { + contents: CResult_boolLightningErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PublicKeySecp256k1ErrorZ in the error state. -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PublicKeySecp256k1ErrorZ { - CResult_PublicKeySecp256k1ErrorZ { - contents: CResult_PublicKeySecp256k1ErrorZPtr { +/// Creates a new CResult_boolLightningErrorZ in the error state. +pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ { + CResult_boolLightningErrorZ { + contents: CResult_boolLightningErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8076,13 +8095,13 @@ pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_err(e: crate::c_types::Secp25 } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_is_ok(o: &CResult_PublicKeySecp256k1ErrorZ) -> bool { +pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PublicKeySecp256k1ErrorZ. -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_free(_res: CResult_PublicKeySecp256k1ErrorZ) { } -impl Drop for CResult_PublicKeySecp256k1ErrorZ { +/// Frees any resources used by the CResult_boolLightningErrorZ. +pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { } +impl Drop for CResult_boolLightningErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8095,16 +8114,16 @@ impl Drop for CResult_PublicKeySecp256k1ErrorZ { } } } -impl From> for CResult_PublicKeySecp256k1ErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_boolLightningErrorZ { + 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_PublicKeySecp256k1ErrorZPtr { result } + CResult_boolLightningErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PublicKeySecp256k1ErrorZPtr { err } + CResult_boolLightningErrorZPtr { err } }; Self { contents, @@ -8112,96 +8131,188 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PublicKeySecp256k1ErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_boolLightningErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PublicKeySecp256k1ErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_boolLightningErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PublicKeySecp256k1ErrorZ which has the same data as `orig` +/// Creates a new CResult_boolLightningErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PublicKeySecp256k1ErrorZ_clone(orig: &CResult_PublicKeySecp256k1ErrorZ) -> CResult_PublicKeySecp256k1ErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { 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 - Some(crate::lightning::routing::gossip::NetworkUpdate), - /// When we're in this state, this COption_NetworkUpdateZ contains nothing - None +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + /// The element at position 0 + pub a: crate::lightning::ln::msgs::ChannelAnnouncement, + /// The element at position 1 + pub b: crate::lightning::ln::msgs::ChannelUpdate, + /// The element at position 2 + pub c: crate::lightning::ln::msgs::ChannelUpdate, } -impl COption_NetworkUpdateZ { - #[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::routing::gossip::NetworkUpdate { - if let Self::Some(v) = self { v } else { unreachable!() } +impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + } } } -#[no_mangle] -/// Constructs a new COption_NetworkUpdateZ containing a crate::lightning::routing::gossip::NetworkUpdate -pub extern "C" fn COption_NetworkUpdateZ_some(o: crate::lightning::routing::gossip::NetworkUpdate) -> COption_NetworkUpdateZ { - COption_NetworkUpdateZ::Some(o) +impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) { + (self.a, self.b, self.c) + } +} +impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), + } + } } #[no_mangle] -/// Constructs a new COption_NetworkUpdateZ containing nothing -pub extern "C" fn COption_NetworkUpdateZ_none() -> COption_NetworkUpdateZ { - COption_NetworkUpdateZ::None +/// 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_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. +#[no_mangle] +pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, } } + #[no_mangle] -/// Frees any resources associated with the crate::lightning::routing::gossip::NetworkUpdate, if we are in the Some state -pub extern "C" fn COption_NetworkUpdateZ_free(_res: COption_NetworkUpdateZ) { } +/// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. +pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not +pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ + Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), + /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing + None +} +impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + #[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::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} #[no_mangle] -/// Creates a new COption_NetworkUpdateZ which has the same data as `orig` +/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { + COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { } +#[no_mangle] +/// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_NetworkUpdateZ_clone(orig: &COption_NetworkUpdateZ) -> COption_NetworkUpdateZ { Clone::clone(&orig) } +pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_NetworkUpdateZDecodeErrorZ -pub union CResult_COption_NetworkUpdateZDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_MessageSendEventZ { + /// 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::events::MessageSendEvent, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_MessageSendEventZ { + #[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::events::MessageSendEvent] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_MessageSendEventZ { + 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_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { } +impl Drop for CVec_MessageSendEventZ { + 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_MessageSendEventZ { + 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_ChannelUpdateInfoDecodeErrorZ +pub union CResult_ChannelUpdateInfoDecodeErrorZPtr { /// 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_NetworkUpdateZ, + pub result: *mut crate::lightning::routing::gossip::ChannelUpdateInfo, /// 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_COption_NetworkUpdateZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_NetworkUpdateZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_NetworkUpdateZDecodeErrorZ { - /// The contents of this CResult_COption_NetworkUpdateZDecodeErrorZ, accessible via either +pub struct CResult_ChannelUpdateInfoDecodeErrorZ { + /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr, - /// Whether this CResult_COption_NetworkUpdateZDecodeErrorZ represents a success state. + pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr, + /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_ok(o: crate::c_types::derived::COption_NetworkUpdateZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { - CResult_COption_NetworkUpdateZDecodeErrorZ { - contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { +/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ { + CResult_ChannelUpdateInfoDecodeErrorZ { + contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_NetworkUpdateZDecodeErrorZ { - CResult_COption_NetworkUpdateZDecodeErrorZ { - contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { +/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ { + CResult_ChannelUpdateInfoDecodeErrorZ { + contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8209,13 +8320,13 @@ pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_is_ok(o: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_NetworkUpdateZDecodeErrorZ. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_free(_res: CResult_COption_NetworkUpdateZDecodeErrorZ) { } -impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { } +impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8228,16 +8339,16 @@ impl Drop for CResult_COption_NetworkUpdateZDecodeErrorZ { } } } -impl From> for CResult_COption_NetworkUpdateZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelUpdateInfoDecodeErrorZ { + 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_NetworkUpdateZDecodeErrorZPtr { result } + CResult_ChannelUpdateInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_NetworkUpdateZDecodeErrorZPtr { err } + CResult_ChannelUpdateInfoDecodeErrorZPtr { err } }; Self { contents, @@ -8245,90 +8356,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_NetworkUpdateZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_NetworkUpdateZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_NetworkUpdateZDecodeErrorZ_clone(orig: &CResult_COption_NetworkUpdateZDecodeErrorZ) -> CResult_COption_NetworkUpdateZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// An enum which can either contain a crate::lightning::routing::utxo::UtxoLookup or not -pub enum COption_UtxoLookupZ { - /// When we're in this state, this COption_UtxoLookupZ contains a crate::lightning::routing::utxo::UtxoLookup - Some(crate::lightning::routing::utxo::UtxoLookup), - /// When we're in this state, this COption_UtxoLookupZ contains nothing - None -} -impl COption_UtxoLookupZ { - #[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::routing::utxo::UtxoLookup { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_UtxoLookupZ containing a crate::lightning::routing::utxo::UtxoLookup -pub extern "C" fn COption_UtxoLookupZ_some(o: crate::lightning::routing::utxo::UtxoLookup) -> COption_UtxoLookupZ { - COption_UtxoLookupZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_UtxoLookupZ containing nothing -pub extern "C" fn COption_UtxoLookupZ_none() -> COption_UtxoLookupZ { - COption_UtxoLookupZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::routing::utxo::UtxoLookup, if we are in the Some state -pub extern "C" fn COption_UtxoLookupZ_free(_res: COption_UtxoLookupZ) { } +pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneLightningErrorZ -pub union CResult_NoneLightningErrorZPtr { - /// 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_ChannelInfoDecodeErrorZ +pub union CResult_ChannelInfoDecodeErrorZPtr { + /// 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::ChannelInfo, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_NoneLightningErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::ln::msgs::LightningError on failure. +/// A CResult_ChannelInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NoneLightningErrorZ { - /// The contents of this CResult_NoneLightningErrorZ, accessible via either +pub struct CResult_ChannelInfoDecodeErrorZ { + /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneLightningErrorZPtr, - /// Whether this CResult_NoneLightningErrorZ represents a success state. + pub contents: CResult_ChannelInfoDecodeErrorZPtr, + /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneLightningErrorZ in the success state. -pub extern "C" fn CResult_NoneLightningErrorZ_ok() -> CResult_NoneLightningErrorZ { - CResult_NoneLightningErrorZ { - contents: CResult_NoneLightningErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ { + CResult_ChannelInfoDecodeErrorZ { + contents: CResult_ChannelInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneLightningErrorZ in the error state. -pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_NoneLightningErrorZ { - CResult_NoneLightningErrorZ { - contents: CResult_NoneLightningErrorZPtr { +/// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ { + CResult_ChannelInfoDecodeErrorZ { + contents: CResult_ChannelInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8336,15 +8416,18 @@ pub extern "C" fn CResult_NoneLightningErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneLightningErrorZ_is_ok(o: &CResult_NoneLightningErrorZ) -> bool { +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneLightningErrorZ. -pub extern "C" fn CResult_NoneLightningErrorZ_free(_res: CResult_NoneLightningErrorZ) { } -impl Drop for CResult_NoneLightningErrorZ { - fn drop(&mut self) { - if self.result_ok { +/// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { } +impl Drop for CResult_ChannelInfoDecodeErrorZ { + 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) }; @@ -8352,16 +8435,16 @@ impl Drop for CResult_NoneLightningErrorZ { } } } -impl From> for CResult_NoneLightningErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::msgs::LightningError>) -> Self { +impl From> for CResult_ChannelInfoDecodeErrorZ { + 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_NoneLightningErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_ChannelInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneLightningErrorZPtr { err } + CResult_ChannelInfoDecodeErrorZPtr { err } }; Self { contents, @@ -8369,59 +8452,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneLightningErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneLightningErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneLightningErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneLightningErrorZ_clone(orig: &CResult_NoneLightningErrorZ) -> CResult_NoneLightningErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_boolLightningErrorZ -pub union CResult_boolLightningErrorZPtr { +/// The contents of CResult_RoutingFeesDecodeErrorZ +pub union CResult_RoutingFeesDecodeErrorZPtr { /// 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_types::routing::RoutingFees, /// 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, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_boolLightningErrorZ represents the result of a fallible operation, -/// containing a bool on success and a crate::lightning::ln::msgs::LightningError on failure. +/// A CResult_RoutingFeesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::routing::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_boolLightningErrorZ { - /// The contents of this CResult_boolLightningErrorZ, accessible via either +pub struct CResult_RoutingFeesDecodeErrorZ { + /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_boolLightningErrorZPtr, - /// Whether this CResult_boolLightningErrorZ represents a success state. + pub contents: CResult_RoutingFeesDecodeErrorZPtr, + /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_boolLightningErrorZ in the success state. -pub extern "C" fn CResult_boolLightningErrorZ_ok(o: bool) -> CResult_boolLightningErrorZ { - CResult_boolLightningErrorZ { - contents: CResult_boolLightningErrorZPtr { +/// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning_types::routing::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ { + CResult_RoutingFeesDecodeErrorZ { + contents: CResult_RoutingFeesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_boolLightningErrorZ in the error state. -pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs::LightningError) -> CResult_boolLightningErrorZ { - CResult_boolLightningErrorZ { - contents: CResult_boolLightningErrorZPtr { +/// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ { + CResult_RoutingFeesDecodeErrorZ { + contents: CResult_RoutingFeesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8429,13 +8512,13 @@ pub extern "C" fn CResult_boolLightningErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_boolLightningErrorZ_is_ok(o: &CResult_boolLightningErrorZ) -> bool { +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_boolLightningErrorZ. -pub extern "C" fn CResult_boolLightningErrorZ_free(_res: CResult_boolLightningErrorZ) { } -impl Drop for CResult_boolLightningErrorZ { +/// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { } +impl Drop for CResult_RoutingFeesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8448,16 +8531,16 @@ impl Drop for CResult_boolLightningErrorZ { } } } -impl From> for CResult_boolLightningErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RoutingFeesDecodeErrorZ { + 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_boolLightningErrorZPtr { result } + CResult_RoutingFeesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_boolLightningErrorZPtr { err } + CResult_RoutingFeesDecodeErrorZPtr { err } }; Self { contents, @@ -8465,130 +8548,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_boolLightningErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_boolLightningErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_boolLightningErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_boolLightningErrorZ_clone(orig: &CResult_boolLightningErrorZ) -> CResult_boolLightningErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - /// The element at position 0 - pub a: crate::lightning::ln::msgs::ChannelAnnouncement, - /// The element at position 1 - pub b: crate::lightning::ln::msgs::ChannelUpdate, - /// The element at position 2 - pub c: crate::lightning::ln::msgs::ChannelUpdate, -} -impl From<(crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)> for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - fn from (tup: (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } - } -} -impl C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::msgs::ChannelAnnouncement, crate::lightning::ln::msgs::ChannelUpdate, crate::lightning::ln::msgs::ChannelUpdate) { - (self.a, self.b, self.c) - } -} -impl Clone for C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - 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 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_clone(orig: &C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a: crate::lightning::ln::msgs::ChannelAnnouncement, b: crate::lightning::ln::msgs::ChannelUpdate, c: crate::lightning::ln::msgs::ChannelUpdate) -> C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ. -pub extern "C" fn C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(_res: C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ or not -pub enum COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ - Some(crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), - /// When we're in this state, this COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ contains nothing - None -} -impl COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - #[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::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing a crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_some(o: crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ containing nothing -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_none() -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { - COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ, if we are in the Some state -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(_res: COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) { } -#[no_mangle] -/// Creates a new COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ which has the same data as `orig` +/// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_clone(orig: &COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ) -> COption_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::events::MessageSendEvents of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_MessageSendEventZ { +pub struct CVec_SocketAddressZ { /// 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::events::MessageSendEvent, + pub data: *mut crate::lightning::ln::msgs::SocketAddress, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_MessageSendEventZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_SocketAddressZ { + #[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::events::MessageSendEvent] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::msgs::SocketAddress] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_MessageSendEventZ { - fn from(v: Vec) -> Self { +impl From> for CVec_SocketAddressZ { + 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() } } @@ -8596,14 +8596,14 @@ impl From> for CVec_MessageSendE } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_MessageSendEventZ_free(_res: CVec_MessageSendEventZ) { } -impl Drop for CVec_MessageSendEventZ { +pub extern "C" fn CVec_SocketAddressZ_free(_res: CVec_SocketAddressZ) { } +impl Drop for CVec_SocketAddressZ { 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_MessageSendEventZ { +impl Clone for CVec_SocketAddressZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -8612,41 +8612,41 @@ impl Clone for CVec_MessageSendEventZ { } } #[repr(C)] -/// The contents of CResult_ChannelUpdateInfoDecodeErrorZ -pub union CResult_ChannelUpdateInfoDecodeErrorZPtr { +/// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ +pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr { /// 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::ChannelUpdateInfo, + pub result: *mut crate::lightning::routing::gossip::NodeAnnouncementInfo, /// 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_ChannelUpdateInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::ChannelUpdateInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelUpdateInfoDecodeErrorZ { - /// The contents of this CResult_ChannelUpdateInfoDecodeErrorZ, accessible via either +pub struct CResult_NodeAnnouncementInfoDecodeErrorZ { + /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelUpdateInfoDecodeErrorZPtr, - /// Whether this CResult_ChannelUpdateInfoDecodeErrorZ represents a success state. + pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr, + /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelUpdateInfo) -> CResult_ChannelUpdateInfoDecodeErrorZ { - CResult_ChannelUpdateInfoDecodeErrorZ { - contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { +/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ { + CResult_NodeAnnouncementInfoDecodeErrorZ { + contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateInfoDecodeErrorZ { - CResult_ChannelUpdateInfoDecodeErrorZ { - contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { +/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ { + CResult_NodeAnnouncementInfoDecodeErrorZ { + contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8654,13 +8654,13 @@ pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelUpdateInfoDecodeErrorZ. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_free(_res: CResult_ChannelUpdateInfoDecodeErrorZ) { } -impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ { +/// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { } +impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8673,16 +8673,16 @@ impl Drop for CResult_ChannelUpdateInfoDecodeErrorZ { } } } -impl From> for CResult_ChannelUpdateInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeAnnouncementInfoDecodeErrorZ { + 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_ChannelUpdateInfoDecodeErrorZPtr { result } + CResult_NodeAnnouncementInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelUpdateInfoDecodeErrorZPtr { err } + CResult_NodeAnnouncementInfoDecodeErrorZPtr { err } }; Self { contents, @@ -8690,59 +8690,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelUpdateInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelUpdateInfoDecodeErrorZ_clone(orig: &CResult_ChannelUpdateInfoDecodeErrorZ) -> CResult_ChannelUpdateInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelInfoDecodeErrorZ -pub union CResult_ChannelInfoDecodeErrorZPtr { +/// The contents of CResult_NodeAliasDecodeErrorZ +pub union CResult_NodeAliasDecodeErrorZPtr { /// 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::ChannelInfo, + pub result: *mut crate::lightning::routing::gossip::NodeAlias, /// 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_ChannelInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::ChannelInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelInfoDecodeErrorZ { - /// The contents of this CResult_ChannelInfoDecodeErrorZ, accessible via either +pub struct CResult_NodeAliasDecodeErrorZ { + /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelInfoDecodeErrorZPtr, - /// Whether this CResult_ChannelInfoDecodeErrorZ represents a success state. + pub contents: CResult_NodeAliasDecodeErrorZPtr, + /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::ChannelInfo) -> CResult_ChannelInfoDecodeErrorZ { - CResult_ChannelInfoDecodeErrorZ { - contents: CResult_ChannelInfoDecodeErrorZPtr { +/// Creates a new CResult_NodeAliasDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ { + CResult_NodeAliasDecodeErrorZ { + contents: CResult_NodeAliasDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelInfoDecodeErrorZ { - CResult_ChannelInfoDecodeErrorZ { - contents: CResult_ChannelInfoDecodeErrorZPtr { +/// Creates a new CResult_NodeAliasDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ { + CResult_NodeAliasDecodeErrorZ { + contents: CResult_NodeAliasDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8750,13 +8750,13 @@ pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_is_ok(o: &CResult_ChannelInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelInfoDecodeErrorZ. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_free(_res: CResult_ChannelInfoDecodeErrorZ) { } -impl Drop for CResult_ChannelInfoDecodeErrorZ { +/// Frees any resources used by the CResult_NodeAliasDecodeErrorZ. +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { } +impl Drop for CResult_NodeAliasDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8769,16 +8769,16 @@ impl Drop for CResult_ChannelInfoDecodeErrorZ { } } } -impl From> for CResult_ChannelInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeAliasDecodeErrorZ { + 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_ChannelInfoDecodeErrorZPtr { result } + CResult_NodeAliasDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelInfoDecodeErrorZPtr { err } + CResult_NodeAliasDecodeErrorZPtr { err } }; Self { contents, @@ -8786,59 +8786,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelInfoDecodeErrorZ_clone(orig: &CResult_ChannelInfoDecodeErrorZ) -> CResult_ChannelInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RoutingFeesDecodeErrorZ -pub union CResult_RoutingFeesDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::routing::gossip::NodeAnnouncementInfo or not +pub enum COption_NodeAnnouncementInfoZ { + /// When we're in this state, this COption_NodeAnnouncementInfoZ contains a crate::lightning::routing::gossip::NodeAnnouncementInfo + Some(crate::lightning::routing::gossip::NodeAnnouncementInfo), + /// When we're in this state, this COption_NodeAnnouncementInfoZ contains nothing + None +} +impl COption_NodeAnnouncementInfoZ { + #[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::routing::gossip::NodeAnnouncementInfo { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_NodeAnnouncementInfoZ containing a crate::lightning::routing::gossip::NodeAnnouncementInfo +pub extern "C" fn COption_NodeAnnouncementInfoZ_some(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> COption_NodeAnnouncementInfoZ { + COption_NodeAnnouncementInfoZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_NodeAnnouncementInfoZ containing nothing +pub extern "C" fn COption_NodeAnnouncementInfoZ_none() -> COption_NodeAnnouncementInfoZ { + COption_NodeAnnouncementInfoZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::routing::gossip::NodeAnnouncementInfo, if we are in the Some state +pub extern "C" fn COption_NodeAnnouncementInfoZ_free(_res: COption_NodeAnnouncementInfoZ) { } +#[no_mangle] +/// Creates a new COption_NodeAnnouncementInfoZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_NodeAnnouncementInfoZ_clone(orig: &COption_NodeAnnouncementInfoZ) -> COption_NodeAnnouncementInfoZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_NodeInfoDecodeErrorZ +pub union CResult_NodeInfoDecodeErrorZPtr { /// 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_types::routing::RoutingFees, + pub result: *mut crate::lightning::routing::gossip::NodeInfo, /// 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_RoutingFeesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::routing::RoutingFees on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_RoutingFeesDecodeErrorZ { - /// The contents of this CResult_RoutingFeesDecodeErrorZ, accessible via either +pub struct CResult_NodeInfoDecodeErrorZ { + /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RoutingFeesDecodeErrorZPtr, - /// Whether this CResult_RoutingFeesDecodeErrorZ represents a success state. + pub contents: CResult_NodeInfoDecodeErrorZPtr, + /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RoutingFeesDecodeErrorZ in the success state. -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_ok(o: crate::lightning_types::routing::RoutingFees) -> CResult_RoutingFeesDecodeErrorZ { - CResult_RoutingFeesDecodeErrorZ { - contents: CResult_RoutingFeesDecodeErrorZPtr { +/// Creates a new CResult_NodeInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ { + CResult_NodeInfoDecodeErrorZ { + contents: CResult_NodeInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RoutingFeesDecodeErrorZ in the error state. -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RoutingFeesDecodeErrorZ { - CResult_RoutingFeesDecodeErrorZ { - contents: CResult_RoutingFeesDecodeErrorZPtr { +/// Creates a new CResult_NodeInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ { + CResult_NodeInfoDecodeErrorZ { + contents: CResult_NodeInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8846,13 +8883,13 @@ pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_is_ok(o: &CResult_RoutingFeesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RoutingFeesDecodeErrorZ. -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_free(_res: CResult_RoutingFeesDecodeErrorZ) { } -impl Drop for CResult_RoutingFeesDecodeErrorZ { +/// Frees any resources used by the CResult_NodeInfoDecodeErrorZ. +pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { } +impl Drop for CResult_NodeInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -8865,16 +8902,16 @@ impl Drop for CResult_RoutingFeesDecodeErrorZ { } } } -impl From> for CResult_RoutingFeesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeInfoDecodeErrorZ { + 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_RoutingFeesDecodeErrorZPtr { result } + CResult_NodeInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RoutingFeesDecodeErrorZPtr { err } + CResult_NodeInfoDecodeErrorZPtr { err } }; Self { contents, @@ -8882,105 +8919,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RoutingFeesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RoutingFeesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RoutingFeesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RoutingFeesDecodeErrorZ_clone(orig: &CResult_RoutingFeesDecodeErrorZ) -> CResult_RoutingFeesDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::msgs::SocketAddresss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_SocketAddressZ { - /// 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::msgs::SocketAddress, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_SocketAddressZ { - #[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::msgs::SocketAddress] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_SocketAddressZ { - 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_SocketAddressZ_free(_res: CVec_SocketAddressZ) { } -impl Drop for CVec_SocketAddressZ { - 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_SocketAddressZ { - 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_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeAnnouncementInfoDecodeErrorZ -pub union CResult_NodeAnnouncementInfoDecodeErrorZPtr { +/// The contents of CResult_NetworkGraphDecodeErrorZ +pub union CResult_NetworkGraphDecodeErrorZPtr { /// 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::NodeAnnouncementInfo, + pub result: *mut crate::lightning::routing::gossip::NetworkGraph, /// 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_NodeAnnouncementInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NodeAnnouncementInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeAnnouncementInfoDecodeErrorZ { - /// The contents of this CResult_NodeAnnouncementInfoDecodeErrorZ, accessible via either +pub struct CResult_NetworkGraphDecodeErrorZ { + /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr, - /// Whether this CResult_NodeAnnouncementInfoDecodeErrorZ represents a success state. + pub contents: CResult_NetworkGraphDecodeErrorZPtr, + /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> CResult_NodeAnnouncementInfoDecodeErrorZ { - CResult_NodeAnnouncementInfoDecodeErrorZ { - contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { +/// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ { + CResult_NetworkGraphDecodeErrorZ { + contents: CResult_NetworkGraphDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementInfoDecodeErrorZ { - CResult_NodeAnnouncementInfoDecodeErrorZ { - contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { +/// Creates a new CResult_NetworkGraphDecodeErrorZ in the error state. +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ { + CResult_NetworkGraphDecodeErrorZ { + contents: CResult_NetworkGraphDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -8988,13 +8979,13 @@ pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeAnnouncementInfoDecodeErrorZ. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_free(_res: CResult_NodeAnnouncementInfoDecodeErrorZ) { } -impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ { +/// Frees any resources used by the CResult_NetworkGraphDecodeErrorZ. +pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { } +impl Drop for CResult_NetworkGraphDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -9007,16 +8998,16 @@ impl Drop for CResult_NodeAnnouncementInfoDecodeErrorZ { } } } -impl From> for CResult_NodeAnnouncementInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NetworkGraphDecodeErrorZ { + 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_NodeAnnouncementInfoDecodeErrorZPtr { result } + CResult_NetworkGraphDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeAnnouncementInfoDecodeErrorZPtr { err } + CResult_NetworkGraphDecodeErrorZPtr { err } }; Self { contents, @@ -9024,59 +9015,79 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_NodeAnnouncementInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not +pub enum COption_CVec_SocketAddressZZ { + /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ + Some(crate::c_types::derived::CVec_SocketAddressZ), + /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing + None +} +impl COption_CVec_SocketAddressZZ { + #[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::derived::CVec_SocketAddressZ { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementInfoDecodeErrorZ which has the same data as `orig` +/// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ +pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ { + COption_CVec_SocketAddressZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_CVec_SocketAddressZZ containing nothing +pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ { + COption_CVec_SocketAddressZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state +pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { } +#[no_mangle] +/// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeAnnouncementInfoDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementInfoDecodeErrorZ) -> CResult_NodeAnnouncementInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeAliasDecodeErrorZ -pub union CResult_NodeAliasDecodeErrorZPtr { +/// The contents of CResult_u64ShortChannelIdErrorZ +pub union CResult_u64ShortChannelIdErrorZPtr { /// 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::NodeAlias, + pub result: *mut u64, /// 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::util::scid_utils::ShortChannelIdError, } #[repr(C)] -/// A CResult_NodeAliasDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NodeAlias on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation, +/// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeAliasDecodeErrorZ { - /// The contents of this CResult_NodeAliasDecodeErrorZ, accessible via either +pub struct CResult_u64ShortChannelIdErrorZ { + /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeAliasDecodeErrorZPtr, - /// Whether this CResult_NodeAliasDecodeErrorZ represents a success state. + pub contents: CResult_u64ShortChannelIdErrorZPtr, + /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeAliasDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeAlias) -> CResult_NodeAliasDecodeErrorZ { - CResult_NodeAliasDecodeErrorZ { - contents: CResult_NodeAliasDecodeErrorZPtr { +/// Creates a new CResult_u64ShortChannelIdErrorZ in the success state. +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ { + CResult_u64ShortChannelIdErrorZ { + contents: CResult_u64ShortChannelIdErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeAliasDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAliasDecodeErrorZ { - CResult_NodeAliasDecodeErrorZ { - contents: CResult_NodeAliasDecodeErrorZPtr { +/// Creates a new CResult_u64ShortChannelIdErrorZ in the error state. +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ { + CResult_u64ShortChannelIdErrorZ { + contents: CResult_u64ShortChannelIdErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -9084,13 +9095,13 @@ pub extern "C" fn CResult_NodeAliasDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_is_ok(o: &CResult_NodeAliasDecodeErrorZ) -> bool { +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeAliasDecodeErrorZ. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_free(_res: CResult_NodeAliasDecodeErrorZ) { } -impl Drop for CResult_NodeAliasDecodeErrorZ { +/// Frees any resources used by the CResult_u64ShortChannelIdErrorZ. +pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { } +impl Drop for CResult_u64ShortChannelIdErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -9103,16 +9114,16 @@ impl Drop for CResult_NodeAliasDecodeErrorZ { } } } -impl From> for CResult_NodeAliasDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_u64ShortChannelIdErrorZ { + 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_NodeAliasDecodeErrorZPtr { result } + CResult_u64ShortChannelIdErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeAliasDecodeErrorZPtr { err } + CResult_u64ShortChannelIdErrorZPtr { err } }; Self { contents, @@ -9120,96 +9131,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NodeAliasDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_NodeAliasDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_NodeAliasDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeAliasDecodeErrorZ_clone(orig: &CResult_NodeAliasDecodeErrorZ) -> CResult_NodeAliasDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::routing::gossip::NodeAnnouncementInfo or not -pub enum COption_NodeAnnouncementInfoZ { - /// When we're in this state, this COption_NodeAnnouncementInfoZ contains a crate::lightning::routing::gossip::NodeAnnouncementInfo - Some(crate::lightning::routing::gossip::NodeAnnouncementInfo), - /// When we're in this state, this COption_NodeAnnouncementInfoZ contains nothing - None -} -impl COption_NodeAnnouncementInfoZ { - #[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::routing::gossip::NodeAnnouncementInfo { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_NodeAnnouncementInfoZ containing a crate::lightning::routing::gossip::NodeAnnouncementInfo -pub extern "C" fn COption_NodeAnnouncementInfoZ_some(o: crate::lightning::routing::gossip::NodeAnnouncementInfo) -> COption_NodeAnnouncementInfoZ { - COption_NodeAnnouncementInfoZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_NodeAnnouncementInfoZ containing nothing -pub extern "C" fn COption_NodeAnnouncementInfoZ_none() -> COption_NodeAnnouncementInfoZ { - COption_NodeAnnouncementInfoZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::routing::gossip::NodeAnnouncementInfo, if we are in the Some state -pub extern "C" fn COption_NodeAnnouncementInfoZ_free(_res: COption_NodeAnnouncementInfoZ) { } -#[no_mangle] -/// Creates a new COption_NodeAnnouncementInfoZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_NodeAnnouncementInfoZ_clone(orig: &COption_NodeAnnouncementInfoZ) -> COption_NodeAnnouncementInfoZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeInfoDecodeErrorZ -pub union CResult_NodeInfoDecodeErrorZPtr { +/// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ +pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr { /// 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::NodeInfo, + pub result: *mut crate::lightning::ln::channelmanager::PendingHTLCInfo, /// 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::onion_payment::InboundHTLCErr, } #[repr(C)] -/// A CResult_NodeInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NodeInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NodeInfoDecodeErrorZ { - /// The contents of this CResult_NodeInfoDecodeErrorZ, accessible via either +pub struct CResult_PendingHTLCInfoInboundHTLCErrZ { + /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeInfoDecodeErrorZPtr, - /// Whether this CResult_NodeInfoDecodeErrorZ represents a success state. + pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr, + /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NodeInfo) -> CResult_NodeInfoDecodeErrorZ { - CResult_NodeInfoDecodeErrorZ { - contents: CResult_NodeInfoDecodeErrorZPtr { +/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ { + CResult_PendingHTLCInfoInboundHTLCErrZ { + contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeInfoDecodeErrorZ { - CResult_NodeInfoDecodeErrorZ { - contents: CResult_NodeInfoDecodeErrorZPtr { +/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ { + CResult_PendingHTLCInfoInboundHTLCErrZ { + contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -9217,13 +9174,13 @@ pub extern "C" fn CResult_NodeInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_is_ok(o: &CResult_NodeInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeInfoDecodeErrorZ. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_free(_res: CResult_NodeInfoDecodeErrorZ) { } -impl Drop for CResult_NodeInfoDecodeErrorZ { +/// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { } +impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -9236,16 +9193,16 @@ impl Drop for CResult_NodeInfoDecodeErrorZ { } } } -impl From> for CResult_NodeInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PendingHTLCInfoInboundHTLCErrZ { + 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_NodeInfoDecodeErrorZPtr { result } + CResult_PendingHTLCInfoInboundHTLCErrZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeInfoDecodeErrorZPtr { err } + CResult_PendingHTLCInfoInboundHTLCErrZPtr { err } }; Self { contents, @@ -9253,211 +9210,312 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeInfoDecodeErrorZ_clone(orig: &CResult_NodeInfoDecodeErrorZ) -> CResult_NodeInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> CResult_PendingHTLCInfoInboundHTLCErrZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NetworkGraphDecodeErrorZ -pub union CResult_NetworkGraphDecodeErrorZPtr { - /// 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::NetworkGraph, - /// 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, +/// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_HTLCOutputInCommitmentZ { + /// 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::chan_utils::HTLCOutputInCommitment, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[repr(C)] -/// A CResult_NetworkGraphDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::routing::gossip::NetworkGraph on success and a crate::lightning::ln::msgs::DecodeError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NetworkGraphDecodeErrorZ { - /// The contents of this CResult_NetworkGraphDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NetworkGraphDecodeErrorZPtr, - /// Whether this CResult_NetworkGraphDecodeErrorZ represents a success state. - pub result_ok: bool, +impl CVec_HTLCOutputInCommitmentZ { + #[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::chan_utils::HTLCOutputInCommitment] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } } -#[no_mangle] -/// Creates a new CResult_NetworkGraphDecodeErrorZ in the success state. -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_ok(o: crate::lightning::routing::gossip::NetworkGraph) -> CResult_NetworkGraphDecodeErrorZ { - CResult_NetworkGraphDecodeErrorZ { - contents: CResult_NetworkGraphDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl From> for CVec_HTLCOutputInCommitmentZ { + 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_NetworkGraphDecodeErrorZ in the error state. -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NetworkGraphDecodeErrorZ { - CResult_NetworkGraphDecodeErrorZ { - contents: CResult_NetworkGraphDecodeErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { } +impl Drop for CVec_HTLCOutputInCommitmentZ { + 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_HTLCOutputInCommitmentZ { + 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::sign::HTLCDescriptors of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_HTLCDescriptorZ { + /// 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::sign::HTLCDescriptor, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_HTLCDescriptorZ { + #[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::sign::HTLCDescriptor] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_HTLCDescriptorZ { + 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() } } } } -/// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_is_ok(o: &CResult_NetworkGraphDecodeErrorZ) -> bool { - o.result_ok +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { } +impl Drop for CVec_HTLCDescriptorZ { + 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_HTLCDescriptorZ { + 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::events::bump_transaction::Utxos of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UtxoZ { + /// 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::events::bump_transaction::Utxo, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UtxoZ { + #[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::events::bump_transaction::Utxo] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UtxoZ { + 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_NetworkGraphDecodeErrorZ. -pub extern "C" fn CResult_NetworkGraphDecodeErrorZ_free(_res: CResult_NetworkGraphDecodeErrorZ) { } -impl Drop for CResult_NetworkGraphDecodeErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { } +impl Drop for CVec_UtxoZ { 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_NetworkGraphDecodeErrorZ { - 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_NetworkGraphDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NetworkGraphDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl Clone for CVec_UtxoZ { + 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)] #[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::CVec_SocketAddressZ or not -pub enum COption_CVec_SocketAddressZZ { - /// When we're in this state, this COption_CVec_SocketAddressZZ contains a crate::c_types::derived::CVec_SocketAddressZ - Some(crate::c_types::derived::CVec_SocketAddressZ), - /// When we're in this state, this COption_CVec_SocketAddressZZ contains nothing +/// An enum which can either contain a crate::c_types::TxOut or not +pub enum COption_TxOutZ { + /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut + Some(crate::c_types::TxOut), + /// When we're in this state, this COption_TxOutZ contains nothing None } -impl COption_CVec_SocketAddressZZ { +impl COption_TxOutZ { #[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::derived::CVec_SocketAddressZ { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::TxOut { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_CVec_SocketAddressZZ containing a crate::c_types::derived::CVec_SocketAddressZ -pub extern "C" fn COption_CVec_SocketAddressZZ_some(o: crate::c_types::derived::CVec_SocketAddressZ) -> COption_CVec_SocketAddressZZ { - COption_CVec_SocketAddressZZ::Some(o) +/// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut +pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ { + COption_TxOutZ::Some(o) } #[no_mangle] -/// Constructs a new COption_CVec_SocketAddressZZ containing nothing -pub extern "C" fn COption_CVec_SocketAddressZZ_none() -> COption_CVec_SocketAddressZZ { - COption_CVec_SocketAddressZZ::None +/// Constructs a new COption_TxOutZ containing nothing +pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ { + COption_TxOutZ::None } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::CVec_SocketAddressZ, if we are in the Some state -pub extern "C" fn COption_CVec_SocketAddressZZ_free(_res: COption_CVec_SocketAddressZZ) { } +/// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state +pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { } #[no_mangle] -/// Creates a new COption_CVec_SocketAddressZZ which has the same data as `orig` +/// Creates a new COption_TxOutZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_CVec_SocketAddressZZ_clone(orig: &COption_CVec_SocketAddressZZ) -> COption_CVec_SocketAddressZZ { Clone::clone(&orig) } +pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_u64ShortChannelIdErrorZ -pub union CResult_u64ShortChannelIdErrorZPtr { - /// A pointer to the contents in the success state. - /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut u64, - /// 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::util::scid_utils::ShortChannelIdError, +/// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_InputZ { + /// 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::events::bump_transaction::Input, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[repr(C)] -/// A CResult_u64ShortChannelIdErrorZ represents the result of a fallible operation, -/// containing a u64 on success and a crate::lightning::util::scid_utils::ShortChannelIdError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_u64ShortChannelIdErrorZ { - /// The contents of this CResult_u64ShortChannelIdErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_u64ShortChannelIdErrorZPtr, - /// Whether this CResult_u64ShortChannelIdErrorZ represents a success state. - pub result_ok: bool, +impl CVec_InputZ { + #[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::events::bump_transaction::Input] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } } -#[no_mangle] -/// Creates a new CResult_u64ShortChannelIdErrorZ in the success state. -pub extern "C" fn CResult_u64ShortChannelIdErrorZ_ok(o: u64) -> CResult_u64ShortChannelIdErrorZ { - CResult_u64ShortChannelIdErrorZ { - contents: CResult_u64ShortChannelIdErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl From> for CVec_InputZ { + 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_u64ShortChannelIdErrorZ in the error state. -pub extern "C" fn CResult_u64ShortChannelIdErrorZ_err(e: crate::lightning::util::scid_utils::ShortChannelIdError) -> CResult_u64ShortChannelIdErrorZ { - CResult_u64ShortChannelIdErrorZ { - contents: CResult_u64ShortChannelIdErrorZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_InputZ_free(_res: CVec_InputZ) { } +impl Drop for CVec_InputZ { + 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_InputZ { + 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_CoinSelectionNoneZ +pub union CResult_CoinSelectionNoneZPtr { + /// 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::events::bump_transaction::CoinSelection, + /// 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_CoinSelectionNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CoinSelectionNoneZ { + /// The contents of this CResult_CoinSelectionNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CoinSelectionNoneZPtr, + /// Whether this CResult_CoinSelectionNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_CoinSelectionNoneZ in the success state. +pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ { + CResult_CoinSelectionNoneZ { + contents: CResult_CoinSelectionNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_CoinSelectionNoneZ in the error state. +pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ { + CResult_CoinSelectionNoneZ { + contents: CResult_CoinSelectionNoneZPtr { + 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_u64ShortChannelIdErrorZ_is_ok(o: &CResult_u64ShortChannelIdErrorZ) -> bool { +pub extern "C" fn CResult_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_u64ShortChannelIdErrorZ. -pub extern "C" fn CResult_u64ShortChannelIdErrorZ_free(_res: CResult_u64ShortChannelIdErrorZ) { } -impl Drop for CResult_u64ShortChannelIdErrorZ { +/// Frees any resources used by the CResult_CoinSelectionNoneZ. +pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { } +impl Drop for CResult_CoinSelectionNoneZ { 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_u64ShortChannelIdErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CoinSelectionNoneZ { + 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_u64ShortChannelIdErrorZPtr { result } + CResult_CoinSelectionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_u64ShortChannelIdErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -9465,78 +9523,91 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PendingHTLCInfoInboundHTLCErrZ -pub union CResult_PendingHTLCInfoInboundHTLCErrZPtr { +/// The contents of CResult_CVec_UtxoZNoneZ +pub union CResult_CVec_UtxoZNoneZPtr { /// 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::channelmanager::PendingHTLCInfo, - /// 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::onion_payment::InboundHTLCErr, + pub result: *mut crate::c_types::derived::CVec_UtxoZ, + /// 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_PendingHTLCInfoInboundHTLCErrZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channelmanager::PendingHTLCInfo on success and a crate::lightning::ln::onion_payment::InboundHTLCErr on failure. +/// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PendingHTLCInfoInboundHTLCErrZ { - /// The contents of this CResult_PendingHTLCInfoInboundHTLCErrZ, accessible via either +pub struct CResult_CVec_UtxoZNoneZ { + /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr, - /// Whether this CResult_PendingHTLCInfoInboundHTLCErrZ represents a success state. + pub contents: CResult_CVec_UtxoZNoneZPtr, + /// Whether this CResult_CVec_UtxoZNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the success state. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_ok(o: crate::lightning::ln::channelmanager::PendingHTLCInfo) -> CResult_PendingHTLCInfoInboundHTLCErrZ { - CResult_PendingHTLCInfoInboundHTLCErrZ { - contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { +/// Creates a new CResult_CVec_UtxoZNoneZ in the success state. +pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ { + CResult_CVec_UtxoZNoneZ { + contents: CResult_CVec_UtxoZNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ in the error state. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_err(e: crate::lightning::ln::onion_payment::InboundHTLCErr) -> CResult_PendingHTLCInfoInboundHTLCErrZ { - CResult_PendingHTLCInfoInboundHTLCErrZ { - contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_CVec_UtxoZNoneZ in the error state. +pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ { + CResult_CVec_UtxoZNoneZ { + contents: CResult_CVec_UtxoZNoneZPtr { + 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_PendingHTLCInfoInboundHTLCErrZ_is_ok(o: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> bool { +pub extern "C" fn CResult_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PendingHTLCInfoInboundHTLCErrZ. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_free(_res: CResult_PendingHTLCInfoInboundHTLCErrZ) { } -impl Drop for CResult_PendingHTLCInfoInboundHTLCErrZ { +/// Frees any resources used by the CResult_CVec_UtxoZNoneZ. +pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { } +impl Drop for CResult_CVec_UtxoZNoneZ { 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_PendingHTLCInfoInboundHTLCErrZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_UtxoZNoneZ { + 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_PendingHTLCInfoInboundHTLCErrZPtr { result } + CResult_CVec_UtxoZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PendingHTLCInfoInboundHTLCErrZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -9544,312 +9615,211 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PendingHTLCInfoInboundHTLCErrZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_PendingHTLCInfoInboundHTLCErrZ which has the same data as `orig` +/// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PendingHTLCInfoInboundHTLCErrZ_clone(orig: &CResult_PendingHTLCInfoInboundHTLCErrZ) -> CResult_PendingHTLCInfoInboundHTLCErrZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::chan_utils::HTLCOutputInCommitments of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_HTLCOutputInCommitmentZ { - /// 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::chan_utils::HTLCOutputInCommitment, - /// The number of elements pointed to by `data`. - pub datalen: usize +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not +pub enum COption_PaymentContextZ { + /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext + Some(crate::lightning::blinded_path::payment::PaymentContext), + /// When we're in this state, this COption_PaymentContextZ contains nothing + None } -impl CVec_HTLCOutputInCommitmentZ { - #[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 +impl COption_PaymentContextZ { + #[allow(unused)] pub(crate) fn is_some(&self) -> bool { + if let Self::None = self { false } else { true } } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::chan_utils::HTLCOutputInCommitment] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + #[allow(unused)] pub(crate) fn is_none(&self) -> bool { + !self.is_some() } -} -impl From> for CVec_HTLCOutputInCommitmentZ { - 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() } } + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::blinded_path::payment::PaymentContext { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_HTLCOutputInCommitmentZ_free(_res: CVec_HTLCOutputInCommitmentZ) { } -impl Drop for CVec_HTLCOutputInCommitmentZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; +/// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext +pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ { + COption_PaymentContextZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_PaymentContextZ containing nothing +pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ { + COption_PaymentContextZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state +pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { } +#[no_mangle] +/// Creates a new COption_PaymentContextZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_u64u16Z { + /// The element at position 0 + pub a: u64, + /// The element at position 1 + pub b: u16, +} +impl From<(u64, u16)> for C2Tuple_u64u16Z { + fn from (tup: (u64, u16)) -> Self { + Self { + a: tup.0, + b: tup.1, + } } } -impl Clone for CVec_HTLCOutputInCommitmentZ { +impl C2Tuple_u64u16Z { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_u64u16Z { 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::sign::HTLCDescriptors of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_HTLCDescriptorZ { - /// 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::sign::HTLCDescriptor, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_HTLCDescriptorZ { - #[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::sign::HTLCDescriptor] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_HTLCDescriptorZ { - 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() } } + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_HTLCDescriptorZ_free(_res: CVec_HTLCDescriptorZ) { } -impl Drop for CVec_HTLCDescriptorZ { - 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_HTLCDescriptorZ { - 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::events::bump_transaction::Utxos of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UtxoZ { - /// 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::events::bump_transaction::Utxo, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UtxoZ { - #[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::events::bump_transaction::Utxo] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_UtxoZ { - 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() } } - } -} +/// 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_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) } +/// Creates a new C2Tuple_u64u16Z from the contained elements. #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_UtxoZ_free(_res: CVec_UtxoZ) { } -impl Drop for CVec_UtxoZ { - 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_UtxoZ { - 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 C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z { + C2Tuple_u64u16Z { a, b, } } + +#[no_mangle] +/// Frees any resources used by the C2Tuple_u64u16Z. +pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::c_types::TxOut or not -pub enum COption_TxOutZ { - /// When we're in this state, this COption_TxOutZ contains a crate::c_types::TxOut - Some(crate::c_types::TxOut), - /// When we're in this state, this COption_TxOutZ contains nothing +/// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not +pub enum COption_C2Tuple_u64u16ZZ { + /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z + Some(crate::c_types::derived::C2Tuple_u64u16Z), + /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing None } -impl COption_TxOutZ { +impl COption_C2Tuple_u64u16ZZ { #[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::TxOut { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::c_types::derived::C2Tuple_u64u16Z { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_TxOutZ containing a crate::c_types::TxOut -pub extern "C" fn COption_TxOutZ_some(o: crate::c_types::TxOut) -> COption_TxOutZ { - COption_TxOutZ::Some(o) +/// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z +pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ { + COption_C2Tuple_u64u16ZZ::Some(o) } #[no_mangle] -/// Constructs a new COption_TxOutZ containing nothing -pub extern "C" fn COption_TxOutZ_none() -> COption_TxOutZ { - COption_TxOutZ::None +/// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing +pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ { + COption_C2Tuple_u64u16ZZ::None } #[no_mangle] -/// Frees any resources associated with the crate::c_types::TxOut, if we are in the Some state -pub extern "C" fn COption_TxOutZ_free(_res: COption_TxOutZ) { } +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state +pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { } #[no_mangle] -/// Creates a new COption_TxOutZ which has the same data as `orig` +/// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_TxOutZ_clone(orig: &COption_TxOutZ) -> COption_TxOutZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::events::bump_transaction::Inputs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_InputZ { - /// 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::events::bump_transaction::Input, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_InputZ { - #[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::events::bump_transaction::Input] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_InputZ { - 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_InputZ_free(_res: CVec_InputZ) { } -impl Drop for CVec_InputZ { - 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_InputZ { - 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 COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CoinSelectionNoneZ -pub union CResult_CoinSelectionNoneZPtr { +/// The contents of CResult_ChannelIdAPIErrorZ +pub union CResult_ChannelIdAPIErrorZPtr { /// 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::events::bump_transaction::CoinSelection, - /// 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::types::ChannelId, + /// 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::util::errors::APIError, } #[repr(C)] -/// A CResult_CoinSelectionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::events::bump_transaction::CoinSelection on success and a () on failure. +/// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CoinSelectionNoneZ { - /// The contents of this CResult_CoinSelectionNoneZ, accessible via either +pub struct CResult_ChannelIdAPIErrorZ { + /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CoinSelectionNoneZPtr, - /// Whether this CResult_CoinSelectionNoneZ represents a success state. + pub contents: CResult_ChannelIdAPIErrorZPtr, + /// Whether this CResult_ChannelIdAPIErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CoinSelectionNoneZ in the success state. -pub extern "C" fn CResult_CoinSelectionNoneZ_ok(o: crate::lightning::events::bump_transaction::CoinSelection) -> CResult_CoinSelectionNoneZ { - CResult_CoinSelectionNoneZ { - contents: CResult_CoinSelectionNoneZPtr { +/// Creates a new CResult_ChannelIdAPIErrorZ in the success state. +pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ { + CResult_ChannelIdAPIErrorZ { + contents: CResult_ChannelIdAPIErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CoinSelectionNoneZ in the error state. -pub extern "C" fn CResult_CoinSelectionNoneZ_err() -> CResult_CoinSelectionNoneZ { - CResult_CoinSelectionNoneZ { - contents: CResult_CoinSelectionNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_ChannelIdAPIErrorZ in the error state. +pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ { + CResult_ChannelIdAPIErrorZ { + contents: CResult_ChannelIdAPIErrorZPtr { + 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_CoinSelectionNoneZ_is_ok(o: &CResult_CoinSelectionNoneZ) -> bool { +pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CoinSelectionNoneZ. -pub extern "C" fn CResult_CoinSelectionNoneZ_free(_res: CResult_CoinSelectionNoneZ) { } -impl Drop for CResult_CoinSelectionNoneZ { +/// Frees any resources used by the CResult_ChannelIdAPIErrorZ. +pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { } +impl Drop for CResult_ChannelIdAPIErrorZ { 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_CoinSelectionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelIdAPIErrorZ { + 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_CoinSelectionNoneZPtr { result } + CResult_ChannelIdAPIErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CoinSelectionNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_ChannelIdAPIErrorZPtr { err } }; Self { contents, @@ -9857,91 +9827,221 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CoinSelectionNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CoinSelectionNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CoinSelectionNoneZ which has the same data as `orig` +/// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CoinSelectionNoneZ_clone(orig: &CResult_CoinSelectionNoneZ) -> CResult_CoinSelectionNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_UtxoZNoneZ -pub union CResult_CVec_UtxoZNoneZPtr { - /// 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_UtxoZ, - /// Note that this value is always NULL, as there are no contents in the Err variant - pub err: *mut core::ffi::c_void, +/// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_RecentPaymentDetailsZ { + /// 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::RecentPaymentDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_RecentPaymentDetailsZ { + #[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::RecentPaymentDetails] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_RecentPaymentDetailsZ { + 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_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { } +impl Drop for CVec_RecentPaymentDetailsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } } #[repr(C)] -/// A CResult_CVec_UtxoZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_UtxoZ on success and a () on failure. +/// The contents of CResult_NoneAPIErrorZ +pub union CResult_NoneAPIErrorZPtr { + /// 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::util::errors::APIError, +} +#[repr(C)] +/// A CResult_NoneAPIErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::util::errors::APIError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_UtxoZNoneZ { - /// The contents of this CResult_CVec_UtxoZNoneZ, accessible via either +pub struct CResult_NoneAPIErrorZ { + /// The contents of this CResult_NoneAPIErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_UtxoZNoneZPtr, - /// Whether this CResult_CVec_UtxoZNoneZ represents a success state. + pub contents: CResult_NoneAPIErrorZPtr, + /// Whether this CResult_NoneAPIErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_UtxoZNoneZ in the success state. -pub extern "C" fn CResult_CVec_UtxoZNoneZ_ok(o: crate::c_types::derived::CVec_UtxoZ) -> CResult_CVec_UtxoZNoneZ { - CResult_CVec_UtxoZNoneZ { - contents: CResult_CVec_UtxoZNoneZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneAPIErrorZ in the success state. +pub extern "C" fn CResult_NoneAPIErrorZ_ok() -> CResult_NoneAPIErrorZ { + CResult_NoneAPIErrorZ { + contents: CResult_NoneAPIErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_UtxoZNoneZ in the error state. -pub extern "C" fn CResult_CVec_UtxoZNoneZ_err() -> CResult_CVec_UtxoZNoneZ { - CResult_CVec_UtxoZNoneZ { - contents: CResult_CVec_UtxoZNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_NoneAPIErrorZ in the error state. +pub extern "C" fn CResult_NoneAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_NoneAPIErrorZ { + CResult_NoneAPIErrorZ { + contents: CResult_NoneAPIErrorZPtr { + 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_CVec_UtxoZNoneZ_is_ok(o: &CResult_CVec_UtxoZNoneZ) -> bool { +pub extern "C" fn CResult_NoneAPIErrorZ_is_ok(o: &CResult_NoneAPIErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_UtxoZNoneZ. -pub extern "C" fn CResult_CVec_UtxoZNoneZ_free(_res: CResult_CVec_UtxoZNoneZ) { } -impl Drop for CResult_CVec_UtxoZNoneZ { +/// Frees any resources used by the CResult_NoneAPIErrorZ. +pub extern "C" fn CResult_NoneAPIErrorZ_free(_res: CResult_NoneAPIErrorZ) { } +impl Drop for CResult_NoneAPIErrorZ { 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_NoneAPIErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::util::errors::APIError>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneAPIErrorZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneAPIErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NoneAPIErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NoneAPIErrorZPtr { + result: core::ptr::null_mut() + } } } else { + Self { result_ok: false, contents: CResult_NoneAPIErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } } } } -impl From> for CResult_CVec_UtxoZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +#[no_mangle] +/// Creates a new CResult_NoneAPIErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_NoneAPIErrorZ_clone(orig: &CResult_NoneAPIErrorZ) -> CResult_NoneAPIErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_NoneRetryableSendFailureZ +pub union CResult_NoneRetryableSendFailureZPtr { + /// 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::outbound_payment::RetryableSendFailure, +} +#[repr(C)] +/// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_NoneRetryableSendFailureZ { + /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NoneRetryableSendFailureZPtr, + /// Whether this CResult_NoneRetryableSendFailureZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_NoneRetryableSendFailureZ in the success state. +pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ { + CResult_NoneRetryableSendFailureZ { + contents: CResult_NoneRetryableSendFailureZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_NoneRetryableSendFailureZ in the error state. +pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ { + CResult_NoneRetryableSendFailureZ { + contents: CResult_NoneRetryableSendFailureZPtr { + 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_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_NoneRetryableSendFailureZ. +pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { } +impl Drop for CResult_NoneRetryableSendFailureZ { + 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) }; + } + } + } +} +impl From> for CResult_NoneRetryableSendFailureZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_CVec_UtxoZNoneZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CVec_UtxoZNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneRetryableSendFailureZPtr { err } }; Self { contents, @@ -9949,175 +10049,188 @@ impl From> } } } -impl Clone for CResult_CVec_UtxoZNoneZ { +impl Clone for CResult_NoneRetryableSendFailureZ { fn clone(&self) -> Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_UtxoZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_CVec_UtxoZNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_UtxoZNoneZ which has the same data as `orig` +/// Creates a new CResult_NoneRetryableSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_UtxoZNoneZ_clone(orig: &CResult_CVec_UtxoZNoneZ) -> CResult_CVec_UtxoZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::lightning::blinded_path::payment::PaymentContext or not -pub enum COption_PaymentContextZ { - /// When we're in this state, this COption_PaymentContextZ contains a crate::lightning::blinded_path::payment::PaymentContext - Some(crate::lightning::blinded_path::payment::PaymentContext), - /// When we're in this state, this COption_PaymentContextZ contains nothing +/// An enum which can either contain a crate::lightning::blinded_path::message::OffersContext or not +pub enum COption_OffersContextZ { + /// When we're in this state, this COption_OffersContextZ contains a crate::lightning::blinded_path::message::OffersContext + Some(crate::lightning::blinded_path::message::OffersContext), + /// When we're in this state, this COption_OffersContextZ contains nothing None } -impl COption_PaymentContextZ { +impl COption_OffersContextZ { #[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::blinded_path::payment::PaymentContext { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::blinded_path::message::OffersContext { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_PaymentContextZ containing a crate::lightning::blinded_path::payment::PaymentContext -pub extern "C" fn COption_PaymentContextZ_some(o: crate::lightning::blinded_path::payment::PaymentContext) -> COption_PaymentContextZ { - COption_PaymentContextZ::Some(o) +/// Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext +pub extern "C" fn COption_OffersContextZ_some(o: crate::lightning::blinded_path::message::OffersContext) -> COption_OffersContextZ { + COption_OffersContextZ::Some(o) } #[no_mangle] -/// Constructs a new COption_PaymentContextZ containing nothing -pub extern "C" fn COption_PaymentContextZ_none() -> COption_PaymentContextZ { - COption_PaymentContextZ::None +/// Constructs a new COption_OffersContextZ containing nothing +pub extern "C" fn COption_OffersContextZ_none() -> COption_OffersContextZ { + COption_OffersContextZ::None } #[no_mangle] -/// Frees any resources associated with the crate::lightning::blinded_path::payment::PaymentContext, if we are in the Some state -pub extern "C" fn COption_PaymentContextZ_free(_res: COption_PaymentContextZ) { } +/// Frees any resources associated with the crate::lightning::blinded_path::message::OffersContext, if we are in the Some state +pub extern "C" fn COption_OffersContextZ_free(_res: COption_OffersContextZ) { } #[no_mangle] -/// Creates a new COption_PaymentContextZ which has the same data as `orig` +/// Creates a new COption_OffersContextZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentContextZ_clone(orig: &COption_PaymentContextZ) -> COption_PaymentContextZ { Clone::clone(&orig) } +pub extern "C" fn COption_OffersContextZ_clone(orig: &COption_OffersContextZ) -> COption_OffersContextZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_u64u16Z { - /// The element at position 0 - pub a: u64, - /// The element at position 1 - pub b: u16, +/// The contents of CResult_NoneBolt12PaymentErrorZ +pub union CResult_NoneBolt12PaymentErrorZPtr { + /// 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::outbound_payment::Bolt12PaymentError, } -impl From<(u64, u16)> for C2Tuple_u64u16Z { - fn from (tup: (u64, u16)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } +#[repr(C)] +/// A CResult_NoneBolt12PaymentErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning::ln::outbound_payment::Bolt12PaymentError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_NoneBolt12PaymentErrorZ { + /// The contents of this CResult_NoneBolt12PaymentErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NoneBolt12PaymentErrorZPtr, + /// Whether this CResult_NoneBolt12PaymentErrorZ represents a success state. + pub result_ok: bool, } -impl C2Tuple_u64u16Z { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (u64, u16) { - (self.a, self.b) +#[no_mangle] +/// Creates a new CResult_NoneBolt12PaymentErrorZ in the success state. +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_ok() -> CResult_NoneBolt12PaymentErrorZ { + CResult_NoneBolt12PaymentErrorZ { + contents: CResult_NoneBolt12PaymentErrorZPtr { + result: core::ptr::null_mut(), + }, + result_ok: true, } } -impl Clone for C2Tuple_u64u16Z { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - } +#[no_mangle] +/// Creates a new CResult_NoneBolt12PaymentErrorZ in the error state. +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_err(e: crate::lightning::ln::outbound_payment::Bolt12PaymentError) -> CResult_NoneBolt12PaymentErrorZ { + CResult_NoneBolt12PaymentErrorZ { + contents: CResult_NoneBolt12PaymentErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } +/// Checks if the given object is currently in the success state #[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_u64u16Z_clone(orig: &C2Tuple_u64u16Z) -> C2Tuple_u64u16Z { Clone::clone(&orig) } -/// Creates a new C2Tuple_u64u16Z from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_u64u16Z_new(a: u64, b: u16) -> C2Tuple_u64u16Z { - C2Tuple_u64u16Z { a, b, } +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_is_ok(o: &CResult_NoneBolt12PaymentErrorZ) -> bool { + o.result_ok } - #[no_mangle] -/// Frees any resources used by the C2Tuple_u64u16Z. -pub extern "C" fn C2Tuple_u64u16Z_free(_res: C2Tuple_u64u16Z) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple_u64u16Z or not -pub enum COption_C2Tuple_u64u16ZZ { - /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains a crate::c_types::derived::C2Tuple_u64u16Z - Some(crate::c_types::derived::C2Tuple_u64u16Z), - /// When we're in this state, this COption_C2Tuple_u64u16ZZ contains nothing - None -} -impl COption_C2Tuple_u64u16ZZ { - #[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::derived::C2Tuple_u64u16Z { - if let Self::Some(v) = self { v } else { unreachable!() } +/// Frees any resources used by the CResult_NoneBolt12PaymentErrorZ. +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_free(_res: CResult_NoneBolt12PaymentErrorZ) { } +impl Drop for CResult_NoneBolt12PaymentErrorZ { + 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) }; + } + } } } -#[no_mangle] -/// Constructs a new COption_C2Tuple_u64u16ZZ containing a crate::c_types::derived::C2Tuple_u64u16Z -pub extern "C" fn COption_C2Tuple_u64u16ZZ_some(o: crate::c_types::derived::C2Tuple_u64u16Z) -> COption_C2Tuple_u64u16ZZ { - COption_C2Tuple_u64u16ZZ::Some(o) +impl From> for CResult_NoneBolt12PaymentErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::Bolt12PaymentError>) -> Self { + let contents = if o.result_ok { + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneBolt12PaymentErrorZPtr { result: core::ptr::null_mut() } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_NoneBolt12PaymentErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } } -#[no_mangle] -/// Constructs a new COption_C2Tuple_u64u16ZZ containing nothing -pub extern "C" fn COption_C2Tuple_u64u16ZZ_none() -> COption_C2Tuple_u64u16ZZ { - COption_C2Tuple_u64u16ZZ::None +impl Clone for CResult_NoneBolt12PaymentErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NoneBolt12PaymentErrorZPtr { + result: core::ptr::null_mut() + } } + } else { + Self { result_ok: false, contents: CResult_NoneBolt12PaymentErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } } #[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple_u64u16Z, if we are in the Some state -pub extern "C" fn COption_C2Tuple_u64u16ZZ_free(_res: COption_C2Tuple_u64u16ZZ) { } -#[no_mangle] -/// Creates a new COption_C2Tuple_u64u16ZZ which has the same data as `orig` +/// Creates a new CResult_NoneBolt12PaymentErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C2Tuple_u64u16ZZ_clone(orig: &COption_C2Tuple_u64u16ZZ) -> COption_C2Tuple_u64u16ZZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneBolt12PaymentErrorZ_clone(orig: &CResult_NoneBolt12PaymentErrorZ) -> CResult_NoneBolt12PaymentErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelIdAPIErrorZ -pub union CResult_ChannelIdAPIErrorZPtr { +/// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ +pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr { /// 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::types::ChannelId, + 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::util::errors::APIError, + pub err: *mut crate::lightning::ln::outbound_payment::RetryableSendFailure, } #[repr(C)] -/// A CResult_ChannelIdAPIErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::util::errors::APIError on failure. +/// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation, +/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelIdAPIErrorZ { - /// The contents of this CResult_ChannelIdAPIErrorZ, accessible via either +pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ { + /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelIdAPIErrorZPtr, - /// Whether this CResult_ChannelIdAPIErrorZ represents a success state. + pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr, + /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelIdAPIErrorZ in the success state. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdAPIErrorZ { - CResult_ChannelIdAPIErrorZ { - contents: CResult_ChannelIdAPIErrorZPtr { +/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { + CResult_ThirtyTwoBytesRetryableSendFailureZ { + contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelIdAPIErrorZ in the error state. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::errors::APIError) -> CResult_ChannelIdAPIErrorZ { - CResult_ChannelIdAPIErrorZ { - contents: CResult_ChannelIdAPIErrorZPtr { +/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { + CResult_ThirtyTwoBytesRetryableSendFailureZ { + contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10125,13 +10238,13 @@ pub extern "C" fn CResult_ChannelIdAPIErrorZ_err(e: crate::lightning::util::erro } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelIdAPIErrorZ_is_ok(o: &CResult_ChannelIdAPIErrorZ) -> bool { +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelIdAPIErrorZ. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_free(_res: CResult_ChannelIdAPIErrorZ) { } -impl Drop for CResult_ChannelIdAPIErrorZ { +/// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { } +impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10144,16 +10257,16 @@ impl Drop for CResult_ChannelIdAPIErrorZ { } } } -impl From> for CResult_ChannelIdAPIErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ThirtyTwoBytesRetryableSendFailureZ { + 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_ChannelIdAPIErrorZPtr { result } + CResult_ThirtyTwoBytesRetryableSendFailureZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelIdAPIErrorZPtr { err } + CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err } }; Self { contents, @@ -10161,96 +10274,101 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelIdAPIErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelIdAPIErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelIdAPIErrorZ which has the same data as `orig` +/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelIdAPIErrorZ_clone(orig: &CResult_ChannelIdAPIErrorZ) -> CResult_ChannelIdAPIErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channelmanager::RecentPaymentDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_RecentPaymentDetailsZ { - /// 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::RecentPaymentDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { + /// The element at position 0 + pub a: crate::c_types::ThirtyTwoBytes, + /// The element at position 1 + pub b: crate::c_types::ThirtyTwoBytes, } -impl CVec_RecentPaymentDetailsZ { - #[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 +impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { + fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { + Self { + a: tup.0, + b: tup.1, + } } - #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::channelmanager::RecentPaymentDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +} +impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) { + (self.a, self.b) } } -impl From> for CVec_RecentPaymentDetailsZ { - 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() } } +impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + } } } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_RecentPaymentDetailsZ_free(_res: CVec_RecentPaymentDetailsZ) { } -impl Drop for CVec_RecentPaymentDetailsZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } +/// 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_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { + C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, } } + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { } #[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 - pub result: *mut core::ffi::c_void, +/// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ +pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + /// 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_ThirtyTwoBytesThirtyTwoBytesZ, /// 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::outbound_payment::PaymentSendFailure, + pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure, } #[repr(C)] -/// A CResult_NonePaymentSendFailureZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. +/// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NonePaymentSendFailureZ { - /// The contents of this CResult_NonePaymentSendFailureZ, accessible via either +pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NonePaymentSendFailureZPtr, - /// Whether this CResult_NonePaymentSendFailureZ represents a success state. + pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NonePaymentSendFailureZ in the success state. -pub extern "C" fn CResult_NonePaymentSendFailureZ_ok() -> CResult_NonePaymentSendFailureZ { - CResult_NonePaymentSendFailureZ { - contents: CResult_NonePaymentSendFailureZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NonePaymentSendFailureZ in the error state. -pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_NonePaymentSendFailureZ { - CResult_NonePaymentSendFailureZ { - contents: CResult_NonePaymentSendFailureZPtr { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10258,15 +10376,18 @@ pub extern "C" fn CResult_NonePaymentSendFailureZ_err(e: crate::lightning::ln::o } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NonePaymentSendFailureZ_is_ok(o: &CResult_NonePaymentSendFailureZ) -> bool { +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NonePaymentSendFailureZ. -pub extern "C" fn CResult_NonePaymentSendFailureZ_free(_res: CResult_NonePaymentSendFailureZ) { } -impl Drop for CResult_NonePaymentSendFailureZ { +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { 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) }; @@ -10274,16 +10395,16 @@ impl Drop for CResult_NonePaymentSendFailureZ { } } } -impl From> for CResult_NonePaymentSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::PaymentSendFailure>) -> Self { +impl From> for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { + 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_NonePaymentSendFailureZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NonePaymentSendFailureZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { err } }; Self { contents, @@ -10291,247 +10412,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NonePaymentSendFailureZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NonePaymentSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NonePaymentSendFailureZ which has the same data as `orig` +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ which has the same data as `orig` /// 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) } +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneRetryableSendFailureZ -pub union CResult_NoneRetryableSendFailureZPtr { - /// 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::outbound_payment::RetryableSendFailure, -} -#[repr(C)] -/// A CResult_NoneRetryableSendFailureZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NoneRetryableSendFailureZ { - /// The contents of this CResult_NoneRetryableSendFailureZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneRetryableSendFailureZPtr, - /// Whether this CResult_NoneRetryableSendFailureZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_NoneRetryableSendFailureZ in the success state. -pub extern "C" fn CResult_NoneRetryableSendFailureZ_ok() -> CResult_NoneRetryableSendFailureZ { - CResult_NoneRetryableSendFailureZ { - contents: CResult_NoneRetryableSendFailureZPtr { - result: core::ptr::null_mut(), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_NoneRetryableSendFailureZ in the error state. -pub extern "C" fn CResult_NoneRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_NoneRetryableSendFailureZ { - CResult_NoneRetryableSendFailureZ { - contents: CResult_NoneRetryableSendFailureZPtr { - 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_NoneRetryableSendFailureZ_is_ok(o: &CResult_NoneRetryableSendFailureZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_NoneRetryableSendFailureZ. -pub extern "C" fn CResult_NoneRetryableSendFailureZ_free(_res: CResult_NoneRetryableSendFailureZ) { } -impl Drop for CResult_NoneRetryableSendFailureZ { - 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) }; - } - } - } -} -impl From> for CResult_NoneRetryableSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning::ln::outbound_payment::RetryableSendFailure>) -> Self { - let contents = if o.result_ok { - let _ = unsafe { Box::from_raw(o.contents.result) }; - o.contents.result = core::ptr::null_mut(); - CResult_NoneRetryableSendFailureZPtr { result: core::ptr::null_mut() } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneRetryableSendFailureZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { + /// 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_ThirtyTwoBytesThirtyTwoBytesZ, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl Clone for CResult_NoneRetryableSendFailureZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_NoneRetryableSendFailureZPtr { - result: core::ptr::null_mut() - } } - } else { - Self { result_ok: false, contents: CResult_NoneRetryableSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { + #[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_NoneRetryableSendFailureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneRetryableSendFailureZ_clone(orig: &CResult_NoneRetryableSendFailureZ) -> CResult_NoneRetryableSendFailureZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_ThirtyTwoBytesPaymentSendFailureZ -pub union CResult_ThirtyTwoBytesPaymentSendFailureZPtr { - /// 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::outbound_payment::PaymentSendFailure, -} -#[repr(C)] -/// A CResult_ThirtyTwoBytesPaymentSendFailureZ represents the result of a fallible operation, -/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ThirtyTwoBytesPaymentSendFailureZ { - /// The contents of this CResult_ThirtyTwoBytesPaymentSendFailureZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr, - /// Whether this CResult_ThirtyTwoBytesPaymentSendFailureZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the success state. -pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { - CResult_ThirtyTwoBytesPaymentSendFailureZ { - contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -#[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ in the error state. -pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { - CResult_ThirtyTwoBytesPaymentSendFailureZ { - contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, +impl From> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { + 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() } } } } -/// Checks if the given object is currently in the success state -#[no_mangle] -pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> bool { - o.result_ok -} #[no_mangle] -/// Frees any resources used by the CResult_ThirtyTwoBytesPaymentSendFailureZ. -pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_free(_res: CResult_ThirtyTwoBytesPaymentSendFailureZ) { } -impl Drop for CResult_ThirtyTwoBytesPaymentSendFailureZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { } +impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { 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_ThirtyTwoBytesPaymentSendFailureZ { - 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_ThirtyTwoBytesPaymentSendFailureZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ThirtyTwoBytesPaymentSendFailureZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CResult_ThirtyTwoBytesPaymentSendFailureZ { +impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ThirtyTwoBytesPaymentSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + 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] -/// Creates a new CResult_ThirtyTwoBytesPaymentSendFailureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ThirtyTwoBytesPaymentSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesPaymentSendFailureZ) -> CResult_ThirtyTwoBytesPaymentSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ThirtyTwoBytesRetryableSendFailureZ -pub union CResult_ThirtyTwoBytesRetryableSendFailureZPtr { +/// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ +pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { /// 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, + pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, /// 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::outbound_payment::RetryableSendFailure, + pub err: *mut crate::lightning::ln::outbound_payment::ProbeSendFailure, } #[repr(C)] -/// A CResult_ThirtyTwoBytesRetryableSendFailureZ represents the result of a fallible operation, -/// containing a crate::c_types::ThirtyTwoBytes on success and a crate::lightning::ln::outbound_payment::RetryableSendFailure on failure. +/// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ThirtyTwoBytesRetryableSendFailureZ { - /// The contents of this CResult_ThirtyTwoBytesRetryableSendFailureZ, accessible via either +pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr, - /// Whether this CResult_ThirtyTwoBytesRetryableSendFailureZ represents a success state. + pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr, + /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the success state. -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_ok(o: crate::c_types::ThirtyTwoBytes) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { - CResult_ThirtyTwoBytesRetryableSendFailureZ { - contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ in the error state. -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::lightning::ln::outbound_payment::RetryableSendFailure) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { - CResult_ThirtyTwoBytesRetryableSendFailureZ { - contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10539,13 +10518,13 @@ pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_err(e: crate::ligh } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_is_ok(o: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> bool { +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ThirtyTwoBytesRetryableSendFailureZ. -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_free(_res: CResult_ThirtyTwoBytesRetryableSendFailureZ) { } -impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ { +/// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { } +impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10558,16 +10537,16 @@ impl Drop for CResult_ThirtyTwoBytesRetryableSendFailureZ { } } } -impl From> for CResult_ThirtyTwoBytesRetryableSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { + 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_ThirtyTwoBytesRetryableSendFailureZPtr { result } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ThirtyTwoBytesRetryableSendFailureZPtr { err } + CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err } }; Self { contents, @@ -10575,45 +10554,45 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ThirtyTwoBytesRetryableSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ThirtyTwoBytesRetryableSendFailureZ which has the same data as `orig` +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ThirtyTwoBytesRetryableSendFailureZ_clone(orig: &CResult_ThirtyTwoBytesRetryableSendFailureZ) -> CResult_ThirtyTwoBytesRetryableSendFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { +pub struct C2Tuple_ChannelIdPublicKeyZ { /// The element at position 0 - pub a: crate::c_types::ThirtyTwoBytes, + pub a: crate::lightning::ln::types::ChannelId, /// The element at position 1 - pub b: crate::c_types::ThirtyTwoBytes, + pub b: crate::c_types::PublicKey, } -impl From<(crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)> for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { - fn from (tup: (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes)) -> Self { +impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ { + fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self { Self { a: tup.0, b: tup.1, } } } -impl C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::ThirtyTwoBytes, crate::c_types::ThirtyTwoBytes) { +impl C2Tuple_ChannelIdPublicKeyZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) { (self.a, self.b) } } -impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { +impl Clone for C2Tuple_ChannelIdPublicKeyZ { fn clone(&self) -> Self { Self { a: Clone::clone(&self.a), @@ -10624,136 +10603,86 @@ impl Clone for C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { #[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_ThirtyTwoBytesThirtyTwoBytesZ_clone(orig: &C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ from the contained elements. +pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. #[no_mangle] -pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::c_types::ThirtyTwoBytes) -> C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { - C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ { a, b, } +pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ { + C2Tuple_ChannelIdPublicKeyZ { a, b, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ. -pub extern "C" fn C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ_free(_res: C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) { } -#[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ -pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { - /// 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_ThirtyTwoBytesThirtyTwoBytesZ, - /// 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::outbound_payment::PaymentSendFailure, -} +/// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. +pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { } #[repr(C)] -/// A CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ on success and a crate::lightning::ln::outbound_payment::PaymentSendFailure on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ represents a success state. - pub result_ok: bool, +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ { + /// 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_ChannelIdPublicKeyZ, + /// The number of elements pointed to by `data`. + pub datalen: usize } -#[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the success state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { - contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, +impl CVec_C2Tuple_ChannelIdPublicKeyZZ { + #[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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ in the error state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_err(e: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { - contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { - err: Box::into_raw(Box::new(e)), - }, - result_ok: false, + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZ] { + 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> bool { - o.result_ok +impl From> for CVec_C2Tuple_ChannelIdPublicKeyZZ { + 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) { } -impl Drop for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_C2Tuple_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { } +impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ { 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { - 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_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; } } -impl Clone for CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { +impl Clone for CVec_C2Tuple_ChannelIdPublicKeyZZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + 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] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ) -> CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesThirtyTwoBytesZs of arbitrary size. +/// A dynamically-allocated array of crate::lightning::ln::types::ChannelIds of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { +pub struct CVec_ChannelIdZ { /// 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_ThirtyTwoBytesThirtyTwoBytesZ, + pub data: *mut crate::lightning::ln::types::ChannelId, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_ChannelIdZ { + #[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_ThirtyTwoBytesThirtyTwoBytesZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::ln::types::ChannelId] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_ChannelIdZ { + 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() } } @@ -10761,14 +10690,14 @@ impl From> f } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) { } -impl Drop for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { +pub extern "C" fn CVec_ChannelIdZ_free(_res: CVec_ChannelIdZ) { } +impl Drop for CVec_ChannelIdZ { 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_ThirtyTwoBytesThirtyTwoBytesZZ { +impl Clone for CVec_ChannelIdZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -10777,41 +10706,120 @@ impl Clone for CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ { } } #[repr(C)] -/// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ -pub union CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_PublicKeyChannelIdZ { + /// The element at position 0 + pub a: crate::c_types::PublicKey, + /// The element at position 1 + pub b: crate::lightning::ln::types::ChannelId, +} +impl From<(crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId)> for C2Tuple_PublicKeyChannelIdZ { + fn from (tup: (crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_PublicKeyChannelIdZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::PublicKey, crate::lightning::ln::types::ChannelId) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_PublicKeyChannelIdZ { + 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_PublicKeyChannelIdZ_clone(orig: &C2Tuple_PublicKeyChannelIdZ) -> C2Tuple_PublicKeyChannelIdZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_PublicKeyChannelIdZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_PublicKeyChannelIdZ_new(a: crate::c_types::PublicKey, b: crate::lightning::ln::types::ChannelId) -> C2Tuple_PublicKeyChannelIdZ { + C2Tuple_PublicKeyChannelIdZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_PublicKeyChannelIdZ. +pub extern "C" fn C2Tuple_PublicKeyChannelIdZ_free(_res: C2Tuple_PublicKeyChannelIdZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ or not +pub enum COption_C2Tuple_PublicKeyChannelIdZZ { + /// When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ + Some(crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ), + /// When we're in this state, this COption_C2Tuple_PublicKeyChannelIdZZ contains nothing + None +} +impl COption_C2Tuple_PublicKeyChannelIdZZ { + #[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::derived::C2Tuple_PublicKeyChannelIdZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing a crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_some(o: crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ) -> COption_C2Tuple_PublicKeyChannelIdZZ { + COption_C2Tuple_PublicKeyChannelIdZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_PublicKeyChannelIdZZ containing nothing +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_none() -> COption_C2Tuple_PublicKeyChannelIdZZ { + COption_C2Tuple_PublicKeyChannelIdZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_PublicKeyChannelIdZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_free(_res: COption_C2Tuple_PublicKeyChannelIdZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_PublicKeyChannelIdZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_PublicKeyChannelIdZZ_clone(orig: &COption_C2Tuple_PublicKeyChannelIdZZ) -> COption_C2Tuple_PublicKeyChannelIdZZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ +pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr { /// 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ, + pub result: *mut crate::lightning_invoice::Bolt11Invoice, /// 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::outbound_payment::ProbeSendFailure, + pub err: *mut crate::lightning_invoice::SignOrCreationError, } #[repr(C)] -/// A CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ on success and a crate::lightning::ln::outbound_payment::ProbeSendFailure on failure. +/// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ, accessible via either +pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ { + /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr, - /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ represents a success state. + pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr, + /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the success state. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { +/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { + CResult_Bolt11InvoiceSignOrCreationErrorZ { + contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ in the error state. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_err(e: crate::lightning::ln::outbound_payment::ProbeSendFailure) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { +/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { + CResult_Bolt11InvoiceSignOrCreationErrorZ { + contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -10819,13 +10827,13 @@ pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFa } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> bool { +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) { } -impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { +/// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { } +impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -10838,16 +10846,16 @@ impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailur } } } -impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt11InvoiceSignOrCreationErrorZ { + 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { result } + CResult_Bolt11InvoiceSignOrCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { err } + CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err } }; Self { contents, @@ -10855,166 +10863,32 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ which has the same data as `orig` +/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbeSendFailureZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_ChannelIdPublicKeyZ { - /// The element at position 0 - pub a: crate::lightning::ln::types::ChannelId, - /// The element at position 1 - pub b: crate::c_types::PublicKey, -} -impl From<(crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)> for C2Tuple_ChannelIdPublicKeyZ { - fn from (tup: (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_ChannelIdPublicKeyZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::ln::types::ChannelId, crate::c_types::PublicKey) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_ChannelIdPublicKeyZ { - 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_ChannelIdPublicKeyZ_clone(orig: &C2Tuple_ChannelIdPublicKeyZ) -> C2Tuple_ChannelIdPublicKeyZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ChannelIdPublicKeyZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_new(a: crate::lightning::ln::types::ChannelId, b: crate::c_types::PublicKey) -> C2Tuple_ChannelIdPublicKeyZ { - C2Tuple_ChannelIdPublicKeyZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_ChannelIdPublicKeyZ. -pub extern "C" fn C2Tuple_ChannelIdPublicKeyZ_free(_res: C2Tuple_ChannelIdPublicKeyZ) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ChannelIdPublicKeyZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_ChannelIdPublicKeyZZ { - /// 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_ChannelIdPublicKeyZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C2Tuple_ChannelIdPublicKeyZZ { - #[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_ChannelIdPublicKeyZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_C2Tuple_ChannelIdPublicKeyZZ { - 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_ChannelIdPublicKeyZZ_free(_res: CVec_C2Tuple_ChannelIdPublicKeyZZ) { } -impl Drop for CVec_C2Tuple_ChannelIdPublicKeyZZ { - 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_ChannelIdPublicKeyZZ { - 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::ln::types::ChannelIds of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_ChannelIdZ { - /// 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::types::ChannelId, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_ChannelIdZ { - #[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::types::ChannelId] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_ChannelIdZ { - 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_ChannelIdZ_free(_res: CVec_ChannelIdZ) { } -impl Drop for CVec_ChannelIdZ { - 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_ChannelIdZ { - 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_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ -pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { - /// 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::offers::offer::OfferWithDerivedMetadataBuilder, - /// 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::offers::parse::Bolt12SemanticError, +/// The contents of CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ +pub union CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZPtr { + /// 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::offers::offer::OfferWithDerivedMetadataBuilder, + /// 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::offers::parse::Bolt12SemanticError, } #[repr(C)] /// A CResult_OfferWithDerivedMetadataBuilderBolt12SemanticErrorZ represents the result of a fallible operation, @@ -11140,6 +11014,52 @@ pub extern "C" fn COption_StrZ_free(_res: COption_StrZ) { } /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn COption_StrZ_clone(orig: &COption_StrZ) -> COption_StrZ { Clone::clone(&orig) } #[repr(C)] +/// A dynamically-allocated array of crate::lightning::onion_message::messenger::Destinations of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_DestinationZ { + /// 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::onion_message::messenger::Destination, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_DestinationZ { + #[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::onion_message::messenger::Destination] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_DestinationZ { + 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_DestinationZ_free(_res: CVec_DestinationZ) { } +impl Drop for CVec_DestinationZ { + 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_DestinationZ { + 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_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ pub union CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZPtr { /// A pointer to the contents in the success state. @@ -11328,43 +11248,6 @@ impl Clone for CResult_ThirtyTwoBytesAPIErrorZ { /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_ThirtyTwoBytesAPIErrorZ_clone(orig: &CResult_ThirtyTwoBytesAPIErrorZ) -> CResult_ThirtyTwoBytesAPIErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::blinded_path::message::OffersContext or not -pub enum COption_OffersContextZ { - /// When we're in this state, this COption_OffersContextZ contains a crate::lightning::blinded_path::message::OffersContext - Some(crate::lightning::blinded_path::message::OffersContext), - /// When we're in this state, this COption_OffersContextZ contains nothing - None -} -impl COption_OffersContextZ { - #[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::blinded_path::message::OffersContext { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_OffersContextZ containing a crate::lightning::blinded_path::message::OffersContext -pub extern "C" fn COption_OffersContextZ_some(o: crate::lightning::blinded_path::message::OffersContext) -> COption_OffersContextZ { - COption_OffersContextZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_OffersContextZ containing nothing -pub extern "C" fn COption_OffersContextZ_none() -> COption_OffersContextZ { - COption_OffersContextZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::blinded_path::message::OffersContext, if we are in the Some state -pub extern "C" fn COption_OffersContextZ_free(_res: COption_OffersContextZ) { } -#[no_mangle] -/// Creates a new COption_OffersContextZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_OffersContextZ_clone(orig: &COption_OffersContextZ) -> COption_OffersContextZ { Clone::clone(&orig) } -#[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. pub struct C2Tuple_OffersMessageResponseInstructionZ { /// The element at position 0 @@ -13553,6 +13436,48 @@ impl Clone for CVec_TransactionOutputsZ { } } #[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_boolboolZ { + /// The element at position 0 + pub a: bool, + /// The element at position 1 + pub b: bool, +} +impl From<(bool, bool)> for C2Tuple_boolboolZ { + fn from (tup: (bool, bool)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_boolboolZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (bool, bool) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_boolboolZ { + 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_boolboolZ_clone(orig: &C2Tuple_boolboolZ) -> C2Tuple_boolboolZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_boolboolZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_boolboolZ_new(a: bool, b: bool) -> C2Tuple_boolboolZ { + C2Tuple_boolboolZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_boolboolZ. +pub extern "C" fn C2Tuple_boolboolZ_free(_res: C2Tuple_boolboolZ) { } +#[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 { @@ -13621,61 +13546,1212 @@ impl C2Tuple_ThirtyTwoBytesChannelMonitorZ { } impl Clone for C2Tuple_ThirtyTwoBytesChannelMonitorZ { fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), + 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_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { + C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. +pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { } +#[repr(C)] +/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ +pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { + /// 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_ThirtyTwoBytesChannelMonitorZ, + /// 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { + 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + 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_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + 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_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) } +#[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) + } +} +impl Clone for C2Tuple_PublicKeyTypeZ { + 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_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) } +/// 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) { } +#[repr(C)] +/// 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 +} +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 + } + #[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) } + } +} +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 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.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +impl Clone for CVec_C2Tuple_PublicKeyTypeZZ { + 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_OnionMessageContentsResponseInstructionZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::packet::OnionMessageContents, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::ResponseInstruction, +} +impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_OnionMessageContentsResponseInstructionZ { + fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OnionMessageContentsResponseInstructionZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OnionMessageContentsResponseInstructionZ { + 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_OnionMessageContentsResponseInstructionZ_clone(orig: &C2Tuple_OnionMessageContentsResponseInstructionZ) -> C2Tuple_OnionMessageContentsResponseInstructionZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OnionMessageContentsResponseInstructionZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_OnionMessageContentsResponseInstructionZ { + C2Tuple_OnionMessageContentsResponseInstructionZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OnionMessageContentsResponseInstructionZ. +pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_free(_res: C2Tuple_OnionMessageContentsResponseInstructionZ) { } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ or not +pub enum COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ + Some(crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ), + /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains nothing + None +} +impl COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + #[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::derived::C2Tuple_OnionMessageContentsResponseInstructionZ { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing nothing +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_none() -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { + COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ, if we are in the Some state +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(_res: COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) { } +#[no_mangle] +/// Creates a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_clone(orig: &COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not +pub enum COption_OnionMessageContentsZ { + /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents + Some(crate::lightning::onion_message::packet::OnionMessageContents), + /// When we're in this state, this COption_OnionMessageContentsZ contains nothing + None +} +impl COption_OnionMessageContentsZ { + #[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::OnionMessageContents { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents +pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ { + COption_OnionMessageContentsZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_OnionMessageContentsZ containing nothing +pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ { + COption_OnionMessageContentsZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state +pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { } +#[no_mangle] +/// Creates a new COption_OnionMessageContentsZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ +pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr { + /// 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_OnionMessageContentsZ, + /// 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_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_OnionMessageContentsZ 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_COption_OnionMessageContentsZDecodeErrorZ { + /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr, + /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { + CResult_COption_OnionMessageContentsZDecodeErrorZ { + contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { + CResult_COption_OnionMessageContentsZDecodeErrorZ { + contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { + 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_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { } +impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ { + 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_COption_OnionMessageContentsZDecodeErrorZ { + 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_OnionMessageContentsZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_OnionMessageContentsZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A tuple of 2 elements. See the individual fields for the types contained. +pub struct C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + /// The element at position 0 + pub a: crate::lightning::onion_message::packet::OnionMessageContents, + /// The element at position 1 + pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, +} +impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { + Self { + a: tup.0, + b: tup.1, + } + } +} +impl C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions) { + (self.a, self.b) + } +} +impl Clone for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + 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_OnionMessageContentsMessageSendInstructionsZ_clone(orig: &C2Tuple_OnionMessageContentsMessageSendInstructionsZ) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { Clone::clone(&orig) } +/// Creates a new C2Tuple_OnionMessageContentsMessageSendInstructionsZ from the contained elements. +#[no_mangle] +pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { + C2Tuple_OnionMessageContentsMessageSendInstructionsZ { a, b, } +} + +#[no_mangle] +/// Frees any resources used by the C2Tuple_OnionMessageContentsMessageSendInstructionsZ. +pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(_res: C2Tuple_OnionMessageContentsMessageSendInstructionsZ) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OnionMessageContentsMessageSendInstructionsZs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { + /// 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_OnionMessageContentsMessageSendInstructionsZ, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { + #[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_OnionMessageContentsMessageSendInstructionsZ] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { + 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_OnionMessageContentsMessageSendInstructionsZZ_free(_res: CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ) { } +impl Drop for CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { + 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_OnionMessageContentsMessageSendInstructionsZZ { + 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)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::wire::Type or not +pub enum COption_TypeZ { + /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type + Some(crate::lightning::ln::wire::Type), + /// When we're in this state, this COption_TypeZ contains nothing + None +} +impl COption_TypeZ { + #[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::wire::Type { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type +pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ { + COption_TypeZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_TypeZ containing nothing +pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ { + COption_TypeZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state +pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { } +#[no_mangle] +/// Creates a new COption_TypeZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_TypeZDecodeErrorZ +pub union CResult_COption_TypeZDecodeErrorZPtr { + /// 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_TypeZ, + /// 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_COption_TypeZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_COption_TypeZDecodeErrorZ { + /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_COption_TypeZDecodeErrorZPtr, + /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ { + CResult_COption_TypeZDecodeErrorZ { + contents: CResult_COption_TypeZDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ { + CResult_COption_TypeZDecodeErrorZ { + contents: CResult_COption_TypeZDecodeErrorZPtr { + 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_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { } +impl Drop for CResult_COption_TypeZDecodeErrorZ { + 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_COption_TypeZDecodeErrorZ { + 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_TypeZDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_COption_TypeZDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_COption_TypeZDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not +pub enum COption_SocketAddressZ { + /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress + Some(crate::lightning::ln::msgs::SocketAddress), + /// When we're in this state, this COption_SocketAddressZ contains nothing + None +} +impl COption_SocketAddressZ { + #[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::SocketAddress { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress +pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ { + COption_SocketAddressZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_SocketAddressZ containing nothing +pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ { + COption_SocketAddressZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state +pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { } +#[no_mangle] +/// Creates a new COption_SocketAddressZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_PeerDetailsZ { + /// 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::peer_handler::PeerDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_PeerDetailsZ { + #[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::peer_handler::PeerDetails] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_PeerDetailsZ { + 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_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { } +impl Drop for CVec_PeerDetailsZ { + fn drop(&mut self) { + if self.datalen == 0 { return; } + let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; + } +} +#[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, + /// 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, +} +#[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. +/// `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 + /// `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 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)), + }, + 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 { + 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_CVec_u8ZPeerHandleErrorZ_is_ok(o: &CResult_CVec_u8ZPeerHandleErrorZ) -> 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 { + 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_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_CVec_u8ZPeerHandleErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_u8ZPeerHandleErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_u8ZPeerHandleErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + 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_CVec_u8ZPeerHandleErrorZPtr { + 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` +/// 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) } +#[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, + /// 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, +} +#[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. +/// `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 + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_NonePeerHandleErrorZPtr, + /// Whether this CResult_NonePeerHandleErrorZ 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(), + }, + 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 { + 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_NonePeerHandleErrorZ_is_ok(o: &CResult_NonePeerHandleErrorZ) -> 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 { + 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) }; + } + } + } +} +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 _ = 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_NonePeerHandleErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_NonePeerHandleErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr { + result: core::ptr::null_mut() + } } + } else { + Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr { + 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` +/// 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) } +#[repr(C)] +/// 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 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::peer_handler::PeerHandleError, +} +#[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. +/// `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 + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_boolPeerHandleErrorZPtr, + /// Whether this CResult_boolPeerHandleErrorZ 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 { + 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 { + 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_boolPeerHandleErrorZ_is_ok(o: &CResult_boolPeerHandleErrorZ) -> 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 { + 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_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_boolPeerHandleErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_boolPeerHandleErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_boolPeerHandleErrorZ { + fn clone(&self) -> Self { + 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 CResult_boolPeerHandleErrorZ 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) } +#[repr(C)] +/// The contents of CResult_u32GraphSyncErrorZ +pub union CResult_u32GraphSyncErrorZPtr { + /// A pointer to the contents in the success state. + /// Reading from this pointer when `result_ok` is not set is undefined. + pub result: *mut u32, + /// 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_rapid_gossip_sync::GraphSyncError, +} +#[repr(C)] +/// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, +/// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_u32GraphSyncErrorZ { + /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_u32GraphSyncErrorZPtr, + /// Whether this CResult_u32GraphSyncErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_u32GraphSyncErrorZ in the success state. +pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ { + CResult_u32GraphSyncErrorZ { + contents: CResult_u32GraphSyncErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_u32GraphSyncErrorZ in the error state. +pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ { + CResult_u32GraphSyncErrorZ { + contents: CResult_u32GraphSyncErrorZPtr { + 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_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_u32GraphSyncErrorZ. +pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { } +impl Drop for CResult_u32GraphSyncErrorZ { + 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_u32GraphSyncErrorZ { + 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_u32GraphSyncErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_u32GraphSyncErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +#[repr(C)] +/// The contents of CResult_CVec_u8ZIOErrorZ +pub union CResult_CVec_u8ZIOErrorZPtr { + /// 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, + /// 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::IOError, +} +#[repr(C)] +/// A CResult_CVec_u8ZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_u8Z on success and a crate::c_types::IOError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CVec_u8ZIOErrorZ { + /// The contents of this CResult_CVec_u8ZIOErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CVec_u8ZIOErrorZPtr, + /// Whether this CResult_CVec_u8ZIOErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_CVec_u8ZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_ok(o: crate::c_types::derived::CVec_u8Z) -> CResult_CVec_u8ZIOErrorZ { + CResult_CVec_u8ZIOErrorZ { + contents: CResult_CVec_u8ZIOErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_CVec_u8ZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ { + CResult_CVec_u8ZIOErrorZ { + contents: CResult_CVec_u8ZIOErrorZPtr { + 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_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_CVec_u8ZIOErrorZ. +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { } +impl Drop for CResult_CVec_u8ZIOErrorZ { + 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_CVec_u8ZIOErrorZ { + 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_u8ZIOErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CVec_u8ZIOErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_u8ZIOErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr { + 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_CVec_u8ZIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_clone(orig: &C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_ThirtyTwoBytesChannelMonitorZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_new(a: crate::c_types::ThirtyTwoBytes, b: crate::lightning::chain::channelmonitor::ChannelMonitor) -> C2Tuple_ThirtyTwoBytesChannelMonitorZ { - C2Tuple_ThirtyTwoBytesChannelMonitorZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_ThirtyTwoBytesChannelMonitorZ. -pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelMonitorZ_free(_res: C2Tuple_ThirtyTwoBytesChannelMonitorZ) { } +pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ -pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { +/// The contents of CResult_CVec_StrZIOErrorZ +pub union CResult_CVec_StrZIOErrorZPtr { /// 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_ThirtyTwoBytesChannelMonitorZ, + pub result: *mut crate::c_types::derived::CVec_StrZ, /// 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::IOError, } #[repr(C)] -/// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ, accessible via either +pub struct CResult_CVec_StrZIOErrorZ { + /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ represents a success state. + pub contents: CResult_CVec_StrZIOErrorZPtr, + /// Whether this CResult_CVec_StrZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the success state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { +/// Creates a new CResult_CVec_StrZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ { + CResult_CVec_StrZIOErrorZ { + contents: CResult_CVec_StrZIOErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ in the error state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { +/// Creates a new CResult_CVec_StrZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ { + CResult_CVec_StrZIOErrorZ { + contents: CResult_CVec_StrZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -13683,13 +14759,13 @@ pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_err( } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) { } -impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { +/// Frees any resources used by the CResult_CVec_StrZIOErrorZ. +pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { } +impl Drop for CResult_CVec_StrZIOErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -13702,16 +14778,16 @@ impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { } } } -impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_StrZIOErrorZ { + 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_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { result } + CResult_CVec_StrZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { err } + CResult_CVec_StrZIOErrorZPtr { err } }; Self { contents, @@ -13719,89 +14795,93 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_PublicKeyTypeZ { +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_StrStrStrZ { /// The element at position 0 - pub a: crate::c_types::PublicKey, + pub a: crate::c_types::Str, /// The element at position 1 - pub b: crate::lightning::ln::wire::Type, + pub b: crate::c_types::Str, + /// The element at position 2 + pub c: crate::c_types::Str, } -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 { +impl From<(crate::c_types::Str, crate::c_types::Str, crate::c_types::Str)> for C3Tuple_StrStrStrZ { + fn from (tup: (crate::c_types::Str, crate::c_types::Str, crate::c_types::Str)) -> Self { Self { a: tup.0, b: tup.1, + c: tup.2, } } } -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) +impl C3Tuple_StrStrStrZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::c_types::Str, crate::c_types::Str, crate::c_types::Str) { + (self.a, self.b, self.c) } } -impl Clone for C2Tuple_PublicKeyTypeZ { +impl Clone for C3Tuple_StrStrStrZ { 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_PublicKeyTypeZ_clone(orig: &C2Tuple_PublicKeyTypeZ) -> C2Tuple_PublicKeyTypeZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_PublicKeyTypeZ from the contained elements. +pub extern "C" fn C3Tuple_StrStrStrZ_clone(orig: &C3Tuple_StrStrStrZ) -> C3Tuple_StrStrStrZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_StrStrStrZ 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, } +pub extern "C" fn C3Tuple_StrStrStrZ_new(a: crate::c_types::Str, b: crate::c_types::Str, c: crate::c_types::Str) -> C3Tuple_StrStrStrZ { + C3Tuple_StrStrStrZ { a, b, c, } } #[no_mangle] -/// Frees any resources used by the C2Tuple_PublicKeyTypeZ. -pub extern "C" fn C2Tuple_PublicKeyTypeZ_free(_res: C2Tuple_PublicKeyTypeZ) { } +/// Frees any resources used by the C3Tuple_StrStrStrZ. +pub extern "C" fn C3Tuple_StrStrStrZ_free(_res: C3Tuple_StrStrStrZ) { } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_PublicKeyTypeZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C3Tuple_StrStrStrZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_PublicKeyTypeZZ { +pub struct CVec_C3Tuple_StrStrStrZZ { /// 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::c_types::derived::C3Tuple_StrStrStrZ, /// 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_C3Tuple_StrStrStrZZ { + #[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::c_types::derived::C3Tuple_StrStrStrZ] { 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_C3Tuple_StrStrStrZZ { + 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() } } @@ -13809,14 +14889,14 @@ 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_C3Tuple_StrStrStrZZ_free(_res: CVec_C3Tuple_StrStrStrZZ) { } +impl Drop for CVec_C3Tuple_StrStrStrZZ { 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_PublicKeyTypeZZ { +impl Clone for CVec_C3Tuple_StrStrStrZZ { fn clone(&self) -> Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -13825,157 +14905,41 @@ impl Clone for CVec_C2Tuple_PublicKeyTypeZZ { } } #[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OnionMessageContentsResponseInstructionZ { - /// The element at position 0 - pub a: crate::lightning::onion_message::packet::OnionMessageContents, - /// The element at position 1 - pub b: crate::lightning::onion_message::messenger::ResponseInstruction, -} -impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)> for C2Tuple_OnionMessageContentsResponseInstructionZ { - fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_OnionMessageContentsResponseInstructionZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::ResponseInstruction) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_OnionMessageContentsResponseInstructionZ { - 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_OnionMessageContentsResponseInstructionZ_clone(orig: &C2Tuple_OnionMessageContentsResponseInstructionZ) -> C2Tuple_OnionMessageContentsResponseInstructionZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OnionMessageContentsResponseInstructionZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::ResponseInstruction) -> C2Tuple_OnionMessageContentsResponseInstructionZ { - C2Tuple_OnionMessageContentsResponseInstructionZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_OnionMessageContentsResponseInstructionZ. -pub extern "C" fn C2Tuple_OnionMessageContentsResponseInstructionZ_free(_res: C2Tuple_OnionMessageContentsResponseInstructionZ) { } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ or not -pub enum COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { - /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ - Some(crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ), - /// When we're in this state, this COption_C2Tuple_OnionMessageContentsResponseInstructionZZ contains nothing - None -} -impl COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { - #[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::derived::C2Tuple_OnionMessageContentsResponseInstructionZ { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing a crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_some(o: crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ containing nothing -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_none() -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { - COption_C2Tuple_OnionMessageContentsResponseInstructionZZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::derived::C2Tuple_OnionMessageContentsResponseInstructionZ, if we are in the Some state -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_free(_res: COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) { } -#[no_mangle] -/// Creates a new COption_C2Tuple_OnionMessageContentsResponseInstructionZZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_C2Tuple_OnionMessageContentsResponseInstructionZZ_clone(orig: &COption_C2Tuple_OnionMessageContentsResponseInstructionZZ) -> COption_C2Tuple_OnionMessageContentsResponseInstructionZZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::onion_message::packet::OnionMessageContents or not -pub enum COption_OnionMessageContentsZ { - /// When we're in this state, this COption_OnionMessageContentsZ contains a crate::lightning::onion_message::packet::OnionMessageContents - Some(crate::lightning::onion_message::packet::OnionMessageContents), - /// When we're in this state, this COption_OnionMessageContentsZ contains nothing - None -} -impl COption_OnionMessageContentsZ { - #[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::OnionMessageContents { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_OnionMessageContentsZ containing a crate::lightning::onion_message::packet::OnionMessageContents -pub extern "C" fn COption_OnionMessageContentsZ_some(o: crate::lightning::onion_message::packet::OnionMessageContents) -> COption_OnionMessageContentsZ { - COption_OnionMessageContentsZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_OnionMessageContentsZ containing nothing -pub extern "C" fn COption_OnionMessageContentsZ_none() -> COption_OnionMessageContentsZ { - COption_OnionMessageContentsZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::onion_message::packet::OnionMessageContents, if we are in the Some state -pub extern "C" fn COption_OnionMessageContentsZ_free(_res: COption_OnionMessageContentsZ) { } -#[no_mangle] -/// Creates a new COption_OnionMessageContentsZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_OnionMessageContentsZ_clone(orig: &COption_OnionMessageContentsZ) -> COption_OnionMessageContentsZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_COption_OnionMessageContentsZDecodeErrorZ -pub union CResult_COption_OnionMessageContentsZDecodeErrorZPtr { +/// The contents of CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ +pub union CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { /// 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_OnionMessageContentsZ, + pub result: *mut crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ, /// 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::IOError, } #[repr(C)] -/// A CResult_COption_OnionMessageContentsZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_OnionMessageContentsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ on success and a crate::c_types::IOError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_OnionMessageContentsZDecodeErrorZ { - /// The contents of this CResult_COption_OnionMessageContentsZDecodeErrorZ, accessible via either +pub struct CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + /// The contents of this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr, - /// Whether this CResult_COption_OnionMessageContentsZDecodeErrorZ represents a success state. + pub contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr, + /// Whether this CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ represents a success state. pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OnionMessageContentsZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { - CResult_COption_OnionMessageContentsZDecodeErrorZ { - contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { +} +#[no_mangle] +/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C3Tuple_StrStrStrZZ) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { - CResult_COption_OnionMessageContentsZDecodeErrorZ { - contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { +/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -13983,13 +14947,13 @@ pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_err(e: crate } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_is_ok(o: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_is_ok(o: &CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_OnionMessageContentsZDecodeErrorZ. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_free(_res: CResult_COption_OnionMessageContentsZDecodeErrorZ) { } -impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ { +/// Frees any resources used by the CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ. +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_free(_res: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) { } +impl Drop for CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14002,16 +14966,16 @@ impl Drop for CResult_COption_OnionMessageContentsZDecodeErrorZ { } } } -impl From> for CResult_COption_OnionMessageContentsZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + 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_OnionMessageContentsZDecodeErrorZPtr { result } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_OnionMessageContentsZDecodeErrorZPtr { err } + CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { err } }; Self { contents, @@ -14019,89 +14983,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_OnionMessageContentsZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_C3Tuple_StrStrStrZZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_OnionMessageContentsZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_OnionMessageContentsZDecodeErrorZ_clone(orig: &CResult_COption_OnionMessageContentsZDecodeErrorZ) -> CResult_COption_OnionMessageContentsZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 2 elements. See the individual fields for the types contained. -pub struct C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - /// The element at position 0 - pub a: crate::lightning::onion_message::packet::OnionMessageContents, - /// The element at position 1 - pub b: crate::lightning::onion_message::messenger::MessageSendInstructions, -} -impl From<(crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)> for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - fn from (tup: (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions)) -> Self { - Self { - a: tup.0, - b: tup.1, - } - } -} -impl C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning::onion_message::packet::OnionMessageContents, crate::lightning::onion_message::messenger::MessageSendInstructions) { - (self.a, self.b) - } -} -impl Clone for C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - 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` +/// Creates a new CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_clone(orig: &C2Tuple_OnionMessageContentsMessageSendInstructionsZ) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { Clone::clone(&orig) } -/// Creates a new C2Tuple_OnionMessageContentsMessageSendInstructionsZ from the contained elements. -#[no_mangle] -pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_new(a: crate::lightning::onion_message::packet::OnionMessageContents, b: crate::lightning::onion_message::messenger::MessageSendInstructions) -> C2Tuple_OnionMessageContentsMessageSendInstructionsZ { - C2Tuple_OnionMessageContentsMessageSendInstructionsZ { a, b, } -} - -#[no_mangle] -/// Frees any resources used by the C2Tuple_OnionMessageContentsMessageSendInstructionsZ. -pub extern "C" fn C2Tuple_OnionMessageContentsMessageSendInstructionsZ_free(_res: C2Tuple_OnionMessageContentsMessageSendInstructionsZ) { } +pub extern "C" fn CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ_clone(orig: &CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ) -> CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_OnionMessageContentsMessageSendInstructionsZs of arbitrary size. +/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { +pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { /// 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_OnionMessageContentsMessageSendInstructionsZ, + pub data: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + #[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_OnionMessageContentsMessageSendInstructionsZ] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { - fn from(v: Vec) -> Self { +impl From> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { + 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() } } @@ -14109,14 +15031,14 @@ impl From Self { let mut res = Vec::new(); if self.datalen == 0 { return Self::from(res); } @@ -14125,78 +15047,41 @@ impl Clone for CVec_C2Tuple_OnionMessageContentsMessageSendInstructionsZZ { } } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::wire::Type or not -pub enum COption_TypeZ { - /// When we're in this state, this COption_TypeZ contains a crate::lightning::ln::wire::Type - Some(crate::lightning::ln::wire::Type), - /// When we're in this state, this COption_TypeZ contains nothing - None -} -impl COption_TypeZ { - #[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::wire::Type { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_TypeZ containing a crate::lightning::ln::wire::Type -pub extern "C" fn COption_TypeZ_some(o: crate::lightning::ln::wire::Type) -> COption_TypeZ { - COption_TypeZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_TypeZ containing nothing -pub extern "C" fn COption_TypeZ_none() -> COption_TypeZ { - COption_TypeZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::wire::Type, if we are in the Some state -pub extern "C" fn COption_TypeZ_free(_res: COption_TypeZ) { } -#[no_mangle] -/// Creates a new COption_TypeZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_TypeZ_clone(orig: &COption_TypeZ) -> COption_TypeZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_COption_TypeZDecodeErrorZ -pub union CResult_COption_TypeZDecodeErrorZPtr { +/// The contents of CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ +pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { /// 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_TypeZ, + pub result: *mut crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, /// 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::IOError, } #[repr(C)] -/// A CResult_COption_TypeZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_TypeZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_TypeZDecodeErrorZ { - /// The contents of this CResult_COption_TypeZDecodeErrorZ, accessible via either +pub struct CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_TypeZDecodeErrorZPtr, - /// Whether this CResult_COption_TypeZDecodeErrorZ represents a success state. + pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr, + /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_TypeZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_ok(o: crate::c_types::derived::COption_TypeZ) -> CResult_COption_TypeZDecodeErrorZ { - CResult_COption_TypeZDecodeErrorZ { - contents: CResult_COption_TypeZDecodeErrorZPtr { +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_TypeZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_TypeZDecodeErrorZ { - CResult_COption_TypeZDecodeErrorZ { - contents: CResult_COption_TypeZDecodeErrorZPtr { +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14204,13 +15089,13 @@ pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_is_ok(o: &CResult_COption_TypeZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_TypeZDecodeErrorZ. -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_free(_res: CResult_COption_TypeZDecodeErrorZ) { } -impl Drop for CResult_COption_TypeZDecodeErrorZ { +/// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { } +impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14223,16 +15108,16 @@ impl Drop for CResult_COption_TypeZDecodeErrorZ { } } } -impl From> for CResult_COption_TypeZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { + 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_TypeZDecodeErrorZPtr { result } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_TypeZDecodeErrorZPtr { err } + CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err } }; Self { contents, @@ -14240,134 +15125,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_TypeZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_TypeZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } - } - } -} -#[no_mangle] -/// Creates a new CResult_COption_TypeZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_TypeZDecodeErrorZ_clone(orig: &CResult_COption_TypeZDecodeErrorZ) -> CResult_COption_TypeZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::msgs::SocketAddress or not -pub enum COption_SocketAddressZ { - /// When we're in this state, this COption_SocketAddressZ contains a crate::lightning::ln::msgs::SocketAddress - Some(crate::lightning::ln::msgs::SocketAddress), - /// When we're in this state, this COption_SocketAddressZ contains nothing - None -} -impl COption_SocketAddressZ { - #[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::SocketAddress { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_SocketAddressZ containing a crate::lightning::ln::msgs::SocketAddress -pub extern "C" fn COption_SocketAddressZ_some(o: crate::lightning::ln::msgs::SocketAddress) -> COption_SocketAddressZ { - COption_SocketAddressZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_SocketAddressZ containing nothing -pub extern "C" fn COption_SocketAddressZ_none() -> COption_SocketAddressZ { - COption_SocketAddressZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::msgs::SocketAddress, if we are in the Some state -pub extern "C" fn COption_SocketAddressZ_free(_res: COption_SocketAddressZ) { } -#[no_mangle] -/// Creates a new COption_SocketAddressZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_SocketAddressZ_clone(orig: &COption_SocketAddressZ) -> COption_SocketAddressZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::peer_handler::PeerDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_PeerDetailsZ { - /// 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::peer_handler::PeerDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_PeerDetailsZ { - #[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::peer_handler::PeerDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_PeerDetailsZ { - 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_PeerDetailsZ_free(_res: CVec_PeerDetailsZ) { } -impl Drop for CVec_PeerDetailsZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} +/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_u8ZPeerHandleErrorZ -pub union CResult_CVec_u8ZPeerHandleErrorZPtr { +/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ +pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { /// 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, + pub result: *mut crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ, /// 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::c_types::IOError, } #[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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr, + /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ 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 { +/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result: Box::into_raw(Box::new(o)), }, 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14375,13 +15185,13 @@ 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. +pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { } +impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14394,16 +15204,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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { + 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_u8ZPeerHandleErrorZPtr { result } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_u8ZPeerHandleErrorZPtr { err } + CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err } }; Self { contents, @@ -14411,58 +15221,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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { + 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { 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_MonitorNameIOErrorZ +pub union CResult_MonitorNameIOErrorZPtr { + /// 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::util::persist::MonitorName, /// 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::c_types::IOError, } #[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_MonitorNameIOErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::persist::MonitorName on success and a crate::c_types::IOError 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_MonitorNameIOErrorZ { + /// The contents of this CResult_MonitorNameIOErrorZ, 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_MonitorNameIOErrorZPtr, + /// Whether this CResult_MonitorNameIOErrorZ 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_MonitorNameIOErrorZ in the success state. +pub extern "C" fn CResult_MonitorNameIOErrorZ_ok(o: crate::lightning::util::persist::MonitorName) -> CResult_MonitorNameIOErrorZ { + CResult_MonitorNameIOErrorZ { + contents: CResult_MonitorNameIOErrorZPtr { + 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_MonitorNameIOErrorZ in the error state. +pub extern "C" fn CResult_MonitorNameIOErrorZ_err(e: crate::c_types::IOError) -> CResult_MonitorNameIOErrorZ { + CResult_MonitorNameIOErrorZ { + contents: CResult_MonitorNameIOErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14470,15 +15281,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_MonitorNameIOErrorZ_is_ok(o: &CResult_MonitorNameIOErrorZ) -> 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_MonitorNameIOErrorZ. +pub extern "C" fn CResult_MonitorNameIOErrorZ_free(_res: CResult_MonitorNameIOErrorZ) { } +impl Drop for CResult_MonitorNameIOErrorZ { 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) }; @@ -14486,16 +15300,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_MonitorNameIOErrorZ { + 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_MonitorNameIOErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NonePeerHandleErrorZPtr { err } + CResult_MonitorNameIOErrorZPtr { err } }; Self { contents, @@ -14503,59 +15317,121 @@ impl From Self { +#[repr(C)] +/// The contents of CResult_UpdateNameIOErrorZ +pub union CResult_UpdateNameIOErrorZPtr { + /// 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::util::persist::UpdateName, + /// 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::IOError, +} +#[repr(C)] +/// A CResult_UpdateNameIOErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::persist::UpdateName on success and a crate::c_types::IOError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_UpdateNameIOErrorZ { + /// The contents of this CResult_UpdateNameIOErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_UpdateNameIOErrorZPtr, + /// Whether this CResult_UpdateNameIOErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_UpdateNameIOErrorZ in the success state. +pub extern "C" fn CResult_UpdateNameIOErrorZ_ok(o: crate::lightning::util::persist::UpdateName) -> CResult_UpdateNameIOErrorZ { + CResult_UpdateNameIOErrorZ { + contents: CResult_UpdateNameIOErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_UpdateNameIOErrorZ in the error state. +pub extern "C" fn CResult_UpdateNameIOErrorZ_err(e: crate::c_types::IOError) -> CResult_UpdateNameIOErrorZ { + CResult_UpdateNameIOErrorZ { + contents: CResult_UpdateNameIOErrorZPtr { + 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_UpdateNameIOErrorZ_is_ok(o: &CResult_UpdateNameIOErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_UpdateNameIOErrorZ. +pub extern "C" fn CResult_UpdateNameIOErrorZ_free(_res: CResult_UpdateNameIOErrorZ) { } +impl Drop for CResult_UpdateNameIOErrorZ { + fn drop(&mut self) { if self.result_ok { - Self { result_ok: true, contents: CResult_NonePeerHandleErrorZPtr { - result: core::ptr::null_mut() - } } + if unsafe { !(self.contents.result as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.result) }; + } } else { - Self { result_ok: false, contents: CResult_NonePeerHandleErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } + if unsafe { !(self.contents.err as *mut ()).is_null() } { + let _ = unsafe { Box::from_raw(self.contents.err) }; + } + } + } +} +impl From> for CResult_UpdateNameIOErrorZ { + 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_UpdateNameIOErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_UpdateNameIOErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, } } } -#[no_mangle] -/// 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_NonePeerHandleErrorZ_clone(orig: &CResult_NonePeerHandleErrorZ) -> CResult_NonePeerHandleErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_boolPeerHandleErrorZ -pub union CResult_boolPeerHandleErrorZPtr { +/// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ +pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr { /// 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::offers::invoice_request::InvoiceRequest, /// 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::offers::parse::Bolt12SemanticError, } #[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_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError 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_InvoiceRequestBolt12SemanticErrorZ { + /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, 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_InvoiceRequestBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ 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_InvoiceRequestBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ { + CResult_InvoiceRequestBolt12SemanticErrorZ { + contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { 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_InvoiceRequestBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ { + CResult_InvoiceRequestBolt12SemanticErrorZ { + contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14563,13 +15439,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_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> 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_InvoiceRequestBolt12SemanticErrorZ. +pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { } +impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14582,16 +15458,16 @@ impl Drop for CResult_boolPeerHandleErrorZ { } } } -impl From> for CResult_boolPeerHandleErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceRequestBolt12SemanticErrorZ { + 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_InvoiceRequestBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_boolPeerHandleErrorZPtr { err } + CResult_InvoiceRequestBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -14599,59 +15475,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_InvoiceRequestBolt12SemanticErrorZPtr { + 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_InvoiceRequestBolt12SemanticErrorZPtr { + 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_InvoiceRequestBolt12SemanticErrorZ 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_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_u32GraphSyncErrorZ -pub union CResult_u32GraphSyncErrorZPtr { +/// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ +pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { /// A pointer to the contents in the success state. /// Reading from this pointer when `result_ok` is not set is undefined. - pub result: *mut u32, + pub result: *mut crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, /// 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_rapid_gossip_sync::GraphSyncError, + pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_u32GraphSyncErrorZ represents the result of a fallible operation, -/// containing a u32 on success and a crate::lightning_rapid_gossip_sync::GraphSyncError on failure. +/// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_u32GraphSyncErrorZ { - /// The contents of this CResult_u32GraphSyncErrorZ, accessible via either +pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_u32GraphSyncErrorZPtr, - /// Whether this CResult_u32GraphSyncErrorZ represents a success state. + pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_u32GraphSyncErrorZ in the success state. -pub extern "C" fn CResult_u32GraphSyncErrorZ_ok(o: u32) -> CResult_u32GraphSyncErrorZ { - CResult_u32GraphSyncErrorZ { - contents: CResult_u32GraphSyncErrorZPtr { +/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_u32GraphSyncErrorZ in the error state. -pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossip_sync::GraphSyncError) -> CResult_u32GraphSyncErrorZ { - CResult_u32GraphSyncErrorZ { - contents: CResult_u32GraphSyncErrorZPtr { +/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14659,13 +15535,13 @@ pub extern "C" fn CResult_u32GraphSyncErrorZ_err(e: crate::lightning_rapid_gossi } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_u32GraphSyncErrorZ_is_ok(o: &CResult_u32GraphSyncErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_u32GraphSyncErrorZ. -pub extern "C" fn CResult_u32GraphSyncErrorZ_free(_res: CResult_u32GraphSyncErrorZ) { } -impl Drop for CResult_u32GraphSyncErrorZ { +/// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ. +pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { } +impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14678,16 +15554,16 @@ impl Drop for CResult_u32GraphSyncErrorZ { } } } -impl From> for CResult_u32GraphSyncErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { + 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_u32GraphSyncErrorZPtr { result } + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_u32GraphSyncErrorZPtr { err } + CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -14696,77 +15572,73 @@ impl From CResult_CVec_u8ZIOErrorZ { - CResult_CVec_u8ZIOErrorZ { - contents: CResult_CVec_u8ZIOErrorZPtr { +/// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ { + CResult_VerifiedInvoiceRequestNoneZ { + contents: CResult_VerifiedInvoiceRequestNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZIOErrorZ in the error state. -pub extern "C" fn CResult_CVec_u8ZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_u8ZIOErrorZ { - CResult_CVec_u8ZIOErrorZ { - contents: CResult_CVec_u8ZIOErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ { + CResult_VerifiedInvoiceRequestNoneZ { + contents: CResult_VerifiedInvoiceRequestNoneZPtr { + 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_CVec_u8ZIOErrorZ_is_ok(o: &CResult_CVec_u8ZIOErrorZ) -> bool { +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_u8ZIOErrorZ. -pub extern "C" fn CResult_CVec_u8ZIOErrorZ_free(_res: CResult_CVec_u8ZIOErrorZ) { } -impl Drop for CResult_CVec_u8ZIOErrorZ { +/// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { } +impl Drop for CResult_VerifiedInvoiceRequestNoneZ { 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_CVec_u8ZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_VerifiedInvoiceRequestNoneZ { + 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_u8ZIOErrorZPtr { result } + CResult_VerifiedInvoiceRequestNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_u8ZIOErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -14774,59 +15646,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_u8ZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_u8ZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_CVec_u8ZIOErrorZ which has the same data as `orig` +/// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_u8ZIOErrorZ_clone(orig: &CResult_CVec_u8ZIOErrorZ) -> CResult_CVec_u8ZIOErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_StrZIOErrorZ -pub union CResult_CVec_StrZIOErrorZPtr { +/// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ +pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { /// 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_StrZ, + pub result: *mut crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, /// 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::IOError, + pub err: *mut crate::lightning::offers::parse::Bolt12SemanticError, } #[repr(C)] -/// A CResult_CVec_StrZIOErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_StrZ on success and a crate::c_types::IOError on failure. +/// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_StrZIOErrorZ { - /// The contents of this CResult_CVec_StrZIOErrorZ, accessible via either +pub struct CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_StrZIOErrorZPtr, - /// Whether this CResult_CVec_StrZIOErrorZ represents a success state. + pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr, + /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_StrZIOErrorZ in the success state. -pub extern "C" fn CResult_CVec_StrZIOErrorZ_ok(o: crate::c_types::derived::CVec_StrZ) -> CResult_CVec_StrZIOErrorZ { - CResult_CVec_StrZIOErrorZ { - contents: CResult_CVec_StrZIOErrorZPtr { +/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_StrZIOErrorZ in the error state. -pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_StrZIOErrorZ { - CResult_CVec_StrZIOErrorZ { - contents: CResult_CVec_StrZIOErrorZPtr { +/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14834,13 +15706,13 @@ pub extern "C" fn CResult_CVec_StrZIOErrorZ_err(e: crate::c_types::IOError) -> C } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_StrZIOErrorZ_is_ok(o: &CResult_CVec_StrZIOErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_StrZIOErrorZ. -pub extern "C" fn CResult_CVec_StrZIOErrorZ_free(_res: CResult_CVec_StrZIOErrorZ) { } -impl Drop for CResult_CVec_StrZIOErrorZ { +/// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ. +pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { } +impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14853,16 +15725,16 @@ impl Drop for CResult_CVec_StrZIOErrorZ { } } } -impl From> for CResult_CVec_StrZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { + 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_StrZIOErrorZPtr { result } + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_StrZIOErrorZPtr { err } + CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } }; Self { contents, @@ -14870,105 +15742,42 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_StrZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_CVec_StrZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_CVec_StrZIOErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_StrZIOErrorZ_clone(orig: &CResult_CVec_StrZIOErrorZ) -> CResult_CVec_StrZIOErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { - /// 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_ThirtyTwoBytesChannelMonitorZ, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { - #[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_ThirtyTwoBytesChannelMonitorZ] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { - 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_ThirtyTwoBytesChannelMonitorZZ_free(_res: CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) { } -impl Drop for CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ { - 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_ThirtyTwoBytesChannelMonitorZZ { - 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ -pub union CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { +/// The contents of CResult_InvoiceRequestDecodeErrorZ +pub union CResult_InvoiceRequestDecodeErrorZPtr { /// 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_C2Tuple_ThirtyTwoBytesChannelMonitorZZ, + pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequest, /// 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::IOError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ on success and a crate::c_types::IOError on failure. +/// A CResult_InvoiceRequestDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::InvoiceRequest 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_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - /// The contents of this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ, accessible via either +pub struct CResult_InvoiceRequestDecodeErrorZ { + /// The contents of this CResult_InvoiceRequestDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr, - /// Whether this CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ represents a success state. + pub contents: CResult_InvoiceRequestDecodeErrorZPtr, + /// Whether this CResult_InvoiceRequestDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the success state. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_ok(o: crate::c_types::derived::CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { +/// Creates a new CResult_InvoiceRequestDecodeErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestDecodeErrorZ { + CResult_InvoiceRequestDecodeErrorZ { + contents: CResult_InvoiceRequestDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ in the error state. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { + } +} +#[no_mangle] +/// Creates a new CResult_InvoiceRequestDecodeErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestDecodeErrorZ { + CResult_InvoiceRequestDecodeErrorZ { + contents: CResult_InvoiceRequestDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -14976,13 +15785,13 @@ pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_er } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_is_ok(o: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_free(_res: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) { } -impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { +/// Frees any resources used by the CResult_InvoiceRequestDecodeErrorZ. +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_free(_res: CResult_InvoiceRequestDecodeErrorZ) { } +impl Drop for CResult_InvoiceRequestDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -14995,16 +15804,16 @@ impl Drop for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { } } } -impl From> for CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceRequestDecodeErrorZ { + 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_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { result } + CResult_InvoiceRequestDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { err } + CResult_InvoiceRequestDecodeErrorZPtr { err } }; Self { contents, @@ -15012,59 +15821,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InvoiceRequestDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_InvoiceRequestDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ which has the same data as `orig` +/// Creates a new CResult_InvoiceRequestDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ_clone(orig: &CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ) -> CResult_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InvoiceRequestDecodeErrorZ_clone(orig: &CResult_InvoiceRequestDecodeErrorZ) -> CResult_InvoiceRequestDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ -pub union CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { +/// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ +pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr { /// 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_ThirtyTwoBytesChannelMonitorZ, + pub result: *mut crate::lightning::offers::invoice_request::InvoiceRequestFields, /// 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::IOError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ on success and a crate::c_types::IOError on failure. +/// A CResult_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields 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_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { - /// The contents of this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ, accessible via either +pub struct CResult_InvoiceRequestFieldsDecodeErrorZ { + /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr, - /// Whether this CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ represents a success state. + pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr, + /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the success state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_ok(o: crate::c_types::derived::C2Tuple_ThirtyTwoBytesChannelMonitorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { - contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { +/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ { + CResult_InvoiceRequestFieldsDecodeErrorZ { + contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ in the error state. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: crate::c_types::IOError) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { - contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { +/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state. +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ { + CResult_InvoiceRequestFieldsDecodeErrorZ { + contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15072,13 +15881,13 @@ pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_err(e: c } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_is_ok(o: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> bool { +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_free(_res: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) { } -impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { +/// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ. +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { } +impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15091,16 +15900,16 @@ impl Drop for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { } } } -impl From> for CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InvoiceRequestFieldsDecodeErrorZ { + 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_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { result } + CResult_InvoiceRequestFieldsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { err } + CResult_InvoiceRequestFieldsDecodeErrorZPtr { err } }; Self { contents, @@ -15108,59 +15917,208 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ which has the same data as `orig` +/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ_clone(orig: &CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ) -> CResult_C2Tuple_ThirtyTwoBytesChannelMonitorZIOErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { 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) { } +#[repr(C)] +/// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_WitnessZ { + /// 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::Witness, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_WitnessZ { + #[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::Witness] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_WitnessZ { + 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_WitnessZ_free(_res: CVec_WitnessZ) { } +impl Drop for CVec_WitnessZ { + 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_WitnessZ { + 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)] +#[derive(Clone)] +/// An enum which can either contain a crate::c_types::ECDSASignature or not +pub enum COption_ECDSASignatureZ { + /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature + Some(crate::c_types::ECDSASignature), + /// When we're in this state, this COption_ECDSASignatureZ contains nothing + None +} +impl COption_ECDSASignatureZ { + #[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::ECDSASignature { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature +pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ { + COption_ECDSASignatureZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_ECDSASignatureZ containing nothing +pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ { + COption_ECDSASignatureZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state +pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { } +#[no_mangle] +/// Creates a new COption_ECDSASignatureZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a i64 or not +pub enum COption_i64Z { + /// When we're in this state, this COption_i64Z contains a i64 + Some(i64), + /// When we're in this state, this COption_i64Z contains nothing + None +} +impl COption_i64Z { + #[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) -> i64 { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_i64Z containing a i64 +pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z { + COption_i64Z::Some(o) +} +#[no_mangle] +/// Constructs a new COption_i64Z containing nothing +pub extern "C" fn COption_i64Z_none() -> COption_i64Z { + COption_i64Z::None +} +#[no_mangle] +/// Frees any resources associated with the i64, if we are in the Some state +pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { } +#[no_mangle] +/// Creates a new COption_i64Z which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ -pub union CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { +/// The contents of CResult_SocketAddressDecodeErrorZ +pub union CResult_SocketAddressDecodeErrorZPtr { /// 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::offers::invoice_request::UnsignedInvoiceRequest, + pub result: *mut crate::lightning::ln::msgs::SocketAddress, /// 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::UnsignedInvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_SocketAddressDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SocketAddress 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_UnsignedInvoiceRequestBolt12SemanticErrorZ { - /// The contents of this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ, accessible via either +pub struct CResult_SocketAddressDecodeErrorZ { + /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr, - /// Whether this CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ represents a success state. + pub contents: CResult_SocketAddressDecodeErrorZPtr, + /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { - contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { +/// Creates a new CResult_SocketAddressDecodeErrorZ in the success state. +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ { + CResult_SocketAddressDecodeErrorZ { + contents: CResult_SocketAddressDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { - contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { +/// Creates a new CResult_SocketAddressDecodeErrorZ in the error state. +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ { + CResult_SocketAddressDecodeErrorZ { + contents: CResult_SocketAddressDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15168,13 +16126,13 @@ pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_err(e: crat } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ. -pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) { } -impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_SocketAddressDecodeErrorZ. +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { } +impl Drop for CResult_SocketAddressDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15187,16 +16145,16 @@ impl Drop for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { } } } -impl From> for CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SocketAddressDecodeErrorZ { + 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_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { result } + CResult_SocketAddressDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { err } + CResult_SocketAddressDecodeErrorZPtr { err } }; Self { contents, @@ -15204,59 +16162,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedInvoiceRequestBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ) -> CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceRequestBolt12SemanticErrorZ -pub union CResult_InvoiceRequestBolt12SemanticErrorZPtr { +/// The contents of CResult_SocketAddressSocketAddressParseErrorZ +pub union CResult_SocketAddressSocketAddressParseErrorZPtr { /// 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::offers::invoice_request::InvoiceRequest, + pub result: *mut crate::lightning::ln::msgs::SocketAddress, /// 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::SocketAddressParseError, } #[repr(C)] -/// A CResult_InvoiceRequestBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::InvoiceRequest on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_InvoiceRequestBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceRequestBolt12SemanticErrorZ, accessible via either +pub struct CResult_SocketAddressSocketAddressParseErrorZ { + /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceRequestBolt12SemanticErrorZ represents a success state. + pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr, + /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequest) -> CResult_InvoiceRequestBolt12SemanticErrorZ { - CResult_InvoiceRequestBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { +/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ { + CResult_SocketAddressSocketAddressParseErrorZ { + contents: CResult_SocketAddressSocketAddressParseErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceRequestBolt12SemanticErrorZ { - CResult_InvoiceRequestBolt12SemanticErrorZ { - contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { +/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ { + CResult_SocketAddressSocketAddressParseErrorZ { + contents: CResult_SocketAddressSocketAddressParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15264,13 +16222,13 @@ pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceRequestBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_free(_res: CResult_InvoiceRequestBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { } +impl Drop for CResult_SocketAddressSocketAddressParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15283,16 +16241,16 @@ impl Drop for CResult_InvoiceRequestBolt12SemanticErrorZ { } } } -impl From> for CResult_InvoiceRequestBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SocketAddressSocketAddressParseErrorZ { + 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_InvoiceRequestBolt12SemanticErrorZPtr { result } + CResult_SocketAddressSocketAddressParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestBolt12SemanticErrorZPtr { err } + CResult_SocketAddressSocketAddressParseErrorZPtr { err } }; Self { contents, @@ -15300,59 +16258,243 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateAddHTLCZ { + /// 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::msgs::UpdateAddHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UpdateAddHTLCZ { + #[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::msgs::UpdateAddHTLC] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UpdateAddHTLCZ { + 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_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { } +impl Drop for CVec_UpdateAddHTLCZ { + 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_UpdateAddHTLCZ { + 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::ln::msgs::UpdateFulfillHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateFulfillHTLCZ { + /// 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::msgs::UpdateFulfillHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UpdateFulfillHTLCZ { + #[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::msgs::UpdateFulfillHTLC] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UpdateFulfillHTLCZ { + 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_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { } +impl Drop for CVec_UpdateFulfillHTLCZ { + 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_UpdateFulfillHTLCZ { + 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::ln::msgs::UpdateFailHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateFailHTLCZ { + /// 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::msgs::UpdateFailHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UpdateFailHTLCZ { + #[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::msgs::UpdateFailHTLC] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UpdateFailHTLCZ { + 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_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { } +impl Drop for CVec_UpdateFailHTLCZ { + 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_UpdateFailHTLCZ { + 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::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_UpdateFailMalformedHTLCZ { + /// 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::msgs::UpdateFailMalformedHTLC, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_UpdateFailMalformedHTLCZ { + #[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::msgs::UpdateFailMalformedHTLC] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_UpdateFailMalformedHTLCZ { + 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_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { } +impl Drop for CVec_UpdateFailMalformedHTLCZ { + 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_UpdateFailMalformedHTLCZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_InvoiceRequestBolt12SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + 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] -/// Creates a new CResult_InvoiceRequestBolt12SemanticErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InvoiceRequestBolt12SemanticErrorZ_clone(orig: &CResult_InvoiceRequestBolt12SemanticErrorZ) -> CResult_InvoiceRequestBolt12SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// The contents of CResult_AcceptChannelDecodeErrorZ +pub union CResult_AcceptChannelDecodeErrorZPtr { /// 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::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder, + pub result: *mut crate::lightning::ln::msgs::AcceptChannel, /// 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_AcceptChannelDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either +pub struct CResult_AcceptChannelDecodeErrorZ { + /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + pub contents: CResult_AcceptChannelDecodeErrorZPtr, + /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ { + CResult_AcceptChannelDecodeErrorZ { + contents: CResult_AcceptChannelDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ { + CResult_AcceptChannelDecodeErrorZ { + contents: CResult_AcceptChannelDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15360,13 +16502,13 @@ pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticE } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { } +impl Drop for CResult_AcceptChannelDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15379,91 +16521,16 @@ impl Drop for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticError } } } -impl From> for CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AcceptChannelDecodeErrorZ { + 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_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } + CResult_AcceptChannelDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -#[repr(C)] -/// The contents of CResult_VerifiedInvoiceRequestNoneZ -pub union CResult_VerifiedInvoiceRequestNoneZPtr { - /// 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::offers::invoice_request::VerifiedInvoiceRequest, - /// 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_VerifiedInvoiceRequestNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::VerifiedInvoiceRequest on success and a () on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_VerifiedInvoiceRequestNoneZ { - /// The contents of this CResult_VerifiedInvoiceRequestNoneZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_VerifiedInvoiceRequestNoneZPtr, - /// Whether this CResult_VerifiedInvoiceRequestNoneZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the success state. -pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_ok(o: crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> CResult_VerifiedInvoiceRequestNoneZ { - CResult_VerifiedInvoiceRequestNoneZ { - contents: CResult_VerifiedInvoiceRequestNoneZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_VerifiedInvoiceRequestNoneZ in the error state. -pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_err() -> CResult_VerifiedInvoiceRequestNoneZ { - CResult_VerifiedInvoiceRequestNoneZ { - contents: CResult_VerifiedInvoiceRequestNoneZPtr { - 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_VerifiedInvoiceRequestNoneZ_is_ok(o: &CResult_VerifiedInvoiceRequestNoneZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_VerifiedInvoiceRequestNoneZ. -pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_free(_res: CResult_VerifiedInvoiceRequestNoneZ) { } -impl Drop for CResult_VerifiedInvoiceRequestNoneZ { - 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_VerifiedInvoiceRequestNoneZ { - 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_VerifiedInvoiceRequestNoneZPtr { result } - } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_VerifiedInvoiceRequestNoneZPtr { err: core::ptr::null_mut() } + CResult_AcceptChannelDecodeErrorZPtr { err } }; Self { contents, @@ -15471,59 +16538,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_VerifiedInvoiceRequestNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_VerifiedInvoiceRequestNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_VerifiedInvoiceRequestNoneZ which has the same data as `orig` +/// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_VerifiedInvoiceRequestNoneZ_clone(orig: &CResult_VerifiedInvoiceRequestNoneZ) -> CResult_VerifiedInvoiceRequestNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ -pub union CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// The contents of CResult_AcceptChannelV2DecodeErrorZ +pub union CResult_AcceptChannelV2DecodeErrorZPtr { /// 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::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder, + pub result: *mut crate::lightning::ln::msgs::AcceptChannelV2, /// 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::offers::parse::Bolt12SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder on success and a crate::lightning::offers::parse::Bolt12SemanticError on failure. +/// A CResult_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::AcceptChannelV2 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_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - /// The contents of this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ, accessible via either +pub struct CResult_AcceptChannelV2DecodeErrorZ { + /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr, - /// Whether this CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ represents a success state. + pub contents: CResult_AcceptChannelV2DecodeErrorZPtr, + /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the success state. -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_ok(o: crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ { + CResult_AcceptChannelV2DecodeErrorZ { + contents: CResult_AcceptChannelV2DecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ in the error state. -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_err(e: crate::lightning::offers::parse::Bolt12SemanticError) -> CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - contents: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { +/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ { + CResult_AcceptChannelV2DecodeErrorZ { + contents: CResult_AcceptChannelV2DecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15531,13 +16598,13 @@ pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticEr } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_is_ok(o: &CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) -> bool { +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ. -pub extern "C" fn CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ_free(_res: CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ) { } -impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { +/// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { } +impl Drop for CResult_AcceptChannelV2DecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15550,16 +16617,16 @@ impl Drop for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ } } } -impl From> for CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AcceptChannelV2DecodeErrorZ { + 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_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { result } + CResult_AcceptChannelV2DecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZPtr { err } + CResult_AcceptChannelV2DecodeErrorZPtr { err } }; Self { contents, @@ -15567,42 +16634,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InvoiceRequestFieldsDecodeErrorZ -pub union CResult_InvoiceRequestFieldsDecodeErrorZPtr { +/// The contents of CResult_StfuDecodeErrorZ +pub union CResult_StfuDecodeErrorZPtr { /// 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::offers::invoice_request::InvoiceRequestFields, + pub result: *mut crate::lightning::ln::msgs::Stfu, /// 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_InvoiceRequestFieldsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::invoice_request::InvoiceRequestFields on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_StfuDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Stfu 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_InvoiceRequestFieldsDecodeErrorZ { - /// The contents of this CResult_InvoiceRequestFieldsDecodeErrorZ, accessible via either +pub struct CResult_StfuDecodeErrorZ { + /// The contents of this CResult_StfuDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr, - /// Whether this CResult_InvoiceRequestFieldsDecodeErrorZ represents a success state. + pub contents: CResult_StfuDecodeErrorZPtr, + /// Whether this CResult_StfuDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the success state. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_ok(o: crate::lightning::offers::invoice_request::InvoiceRequestFields) -> CResult_InvoiceRequestFieldsDecodeErrorZ { - CResult_InvoiceRequestFieldsDecodeErrorZ { - contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { +/// Creates a new CResult_StfuDecodeErrorZ in the success state. +pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ { + CResult_StfuDecodeErrorZ { + contents: CResult_StfuDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ in the error state. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InvoiceRequestFieldsDecodeErrorZ { - CResult_InvoiceRequestFieldsDecodeErrorZ { - contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { +/// Creates a new CResult_StfuDecodeErrorZ in the error state. +pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ { + CResult_StfuDecodeErrorZ { + contents: CResult_StfuDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15610,13 +16694,13 @@ pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_is_ok(o: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InvoiceRequestFieldsDecodeErrorZ. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_free(_res: CResult_InvoiceRequestFieldsDecodeErrorZ) { } -impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ { +/// Frees any resources used by the CResult_StfuDecodeErrorZ. +pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { } +impl Drop for CResult_StfuDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15629,16 +16713,16 @@ impl Drop for CResult_InvoiceRequestFieldsDecodeErrorZ { } } } -impl From> for CResult_InvoiceRequestFieldsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_StfuDecodeErrorZ { + 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_InvoiceRequestFieldsDecodeErrorZPtr { result } + CResult_StfuDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InvoiceRequestFieldsDecodeErrorZPtr { err } + CResult_StfuDecodeErrorZPtr { err } }; Self { contents, @@ -15646,208 +16730,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InvoiceRequestFieldsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InvoiceRequestFieldsDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InvoiceRequestFieldsDecodeErrorZ_clone(orig: &CResult_InvoiceRequestFieldsDecodeErrorZ) -> CResult_InvoiceRequestFieldsDecodeErrorZ { 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) { } -#[repr(C)] -/// A dynamically-allocated array of crate::c_types::Witnesss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_WitnessZ { - /// 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::Witness, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_WitnessZ { - #[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::Witness] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_WitnessZ { - 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_WitnessZ_free(_res: CVec_WitnessZ) { } -impl Drop for CVec_WitnessZ { - 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_WitnessZ { - 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)] -#[derive(Clone)] -/// An enum which can either contain a crate::c_types::ECDSASignature or not -pub enum COption_ECDSASignatureZ { - /// When we're in this state, this COption_ECDSASignatureZ contains a crate::c_types::ECDSASignature - Some(crate::c_types::ECDSASignature), - /// When we're in this state, this COption_ECDSASignatureZ contains nothing - None -} -impl COption_ECDSASignatureZ { - #[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::ECDSASignature { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_ECDSASignatureZ containing a crate::c_types::ECDSASignature -pub extern "C" fn COption_ECDSASignatureZ_some(o: crate::c_types::ECDSASignature) -> COption_ECDSASignatureZ { - COption_ECDSASignatureZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_ECDSASignatureZ containing nothing -pub extern "C" fn COption_ECDSASignatureZ_none() -> COption_ECDSASignatureZ { - COption_ECDSASignatureZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::c_types::ECDSASignature, if we are in the Some state -pub extern "C" fn COption_ECDSASignatureZ_free(_res: COption_ECDSASignatureZ) { } -#[no_mangle] -/// Creates a new COption_ECDSASignatureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_ECDSASignatureZ_clone(orig: &COption_ECDSASignatureZ) -> COption_ECDSASignatureZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a i64 or not -pub enum COption_i64Z { - /// When we're in this state, this COption_i64Z contains a i64 - Some(i64), - /// When we're in this state, this COption_i64Z contains nothing - None -} -impl COption_i64Z { - #[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) -> i64 { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_i64Z containing a i64 -pub extern "C" fn COption_i64Z_some(o: i64) -> COption_i64Z { - COption_i64Z::Some(o) -} -#[no_mangle] -/// Constructs a new COption_i64Z containing nothing -pub extern "C" fn COption_i64Z_none() -> COption_i64Z { - COption_i64Z::None -} -#[no_mangle] -/// Frees any resources associated with the i64, if we are in the Some state -pub extern "C" fn COption_i64Z_free(_res: COption_i64Z) { } -#[no_mangle] -/// Creates a new COption_i64Z which has the same data as `orig` +/// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_i64Z_clone(orig: &COption_i64Z) -> COption_i64Z { Clone::clone(&orig) } +pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SocketAddressDecodeErrorZ -pub union CResult_SocketAddressDecodeErrorZPtr { +/// The contents of CResult_SpliceInitDecodeErrorZ +pub union CResult_SpliceInitDecodeErrorZPtr { /// 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::msgs::SocketAddress, + pub result: *mut crate::lightning::ln::msgs::SpliceInit, /// 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_SocketAddressDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_SpliceInitDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SpliceInit 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_SocketAddressDecodeErrorZ { - /// The contents of this CResult_SocketAddressDecodeErrorZ, accessible via either +pub struct CResult_SpliceInitDecodeErrorZ { + /// The contents of this CResult_SpliceInitDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SocketAddressDecodeErrorZPtr, - /// Whether this CResult_SocketAddressDecodeErrorZ represents a success state. + pub contents: CResult_SpliceInitDecodeErrorZPtr, + /// Whether this CResult_SpliceInitDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SocketAddressDecodeErrorZ in the success state. -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressDecodeErrorZ { - CResult_SocketAddressDecodeErrorZ { - contents: CResult_SocketAddressDecodeErrorZPtr { +/// Creates a new CResult_SpliceInitDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceInit) -> CResult_SpliceInitDecodeErrorZ { + CResult_SpliceInitDecodeErrorZ { + contents: CResult_SpliceInitDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SocketAddressDecodeErrorZ in the error state. -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SocketAddressDecodeErrorZ { - CResult_SocketAddressDecodeErrorZ { - contents: CResult_SocketAddressDecodeErrorZPtr { +/// Creates a new CResult_SpliceInitDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceInitDecodeErrorZ { + CResult_SpliceInitDecodeErrorZ { + contents: CResult_SpliceInitDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15855,13 +16790,13 @@ pub extern "C" fn CResult_SocketAddressDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_is_ok(o: &CResult_SocketAddressDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_is_ok(o: &CResult_SpliceInitDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SocketAddressDecodeErrorZ. -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_free(_res: CResult_SocketAddressDecodeErrorZ) { } -impl Drop for CResult_SocketAddressDecodeErrorZ { +/// Frees any resources used by the CResult_SpliceInitDecodeErrorZ. +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_free(_res: CResult_SpliceInitDecodeErrorZ) { } +impl Drop for CResult_SpliceInitDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15874,16 +16809,16 @@ impl Drop for CResult_SocketAddressDecodeErrorZ { } } } -impl From> for CResult_SocketAddressDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SpliceInitDecodeErrorZ { + 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_SocketAddressDecodeErrorZPtr { result } + CResult_SpliceInitDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SocketAddressDecodeErrorZPtr { err } + CResult_SpliceInitDecodeErrorZPtr { err } }; Self { contents, @@ -15891,59 +16826,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SocketAddressDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SpliceInitDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SocketAddressDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_SpliceInitDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SocketAddressDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_SpliceInitDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SocketAddressDecodeErrorZ_clone(orig: &CResult_SocketAddressDecodeErrorZ) -> CResult_SocketAddressDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SpliceInitDecodeErrorZ_clone(orig: &CResult_SpliceInitDecodeErrorZ) -> CResult_SpliceInitDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SocketAddressSocketAddressParseErrorZ -pub union CResult_SocketAddressSocketAddressParseErrorZPtr { +/// The contents of CResult_SpliceAckDecodeErrorZ +pub union CResult_SpliceAckDecodeErrorZPtr { /// 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::msgs::SocketAddress, + pub result: *mut crate::lightning::ln::msgs::SpliceAck, /// 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::SocketAddressParseError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_SocketAddressSocketAddressParseErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SocketAddress on success and a crate::lightning::ln::msgs::SocketAddressParseError on failure. +/// A CResult_SpliceAckDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SpliceAck 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_SocketAddressSocketAddressParseErrorZ { - /// The contents of this CResult_SocketAddressSocketAddressParseErrorZ, accessible via either +pub struct CResult_SpliceAckDecodeErrorZ { + /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SocketAddressSocketAddressParseErrorZPtr, - /// Whether this CResult_SocketAddressSocketAddressParseErrorZ represents a success state. + pub contents: CResult_SpliceAckDecodeErrorZPtr, + /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the success state. -pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_ok(o: crate::lightning::ln::msgs::SocketAddress) -> CResult_SocketAddressSocketAddressParseErrorZ { - CResult_SocketAddressSocketAddressParseErrorZ { - contents: CResult_SocketAddressSocketAddressParseErrorZPtr { +/// Creates a new CResult_SpliceAckDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ { + CResult_SpliceAckDecodeErrorZ { + contents: CResult_SpliceAckDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ in the error state. -pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::lightning::ln::msgs::SocketAddressParseError) -> CResult_SocketAddressSocketAddressParseErrorZ { - CResult_SocketAddressSocketAddressParseErrorZ { - contents: CResult_SocketAddressSocketAddressParseErrorZPtr { +/// Creates a new CResult_SpliceAckDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ { + CResult_SpliceAckDecodeErrorZ { + contents: CResult_SpliceAckDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -15951,13 +16886,13 @@ pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_err(e: crate::li } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_is_ok(o: &CResult_SocketAddressSocketAddressParseErrorZ) -> bool { +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SocketAddressSocketAddressParseErrorZ. -pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_free(_res: CResult_SocketAddressSocketAddressParseErrorZ) { } -impl Drop for CResult_SocketAddressSocketAddressParseErrorZ { +/// Frees any resources used by the CResult_SpliceAckDecodeErrorZ. +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { } +impl Drop for CResult_SpliceAckDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -15970,16 +16905,16 @@ impl Drop for CResult_SocketAddressSocketAddressParseErrorZ { } } } -impl From> for CResult_SocketAddressSocketAddressParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SpliceAckDecodeErrorZ { + 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_SocketAddressSocketAddressParseErrorZPtr { result } + CResult_SpliceAckDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SocketAddressSocketAddressParseErrorZPtr { err } + CResult_SpliceAckDecodeErrorZPtr { err } }; Self { contents, @@ -15987,243 +16922,155 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SocketAddressSocketAddressParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SocketAddressSocketAddressParseErrorZ which has the same data as `orig` +/// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SocketAddressSocketAddressParseErrorZ_clone(orig: &CResult_SocketAddressSocketAddressParseErrorZ) -> CResult_SocketAddressSocketAddressParseErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateAddHTLCs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UpdateAddHTLCZ { - /// 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::msgs::UpdateAddHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UpdateAddHTLCZ { - #[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::msgs::UpdateAddHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_UpdateAddHTLCZ { - 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_UpdateAddHTLCZ_free(_res: CVec_UpdateAddHTLCZ) { } -impl Drop for CVec_UpdateAddHTLCZ { - 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_UpdateAddHTLCZ { - 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) - } +/// The contents of CResult_SpliceLockedDecodeErrorZ +pub union CResult_SpliceLockedDecodeErrorZPtr { + /// 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::msgs::SpliceLocked, + /// 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 dynamically-allocated array of crate::lightning::ln::msgs::UpdateFulfillHTLCs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UpdateFulfillHTLCZ { - /// 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::msgs::UpdateFulfillHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UpdateFulfillHTLCZ { - #[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::msgs::UpdateFulfillHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_UpdateFulfillHTLCZ { - 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() } } - } +/// A CResult_SpliceLockedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::SpliceLocked 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_SpliceLockedDecodeErrorZ { + /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_SpliceLockedDecodeErrorZPtr, + /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_UpdateFulfillHTLCZ_free(_res: CVec_UpdateFulfillHTLCZ) { } -impl Drop for CVec_UpdateFulfillHTLCZ { - 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_UpdateFulfillHTLCZ { - 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) +/// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ { + CResult_SpliceLockedDecodeErrorZ { + contents: CResult_SpliceLockedDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::msgs::UpdateFailHTLCs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UpdateFailHTLCZ { - /// 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::msgs::UpdateFailHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UpdateFailHTLCZ { - #[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::msgs::UpdateFailHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[no_mangle] +/// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ { + CResult_SpliceLockedDecodeErrorZ { + contents: CResult_SpliceLockedDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } -impl From> for CVec_UpdateFailHTLCZ { - 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() } } - } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool { + o.result_ok } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_UpdateFailHTLCZ_free(_res: CVec_UpdateFailHTLCZ) { } -impl Drop for CVec_UpdateFailHTLCZ { +/// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { } +impl Drop for CResult_SpliceLockedDecodeErrorZ { 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_UpdateFailHTLCZ { - 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::ln::msgs::UpdateFailMalformedHTLCs of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_UpdateFailMalformedHTLCZ { - /// 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::msgs::UpdateFailMalformedHTLC, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_UpdateFailMalformedHTLCZ { - #[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::msgs::UpdateFailMalformedHTLC] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_UpdateFailMalformedHTLCZ { - 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() } } + 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) }; + } + } } } -#[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_UpdateFailMalformedHTLCZ_free(_res: CVec_UpdateFailMalformedHTLCZ) { } -impl Drop for CVec_UpdateFailMalformedHTLCZ { - 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 From> for CResult_SpliceLockedDecodeErrorZ { + 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_SpliceLockedDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_SpliceLockedDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl Clone for CVec_UpdateFailMalformedHTLCZ { +impl Clone for CResult_SpliceLockedDecodeErrorZ { 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_SpliceLockedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AcceptChannelDecodeErrorZ -pub union CResult_AcceptChannelDecodeErrorZPtr { +/// The contents of CResult_TxAddInputDecodeErrorZ +pub union CResult_TxAddInputDecodeErrorZPtr { /// 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::msgs::AcceptChannel, + pub result: *mut crate::lightning::ln::msgs::TxAddInput, /// 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_AcceptChannelDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::AcceptChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxAddInputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAddInput 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_AcceptChannelDecodeErrorZ { - /// The contents of this CResult_AcceptChannelDecodeErrorZ, accessible via either +pub struct CResult_TxAddInputDecodeErrorZ { + /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_AcceptChannelDecodeErrorZPtr, - /// Whether this CResult_AcceptChannelDecodeErrorZ represents a success state. + pub contents: CResult_TxAddInputDecodeErrorZPtr, + /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_AcceptChannelDecodeErrorZ in the success state. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannel) -> CResult_AcceptChannelDecodeErrorZ { - CResult_AcceptChannelDecodeErrorZ { - contents: CResult_AcceptChannelDecodeErrorZPtr { +/// Creates a new CResult_TxAddInputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ { + CResult_TxAddInputDecodeErrorZ { + contents: CResult_TxAddInputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_AcceptChannelDecodeErrorZ in the error state. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelDecodeErrorZ { - CResult_AcceptChannelDecodeErrorZ { - contents: CResult_AcceptChannelDecodeErrorZPtr { +/// Creates a new CResult_TxAddInputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ { + CResult_TxAddInputDecodeErrorZ { + contents: CResult_TxAddInputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16231,13 +17078,13 @@ pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_is_ok(o: &CResult_AcceptChannelDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_AcceptChannelDecodeErrorZ. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_free(_res: CResult_AcceptChannelDecodeErrorZ) { } -impl Drop for CResult_AcceptChannelDecodeErrorZ { +/// Frees any resources used by the CResult_TxAddInputDecodeErrorZ. +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { } +impl Drop for CResult_TxAddInputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16250,16 +17097,16 @@ impl Drop for CResult_AcceptChannelDecodeErrorZ { } } } -impl From> for CResult_AcceptChannelDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAddInputDecodeErrorZ { + 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_AcceptChannelDecodeErrorZPtr { result } + CResult_TxAddInputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AcceptChannelDecodeErrorZPtr { err } + CResult_TxAddInputDecodeErrorZPtr { err } }; Self { contents, @@ -16267,59 +17114,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_AcceptChannelDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_AcceptChannelDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_AcceptChannelDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_AcceptChannelDecodeErrorZ_clone(orig: &CResult_AcceptChannelDecodeErrorZ) -> CResult_AcceptChannelDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AcceptChannelV2DecodeErrorZ -pub union CResult_AcceptChannelV2DecodeErrorZPtr { +/// The contents of CResult_TxAddOutputDecodeErrorZ +pub union CResult_TxAddOutputDecodeErrorZPtr { /// 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::msgs::AcceptChannelV2, + pub result: *mut crate::lightning::ln::msgs::TxAddOutput, /// 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_AcceptChannelV2DecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::AcceptChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxAddOutputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAddOutput 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_AcceptChannelV2DecodeErrorZ { - /// The contents of this CResult_AcceptChannelV2DecodeErrorZ, accessible via either +pub struct CResult_TxAddOutputDecodeErrorZ { + /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_AcceptChannelV2DecodeErrorZPtr, - /// Whether this CResult_AcceptChannelV2DecodeErrorZ represents a success state. + pub contents: CResult_TxAddOutputDecodeErrorZPtr, + /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the success state. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::AcceptChannelV2) -> CResult_AcceptChannelV2DecodeErrorZ { - CResult_AcceptChannelV2DecodeErrorZ { - contents: CResult_AcceptChannelV2DecodeErrorZPtr { +/// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ { + CResult_TxAddOutputDecodeErrorZ { + contents: CResult_TxAddOutputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_AcceptChannelV2DecodeErrorZ in the error state. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AcceptChannelV2DecodeErrorZ { - CResult_AcceptChannelV2DecodeErrorZ { - contents: CResult_AcceptChannelV2DecodeErrorZPtr { +/// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ { + CResult_TxAddOutputDecodeErrorZ { + contents: CResult_TxAddOutputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16327,13 +17174,13 @@ pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_is_ok(o: &CResult_AcceptChannelV2DecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_AcceptChannelV2DecodeErrorZ. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_free(_res: CResult_AcceptChannelV2DecodeErrorZ) { } -impl Drop for CResult_AcceptChannelV2DecodeErrorZ { +/// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { } +impl Drop for CResult_TxAddOutputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16346,16 +17193,16 @@ impl Drop for CResult_AcceptChannelV2DecodeErrorZ { } } } -impl From> for CResult_AcceptChannelV2DecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAddOutputDecodeErrorZ { + 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_AcceptChannelV2DecodeErrorZPtr { result } + CResult_TxAddOutputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AcceptChannelV2DecodeErrorZPtr { err } + CResult_TxAddOutputDecodeErrorZPtr { err } }; Self { contents, @@ -16363,59 +17210,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_AcceptChannelV2DecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_AcceptChannelV2DecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_AcceptChannelV2DecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_AcceptChannelV2DecodeErrorZ_clone(orig: &CResult_AcceptChannelV2DecodeErrorZ) -> CResult_AcceptChannelV2DecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_StfuDecodeErrorZ -pub union CResult_StfuDecodeErrorZPtr { +/// The contents of CResult_TxRemoveInputDecodeErrorZ +pub union CResult_TxRemoveInputDecodeErrorZPtr { /// 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::msgs::Stfu, + pub result: *mut crate::lightning::ln::msgs::TxRemoveInput, /// 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_StfuDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Stfu on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxRemoveInputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxRemoveInput 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_StfuDecodeErrorZ { - /// The contents of this CResult_StfuDecodeErrorZ, accessible via either +pub struct CResult_TxRemoveInputDecodeErrorZ { + /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_StfuDecodeErrorZPtr, - /// Whether this CResult_StfuDecodeErrorZ represents a success state. + pub contents: CResult_TxRemoveInputDecodeErrorZPtr, + /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_StfuDecodeErrorZ in the success state. -pub extern "C" fn CResult_StfuDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Stfu) -> CResult_StfuDecodeErrorZ { - CResult_StfuDecodeErrorZ { - contents: CResult_StfuDecodeErrorZPtr { +/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ { + CResult_TxRemoveInputDecodeErrorZ { + contents: CResult_TxRemoveInputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_StfuDecodeErrorZ in the error state. -pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_StfuDecodeErrorZ { - CResult_StfuDecodeErrorZ { - contents: CResult_StfuDecodeErrorZPtr { +/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ { + CResult_TxRemoveInputDecodeErrorZ { + contents: CResult_TxRemoveInputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16423,13 +17270,13 @@ pub extern "C" fn CResult_StfuDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_StfuDecodeErrorZ_is_ok(o: &CResult_StfuDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_StfuDecodeErrorZ. -pub extern "C" fn CResult_StfuDecodeErrorZ_free(_res: CResult_StfuDecodeErrorZ) { } -impl Drop for CResult_StfuDecodeErrorZ { +/// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { } +impl Drop for CResult_TxRemoveInputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16442,16 +17289,16 @@ impl Drop for CResult_StfuDecodeErrorZ { } } } -impl From> for CResult_StfuDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxRemoveInputDecodeErrorZ { + 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_StfuDecodeErrorZPtr { result } + CResult_TxRemoveInputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_StfuDecodeErrorZPtr { err } + CResult_TxRemoveInputDecodeErrorZPtr { err } }; Self { contents, @@ -16459,59 +17306,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_StfuDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_StfuDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_StfuDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_StfuDecodeErrorZ_clone(orig: &CResult_StfuDecodeErrorZ) -> CResult_StfuDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceInitDecodeErrorZ -pub union CResult_SpliceInitDecodeErrorZPtr { +/// The contents of CResult_TxRemoveOutputDecodeErrorZ +pub union CResult_TxRemoveOutputDecodeErrorZPtr { /// 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::msgs::SpliceInit, + pub result: *mut crate::lightning::ln::msgs::TxRemoveOutput, /// 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_SpliceInitDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SpliceInit on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxRemoveOutput 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_SpliceInitDecodeErrorZ { - /// The contents of this CResult_SpliceInitDecodeErrorZ, accessible via either +pub struct CResult_TxRemoveOutputDecodeErrorZ { + /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SpliceInitDecodeErrorZPtr, - /// Whether this CResult_SpliceInitDecodeErrorZ represents a success state. + pub contents: CResult_TxRemoveOutputDecodeErrorZPtr, + /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SpliceInitDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceInit) -> CResult_SpliceInitDecodeErrorZ { - CResult_SpliceInitDecodeErrorZ { - contents: CResult_SpliceInitDecodeErrorZPtr { +/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ { + CResult_TxRemoveOutputDecodeErrorZ { + contents: CResult_TxRemoveOutputDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SpliceInitDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceInitDecodeErrorZ { - CResult_SpliceInitDecodeErrorZ { - contents: CResult_SpliceInitDecodeErrorZPtr { +/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ { + CResult_TxRemoveOutputDecodeErrorZ { + contents: CResult_TxRemoveOutputDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16519,13 +17366,13 @@ pub extern "C" fn CResult_SpliceInitDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_is_ok(o: &CResult_SpliceInitDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SpliceInitDecodeErrorZ. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_free(_res: CResult_SpliceInitDecodeErrorZ) { } -impl Drop for CResult_SpliceInitDecodeErrorZ { +/// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { } +impl Drop for CResult_TxRemoveOutputDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16538,16 +17385,16 @@ impl Drop for CResult_SpliceInitDecodeErrorZ { } } } -impl From> for CResult_SpliceInitDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxRemoveOutputDecodeErrorZ { + 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_SpliceInitDecodeErrorZPtr { result } + CResult_TxRemoveOutputDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceInitDecodeErrorZPtr { err } + CResult_TxRemoveOutputDecodeErrorZPtr { err } }; Self { contents, @@ -16555,59 +17402,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpliceInitDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SpliceInitDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SpliceInitDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SpliceInitDecodeErrorZ_clone(orig: &CResult_SpliceInitDecodeErrorZ) -> CResult_SpliceInitDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceAckDecodeErrorZ -pub union CResult_SpliceAckDecodeErrorZPtr { +/// The contents of CResult_TxCompleteDecodeErrorZ +pub union CResult_TxCompleteDecodeErrorZPtr { /// 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::msgs::SpliceAck, + pub result: *mut crate::lightning::ln::msgs::TxComplete, /// 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_SpliceAckDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SpliceAck on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxCompleteDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxComplete 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_SpliceAckDecodeErrorZ { - /// The contents of this CResult_SpliceAckDecodeErrorZ, accessible via either +pub struct CResult_TxCompleteDecodeErrorZ { + /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SpliceAckDecodeErrorZPtr, - /// Whether this CResult_SpliceAckDecodeErrorZ represents a success state. + pub contents: CResult_TxCompleteDecodeErrorZPtr, + /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SpliceAckDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceAck) -> CResult_SpliceAckDecodeErrorZ { - CResult_SpliceAckDecodeErrorZ { - contents: CResult_SpliceAckDecodeErrorZPtr { +/// Creates a new CResult_TxCompleteDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ { + CResult_TxCompleteDecodeErrorZ { + contents: CResult_TxCompleteDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SpliceAckDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceAckDecodeErrorZ { - CResult_SpliceAckDecodeErrorZ { - contents: CResult_SpliceAckDecodeErrorZPtr { +/// Creates a new CResult_TxCompleteDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ { + CResult_TxCompleteDecodeErrorZ { + contents: CResult_TxCompleteDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16615,13 +17462,13 @@ pub extern "C" fn CResult_SpliceAckDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_is_ok(o: &CResult_SpliceAckDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SpliceAckDecodeErrorZ. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_free(_res: CResult_SpliceAckDecodeErrorZ) { } -impl Drop for CResult_SpliceAckDecodeErrorZ { +/// Frees any resources used by the CResult_TxCompleteDecodeErrorZ. +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { } +impl Drop for CResult_TxCompleteDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16634,16 +17481,16 @@ impl Drop for CResult_SpliceAckDecodeErrorZ { } } } -impl From> for CResult_SpliceAckDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxCompleteDecodeErrorZ { + 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_SpliceAckDecodeErrorZPtr { result } + CResult_TxCompleteDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceAckDecodeErrorZPtr { err } + CResult_TxCompleteDecodeErrorZPtr { err } }; Self { contents, @@ -16651,59 +17498,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpliceAckDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SpliceAckDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SpliceAckDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SpliceAckDecodeErrorZ_clone(orig: &CResult_SpliceAckDecodeErrorZ) -> CResult_SpliceAckDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SpliceLockedDecodeErrorZ -pub union CResult_SpliceLockedDecodeErrorZPtr { +/// The contents of CResult_TxSignaturesDecodeErrorZ +pub union CResult_TxSignaturesDecodeErrorZPtr { /// 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::msgs::SpliceLocked, + pub result: *mut crate::lightning::ln::msgs::TxSignatures, /// 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_SpliceLockedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::SpliceLocked on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxSignaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxSignatures 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_SpliceLockedDecodeErrorZ { - /// The contents of this CResult_SpliceLockedDecodeErrorZ, accessible via either +pub struct CResult_TxSignaturesDecodeErrorZ { + /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SpliceLockedDecodeErrorZPtr, - /// Whether this CResult_SpliceLockedDecodeErrorZ represents a success state. + pub contents: CResult_TxSignaturesDecodeErrorZPtr, + /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SpliceLockedDecodeErrorZ in the success state. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::SpliceLocked) -> CResult_SpliceLockedDecodeErrorZ { - CResult_SpliceLockedDecodeErrorZ { - contents: CResult_SpliceLockedDecodeErrorZPtr { +/// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ { + CResult_TxSignaturesDecodeErrorZ { + contents: CResult_TxSignaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SpliceLockedDecodeErrorZ in the error state. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_SpliceLockedDecodeErrorZ { - CResult_SpliceLockedDecodeErrorZ { - contents: CResult_SpliceLockedDecodeErrorZPtr { +/// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ { + CResult_TxSignaturesDecodeErrorZ { + contents: CResult_TxSignaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16711,13 +17558,13 @@ pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_is_ok(o: &CResult_SpliceLockedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SpliceLockedDecodeErrorZ. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_free(_res: CResult_SpliceLockedDecodeErrorZ) { } -impl Drop for CResult_SpliceLockedDecodeErrorZ { +/// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { } +impl Drop for CResult_TxSignaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16730,16 +17577,16 @@ impl Drop for CResult_SpliceLockedDecodeErrorZ { } } } -impl From> for CResult_SpliceLockedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxSignaturesDecodeErrorZ { + 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_SpliceLockedDecodeErrorZPtr { result } + CResult_TxSignaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SpliceLockedDecodeErrorZPtr { err } + CResult_TxSignaturesDecodeErrorZPtr { err } }; Self { contents, @@ -16747,59 +17594,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SpliceLockedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SpliceLockedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_SpliceLockedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SpliceLockedDecodeErrorZ_clone(orig: &CResult_SpliceLockedDecodeErrorZ) -> CResult_SpliceLockedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAddInputDecodeErrorZ -pub union CResult_TxAddInputDecodeErrorZPtr { +/// The contents of CResult_TxInitRbfDecodeErrorZ +pub union CResult_TxInitRbfDecodeErrorZPtr { /// 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::msgs::TxAddInput, + pub result: *mut crate::lightning::ln::msgs::TxInitRbf, /// 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_TxAddInputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAddInput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxInitRbfDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxInitRbf 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_TxAddInputDecodeErrorZ { - /// The contents of this CResult_TxAddInputDecodeErrorZ, accessible via either +pub struct CResult_TxInitRbfDecodeErrorZ { + /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAddInputDecodeErrorZPtr, - /// Whether this CResult_TxAddInputDecodeErrorZ represents a success state. + pub contents: CResult_TxInitRbfDecodeErrorZPtr, + /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAddInputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddInput) -> CResult_TxAddInputDecodeErrorZ { - CResult_TxAddInputDecodeErrorZ { - contents: CResult_TxAddInputDecodeErrorZPtr { +/// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ { + CResult_TxInitRbfDecodeErrorZ { + contents: CResult_TxInitRbfDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAddInputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddInputDecodeErrorZ { - CResult_TxAddInputDecodeErrorZ { - contents: CResult_TxAddInputDecodeErrorZPtr { +/// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ { + CResult_TxInitRbfDecodeErrorZ { + contents: CResult_TxInitRbfDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16807,13 +17654,13 @@ pub extern "C" fn CResult_TxAddInputDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_is_ok(o: &CResult_TxAddInputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAddInputDecodeErrorZ. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_free(_res: CResult_TxAddInputDecodeErrorZ) { } -impl Drop for CResult_TxAddInputDecodeErrorZ { +/// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { } +impl Drop for CResult_TxInitRbfDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16826,16 +17673,16 @@ impl Drop for CResult_TxAddInputDecodeErrorZ { } } } -impl From> for CResult_TxAddInputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxInitRbfDecodeErrorZ { + 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_TxAddInputDecodeErrorZPtr { result } + CResult_TxInitRbfDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAddInputDecodeErrorZPtr { err } + CResult_TxInitRbfDecodeErrorZPtr { err } }; Self { contents, @@ -16843,59 +17690,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAddInputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAddInputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAddInputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAddInputDecodeErrorZ_clone(orig: &CResult_TxAddInputDecodeErrorZ) -> CResult_TxAddInputDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAddOutputDecodeErrorZ -pub union CResult_TxAddOutputDecodeErrorZPtr { +/// The contents of CResult_TxAckRbfDecodeErrorZ +pub union CResult_TxAckRbfDecodeErrorZPtr { /// 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::msgs::TxAddOutput, + pub result: *mut crate::lightning::ln::msgs::TxAckRbf, /// 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_TxAddOutputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAddOutput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxAckRbfDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAckRbf 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_TxAddOutputDecodeErrorZ { - /// The contents of this CResult_TxAddOutputDecodeErrorZ, accessible via either +pub struct CResult_TxAckRbfDecodeErrorZ { + /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAddOutputDecodeErrorZPtr, - /// Whether this CResult_TxAddOutputDecodeErrorZ represents a success state. + pub contents: CResult_TxAckRbfDecodeErrorZPtr, + /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAddOutputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAddOutput) -> CResult_TxAddOutputDecodeErrorZ { - CResult_TxAddOutputDecodeErrorZ { - contents: CResult_TxAddOutputDecodeErrorZPtr { +/// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ { + CResult_TxAckRbfDecodeErrorZ { + contents: CResult_TxAckRbfDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAddOutputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAddOutputDecodeErrorZ { - CResult_TxAddOutputDecodeErrorZ { - contents: CResult_TxAddOutputDecodeErrorZPtr { +/// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ { + CResult_TxAckRbfDecodeErrorZ { + contents: CResult_TxAckRbfDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16903,13 +17750,13 @@ pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_is_ok(o: &CResult_TxAddOutputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAddOutputDecodeErrorZ. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_free(_res: CResult_TxAddOutputDecodeErrorZ) { } -impl Drop for CResult_TxAddOutputDecodeErrorZ { +/// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { } +impl Drop for CResult_TxAckRbfDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -16922,16 +17769,16 @@ impl Drop for CResult_TxAddOutputDecodeErrorZ { } } } -impl From> for CResult_TxAddOutputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAckRbfDecodeErrorZ { + 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_TxAddOutputDecodeErrorZPtr { result } + CResult_TxAckRbfDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAddOutputDecodeErrorZPtr { err } + CResult_TxAckRbfDecodeErrorZPtr { err } }; Self { contents, @@ -16939,59 +17786,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAddOutputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAddOutputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAddOutputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAddOutputDecodeErrorZ_clone(orig: &CResult_TxAddOutputDecodeErrorZ) -> CResult_TxAddOutputDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxRemoveInputDecodeErrorZ -pub union CResult_TxRemoveInputDecodeErrorZPtr { +/// The contents of CResult_TxAbortDecodeErrorZ +pub union CResult_TxAbortDecodeErrorZPtr { /// 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::msgs::TxRemoveInput, + pub result: *mut crate::lightning::ln::msgs::TxAbort, /// 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_TxRemoveInputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxRemoveInput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_TxAbortDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::TxAbort 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_TxRemoveInputDecodeErrorZ { - /// The contents of this CResult_TxRemoveInputDecodeErrorZ, accessible via either +pub struct CResult_TxAbortDecodeErrorZ { + /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxRemoveInputDecodeErrorZPtr, - /// Whether this CResult_TxRemoveInputDecodeErrorZ represents a success state. + pub contents: CResult_TxAbortDecodeErrorZPtr, + /// Whether this CResult_TxAbortDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveInput) -> CResult_TxRemoveInputDecodeErrorZ { - CResult_TxRemoveInputDecodeErrorZ { - contents: CResult_TxRemoveInputDecodeErrorZPtr { +/// Creates a new CResult_TxAbortDecodeErrorZ in the success state. +pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ { + CResult_TxAbortDecodeErrorZ { + contents: CResult_TxAbortDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxRemoveInputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveInputDecodeErrorZ { - CResult_TxRemoveInputDecodeErrorZ { - contents: CResult_TxRemoveInputDecodeErrorZPtr { +/// Creates a new CResult_TxAbortDecodeErrorZ in the error state. +pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ { + CResult_TxAbortDecodeErrorZ { + contents: CResult_TxAbortDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -16999,13 +17846,13 @@ pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_is_ok(o: &CResult_TxRemoveInputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxRemoveInputDecodeErrorZ. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_free(_res: CResult_TxRemoveInputDecodeErrorZ) { } -impl Drop for CResult_TxRemoveInputDecodeErrorZ { +/// Frees any resources used by the CResult_TxAbortDecodeErrorZ. +pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { } +impl Drop for CResult_TxAbortDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17018,16 +17865,16 @@ impl Drop for CResult_TxRemoveInputDecodeErrorZ { } } } -impl From> for CResult_TxRemoveInputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TxAbortDecodeErrorZ { + 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_TxRemoveInputDecodeErrorZPtr { result } + CResult_TxAbortDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxRemoveInputDecodeErrorZPtr { err } + CResult_TxAbortDecodeErrorZPtr { err } }; Self { contents, @@ -17035,59 +17882,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxRemoveInputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxRemoveInputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxRemoveInputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxRemoveInputDecodeErrorZ_clone(orig: &CResult_TxRemoveInputDecodeErrorZ) -> CResult_TxRemoveInputDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxRemoveOutputDecodeErrorZ -pub union CResult_TxRemoveOutputDecodeErrorZPtr { +/// The contents of CResult_AnnouncementSignaturesDecodeErrorZ +pub union CResult_AnnouncementSignaturesDecodeErrorZPtr { /// 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::msgs::TxRemoveOutput, + pub result: *mut crate::lightning::ln::msgs::AnnouncementSignatures, /// 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_TxRemoveOutputDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxRemoveOutput on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TxRemoveOutputDecodeErrorZ { - /// The contents of this CResult_TxRemoveOutputDecodeErrorZ, accessible via either +pub struct CResult_AnnouncementSignaturesDecodeErrorZ { + /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxRemoveOutputDecodeErrorZPtr, - /// Whether this CResult_TxRemoveOutputDecodeErrorZ represents a success state. + pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr, + /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxRemoveOutput) -> CResult_TxRemoveOutputDecodeErrorZ { - CResult_TxRemoveOutputDecodeErrorZ { - contents: CResult_TxRemoveOutputDecodeErrorZPtr { +/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ { + CResult_AnnouncementSignaturesDecodeErrorZ { + contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxRemoveOutputDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxRemoveOutputDecodeErrorZ { - CResult_TxRemoveOutputDecodeErrorZ { - contents: CResult_TxRemoveOutputDecodeErrorZPtr { +/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ { + CResult_AnnouncementSignaturesDecodeErrorZ { + contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17095,13 +17942,13 @@ pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_is_ok(o: &CResult_TxRemoveOutputDecodeErrorZ) -> bool { +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxRemoveOutputDecodeErrorZ. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_free(_res: CResult_TxRemoveOutputDecodeErrorZ) { } -impl Drop for CResult_TxRemoveOutputDecodeErrorZ { +/// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { } +impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17114,16 +17961,16 @@ impl Drop for CResult_TxRemoveOutputDecodeErrorZ { } } } -impl From> for CResult_TxRemoveOutputDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AnnouncementSignaturesDecodeErrorZ { + 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_TxRemoveOutputDecodeErrorZPtr { result } + CResult_AnnouncementSignaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxRemoveOutputDecodeErrorZPtr { err } + CResult_AnnouncementSignaturesDecodeErrorZPtr { err } }; Self { contents, @@ -17131,59 +17978,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxRemoveOutputDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxRemoveOutputDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxRemoveOutputDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxRemoveOutputDecodeErrorZ_clone(orig: &CResult_TxRemoveOutputDecodeErrorZ) -> CResult_TxRemoveOutputDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxCompleteDecodeErrorZ -pub union CResult_TxCompleteDecodeErrorZPtr { +/// The contents of CResult_ChannelReestablishDecodeErrorZ +pub union CResult_ChannelReestablishDecodeErrorZPtr { /// 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::msgs::TxComplete, + pub result: *mut crate::lightning::ln::msgs::ChannelReestablish, /// 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_TxCompleteDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxComplete on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelReestablishDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TxCompleteDecodeErrorZ { - /// The contents of this CResult_TxCompleteDecodeErrorZ, accessible via either +pub struct CResult_ChannelReestablishDecodeErrorZ { + /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxCompleteDecodeErrorZPtr, - /// Whether this CResult_TxCompleteDecodeErrorZ represents a success state. + pub contents: CResult_ChannelReestablishDecodeErrorZPtr, + /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxCompleteDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxComplete) -> CResult_TxCompleteDecodeErrorZ { - CResult_TxCompleteDecodeErrorZ { - contents: CResult_TxCompleteDecodeErrorZPtr { +/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ { + CResult_ChannelReestablishDecodeErrorZ { + contents: CResult_ChannelReestablishDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxCompleteDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxCompleteDecodeErrorZ { - CResult_TxCompleteDecodeErrorZ { - contents: CResult_TxCompleteDecodeErrorZPtr { +/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ { + CResult_ChannelReestablishDecodeErrorZ { + contents: CResult_ChannelReestablishDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17191,13 +18038,13 @@ pub extern "C" fn CResult_TxCompleteDecodeErrorZ_err(e: crate::lightning::ln::ms } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_is_ok(o: &CResult_TxCompleteDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxCompleteDecodeErrorZ. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_free(_res: CResult_TxCompleteDecodeErrorZ) { } -impl Drop for CResult_TxCompleteDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { } +impl Drop for CResult_ChannelReestablishDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17210,16 +18057,16 @@ impl Drop for CResult_TxCompleteDecodeErrorZ { } } } -impl From> for CResult_TxCompleteDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelReestablishDecodeErrorZ { + 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_TxCompleteDecodeErrorZPtr { result } + CResult_ChannelReestablishDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxCompleteDecodeErrorZPtr { err } + CResult_ChannelReestablishDecodeErrorZPtr { err } }; Self { contents, @@ -17227,59 +18074,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxCompleteDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxCompleteDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxCompleteDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxCompleteDecodeErrorZ_clone(orig: &CResult_TxCompleteDecodeErrorZ) -> CResult_TxCompleteDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxSignaturesDecodeErrorZ -pub union CResult_TxSignaturesDecodeErrorZPtr { +/// The contents of CResult_ClosingSignedDecodeErrorZ +pub union CResult_ClosingSignedDecodeErrorZPtr { /// 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::msgs::TxSignatures, + pub result: *mut crate::lightning::ln::msgs::ClosingSigned, /// 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_TxSignaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ClosingSignedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TxSignaturesDecodeErrorZ { - /// The contents of this CResult_TxSignaturesDecodeErrorZ, accessible via either +pub struct CResult_ClosingSignedDecodeErrorZ { + /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxSignaturesDecodeErrorZPtr, - /// Whether this CResult_TxSignaturesDecodeErrorZ represents a success state. + pub contents: CResult_ClosingSignedDecodeErrorZPtr, + /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxSignaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxSignatures) -> CResult_TxSignaturesDecodeErrorZ { - CResult_TxSignaturesDecodeErrorZ { - contents: CResult_TxSignaturesDecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ { + CResult_ClosingSignedDecodeErrorZ { + contents: CResult_ClosingSignedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxSignaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxSignaturesDecodeErrorZ { - CResult_TxSignaturesDecodeErrorZ { - contents: CResult_TxSignaturesDecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ { + CResult_ClosingSignedDecodeErrorZ { + contents: CResult_ClosingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17287,13 +18134,13 @@ pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_is_ok(o: &CResult_TxSignaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxSignaturesDecodeErrorZ. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_free(_res: CResult_TxSignaturesDecodeErrorZ) { } -impl Drop for CResult_TxSignaturesDecodeErrorZ { +/// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { } +impl Drop for CResult_ClosingSignedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17306,16 +18153,16 @@ impl Drop for CResult_TxSignaturesDecodeErrorZ { } } } -impl From> for CResult_TxSignaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ClosingSignedDecodeErrorZ { + 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_TxSignaturesDecodeErrorZPtr { result } + CResult_ClosingSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxSignaturesDecodeErrorZPtr { err } + CResult_ClosingSignedDecodeErrorZPtr { err } }; Self { contents, @@ -17323,59 +18170,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxSignaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxSignaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxSignaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxSignaturesDecodeErrorZ_clone(orig: &CResult_TxSignaturesDecodeErrorZ) -> CResult_TxSignaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxInitRbfDecodeErrorZ -pub union CResult_TxInitRbfDecodeErrorZPtr { +/// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ +pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr { /// 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::msgs::TxInitRbf, + pub result: *mut crate::lightning::ln::msgs::ClosingSignedFeeRange, /// 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_TxInitRbfDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxInitRbf on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TxInitRbfDecodeErrorZ { - /// The contents of this CResult_TxInitRbfDecodeErrorZ, accessible via either +pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ { + /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxInitRbfDecodeErrorZPtr, - /// Whether this CResult_TxInitRbfDecodeErrorZ represents a success state. + pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr, + /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxInitRbfDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxInitRbf) -> CResult_TxInitRbfDecodeErrorZ { - CResult_TxInitRbfDecodeErrorZ { - contents: CResult_TxInitRbfDecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { + CResult_ClosingSignedFeeRangeDecodeErrorZ { + contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxInitRbfDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxInitRbfDecodeErrorZ { - CResult_TxInitRbfDecodeErrorZ { - contents: CResult_TxInitRbfDecodeErrorZPtr { +/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { + CResult_ClosingSignedFeeRangeDecodeErrorZ { + contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17383,13 +18230,13 @@ pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_is_ok(o: &CResult_TxInitRbfDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxInitRbfDecodeErrorZ. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_free(_res: CResult_TxInitRbfDecodeErrorZ) { } -impl Drop for CResult_TxInitRbfDecodeErrorZ { +/// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { } +impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17402,16 +18249,16 @@ impl Drop for CResult_TxInitRbfDecodeErrorZ { } } } -impl From> for CResult_TxInitRbfDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ClosingSignedFeeRangeDecodeErrorZ { + 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_TxInitRbfDecodeErrorZPtr { result } + CResult_ClosingSignedFeeRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxInitRbfDecodeErrorZPtr { err } + CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err } }; Self { contents, @@ -17419,59 +18266,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxInitRbfDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxInitRbfDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxInitRbfDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxInitRbfDecodeErrorZ_clone(orig: &CResult_TxInitRbfDecodeErrorZ) -> CResult_TxInitRbfDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAckRbfDecodeErrorZ -pub union CResult_TxAckRbfDecodeErrorZPtr { +/// The contents of CResult_CommitmentSignedBatchDecodeErrorZ +pub union CResult_CommitmentSignedBatchDecodeErrorZPtr { /// 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::msgs::TxAckRbf, + pub result: *mut crate::lightning::ln::msgs::CommitmentSignedBatch, /// 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_TxAckRbfDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAckRbf on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CommitmentSignedBatchDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::CommitmentSignedBatch 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_TxAckRbfDecodeErrorZ { - /// The contents of this CResult_TxAckRbfDecodeErrorZ, accessible via either +pub struct CResult_CommitmentSignedBatchDecodeErrorZ { + /// The contents of this CResult_CommitmentSignedBatchDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAckRbfDecodeErrorZPtr, - /// Whether this CResult_TxAckRbfDecodeErrorZ represents a success state. + pub contents: CResult_CommitmentSignedBatchDecodeErrorZPtr, + /// Whether this CResult_CommitmentSignedBatchDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAckRbfDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAckRbf) -> CResult_TxAckRbfDecodeErrorZ { - CResult_TxAckRbfDecodeErrorZ { - contents: CResult_TxAckRbfDecodeErrorZPtr { +/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the success state. +pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSignedBatch) -> CResult_CommitmentSignedBatchDecodeErrorZ { + CResult_CommitmentSignedBatchDecodeErrorZ { + contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAckRbfDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAckRbfDecodeErrorZ { - CResult_TxAckRbfDecodeErrorZ { - contents: CResult_TxAckRbfDecodeErrorZPtr { +/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the error state. +pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedBatchDecodeErrorZ { + CResult_CommitmentSignedBatchDecodeErrorZ { + contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17479,13 +18326,13 @@ pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_is_ok(o: &CResult_TxAckRbfDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedBatchDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAckRbfDecodeErrorZ. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_free(_res: CResult_TxAckRbfDecodeErrorZ) { } -impl Drop for CResult_TxAckRbfDecodeErrorZ { +/// Frees any resources used by the CResult_CommitmentSignedBatchDecodeErrorZ. +pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_free(_res: CResult_CommitmentSignedBatchDecodeErrorZ) { } +impl Drop for CResult_CommitmentSignedBatchDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17498,16 +18345,16 @@ impl Drop for CResult_TxAckRbfDecodeErrorZ { } } } -impl From> for CResult_TxAckRbfDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CommitmentSignedBatchDecodeErrorZ { + 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_TxAckRbfDecodeErrorZPtr { result } + CResult_CommitmentSignedBatchDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAckRbfDecodeErrorZPtr { err } + CResult_CommitmentSignedBatchDecodeErrorZPtr { err } }; Self { contents, @@ -17515,59 +18362,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAckRbfDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAckRbfDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAckRbfDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAckRbfDecodeErrorZ_clone(orig: &CResult_TxAckRbfDecodeErrorZ) -> CResult_TxAckRbfDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_clone(orig: &CResult_CommitmentSignedBatchDecodeErrorZ) -> CResult_CommitmentSignedBatchDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxAbortDecodeErrorZ -pub union CResult_TxAbortDecodeErrorZPtr { +/// The contents of CResult_CommitmentSignedDecodeErrorZ +pub union CResult_CommitmentSignedDecodeErrorZPtr { /// 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::msgs::TxAbort, + pub result: *mut crate::lightning::ln::msgs::CommitmentSigned, /// 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_TxAbortDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::TxAbort on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CommitmentSignedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TxAbortDecodeErrorZ { - /// The contents of this CResult_TxAbortDecodeErrorZ, accessible via either +pub struct CResult_CommitmentSignedDecodeErrorZ { + /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TxAbortDecodeErrorZPtr, - /// Whether this CResult_TxAbortDecodeErrorZ represents a success state. + pub contents: CResult_CommitmentSignedDecodeErrorZPtr, + /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TxAbortDecodeErrorZ in the success state. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_ok(o: crate::lightning::ln::msgs::TxAbort) -> CResult_TxAbortDecodeErrorZ { - CResult_TxAbortDecodeErrorZ { - contents: CResult_TxAbortDecodeErrorZPtr { +/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ { + CResult_CommitmentSignedDecodeErrorZ { + contents: CResult_CommitmentSignedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TxAbortDecodeErrorZ in the error state. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TxAbortDecodeErrorZ { - CResult_TxAbortDecodeErrorZ { - contents: CResult_TxAbortDecodeErrorZPtr { +/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ { + CResult_CommitmentSignedDecodeErrorZ { + contents: CResult_CommitmentSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17575,13 +18422,13 @@ pub extern "C" fn CResult_TxAbortDecodeErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TxAbortDecodeErrorZ_is_ok(o: &CResult_TxAbortDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TxAbortDecodeErrorZ. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_free(_res: CResult_TxAbortDecodeErrorZ) { } -impl Drop for CResult_TxAbortDecodeErrorZ { +/// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { } +impl Drop for CResult_CommitmentSignedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17594,16 +18441,16 @@ impl Drop for CResult_TxAbortDecodeErrorZ { } } } -impl From> for CResult_TxAbortDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CommitmentSignedDecodeErrorZ { + 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_TxAbortDecodeErrorZPtr { result } + CResult_CommitmentSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxAbortDecodeErrorZPtr { err } + CResult_CommitmentSignedDecodeErrorZPtr { err } }; Self { contents, @@ -17611,59 +18458,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TxAbortDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TxAbortDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TxAbortDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TxAbortDecodeErrorZ_clone(orig: &CResult_TxAbortDecodeErrorZ) -> CResult_TxAbortDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AnnouncementSignaturesDecodeErrorZ -pub union CResult_AnnouncementSignaturesDecodeErrorZPtr { +/// The contents of CResult_FundingCreatedDecodeErrorZ +pub union CResult_FundingCreatedDecodeErrorZPtr { /// 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::msgs::AnnouncementSignatures, + pub result: *mut crate::lightning::ln::msgs::FundingCreated, /// 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_AnnouncementSignaturesDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::AnnouncementSignatures on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FundingCreatedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_AnnouncementSignaturesDecodeErrorZ { - /// The contents of this CResult_AnnouncementSignaturesDecodeErrorZ, accessible via either +pub struct CResult_FundingCreatedDecodeErrorZ { + /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_AnnouncementSignaturesDecodeErrorZPtr, - /// Whether this CResult_AnnouncementSignaturesDecodeErrorZ represents a success state. + pub contents: CResult_FundingCreatedDecodeErrorZPtr, + /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the success state. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_ok(o: crate::lightning::ln::msgs::AnnouncementSignatures) -> CResult_AnnouncementSignaturesDecodeErrorZ { - CResult_AnnouncementSignaturesDecodeErrorZ { - contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { +/// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ { + CResult_FundingCreatedDecodeErrorZ { + contents: CResult_FundingCreatedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ in the error state. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AnnouncementSignaturesDecodeErrorZ { - CResult_AnnouncementSignaturesDecodeErrorZ { - contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { +/// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ { + CResult_FundingCreatedDecodeErrorZ { + contents: CResult_FundingCreatedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17671,13 +18518,13 @@ pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_is_ok(o: &CResult_AnnouncementSignaturesDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_AnnouncementSignaturesDecodeErrorZ. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_free(_res: CResult_AnnouncementSignaturesDecodeErrorZ) { } -impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ { +/// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { } +impl Drop for CResult_FundingCreatedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17690,16 +18537,16 @@ impl Drop for CResult_AnnouncementSignaturesDecodeErrorZ { } } } -impl From> for CResult_AnnouncementSignaturesDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingCreatedDecodeErrorZ { + 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_AnnouncementSignaturesDecodeErrorZPtr { result } + CResult_FundingCreatedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AnnouncementSignaturesDecodeErrorZPtr { err } + CResult_FundingCreatedDecodeErrorZPtr { err } }; Self { contents, @@ -17707,59 +18554,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_AnnouncementSignaturesDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_AnnouncementSignaturesDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_AnnouncementSignaturesDecodeErrorZ_clone(orig: &CResult_AnnouncementSignaturesDecodeErrorZ) -> CResult_AnnouncementSignaturesDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelReestablishDecodeErrorZ -pub union CResult_ChannelReestablishDecodeErrorZPtr { +/// The contents of CResult_FundingSignedDecodeErrorZ +pub union CResult_FundingSignedDecodeErrorZPtr { /// 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::msgs::ChannelReestablish, + pub result: *mut crate::lightning::ln::msgs::FundingSigned, /// 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_ChannelReestablishDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelReestablish on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FundingSignedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelReestablishDecodeErrorZ { - /// The contents of this CResult_ChannelReestablishDecodeErrorZ, accessible via either +pub struct CResult_FundingSignedDecodeErrorZ { + /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelReestablishDecodeErrorZPtr, - /// Whether this CResult_ChannelReestablishDecodeErrorZ represents a success state. + pub contents: CResult_FundingSignedDecodeErrorZPtr, + /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReestablish) -> CResult_ChannelReestablishDecodeErrorZ { - CResult_ChannelReestablishDecodeErrorZ { - contents: CResult_ChannelReestablishDecodeErrorZPtr { +/// Creates a new CResult_FundingSignedDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ { + CResult_FundingSignedDecodeErrorZ { + contents: CResult_FundingSignedDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelReestablishDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReestablishDecodeErrorZ { - CResult_ChannelReestablishDecodeErrorZ { - contents: CResult_ChannelReestablishDecodeErrorZPtr { +/// Creates a new CResult_FundingSignedDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ { + CResult_FundingSignedDecodeErrorZ { + contents: CResult_FundingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17767,13 +18614,13 @@ pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_is_ok(o: &CResult_ChannelReestablishDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelReestablishDecodeErrorZ. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_free(_res: CResult_ChannelReestablishDecodeErrorZ) { } -impl Drop for CResult_ChannelReestablishDecodeErrorZ { +/// Frees any resources used by the CResult_FundingSignedDecodeErrorZ. +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { } +impl Drop for CResult_FundingSignedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17786,16 +18633,16 @@ impl Drop for CResult_ChannelReestablishDecodeErrorZ { } } } -impl From> for CResult_ChannelReestablishDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingSignedDecodeErrorZ { + 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_ChannelReestablishDecodeErrorZPtr { result } + CResult_FundingSignedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelReestablishDecodeErrorZPtr { err } + CResult_FundingSignedDecodeErrorZPtr { err } }; Self { contents, @@ -17803,59 +18650,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelReestablishDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelReestablishDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelReestablishDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelReestablishDecodeErrorZ_clone(orig: &CResult_ChannelReestablishDecodeErrorZ) -> CResult_ChannelReestablishDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClosingSignedDecodeErrorZ -pub union CResult_ClosingSignedDecodeErrorZPtr { +/// The contents of CResult_ChannelReadyDecodeErrorZ +pub union CResult_ChannelReadyDecodeErrorZPtr { /// 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::msgs::ClosingSigned, + pub result: *mut crate::lightning::ln::msgs::ChannelReady, /// 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_ClosingSignedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ClosingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelReadyDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ClosingSignedDecodeErrorZ { - /// The contents of this CResult_ClosingSignedDecodeErrorZ, accessible via either +pub struct CResult_ChannelReadyDecodeErrorZ { + /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ClosingSignedDecodeErrorZPtr, - /// Whether this CResult_ClosingSignedDecodeErrorZ represents a success state. + pub contents: CResult_ChannelReadyDecodeErrorZPtr, + /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ClosingSignedDecodeErrorZ in the success state. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSigned) -> CResult_ClosingSignedDecodeErrorZ { - CResult_ClosingSignedDecodeErrorZ { - contents: CResult_ClosingSignedDecodeErrorZPtr { +/// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ { + CResult_ChannelReadyDecodeErrorZ { + contents: CResult_ChannelReadyDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ClosingSignedDecodeErrorZ in the error state. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedDecodeErrorZ { - CResult_ClosingSignedDecodeErrorZ { - contents: CResult_ClosingSignedDecodeErrorZPtr { +/// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ { + CResult_ChannelReadyDecodeErrorZ { + contents: CResult_ChannelReadyDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17863,13 +18710,13 @@ pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_is_ok(o: &CResult_ClosingSignedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ClosingSignedDecodeErrorZ. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_free(_res: CResult_ClosingSignedDecodeErrorZ) { } -impl Drop for CResult_ClosingSignedDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { } +impl Drop for CResult_ChannelReadyDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17882,16 +18729,16 @@ impl Drop for CResult_ClosingSignedDecodeErrorZ { } } } -impl From> for CResult_ClosingSignedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelReadyDecodeErrorZ { + 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_ClosingSignedDecodeErrorZPtr { result } + CResult_ChannelReadyDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClosingSignedDecodeErrorZPtr { err } + CResult_ChannelReadyDecodeErrorZPtr { err } }; Self { contents, @@ -17899,59 +18746,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ClosingSignedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ClosingSignedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ClosingSignedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ClosingSignedDecodeErrorZ_clone(orig: &CResult_ClosingSignedDecodeErrorZ) -> CResult_ClosingSignedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClosingSignedFeeRangeDecodeErrorZ -pub union CResult_ClosingSignedFeeRangeDecodeErrorZPtr { +/// The contents of CResult_InitDecodeErrorZ +pub union CResult_InitDecodeErrorZPtr { /// 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::msgs::ClosingSignedFeeRange, + pub result: *mut crate::lightning::ln::msgs::Init, /// 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_ClosingSignedFeeRangeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ClosingSignedFeeRange on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InitDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ClosingSignedFeeRangeDecodeErrorZ { - /// The contents of this CResult_ClosingSignedFeeRangeDecodeErrorZ, accessible via either +pub struct CResult_InitDecodeErrorZ { + /// The contents of this CResult_InitDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr, - /// Whether this CResult_ClosingSignedFeeRangeDecodeErrorZ represents a success state. + pub contents: CResult_InitDecodeErrorZPtr, + /// Whether this CResult_InitDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the success state. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ClosingSignedFeeRange) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { - CResult_ClosingSignedFeeRangeDecodeErrorZ { - contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { +/// Creates a new CResult_InitDecodeErrorZ in the success state. +pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ { + CResult_InitDecodeErrorZ { + contents: CResult_InitDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ in the error state. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { - CResult_ClosingSignedFeeRangeDecodeErrorZ { - contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { +/// Creates a new CResult_InitDecodeErrorZ in the error state. +pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ { + CResult_InitDecodeErrorZ { + contents: CResult_InitDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -17959,13 +18806,13 @@ pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_is_ok(o: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ClosingSignedFeeRangeDecodeErrorZ. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_free(_res: CResult_ClosingSignedFeeRangeDecodeErrorZ) { } -impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ { +/// Frees any resources used by the CResult_InitDecodeErrorZ. +pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { } +impl Drop for CResult_InitDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -17978,16 +18825,16 @@ impl Drop for CResult_ClosingSignedFeeRangeDecodeErrorZ { } } } -impl From> for CResult_ClosingSignedFeeRangeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InitDecodeErrorZ { + 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_ClosingSignedFeeRangeDecodeErrorZPtr { result } + CResult_InitDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClosingSignedFeeRangeDecodeErrorZPtr { err } + CResult_InitDecodeErrorZPtr { err } }; Self { contents, @@ -17995,59 +18842,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ClosingSignedFeeRangeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ClosingSignedFeeRangeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ClosingSignedFeeRangeDecodeErrorZ_clone(orig: &CResult_ClosingSignedFeeRangeDecodeErrorZ) -> CResult_ClosingSignedFeeRangeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentSignedBatchDecodeErrorZ -pub union CResult_CommitmentSignedBatchDecodeErrorZPtr { +/// The contents of CResult_OpenChannelDecodeErrorZ +pub union CResult_OpenChannelDecodeErrorZPtr { /// 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::msgs::CommitmentSignedBatch, + pub result: *mut crate::lightning::ln::msgs::OpenChannel, /// 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_CommitmentSignedBatchDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::CommitmentSignedBatch on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OpenChannelDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CommitmentSignedBatchDecodeErrorZ { - /// The contents of this CResult_CommitmentSignedBatchDecodeErrorZ, accessible via either +pub struct CResult_OpenChannelDecodeErrorZ { + /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CommitmentSignedBatchDecodeErrorZPtr, - /// Whether this CResult_CommitmentSignedBatchDecodeErrorZ represents a success state. + pub contents: CResult_OpenChannelDecodeErrorZPtr, + /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the success state. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSignedBatch) -> CResult_CommitmentSignedBatchDecodeErrorZ { - CResult_CommitmentSignedBatchDecodeErrorZ { - contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelDecodeErrorZ in the success state. +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ { + CResult_OpenChannelDecodeErrorZ { + contents: CResult_OpenChannelDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ in the error state. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedBatchDecodeErrorZ { - CResult_CommitmentSignedBatchDecodeErrorZ { - contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelDecodeErrorZ in the error state. +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ { + CResult_OpenChannelDecodeErrorZ { + contents: CResult_OpenChannelDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18055,13 +18902,13 @@ pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedBatchDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CommitmentSignedBatchDecodeErrorZ. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_free(_res: CResult_CommitmentSignedBatchDecodeErrorZ) { } -impl Drop for CResult_CommitmentSignedBatchDecodeErrorZ { +/// Frees any resources used by the CResult_OpenChannelDecodeErrorZ. +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { } +impl Drop for CResult_OpenChannelDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18074,16 +18921,16 @@ impl Drop for CResult_CommitmentSignedBatchDecodeErrorZ { } } } -impl From> for CResult_CommitmentSignedBatchDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OpenChannelDecodeErrorZ { + 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_CommitmentSignedBatchDecodeErrorZPtr { result } + CResult_OpenChannelDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentSignedBatchDecodeErrorZPtr { err } + CResult_OpenChannelDecodeErrorZPtr { err } }; Self { contents, @@ -18091,59 +18938,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CommitmentSignedBatchDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedBatchDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CommitmentSignedBatchDecodeErrorZ_clone(orig: &CResult_CommitmentSignedBatchDecodeErrorZ) -> CResult_CommitmentSignedBatchDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentSignedDecodeErrorZ -pub union CResult_CommitmentSignedDecodeErrorZPtr { +/// The contents of CResult_OpenChannelV2DecodeErrorZ +pub union CResult_OpenChannelV2DecodeErrorZPtr { /// 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::msgs::CommitmentSigned, + pub result: *mut crate::lightning::ln::msgs::OpenChannelV2, /// 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_CommitmentSignedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::CommitmentSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OpenChannelV2DecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OpenChannelV2 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_CommitmentSignedDecodeErrorZ { - /// The contents of this CResult_CommitmentSignedDecodeErrorZ, accessible via either +pub struct CResult_OpenChannelV2DecodeErrorZ { + /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CommitmentSignedDecodeErrorZPtr, - /// Whether this CResult_CommitmentSignedDecodeErrorZ represents a success state. + pub contents: CResult_OpenChannelV2DecodeErrorZPtr, + /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the success state. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::CommitmentSigned) -> CResult_CommitmentSignedDecodeErrorZ { - CResult_CommitmentSignedDecodeErrorZ { - contents: CResult_CommitmentSignedDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ { + CResult_OpenChannelV2DecodeErrorZ { + contents: CResult_OpenChannelV2DecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedDecodeErrorZ in the error state. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CommitmentSignedDecodeErrorZ { - CResult_CommitmentSignedDecodeErrorZ { - contents: CResult_CommitmentSignedDecodeErrorZPtr { +/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ { + CResult_OpenChannelV2DecodeErrorZ { + contents: CResult_OpenChannelV2DecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18151,13 +18998,13 @@ pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_err(e: crate::lightning:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_is_ok(o: &CResult_CommitmentSignedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CommitmentSignedDecodeErrorZ. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_free(_res: CResult_CommitmentSignedDecodeErrorZ) { } -impl Drop for CResult_CommitmentSignedDecodeErrorZ { +/// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { } +impl Drop for CResult_OpenChannelV2DecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18170,16 +19017,16 @@ impl Drop for CResult_CommitmentSignedDecodeErrorZ { } } } -impl From> for CResult_CommitmentSignedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OpenChannelV2DecodeErrorZ { + 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_CommitmentSignedDecodeErrorZPtr { result } + CResult_OpenChannelV2DecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentSignedDecodeErrorZPtr { err } + CResult_OpenChannelV2DecodeErrorZPtr { err } }; Self { contents, @@ -18187,59 +19034,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CommitmentSignedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CommitmentSignedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CommitmentSignedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CommitmentSignedDecodeErrorZ_clone(orig: &CResult_CommitmentSignedDecodeErrorZ) -> CResult_CommitmentSignedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FundingCreatedDecodeErrorZ -pub union CResult_FundingCreatedDecodeErrorZPtr { +/// The contents of CResult_RevokeAndACKDecodeErrorZ +pub union CResult_RevokeAndACKDecodeErrorZPtr { /// 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::msgs::FundingCreated, + pub result: *mut crate::lightning::ln::msgs::RevokeAndACK, /// 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_FundingCreatedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::FundingCreated on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_RevokeAndACKDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_FundingCreatedDecodeErrorZ { - /// The contents of this CResult_FundingCreatedDecodeErrorZ, accessible via either +pub struct CResult_RevokeAndACKDecodeErrorZ { + /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FundingCreatedDecodeErrorZPtr, - /// Whether this CResult_FundingCreatedDecodeErrorZ represents a success state. + pub contents: CResult_RevokeAndACKDecodeErrorZPtr, + /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_FundingCreatedDecodeErrorZ in the success state. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingCreated) -> CResult_FundingCreatedDecodeErrorZ { - CResult_FundingCreatedDecodeErrorZ { - contents: CResult_FundingCreatedDecodeErrorZPtr { +/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ { + CResult_RevokeAndACKDecodeErrorZ { + contents: CResult_RevokeAndACKDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_FundingCreatedDecodeErrorZ in the error state. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingCreatedDecodeErrorZ { - CResult_FundingCreatedDecodeErrorZ { - contents: CResult_FundingCreatedDecodeErrorZPtr { +/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ { + CResult_RevokeAndACKDecodeErrorZ { + contents: CResult_RevokeAndACKDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18247,13 +19094,13 @@ pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_is_ok(o: &CResult_FundingCreatedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_FundingCreatedDecodeErrorZ. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_free(_res: CResult_FundingCreatedDecodeErrorZ) { } -impl Drop for CResult_FundingCreatedDecodeErrorZ { +/// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { } +impl Drop for CResult_RevokeAndACKDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18266,16 +19113,16 @@ impl Drop for CResult_FundingCreatedDecodeErrorZ { } } } -impl From> for CResult_FundingCreatedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_RevokeAndACKDecodeErrorZ { + 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_FundingCreatedDecodeErrorZPtr { result } + CResult_RevokeAndACKDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingCreatedDecodeErrorZPtr { err } + CResult_RevokeAndACKDecodeErrorZPtr { err } }; Self { contents, @@ -18283,59 +19130,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_FundingCreatedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_FundingCreatedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_FundingCreatedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FundingCreatedDecodeErrorZ_clone(orig: &CResult_FundingCreatedDecodeErrorZ) -> CResult_FundingCreatedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FundingSignedDecodeErrorZ -pub union CResult_FundingSignedDecodeErrorZPtr { +/// The contents of CResult_ShutdownDecodeErrorZ +pub union CResult_ShutdownDecodeErrorZPtr { /// 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::msgs::FundingSigned, + pub result: *mut crate::lightning::ln::msgs::Shutdown, /// 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_FundingSignedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::FundingSigned on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ShutdownDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_FundingSignedDecodeErrorZ { - /// The contents of this CResult_FundingSignedDecodeErrorZ, accessible via either +pub struct CResult_ShutdownDecodeErrorZ { + /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FundingSignedDecodeErrorZPtr, - /// Whether this CResult_FundingSignedDecodeErrorZ represents a success state. + pub contents: CResult_ShutdownDecodeErrorZPtr, + /// Whether this CResult_ShutdownDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_FundingSignedDecodeErrorZ in the success state. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FundingSigned) -> CResult_FundingSignedDecodeErrorZ { - CResult_FundingSignedDecodeErrorZ { - contents: CResult_FundingSignedDecodeErrorZPtr { +/// Creates a new CResult_ShutdownDecodeErrorZ in the success state. +pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ { + CResult_ShutdownDecodeErrorZ { + contents: CResult_ShutdownDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_FundingSignedDecodeErrorZ in the error state. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingSignedDecodeErrorZ { - CResult_FundingSignedDecodeErrorZ { - contents: CResult_FundingSignedDecodeErrorZPtr { +/// Creates a new CResult_ShutdownDecodeErrorZ in the error state. +pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ { + CResult_ShutdownDecodeErrorZ { + contents: CResult_ShutdownDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18343,13 +19190,13 @@ pub extern "C" fn CResult_FundingSignedDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_is_ok(o: &CResult_FundingSignedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_FundingSignedDecodeErrorZ. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_free(_res: CResult_FundingSignedDecodeErrorZ) { } -impl Drop for CResult_FundingSignedDecodeErrorZ { +/// Frees any resources used by the CResult_ShutdownDecodeErrorZ. +pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { } +impl Drop for CResult_ShutdownDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18362,16 +19209,16 @@ impl Drop for CResult_FundingSignedDecodeErrorZ { } } } -impl From> for CResult_FundingSignedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ShutdownDecodeErrorZ { + 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_FundingSignedDecodeErrorZPtr { result } + CResult_ShutdownDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingSignedDecodeErrorZPtr { err } + CResult_ShutdownDecodeErrorZPtr { err } }; Self { contents, @@ -18379,59 +19226,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_FundingSignedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_FundingSignedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_FundingSignedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FundingSignedDecodeErrorZ_clone(orig: &CResult_FundingSignedDecodeErrorZ) -> CResult_FundingSignedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelReadyDecodeErrorZ -pub union CResult_ChannelReadyDecodeErrorZPtr { +/// The contents of CResult_UpdateFailHTLCDecodeErrorZ +pub union CResult_UpdateFailHTLCDecodeErrorZPtr { /// 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::msgs::ChannelReady, + pub result: *mut crate::lightning::ln::msgs::UpdateFailHTLC, /// 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_ChannelReadyDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelReady on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelReadyDecodeErrorZ { - /// The contents of this CResult_ChannelReadyDecodeErrorZ, accessible via either +pub struct CResult_UpdateFailHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelReadyDecodeErrorZPtr, - /// Whether this CResult_ChannelReadyDecodeErrorZ represents a success state. + pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelReadyDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelReady) -> CResult_ChannelReadyDecodeErrorZ { - CResult_ChannelReadyDecodeErrorZ { - contents: CResult_ChannelReadyDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ { + CResult_UpdateFailHTLCDecodeErrorZ { + contents: CResult_UpdateFailHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelReadyDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelReadyDecodeErrorZ { - CResult_ChannelReadyDecodeErrorZ { - contents: CResult_ChannelReadyDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ { + CResult_UpdateFailHTLCDecodeErrorZ { + contents: CResult_UpdateFailHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18439,13 +19286,13 @@ pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_is_ok(o: &CResult_ChannelReadyDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelReadyDecodeErrorZ. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_free(_res: CResult_ChannelReadyDecodeErrorZ) { } -impl Drop for CResult_ChannelReadyDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateFailHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18458,16 +19305,16 @@ impl Drop for CResult_ChannelReadyDecodeErrorZ { } } } -impl From> for CResult_ChannelReadyDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFailHTLCDecodeErrorZ { + 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_ChannelReadyDecodeErrorZPtr { result } + CResult_UpdateFailHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelReadyDecodeErrorZPtr { err } + CResult_UpdateFailHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18475,59 +19322,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelReadyDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelReadyDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelReadyDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelReadyDecodeErrorZ_clone(orig: &CResult_ChannelReadyDecodeErrorZ) -> CResult_ChannelReadyDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_InitDecodeErrorZ -pub union CResult_InitDecodeErrorZPtr { +pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ +pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { /// 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::msgs::Init, + pub result: *mut crate::lightning::ln::msgs::UpdateFailMalformedHTLC, /// 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_InitDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Init on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_InitDecodeErrorZ { - /// The contents of this CResult_InitDecodeErrorZ, accessible via either +pub struct CResult_UpdateFailMalformedHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InitDecodeErrorZPtr, - /// Whether this CResult_InitDecodeErrorZ represents a success state. + pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InitDecodeErrorZ in the success state. -pub extern "C" fn CResult_InitDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Init) -> CResult_InitDecodeErrorZ { - CResult_InitDecodeErrorZ { - contents: CResult_InitDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { + CResult_UpdateFailMalformedHTLCDecodeErrorZ { + contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InitDecodeErrorZ in the error state. -pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitDecodeErrorZ { - CResult_InitDecodeErrorZ { - contents: CResult_InitDecodeErrorZPtr { +/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { + CResult_UpdateFailMalformedHTLCDecodeErrorZ { + contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18535,13 +19382,13 @@ pub extern "C" fn CResult_InitDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InitDecodeErrorZ_is_ok(o: &CResult_InitDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InitDecodeErrorZ. -pub extern "C" fn CResult_InitDecodeErrorZ_free(_res: CResult_InitDecodeErrorZ) { } -impl Drop for CResult_InitDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18554,16 +19401,16 @@ impl Drop for CResult_InitDecodeErrorZ { } } } -impl From> for CResult_InitDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFailMalformedHTLCDecodeErrorZ { + 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_InitDecodeErrorZPtr { result } + CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InitDecodeErrorZPtr { err } + CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18571,59 +19418,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InitDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InitDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InitDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InitDecodeErrorZ_clone(orig: &CResult_InitDecodeErrorZ) -> CResult_InitDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OpenChannelDecodeErrorZ -pub union CResult_OpenChannelDecodeErrorZPtr { +/// The contents of CResult_UpdateFeeDecodeErrorZ +pub union CResult_UpdateFeeDecodeErrorZPtr { /// 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::msgs::OpenChannel, + pub result: *mut crate::lightning::ln::msgs::UpdateFee, /// 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_OpenChannelDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OpenChannel on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFeeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OpenChannelDecodeErrorZ { - /// The contents of this CResult_OpenChannelDecodeErrorZ, accessible via either +pub struct CResult_UpdateFeeDecodeErrorZ { + /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OpenChannelDecodeErrorZPtr, - /// Whether this CResult_OpenChannelDecodeErrorZ represents a success state. + pub contents: CResult_UpdateFeeDecodeErrorZPtr, + /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OpenChannelDecodeErrorZ in the success state. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannel) -> CResult_OpenChannelDecodeErrorZ { - CResult_OpenChannelDecodeErrorZ { - contents: CResult_OpenChannelDecodeErrorZPtr { +/// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ { + CResult_UpdateFeeDecodeErrorZ { + contents: CResult_UpdateFeeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OpenChannelDecodeErrorZ in the error state. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelDecodeErrorZ { - CResult_OpenChannelDecodeErrorZ { - contents: CResult_OpenChannelDecodeErrorZPtr { +/// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ { + CResult_UpdateFeeDecodeErrorZ { + contents: CResult_UpdateFeeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18631,13 +19478,13 @@ pub extern "C" fn CResult_OpenChannelDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_is_ok(o: &CResult_OpenChannelDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OpenChannelDecodeErrorZ. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_free(_res: CResult_OpenChannelDecodeErrorZ) { } -impl Drop for CResult_OpenChannelDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { } +impl Drop for CResult_UpdateFeeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18650,16 +19497,16 @@ impl Drop for CResult_OpenChannelDecodeErrorZ { } } } -impl From> for CResult_OpenChannelDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFeeDecodeErrorZ { + 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_OpenChannelDecodeErrorZPtr { result } + CResult_UpdateFeeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OpenChannelDecodeErrorZPtr { err } + CResult_UpdateFeeDecodeErrorZPtr { err } }; Self { contents, @@ -18667,59 +19514,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OpenChannelDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OpenChannelDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OpenChannelDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OpenChannelDecodeErrorZ_clone(orig: &CResult_OpenChannelDecodeErrorZ) -> CResult_OpenChannelDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OpenChannelV2DecodeErrorZ -pub union CResult_OpenChannelV2DecodeErrorZPtr { +/// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ +pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr { /// 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::msgs::OpenChannelV2, + pub result: *mut crate::lightning::ln::msgs::UpdateFulfillHTLC, /// 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_OpenChannelV2DecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OpenChannelV2 on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OpenChannelV2DecodeErrorZ { - /// The contents of this CResult_OpenChannelV2DecodeErrorZ, accessible via either +pub struct CResult_UpdateFulfillHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OpenChannelV2DecodeErrorZPtr, - /// Whether this CResult_OpenChannelV2DecodeErrorZ represents a success state. + pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the success state. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_ok(o: crate::lightning::ln::msgs::OpenChannelV2) -> CResult_OpenChannelV2DecodeErrorZ { - CResult_OpenChannelV2DecodeErrorZ { - contents: CResult_OpenChannelV2DecodeErrorZPtr { +/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ { + CResult_UpdateFulfillHTLCDecodeErrorZ { + contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OpenChannelV2DecodeErrorZ in the error state. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OpenChannelV2DecodeErrorZ { - CResult_OpenChannelV2DecodeErrorZ { - contents: CResult_OpenChannelV2DecodeErrorZPtr { +/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ { + CResult_UpdateFulfillHTLCDecodeErrorZ { + contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18727,13 +19574,13 @@ pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_is_ok(o: &CResult_OpenChannelV2DecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OpenChannelV2DecodeErrorZ. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_free(_res: CResult_OpenChannelV2DecodeErrorZ) { } -impl Drop for CResult_OpenChannelV2DecodeErrorZ { +/// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18746,16 +19593,16 @@ impl Drop for CResult_OpenChannelV2DecodeErrorZ { } } } -impl From> for CResult_OpenChannelV2DecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateFulfillHTLCDecodeErrorZ { + 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_OpenChannelV2DecodeErrorZPtr { result } + CResult_UpdateFulfillHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OpenChannelV2DecodeErrorZPtr { err } + CResult_UpdateFulfillHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18763,59 +19610,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OpenChannelV2DecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OpenChannelV2DecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OpenChannelV2DecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OpenChannelV2DecodeErrorZ_clone(orig: &CResult_OpenChannelV2DecodeErrorZ) -> CResult_OpenChannelV2DecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_RevokeAndACKDecodeErrorZ -pub union CResult_RevokeAndACKDecodeErrorZPtr { +/// The contents of CResult_OnionPacketDecodeErrorZ +pub union CResult_OnionPacketDecodeErrorZPtr { /// 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::msgs::RevokeAndACK, + pub result: *mut crate::lightning::ln::msgs::OnionPacket, /// 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_RevokeAndACKDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::RevokeAndACK on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OnionPacketDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OnionPacket 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_RevokeAndACKDecodeErrorZ { - /// The contents of this CResult_RevokeAndACKDecodeErrorZ, accessible via either +pub struct CResult_OnionPacketDecodeErrorZ { + /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_RevokeAndACKDecodeErrorZPtr, - /// Whether this CResult_RevokeAndACKDecodeErrorZ represents a success state. + pub contents: CResult_OnionPacketDecodeErrorZPtr, + /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the success state. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_ok(o: crate::lightning::ln::msgs::RevokeAndACK) -> CResult_RevokeAndACKDecodeErrorZ { - CResult_RevokeAndACKDecodeErrorZ { - contents: CResult_RevokeAndACKDecodeErrorZPtr { +/// Creates a new CResult_OnionPacketDecodeErrorZ in the success state. +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ { + CResult_OnionPacketDecodeErrorZ { + contents: CResult_OnionPacketDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_RevokeAndACKDecodeErrorZ in the error state. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_RevokeAndACKDecodeErrorZ { - CResult_RevokeAndACKDecodeErrorZ { - contents: CResult_RevokeAndACKDecodeErrorZPtr { +/// Creates a new CResult_OnionPacketDecodeErrorZ in the error state. +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ { + CResult_OnionPacketDecodeErrorZ { + contents: CResult_OnionPacketDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18823,13 +19670,13 @@ pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_is_ok(o: &CResult_RevokeAndACKDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_RevokeAndACKDecodeErrorZ. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_free(_res: CResult_RevokeAndACKDecodeErrorZ) { } -impl Drop for CResult_RevokeAndACKDecodeErrorZ { +/// Frees any resources used by the CResult_OnionPacketDecodeErrorZ. +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { } +impl Drop for CResult_OnionPacketDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18842,16 +19689,16 @@ impl Drop for CResult_RevokeAndACKDecodeErrorZ { } } } -impl From> for CResult_RevokeAndACKDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OnionPacketDecodeErrorZ { + 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_RevokeAndACKDecodeErrorZPtr { result } + CResult_OnionPacketDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_RevokeAndACKDecodeErrorZPtr { err } + CResult_OnionPacketDecodeErrorZPtr { err } }; Self { contents, @@ -18859,59 +19706,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_RevokeAndACKDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_RevokeAndACKDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_RevokeAndACKDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_RevokeAndACKDecodeErrorZ_clone(orig: &CResult_RevokeAndACKDecodeErrorZ) -> CResult_RevokeAndACKDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownDecodeErrorZ -pub union CResult_ShutdownDecodeErrorZPtr { +/// The contents of CResult_UpdateAddHTLCDecodeErrorZ +pub union CResult_UpdateAddHTLCDecodeErrorZPtr { /// 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::msgs::Shutdown, + pub result: *mut crate::lightning::ln::msgs::UpdateAddHTLC, /// 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_ShutdownDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Shutdown on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ShutdownDecodeErrorZ { - /// The contents of this CResult_ShutdownDecodeErrorZ, accessible via either +pub struct CResult_UpdateAddHTLCDecodeErrorZ { + /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ShutdownDecodeErrorZPtr, - /// Whether this CResult_ShutdownDecodeErrorZ represents a success state. + pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr, + /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ShutdownDecodeErrorZ in the success state. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Shutdown) -> CResult_ShutdownDecodeErrorZ { - CResult_ShutdownDecodeErrorZ { - contents: CResult_ShutdownDecodeErrorZPtr { +/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ { + CResult_UpdateAddHTLCDecodeErrorZ { + contents: CResult_UpdateAddHTLCDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ShutdownDecodeErrorZ in the error state. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ShutdownDecodeErrorZ { - CResult_ShutdownDecodeErrorZ { - contents: CResult_ShutdownDecodeErrorZPtr { +/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ { + CResult_UpdateAddHTLCDecodeErrorZ { + contents: CResult_UpdateAddHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -18919,13 +19766,13 @@ pub extern "C" fn CResult_ShutdownDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ShutdownDecodeErrorZ_is_ok(o: &CResult_ShutdownDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ShutdownDecodeErrorZ. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_free(_res: CResult_ShutdownDecodeErrorZ) { } -impl Drop for CResult_ShutdownDecodeErrorZ { +/// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { } +impl Drop for CResult_UpdateAddHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -18938,16 +19785,16 @@ impl Drop for CResult_ShutdownDecodeErrorZ { } } } -impl From> for CResult_ShutdownDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UpdateAddHTLCDecodeErrorZ { + 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_ShutdownDecodeErrorZPtr { result } + CResult_UpdateAddHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownDecodeErrorZPtr { err } + CResult_UpdateAddHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -18955,59 +19802,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ShutdownDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ShutdownDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ShutdownDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ShutdownDecodeErrorZ_clone(orig: &CResult_ShutdownDecodeErrorZ) -> CResult_ShutdownDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFailHTLCDecodeErrorZ -pub union CResult_UpdateFailHTLCDecodeErrorZPtr { +/// The contents of CResult_OnionMessageDecodeErrorZ +pub union CResult_OnionMessageDecodeErrorZPtr { /// 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::msgs::UpdateFailHTLC, + pub result: *mut crate::lightning::ln::msgs::OnionMessage, /// 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_UpdateFailHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFailHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OnionMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UpdateFailHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFailHTLCDecodeErrorZ, accessible via either +pub struct CResult_OnionMessageDecodeErrorZ { + /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFailHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFailHTLCDecodeErrorZ represents a success state. + pub contents: CResult_OnionMessageDecodeErrorZPtr, + /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailHTLC) -> CResult_UpdateFailHTLCDecodeErrorZ { - CResult_UpdateFailHTLCDecodeErrorZ { - contents: CResult_UpdateFailHTLCDecodeErrorZPtr { +/// Creates a new CResult_OnionMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ { + CResult_OnionMessageDecodeErrorZ { + contents: CResult_OnionMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailHTLCDecodeErrorZ { - CResult_UpdateFailHTLCDecodeErrorZ { - contents: CResult_UpdateFailHTLCDecodeErrorZPtr { +/// Creates a new CResult_OnionMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ { + CResult_OnionMessageDecodeErrorZ { + contents: CResult_OnionMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19015,13 +19862,13 @@ pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFailHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_free(_res: CResult_UpdateFailHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateFailHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_OnionMessageDecodeErrorZ. +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { } +impl Drop for CResult_OnionMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19034,16 +19881,16 @@ impl Drop for CResult_UpdateFailHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFailHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OnionMessageDecodeErrorZ { + 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_UpdateFailHTLCDecodeErrorZPtr { result } + CResult_OnionMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFailHTLCDecodeErrorZPtr { err } + CResult_OnionMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19051,59 +19898,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFailHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFailHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFailHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailHTLCDecodeErrorZ) -> CResult_UpdateFailHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFailMalformedHTLCDecodeErrorZ -pub union CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { +/// The contents of CResult_FinalOnionHopDataDecodeErrorZ +pub union CResult_FinalOnionHopDataDecodeErrorZPtr { /// 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::msgs::UpdateFailMalformedHTLC, + pub result: *mut crate::lightning::ln::msgs::FinalOnionHopData, /// 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_UpdateFailMalformedHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFailMalformedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::FinalOnionHopData 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_UpdateFailMalformedHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFailMalformedHTLCDecodeErrorZ, accessible via either +pub struct CResult_FinalOnionHopDataDecodeErrorZ { + /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFailMalformedHTLCDecodeErrorZ represents a success state. + pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr, + /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFailMalformedHTLC) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { - CResult_UpdateFailMalformedHTLCDecodeErrorZ { - contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { +/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ { + CResult_FinalOnionHopDataDecodeErrorZ { + contents: CResult_FinalOnionHopDataDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { - CResult_UpdateFailMalformedHTLCDecodeErrorZ { - contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { +/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ { + CResult_FinalOnionHopDataDecodeErrorZ { + contents: CResult_FinalOnionHopDataDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19111,13 +19958,13 @@ pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_err(e: crate::ligh } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFailMalformedHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_free(_res: CResult_UpdateFailMalformedHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { } +impl Drop for CResult_FinalOnionHopDataDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19130,16 +19977,16 @@ impl Drop for CResult_UpdateFailMalformedHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFailMalformedHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FinalOnionHopDataDecodeErrorZ { + 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_UpdateFailMalformedHTLCDecodeErrorZPtr { result } + CResult_FinalOnionHopDataDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { err } + CResult_FinalOnionHopDataDecodeErrorZPtr { err } }; Self { contents, @@ -19147,59 +19994,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFailMalformedHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFailMalformedHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFailMalformedHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFailMalformedHTLCDecodeErrorZ) -> CResult_UpdateFailMalformedHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFeeDecodeErrorZ -pub union CResult_UpdateFeeDecodeErrorZPtr { +/// The contents of CResult_PingDecodeErrorZ +pub union CResult_PingDecodeErrorZPtr { /// 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::msgs::UpdateFee, + pub result: *mut crate::lightning::ln::msgs::Ping, /// 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_UpdateFeeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFee on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PingDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UpdateFeeDecodeErrorZ { - /// The contents of this CResult_UpdateFeeDecodeErrorZ, accessible via either +pub struct CResult_PingDecodeErrorZ { + /// The contents of this CResult_PingDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFeeDecodeErrorZPtr, - /// Whether this CResult_UpdateFeeDecodeErrorZ represents a success state. + pub contents: CResult_PingDecodeErrorZPtr, + /// Whether this CResult_PingDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFeeDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFee) -> CResult_UpdateFeeDecodeErrorZ { - CResult_UpdateFeeDecodeErrorZ { - contents: CResult_UpdateFeeDecodeErrorZPtr { +/// Creates a new CResult_PingDecodeErrorZ in the success state. +pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ { + CResult_PingDecodeErrorZ { + contents: CResult_PingDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFeeDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFeeDecodeErrorZ { - CResult_UpdateFeeDecodeErrorZ { - contents: CResult_UpdateFeeDecodeErrorZPtr { +/// Creates a new CResult_PingDecodeErrorZ in the error state. +pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ { + CResult_PingDecodeErrorZ { + contents: CResult_PingDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19207,13 +20054,13 @@ pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_is_ok(o: &CResult_UpdateFeeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFeeDecodeErrorZ. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_free(_res: CResult_UpdateFeeDecodeErrorZ) { } -impl Drop for CResult_UpdateFeeDecodeErrorZ { +/// Frees any resources used by the CResult_PingDecodeErrorZ. +pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { } +impl Drop for CResult_PingDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19226,16 +20073,16 @@ impl Drop for CResult_UpdateFeeDecodeErrorZ { } } } -impl From> for CResult_UpdateFeeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PingDecodeErrorZ { + 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_UpdateFeeDecodeErrorZPtr { result } + CResult_PingDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFeeDecodeErrorZPtr { err } + CResult_PingDecodeErrorZPtr { err } }; Self { contents, @@ -19243,59 +20090,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFeeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFeeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFeeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFeeDecodeErrorZ_clone(orig: &CResult_UpdateFeeDecodeErrorZ) -> CResult_UpdateFeeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateFulfillHTLCDecodeErrorZ -pub union CResult_UpdateFulfillHTLCDecodeErrorZPtr { +/// The contents of CResult_PongDecodeErrorZ +pub union CResult_PongDecodeErrorZPtr { /// 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::msgs::UpdateFulfillHTLC, + pub result: *mut crate::lightning::ln::msgs::Pong, /// 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_UpdateFulfillHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateFulfillHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PongDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UpdateFulfillHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateFulfillHTLCDecodeErrorZ, accessible via either +pub struct CResult_PongDecodeErrorZ { + /// The contents of this CResult_PongDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateFulfillHTLCDecodeErrorZ represents a success state. + pub contents: CResult_PongDecodeErrorZPtr, + /// Whether this CResult_PongDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateFulfillHTLC) -> CResult_UpdateFulfillHTLCDecodeErrorZ { - CResult_UpdateFulfillHTLCDecodeErrorZ { - contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { +/// Creates a new CResult_PongDecodeErrorZ in the success state. +pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ { + CResult_PongDecodeErrorZ { + contents: CResult_PongDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateFulfillHTLCDecodeErrorZ { - CResult_UpdateFulfillHTLCDecodeErrorZ { - contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { +/// Creates a new CResult_PongDecodeErrorZ in the error state. +pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ { + CResult_PongDecodeErrorZ { + contents: CResult_PongDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19303,13 +20150,13 @@ pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateFulfillHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_free(_res: CResult_UpdateFulfillHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_PongDecodeErrorZ. +pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { } +impl Drop for CResult_PongDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19322,16 +20169,16 @@ impl Drop for CResult_UpdateFulfillHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateFulfillHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PongDecodeErrorZ { + 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_UpdateFulfillHTLCDecodeErrorZPtr { result } + CResult_PongDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateFulfillHTLCDecodeErrorZPtr { err } + CResult_PongDecodeErrorZPtr { err } }; Self { contents, @@ -19339,59 +20186,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateFulfillHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateFulfillHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateFulfillHTLCDecodeErrorZ_clone(orig: &CResult_UpdateFulfillHTLCDecodeErrorZ) -> CResult_UpdateFulfillHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OnionPacketDecodeErrorZ -pub union CResult_OnionPacketDecodeErrorZPtr { +/// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ +pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { /// 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::msgs::OnionPacket, + pub result: *mut crate::lightning::ln::msgs::UnsignedChannelAnnouncement, /// 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_OnionPacketDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OnionPacket on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OnionPacketDecodeErrorZ { - /// The contents of this CResult_OnionPacketDecodeErrorZ, accessible via either +pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ { + /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OnionPacketDecodeErrorZPtr, - /// Whether this CResult_OnionPacketDecodeErrorZ represents a success state. + pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr, + /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OnionPacketDecodeErrorZ in the success state. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionPacket) -> CResult_OnionPacketDecodeErrorZ { - CResult_OnionPacketDecodeErrorZ { - contents: CResult_OnionPacketDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { + CResult_UnsignedChannelAnnouncementDecodeErrorZ { + contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OnionPacketDecodeErrorZ in the error state. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionPacketDecodeErrorZ { - CResult_OnionPacketDecodeErrorZ { - contents: CResult_OnionPacketDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { + CResult_UnsignedChannelAnnouncementDecodeErrorZ { + contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19399,13 +20246,13 @@ pub extern "C" fn CResult_OnionPacketDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_is_ok(o: &CResult_OnionPacketDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OnionPacketDecodeErrorZ. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_free(_res: CResult_OnionPacketDecodeErrorZ) { } -impl Drop for CResult_OnionPacketDecodeErrorZ { +/// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { } +impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19418,16 +20265,16 @@ impl Drop for CResult_OnionPacketDecodeErrorZ { } } } -impl From> for CResult_OnionPacketDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UnsignedChannelAnnouncementDecodeErrorZ { + 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_OnionPacketDecodeErrorZPtr { result } + CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OnionPacketDecodeErrorZPtr { err } + CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19435,59 +20282,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OnionPacketDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OnionPacketDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OnionPacketDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OnionPacketDecodeErrorZ_clone(orig: &CResult_OnionPacketDecodeErrorZ) -> CResult_OnionPacketDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UpdateAddHTLCDecodeErrorZ -pub union CResult_UpdateAddHTLCDecodeErrorZPtr { +/// The contents of CResult_ChannelAnnouncementDecodeErrorZ +pub union CResult_ChannelAnnouncementDecodeErrorZPtr { /// 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::msgs::UpdateAddHTLC, + pub result: *mut crate::lightning::ln::msgs::ChannelAnnouncement, /// 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_UpdateAddHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UpdateAddHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UpdateAddHTLCDecodeErrorZ { - /// The contents of this CResult_UpdateAddHTLCDecodeErrorZ, accessible via either +pub struct CResult_ChannelAnnouncementDecodeErrorZ { + /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UpdateAddHTLCDecodeErrorZPtr, - /// Whether this CResult_UpdateAddHTLCDecodeErrorZ represents a success state. + pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr, + /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UpdateAddHTLC) -> CResult_UpdateAddHTLCDecodeErrorZ { - CResult_UpdateAddHTLCDecodeErrorZ { - contents: CResult_UpdateAddHTLCDecodeErrorZPtr { +/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ { + CResult_ChannelAnnouncementDecodeErrorZ { + contents: CResult_ChannelAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UpdateAddHTLCDecodeErrorZ { - CResult_UpdateAddHTLCDecodeErrorZ { - contents: CResult_UpdateAddHTLCDecodeErrorZPtr { +/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ { + CResult_ChannelAnnouncementDecodeErrorZ { + contents: CResult_ChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19495,13 +20342,13 @@ pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_is_ok(o: &CResult_UpdateAddHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UpdateAddHTLCDecodeErrorZ. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_free(_res: CResult_UpdateAddHTLCDecodeErrorZ) { } -impl Drop for CResult_UpdateAddHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { } +impl Drop for CResult_ChannelAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19514,16 +20361,16 @@ impl Drop for CResult_UpdateAddHTLCDecodeErrorZ { } } } -impl From> for CResult_UpdateAddHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelAnnouncementDecodeErrorZ { + 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_UpdateAddHTLCDecodeErrorZPtr { result } + CResult_ChannelAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UpdateAddHTLCDecodeErrorZPtr { err } + CResult_ChannelAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -19531,59 +20378,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UpdateAddHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UpdateAddHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UpdateAddHTLCDecodeErrorZ_clone(orig: &CResult_UpdateAddHTLCDecodeErrorZ) -> CResult_UpdateAddHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OnionMessageDecodeErrorZ -pub union CResult_OnionMessageDecodeErrorZPtr { +/// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ +pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr { /// 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::msgs::OnionMessage, + pub result: *mut crate::lightning::ln::msgs::UnsignedChannelUpdate, /// 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_OnionMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::OnionMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OnionMessageDecodeErrorZ { - /// The contents of this CResult_OnionMessageDecodeErrorZ, accessible via either +pub struct CResult_UnsignedChannelUpdateDecodeErrorZ { + /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OnionMessageDecodeErrorZPtr, - /// Whether this CResult_OnionMessageDecodeErrorZ represents a success state. + pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr, + /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OnionMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::OnionMessage) -> CResult_OnionMessageDecodeErrorZ { - CResult_OnionMessageDecodeErrorZ { - contents: CResult_OnionMessageDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ { + CResult_UnsignedChannelUpdateDecodeErrorZ { + contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OnionMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OnionMessageDecodeErrorZ { - CResult_OnionMessageDecodeErrorZ { - contents: CResult_OnionMessageDecodeErrorZPtr { +/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ { + CResult_UnsignedChannelUpdateDecodeErrorZ { + contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19591,13 +20438,13 @@ pub extern "C" fn CResult_OnionMessageDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_is_ok(o: &CResult_OnionMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OnionMessageDecodeErrorZ. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_free(_res: CResult_OnionMessageDecodeErrorZ) { } -impl Drop for CResult_OnionMessageDecodeErrorZ { +/// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { } +impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19610,16 +20457,16 @@ impl Drop for CResult_OnionMessageDecodeErrorZ { } } } -impl From> for CResult_OnionMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UnsignedChannelUpdateDecodeErrorZ { + 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_OnionMessageDecodeErrorZPtr { result } + CResult_UnsignedChannelUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OnionMessageDecodeErrorZPtr { err } + CResult_UnsignedChannelUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -19627,59 +20474,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OnionMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OnionMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OnionMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OnionMessageDecodeErrorZ_clone(orig: &CResult_OnionMessageDecodeErrorZ) -> CResult_OnionMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_FinalOnionHopDataDecodeErrorZ -pub union CResult_FinalOnionHopDataDecodeErrorZPtr { +/// The contents of CResult_ChannelUpdateDecodeErrorZ +pub union CResult_ChannelUpdateDecodeErrorZPtr { /// 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::msgs::FinalOnionHopData, + pub result: *mut crate::lightning::ln::msgs::ChannelUpdate, /// 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_FinalOnionHopDataDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::FinalOnionHopData on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelUpdateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_FinalOnionHopDataDecodeErrorZ { - /// The contents of this CResult_FinalOnionHopDataDecodeErrorZ, accessible via either +pub struct CResult_ChannelUpdateDecodeErrorZ { + /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FinalOnionHopDataDecodeErrorZPtr, - /// Whether this CResult_FinalOnionHopDataDecodeErrorZ represents a success state. + pub contents: CResult_ChannelUpdateDecodeErrorZPtr, + /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the success state. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_ok(o: crate::lightning::ln::msgs::FinalOnionHopData) -> CResult_FinalOnionHopDataDecodeErrorZ { - CResult_FinalOnionHopDataDecodeErrorZ { - contents: CResult_FinalOnionHopDataDecodeErrorZPtr { +/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ { + CResult_ChannelUpdateDecodeErrorZ { + contents: CResult_ChannelUpdateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ in the error state. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FinalOnionHopDataDecodeErrorZ { - CResult_FinalOnionHopDataDecodeErrorZ { - contents: CResult_FinalOnionHopDataDecodeErrorZPtr { +/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ { + CResult_ChannelUpdateDecodeErrorZ { + contents: CResult_ChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19687,13 +20534,13 @@ pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_is_ok(o: &CResult_FinalOnionHopDataDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_FinalOnionHopDataDecodeErrorZ. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_free(_res: CResult_FinalOnionHopDataDecodeErrorZ) { } -impl Drop for CResult_FinalOnionHopDataDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { } +impl Drop for CResult_ChannelUpdateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19706,16 +20553,16 @@ impl Drop for CResult_FinalOnionHopDataDecodeErrorZ { } } } -impl From> for CResult_FinalOnionHopDataDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelUpdateDecodeErrorZ { + 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_FinalOnionHopDataDecodeErrorZPtr { result } + CResult_ChannelUpdateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FinalOnionHopDataDecodeErrorZPtr { err } + CResult_ChannelUpdateDecodeErrorZPtr { err } }; Self { contents, @@ -19723,59 +20570,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_FinalOnionHopDataDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_FinalOnionHopDataDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FinalOnionHopDataDecodeErrorZ_clone(orig: &CResult_FinalOnionHopDataDecodeErrorZ) -> CResult_FinalOnionHopDataDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PingDecodeErrorZ -pub union CResult_PingDecodeErrorZPtr { +/// The contents of CResult_ErrorMessageDecodeErrorZ +pub union CResult_ErrorMessageDecodeErrorZPtr { /// 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::msgs::Ping, + pub result: *mut crate::lightning::ln::msgs::ErrorMessage, /// 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_PingDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Ping on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ErrorMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PingDecodeErrorZ { - /// The contents of this CResult_PingDecodeErrorZ, accessible via either +pub struct CResult_ErrorMessageDecodeErrorZ { + /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PingDecodeErrorZPtr, - /// Whether this CResult_PingDecodeErrorZ represents a success state. + pub contents: CResult_ErrorMessageDecodeErrorZPtr, + /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PingDecodeErrorZ in the success state. -pub extern "C" fn CResult_PingDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Ping) -> CResult_PingDecodeErrorZ { - CResult_PingDecodeErrorZ { - contents: CResult_PingDecodeErrorZPtr { +/// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ { + CResult_ErrorMessageDecodeErrorZ { + contents: CResult_ErrorMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PingDecodeErrorZ in the error state. -pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PingDecodeErrorZ { - CResult_PingDecodeErrorZ { - contents: CResult_PingDecodeErrorZPtr { +/// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ { + CResult_ErrorMessageDecodeErrorZ { + contents: CResult_ErrorMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19783,13 +20630,13 @@ pub extern "C" fn CResult_PingDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PingDecodeErrorZ_is_ok(o: &CResult_PingDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PingDecodeErrorZ. -pub extern "C" fn CResult_PingDecodeErrorZ_free(_res: CResult_PingDecodeErrorZ) { } -impl Drop for CResult_PingDecodeErrorZ { +/// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { } +impl Drop for CResult_ErrorMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19802,16 +20649,16 @@ impl Drop for CResult_PingDecodeErrorZ { } } } -impl From> for CResult_PingDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ErrorMessageDecodeErrorZ { + 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_PingDecodeErrorZPtr { result } + CResult_ErrorMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PingDecodeErrorZPtr { err } + CResult_ErrorMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19819,59 +20666,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PingDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PingDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PingDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PingDecodeErrorZ_clone(orig: &CResult_PingDecodeErrorZ) -> CResult_PingDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PongDecodeErrorZ -pub union CResult_PongDecodeErrorZPtr { +/// The contents of CResult_WarningMessageDecodeErrorZ +pub union CResult_WarningMessageDecodeErrorZPtr { /// 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::msgs::Pong, + pub result: *mut crate::lightning::ln::msgs::WarningMessage, /// 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_PongDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::Pong on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_WarningMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PongDecodeErrorZ { - /// The contents of this CResult_PongDecodeErrorZ, accessible via either +pub struct CResult_WarningMessageDecodeErrorZ { + /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PongDecodeErrorZPtr, - /// Whether this CResult_PongDecodeErrorZ represents a success state. + pub contents: CResult_WarningMessageDecodeErrorZPtr, + /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PongDecodeErrorZ in the success state. -pub extern "C" fn CResult_PongDecodeErrorZ_ok(o: crate::lightning::ln::msgs::Pong) -> CResult_PongDecodeErrorZ { - CResult_PongDecodeErrorZ { - contents: CResult_PongDecodeErrorZPtr { +/// Creates a new CResult_WarningMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ { + CResult_WarningMessageDecodeErrorZ { + contents: CResult_WarningMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PongDecodeErrorZ in the error state. -pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PongDecodeErrorZ { - CResult_PongDecodeErrorZ { - contents: CResult_PongDecodeErrorZPtr { +/// Creates a new CResult_WarningMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ { + CResult_WarningMessageDecodeErrorZ { + contents: CResult_WarningMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19879,13 +20726,13 @@ pub extern "C" fn CResult_PongDecodeErrorZ_err(e: crate::lightning::ln::msgs::De } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PongDecodeErrorZ_is_ok(o: &CResult_PongDecodeErrorZ) -> bool { +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PongDecodeErrorZ. -pub extern "C" fn CResult_PongDecodeErrorZ_free(_res: CResult_PongDecodeErrorZ) { } -impl Drop for CResult_PongDecodeErrorZ { +/// Frees any resources used by the CResult_WarningMessageDecodeErrorZ. +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { } +impl Drop for CResult_WarningMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19898,16 +20745,16 @@ impl Drop for CResult_PongDecodeErrorZ { } } } -impl From> for CResult_PongDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_WarningMessageDecodeErrorZ { + 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_PongDecodeErrorZPtr { result } + CResult_WarningMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PongDecodeErrorZPtr { err } + CResult_WarningMessageDecodeErrorZPtr { err } }; Self { contents, @@ -19915,59 +20762,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PongDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PongDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PongDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PongDecodeErrorZ_clone(orig: &CResult_PongDecodeErrorZ) -> CResult_PongDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedChannelAnnouncementDecodeErrorZ -pub union CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { +/// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ +pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { /// 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::msgs::UnsignedChannelAnnouncement, + pub result: *mut crate::lightning::ln::msgs::UnsignedNodeAnnouncement, /// 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_UnsignedChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UnsignedChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UnsignedChannelAnnouncementDecodeErrorZ { - /// The contents of this CResult_UnsignedChannelAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ { + /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr, - /// Whether this CResult_UnsignedChannelAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr, + /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { - CResult_UnsignedChannelAnnouncementDecodeErrorZ { - contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { + CResult_UnsignedNodeAnnouncementDecodeErrorZ { + contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { - CResult_UnsignedChannelAnnouncementDecodeErrorZ { - contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { + CResult_UnsignedNodeAnnouncementDecodeErrorZ { + contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -19975,13 +20822,13 @@ pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_err(e: crate:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnsignedChannelAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedChannelAnnouncementDecodeErrorZ) { } -impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { } +impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -19994,16 +20841,16 @@ impl Drop for CResult_UnsignedChannelAnnouncementDecodeErrorZ { } } } -impl From> for CResult_UnsignedChannelAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UnsignedNodeAnnouncementDecodeErrorZ { + 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_UnsignedChannelAnnouncementDecodeErrorZPtr { result } + CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { err } + CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -20011,59 +20858,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedChannelAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnsignedChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedChannelAnnouncementDecodeErrorZ) -> CResult_UnsignedChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelAnnouncementDecodeErrorZ -pub union CResult_ChannelAnnouncementDecodeErrorZPtr { +/// The contents of CResult_NodeAnnouncementDecodeErrorZ +pub union CResult_NodeAnnouncementDecodeErrorZPtr { /// 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::msgs::ChannelAnnouncement, + pub result: *mut crate::lightning::ln::msgs::NodeAnnouncement, /// 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_ChannelAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelAnnouncementDecodeErrorZ { - /// The contents of this CResult_ChannelAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_NodeAnnouncementDecodeErrorZ { + /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelAnnouncementDecodeErrorZPtr, - /// Whether this CResult_ChannelAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_NodeAnnouncementDecodeErrorZPtr, + /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelAnnouncement) -> CResult_ChannelAnnouncementDecodeErrorZ { - CResult_ChannelAnnouncementDecodeErrorZ { - contents: CResult_ChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ { + CResult_NodeAnnouncementDecodeErrorZ { + contents: CResult_NodeAnnouncementDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelAnnouncementDecodeErrorZ { - CResult_ChannelAnnouncementDecodeErrorZ { - contents: CResult_ChannelAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ { + CResult_NodeAnnouncementDecodeErrorZ { + contents: CResult_NodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20071,13 +20918,13 @@ pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_is_ok(o: &CResult_ChannelAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_free(_res: CResult_ChannelAnnouncementDecodeErrorZ) { } -impl Drop for CResult_ChannelAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { } +impl Drop for CResult_NodeAnnouncementDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20090,16 +20937,16 @@ impl Drop for CResult_ChannelAnnouncementDecodeErrorZ { } } } -impl From> for CResult_ChannelAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeAnnouncementDecodeErrorZ { + 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_ChannelAnnouncementDecodeErrorZPtr { result } + CResult_NodeAnnouncementDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelAnnouncementDecodeErrorZPtr { err } + CResult_NodeAnnouncementDecodeErrorZPtr { err } }; Self { contents, @@ -20107,59 +20954,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelAnnouncementDecodeErrorZ_clone(orig: &CResult_ChannelAnnouncementDecodeErrorZ) -> CResult_ChannelAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedChannelUpdateDecodeErrorZ -pub union CResult_UnsignedChannelUpdateDecodeErrorZPtr { +/// The contents of CResult_QueryShortChannelIdsDecodeErrorZ +pub union CResult_QueryShortChannelIdsDecodeErrorZPtr { /// 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::msgs::UnsignedChannelUpdate, + pub result: *mut crate::lightning::ln::msgs::QueryShortChannelIds, /// 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_UnsignedChannelUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UnsignedChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UnsignedChannelUpdateDecodeErrorZ { - /// The contents of this CResult_UnsignedChannelUpdateDecodeErrorZ, accessible via either +pub struct CResult_QueryShortChannelIdsDecodeErrorZ { + /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr, - /// Whether this CResult_UnsignedChannelUpdateDecodeErrorZ represents a success state. + pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr, + /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedChannelUpdate) -> CResult_UnsignedChannelUpdateDecodeErrorZ { - CResult_UnsignedChannelUpdateDecodeErrorZ { - contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ { + CResult_QueryShortChannelIdsDecodeErrorZ { + contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedChannelUpdateDecodeErrorZ { - CResult_UnsignedChannelUpdateDecodeErrorZ { - contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ { + CResult_QueryShortChannelIdsDecodeErrorZ { + contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20167,13 +21014,13 @@ pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_is_ok(o: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnsignedChannelUpdateDecodeErrorZ. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_free(_res: CResult_UnsignedChannelUpdateDecodeErrorZ) { } -impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { } +impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20186,16 +21033,16 @@ impl Drop for CResult_UnsignedChannelUpdateDecodeErrorZ { } } } -impl From> for CResult_UnsignedChannelUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_QueryShortChannelIdsDecodeErrorZ { + 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_UnsignedChannelUpdateDecodeErrorZPtr { result } + CResult_QueryShortChannelIdsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedChannelUpdateDecodeErrorZPtr { err } + CResult_QueryShortChannelIdsDecodeErrorZPtr { err } }; Self { contents, @@ -20203,59 +21050,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedChannelUpdateDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnsignedChannelUpdateDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnsignedChannelUpdateDecodeErrorZ_clone(orig: &CResult_UnsignedChannelUpdateDecodeErrorZ) -> CResult_UnsignedChannelUpdateDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelUpdateDecodeErrorZ -pub union CResult_ChannelUpdateDecodeErrorZPtr { +/// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ +pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { /// 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::msgs::ChannelUpdate, + pub result: *mut crate::lightning::ln::msgs::ReplyShortChannelIdsEnd, /// 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_ChannelUpdateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ChannelUpdate on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelUpdateDecodeErrorZ { - /// The contents of this CResult_ChannelUpdateDecodeErrorZ, accessible via either +pub struct CResult_ReplyShortChannelIdsEndDecodeErrorZ { + /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelUpdateDecodeErrorZPtr, - /// Whether this CResult_ChannelUpdateDecodeErrorZ represents a success state. + pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr, + /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ChannelUpdate) -> CResult_ChannelUpdateDecodeErrorZ { - CResult_ChannelUpdateDecodeErrorZ { - contents: CResult_ChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { + CResult_ReplyShortChannelIdsEndDecodeErrorZ { + contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelUpdateDecodeErrorZ { - CResult_ChannelUpdateDecodeErrorZ { - contents: CResult_ChannelUpdateDecodeErrorZPtr { +/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { + CResult_ReplyShortChannelIdsEndDecodeErrorZ { + contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20263,13 +21110,13 @@ pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_is_ok(o: &CResult_ChannelUpdateDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelUpdateDecodeErrorZ. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_free(_res: CResult_ChannelUpdateDecodeErrorZ) { } -impl Drop for CResult_ChannelUpdateDecodeErrorZ { +/// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { } +impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20282,16 +21129,16 @@ impl Drop for CResult_ChannelUpdateDecodeErrorZ { } } } -impl From> for CResult_ChannelUpdateDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ReplyShortChannelIdsEndDecodeErrorZ { + 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_ChannelUpdateDecodeErrorZPtr { result } + CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelUpdateDecodeErrorZPtr { err } + CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err } }; Self { contents, @@ -20299,59 +21146,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelUpdateDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelUpdateDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelUpdateDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelUpdateDecodeErrorZ_clone(orig: &CResult_ChannelUpdateDecodeErrorZ) -> CResult_ChannelUpdateDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ErrorMessageDecodeErrorZ -pub union CResult_ErrorMessageDecodeErrorZPtr { +/// The contents of CResult_QueryChannelRangeDecodeErrorZ +pub union CResult_QueryChannelRangeDecodeErrorZPtr { /// 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::msgs::ErrorMessage, + pub result: *mut crate::lightning::ln::msgs::QueryChannelRange, /// 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_ErrorMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ErrorMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ErrorMessageDecodeErrorZ { - /// The contents of this CResult_ErrorMessageDecodeErrorZ, accessible via either +pub struct CResult_QueryChannelRangeDecodeErrorZ { + /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ErrorMessageDecodeErrorZPtr, - /// Whether this CResult_ErrorMessageDecodeErrorZ represents a success state. + pub contents: CResult_QueryChannelRangeDecodeErrorZPtr, + /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ErrorMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ErrorMessage) -> CResult_ErrorMessageDecodeErrorZ { - CResult_ErrorMessageDecodeErrorZ { - contents: CResult_ErrorMessageDecodeErrorZPtr { +/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ { + CResult_QueryChannelRangeDecodeErrorZ { + contents: CResult_QueryChannelRangeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ErrorMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ErrorMessageDecodeErrorZ { - CResult_ErrorMessageDecodeErrorZ { - contents: CResult_ErrorMessageDecodeErrorZPtr { +/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ { + CResult_QueryChannelRangeDecodeErrorZ { + contents: CResult_QueryChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20359,13 +21206,13 @@ pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_err(e: crate::lightning::ln:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_is_ok(o: &CResult_ErrorMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ErrorMessageDecodeErrorZ. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_free(_res: CResult_ErrorMessageDecodeErrorZ) { } -impl Drop for CResult_ErrorMessageDecodeErrorZ { +/// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { } +impl Drop for CResult_QueryChannelRangeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20378,16 +21225,16 @@ impl Drop for CResult_ErrorMessageDecodeErrorZ { } } } -impl From> for CResult_ErrorMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_QueryChannelRangeDecodeErrorZ { + 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_ErrorMessageDecodeErrorZPtr { result } + CResult_QueryChannelRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ErrorMessageDecodeErrorZPtr { err } + CResult_QueryChannelRangeDecodeErrorZPtr { err } }; Self { contents, @@ -20395,59 +21242,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ErrorMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ErrorMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ErrorMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ErrorMessageDecodeErrorZ_clone(orig: &CResult_ErrorMessageDecodeErrorZ) -> CResult_ErrorMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_WarningMessageDecodeErrorZ -pub union CResult_WarningMessageDecodeErrorZPtr { +/// The contents of CResult_ReplyChannelRangeDecodeErrorZ +pub union CResult_ReplyChannelRangeDecodeErrorZPtr { /// 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::msgs::WarningMessage, + pub result: *mut crate::lightning::ln::msgs::ReplyChannelRange, /// 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_WarningMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::WarningMessage on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_WarningMessageDecodeErrorZ { - /// The contents of this CResult_WarningMessageDecodeErrorZ, accessible via either +pub struct CResult_ReplyChannelRangeDecodeErrorZ { + /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_WarningMessageDecodeErrorZPtr, - /// Whether this CResult_WarningMessageDecodeErrorZ represents a success state. + pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr, + /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_WarningMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_ok(o: crate::lightning::ln::msgs::WarningMessage) -> CResult_WarningMessageDecodeErrorZ { - CResult_WarningMessageDecodeErrorZ { - contents: CResult_WarningMessageDecodeErrorZPtr { +/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ { + CResult_ReplyChannelRangeDecodeErrorZ { + contents: CResult_ReplyChannelRangeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_WarningMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_WarningMessageDecodeErrorZ { - CResult_WarningMessageDecodeErrorZ { - contents: CResult_WarningMessageDecodeErrorZPtr { +/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ { + CResult_ReplyChannelRangeDecodeErrorZ { + contents: CResult_ReplyChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20455,13 +21302,13 @@ pub extern "C" fn CResult_WarningMessageDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_is_ok(o: &CResult_WarningMessageDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_WarningMessageDecodeErrorZ. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_free(_res: CResult_WarningMessageDecodeErrorZ) { } -impl Drop for CResult_WarningMessageDecodeErrorZ { +/// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { } +impl Drop for CResult_ReplyChannelRangeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20474,16 +21321,16 @@ impl Drop for CResult_WarningMessageDecodeErrorZ { } } } -impl From> for CResult_WarningMessageDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ReplyChannelRangeDecodeErrorZ { + 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_WarningMessageDecodeErrorZPtr { result } + CResult_ReplyChannelRangeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_WarningMessageDecodeErrorZPtr { err } + CResult_ReplyChannelRangeDecodeErrorZPtr { err } }; Self { contents, @@ -20491,59 +21338,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_WarningMessageDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_WarningMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_WarningMessageDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_WarningMessageDecodeErrorZ_clone(orig: &CResult_WarningMessageDecodeErrorZ) -> CResult_WarningMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UnsignedNodeAnnouncementDecodeErrorZ -pub union CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { +/// The contents of CResult_GossipTimestampFilterDecodeErrorZ +pub union CResult_GossipTimestampFilterDecodeErrorZPtr { /// 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::msgs::UnsignedNodeAnnouncement, + pub result: *mut crate::lightning::ln::msgs::GossipTimestampFilter, /// 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_UnsignedNodeAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::UnsignedNodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UnsignedNodeAnnouncementDecodeErrorZ { - /// The contents of this CResult_UnsignedNodeAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_GossipTimestampFilterDecodeErrorZ { + /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr, - /// Whether this CResult_UnsignedNodeAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr, + /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::UnsignedNodeAnnouncement) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { - CResult_UnsignedNodeAnnouncementDecodeErrorZ { - contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ { + CResult_GossipTimestampFilterDecodeErrorZ { + contents: CResult_GossipTimestampFilterDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { - CResult_UnsignedNodeAnnouncementDecodeErrorZ { - contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ { + CResult_GossipTimestampFilterDecodeErrorZ { + contents: CResult_GossipTimestampFilterDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20551,13 +21398,13 @@ pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_err(e: crate::lig } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnsignedNodeAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_free(_res: CResult_UnsignedNodeAnnouncementDecodeErrorZ) { } -impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { } +impl Drop for CResult_GossipTimestampFilterDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20570,16 +21417,16 @@ impl Drop for CResult_UnsignedNodeAnnouncementDecodeErrorZ { } } } -impl From> for CResult_UnsignedNodeAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_GossipTimestampFilterDecodeErrorZ { + 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_UnsignedNodeAnnouncementDecodeErrorZPtr { result } + CResult_GossipTimestampFilterDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { err } + CResult_GossipTimestampFilterDecodeErrorZPtr { err } }; Self { contents, @@ -20587,59 +21434,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnsignedNodeAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnsignedNodeAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnsignedNodeAnnouncementDecodeErrorZ_clone(orig: &CResult_UnsignedNodeAnnouncementDecodeErrorZ) -> CResult_UnsignedNodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NodeAnnouncementDecodeErrorZ -pub union CResult_NodeAnnouncementDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not +pub enum COption_InboundHTLCStateDetailsZ { + /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails + Some(crate::lightning::ln::channel_state::InboundHTLCStateDetails), + /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing + None +} +impl COption_InboundHTLCStateDetailsZ { + #[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::channel_state::InboundHTLCStateDetails { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails +pub extern "C" fn COption_InboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::InboundHTLCStateDetails) -> COption_InboundHTLCStateDetailsZ { + COption_InboundHTLCStateDetailsZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_InboundHTLCStateDetailsZ containing nothing +pub extern "C" fn COption_InboundHTLCStateDetailsZ_none() -> COption_InboundHTLCStateDetailsZ { + COption_InboundHTLCStateDetailsZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state +pub extern "C" fn COption_InboundHTLCStateDetailsZ_free(_res: COption_InboundHTLCStateDetailsZ) { } +#[no_mangle] +/// Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_InboundHTLCStateDetailsZ_clone(orig: &COption_InboundHTLCStateDetailsZ) -> COption_InboundHTLCStateDetailsZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ +pub union CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { /// 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::msgs::NodeAnnouncement, + pub result: *mut crate::c_types::derived::COption_InboundHTLCStateDetailsZ, /// 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_NodeAnnouncementDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::NodeAnnouncement on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_InboundHTLCStateDetailsZ 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_NodeAnnouncementDecodeErrorZ { - /// The contents of this CResult_NodeAnnouncementDecodeErrorZ, accessible via either +pub struct CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + /// The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NodeAnnouncementDecodeErrorZPtr, - /// Whether this CResult_NodeAnnouncementDecodeErrorZ represents a success state. + pub contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr, + /// Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the success state. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_ok(o: crate::lightning::ln::msgs::NodeAnnouncement) -> CResult_NodeAnnouncementDecodeErrorZ { - CResult_NodeAnnouncementDecodeErrorZ { - contents: CResult_NodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_InboundHTLCStateDetailsZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementDecodeErrorZ in the error state. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeAnnouncementDecodeErrorZ { - CResult_NodeAnnouncementDecodeErrorZ { - contents: CResult_NodeAnnouncementDecodeErrorZPtr { +/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20647,13 +21531,13 @@ pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_err(e: crate::lightning:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_is_ok(o: &CResult_NodeAnnouncementDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NodeAnnouncementDecodeErrorZ. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_free(_res: CResult_NodeAnnouncementDecodeErrorZ) { } -impl Drop for CResult_NodeAnnouncementDecodeErrorZ { +/// Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) { } +impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20666,16 +21550,16 @@ impl Drop for CResult_NodeAnnouncementDecodeErrorZ { } } } -impl From> for CResult_NodeAnnouncementDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { + 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_NodeAnnouncementDecodeErrorZPtr { result } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NodeAnnouncementDecodeErrorZPtr { err } + CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err } }; Self { contents, @@ -20683,59 +21567,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NodeAnnouncementDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NodeAnnouncementDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NodeAnnouncementDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NodeAnnouncementDecodeErrorZ_clone(orig: &CResult_NodeAnnouncementDecodeErrorZ) -> CResult_NodeAnnouncementDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_QueryShortChannelIdsDecodeErrorZ -pub union CResult_QueryShortChannelIdsDecodeErrorZPtr { +/// The contents of CResult_InboundHTLCDetailsDecodeErrorZ +pub union CResult_InboundHTLCDetailsDecodeErrorZPtr { /// 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::msgs::QueryShortChannelIds, + pub result: *mut crate::lightning::ln::channel_state::InboundHTLCDetails, /// 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_QueryShortChannelIdsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::QueryShortChannelIds on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::InboundHTLCDetails 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_QueryShortChannelIdsDecodeErrorZ { - /// The contents of this CResult_QueryShortChannelIdsDecodeErrorZ, accessible via either +pub struct CResult_InboundHTLCDetailsDecodeErrorZ { + /// The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_QueryShortChannelIdsDecodeErrorZPtr, - /// Whether this CResult_QueryShortChannelIdsDecodeErrorZ represents a success state. + pub contents: CResult_InboundHTLCDetailsDecodeErrorZPtr, + /// Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the success state. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryShortChannelIds) -> CResult_QueryShortChannelIdsDecodeErrorZ { - CResult_QueryShortChannelIdsDecodeErrorZ { - contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { +/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::InboundHTLCDetails) -> CResult_InboundHTLCDetailsDecodeErrorZ { + CResult_InboundHTLCDetailsDecodeErrorZ { + contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ in the error state. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryShortChannelIdsDecodeErrorZ { - CResult_QueryShortChannelIdsDecodeErrorZ { - contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { +/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InboundHTLCDetailsDecodeErrorZ { + CResult_InboundHTLCDetailsDecodeErrorZ { + contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20743,13 +21627,13 @@ pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_is_ok(o: &CResult_QueryShortChannelIdsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_InboundHTLCDetailsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_QueryShortChannelIdsDecodeErrorZ. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_free(_res: CResult_QueryShortChannelIdsDecodeErrorZ) { } -impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ { +/// Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_free(_res: CResult_InboundHTLCDetailsDecodeErrorZ) { } +impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20762,16 +21646,16 @@ impl Drop for CResult_QueryShortChannelIdsDecodeErrorZ { } } } -impl From> for CResult_QueryShortChannelIdsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InboundHTLCDetailsDecodeErrorZ { + 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_QueryShortChannelIdsDecodeErrorZPtr { result } + CResult_InboundHTLCDetailsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_QueryShortChannelIdsDecodeErrorZPtr { err } + CResult_InboundHTLCDetailsDecodeErrorZPtr { err } }; Self { contents, @@ -20779,59 +21663,96 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_QueryShortChannelIdsDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +impl Clone for CResult_InboundHTLCDetailsDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_InboundHTLCDetailsDecodeErrorZ) -> CResult_InboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not +pub enum COption_OutboundHTLCStateDetailsZ { + /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails + Some(crate::lightning::ln::channel_state::OutboundHTLCStateDetails), + /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing + None +} +impl COption_OutboundHTLCStateDetailsZ { + #[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::channel_state::OutboundHTLCStateDetails { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_QueryShortChannelIdsDecodeErrorZ which has the same data as `orig` +/// Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::OutboundHTLCStateDetails) -> COption_OutboundHTLCStateDetailsZ { + COption_OutboundHTLCStateDetailsZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_OutboundHTLCStateDetailsZ containing nothing +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_none() -> COption_OutboundHTLCStateDetailsZ { + COption_OutboundHTLCStateDetailsZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_free(_res: COption_OutboundHTLCStateDetailsZ) { } +#[no_mangle] +/// Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_QueryShortChannelIdsDecodeErrorZ_clone(orig: &CResult_QueryShortChannelIdsDecodeErrorZ) -> CResult_QueryShortChannelIdsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn COption_OutboundHTLCStateDetailsZ_clone(orig: &COption_OutboundHTLCStateDetailsZ) -> COption_OutboundHTLCStateDetailsZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ReplyShortChannelIdsEndDecodeErrorZ -pub union CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { +/// The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ +pub union CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { /// 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::msgs::ReplyShortChannelIdsEnd, + pub result: *mut crate::c_types::derived::COption_OutboundHTLCStateDetailsZ, /// 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_ReplyShortChannelIdsEndDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ReplyShortChannelIdsEnd on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_OutboundHTLCStateDetailsZ 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_ReplyShortChannelIdsEndDecodeErrorZ { - /// The contents of this CResult_ReplyShortChannelIdsEndDecodeErrorZ, accessible via either +pub struct CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + /// The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr, - /// Whether this CResult_ReplyShortChannelIdsEndDecodeErrorZ represents a success state. + pub contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr, + /// Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the success state. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { - CResult_ReplyShortChannelIdsEndDecodeErrorZ { - contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { +/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ in the error state. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { - CResult_ReplyShortChannelIdsEndDecodeErrorZ { - contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { +/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20839,13 +21760,13 @@ pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_err(e: crate::ligh } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_is_ok(o: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ReplyShortChannelIdsEndDecodeErrorZ. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_free(_res: CResult_ReplyShortChannelIdsEndDecodeErrorZ) { } -impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ { +/// Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) { } +impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20858,16 +21779,16 @@ impl Drop for CResult_ReplyShortChannelIdsEndDecodeErrorZ { } } } -impl From> for CResult_ReplyShortChannelIdsEndDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { + 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_ReplyShortChannelIdsEndDecodeErrorZPtr { result } + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { err } + CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err } }; Self { contents, @@ -20875,59 +21796,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ReplyShortChannelIdsEndDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ReplyShortChannelIdsEndDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ReplyShortChannelIdsEndDecodeErrorZ_clone(orig: &CResult_ReplyShortChannelIdsEndDecodeErrorZ) -> CResult_ReplyShortChannelIdsEndDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_QueryChannelRangeDecodeErrorZ -pub union CResult_QueryChannelRangeDecodeErrorZPtr { +/// The contents of CResult_OutboundHTLCDetailsDecodeErrorZ +pub union CResult_OutboundHTLCDetailsDecodeErrorZPtr { /// 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::msgs::QueryChannelRange, + pub result: *mut crate::lightning::ln::channel_state::OutboundHTLCDetails, /// 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_QueryChannelRangeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::QueryChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OutboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::OutboundHTLCDetails 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_QueryChannelRangeDecodeErrorZ { - /// The contents of this CResult_QueryChannelRangeDecodeErrorZ, accessible via either +pub struct CResult_OutboundHTLCDetailsDecodeErrorZ { + /// The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_QueryChannelRangeDecodeErrorZPtr, - /// Whether this CResult_QueryChannelRangeDecodeErrorZ represents a success state. + pub contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr, + /// Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the success state. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::QueryChannelRange) -> CResult_QueryChannelRangeDecodeErrorZ { - CResult_QueryChannelRangeDecodeErrorZ { - contents: CResult_QueryChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::OutboundHTLCDetails) -> CResult_OutboundHTLCDetailsDecodeErrorZ { + CResult_OutboundHTLCDetailsDecodeErrorZ { + contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_QueryChannelRangeDecodeErrorZ in the error state. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_QueryChannelRangeDecodeErrorZ { - CResult_QueryChannelRangeDecodeErrorZ { - contents: CResult_QueryChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutboundHTLCDetailsDecodeErrorZ { + CResult_OutboundHTLCDetailsDecodeErrorZ { + contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -20935,13 +21856,13 @@ pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_is_ok(o: &CResult_QueryChannelRangeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_QueryChannelRangeDecodeErrorZ. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_free(_res: CResult_QueryChannelRangeDecodeErrorZ) { } -impl Drop for CResult_QueryChannelRangeDecodeErrorZ { +/// Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res: CResult_OutboundHTLCDetailsDecodeErrorZ) { } +impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -20954,16 +21875,16 @@ impl Drop for CResult_QueryChannelRangeDecodeErrorZ { } } } -impl From> for CResult_QueryChannelRangeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OutboundHTLCDetailsDecodeErrorZ { + 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_QueryChannelRangeDecodeErrorZPtr { result } + CResult_OutboundHTLCDetailsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_QueryChannelRangeDecodeErrorZPtr { err } + CResult_OutboundHTLCDetailsDecodeErrorZPtr { err } }; Self { contents, @@ -20971,59 +21892,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_QueryChannelRangeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_QueryChannelRangeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_QueryChannelRangeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_QueryChannelRangeDecodeErrorZ_clone(orig: &CResult_QueryChannelRangeDecodeErrorZ) -> CResult_QueryChannelRangeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> CResult_OutboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ReplyChannelRangeDecodeErrorZ -pub union CResult_ReplyChannelRangeDecodeErrorZPtr { +/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ +pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr { /// 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::msgs::ReplyChannelRange, + pub result: *mut crate::lightning::ln::channel_state::CounterpartyForwardingInfo, /// 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_ReplyChannelRangeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::ReplyChannelRange on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ReplyChannelRangeDecodeErrorZ { - /// The contents of this CResult_ReplyChannelRangeDecodeErrorZ, accessible via either +pub struct CResult_CounterpartyForwardingInfoDecodeErrorZ { + /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ReplyChannelRangeDecodeErrorZPtr, - /// Whether this CResult_ReplyChannelRangeDecodeErrorZ represents a success state. + pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr, + /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the success state. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_ok(o: crate::lightning::ln::msgs::ReplyChannelRange) -> CResult_ReplyChannelRangeDecodeErrorZ { - CResult_ReplyChannelRangeDecodeErrorZ { - contents: CResult_ReplyChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { + CResult_CounterpartyForwardingInfoDecodeErrorZ { + contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ in the error state. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReplyChannelRangeDecodeErrorZ { - CResult_ReplyChannelRangeDecodeErrorZ { - contents: CResult_ReplyChannelRangeDecodeErrorZPtr { +/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { + CResult_CounterpartyForwardingInfoDecodeErrorZ { + contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21031,13 +21952,13 @@ pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_is_ok(o: &CResult_ReplyChannelRangeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ReplyChannelRangeDecodeErrorZ. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_free(_res: CResult_ReplyChannelRangeDecodeErrorZ) { } -impl Drop for CResult_ReplyChannelRangeDecodeErrorZ { +/// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { } +impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21050,16 +21971,16 @@ impl Drop for CResult_ReplyChannelRangeDecodeErrorZ { } } } -impl From> for CResult_ReplyChannelRangeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CounterpartyForwardingInfoDecodeErrorZ { + 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_ReplyChannelRangeDecodeErrorZPtr { result } + CResult_CounterpartyForwardingInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ReplyChannelRangeDecodeErrorZPtr { err } + CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err } }; Self { contents, @@ -21067,59 +21988,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ReplyChannelRangeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ReplyChannelRangeDecodeErrorZ 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. -pub extern "C" fn CResult_ReplyChannelRangeDecodeErrorZ_clone(orig: &CResult_ReplyChannelRangeDecodeErrorZ) -> CResult_ReplyChannelRangeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_GossipTimestampFilterDecodeErrorZ -pub union CResult_GossipTimestampFilterDecodeErrorZPtr { +/// The contents of CResult_ChannelCounterpartyDecodeErrorZ +pub union CResult_ChannelCounterpartyDecodeErrorZPtr { /// 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::msgs::GossipTimestampFilter, + pub result: *mut crate::lightning::ln::channel_state::ChannelCounterparty, /// 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_GossipTimestampFilterDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::msgs::GossipTimestampFilter on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_GossipTimestampFilterDecodeErrorZ { - /// The contents of this CResult_GossipTimestampFilterDecodeErrorZ, accessible via either +pub struct CResult_ChannelCounterpartyDecodeErrorZ { + /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_GossipTimestampFilterDecodeErrorZPtr, - /// Whether this CResult_GossipTimestampFilterDecodeErrorZ represents a success state. + pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr, + /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the success state. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_ok(o: crate::lightning::ln::msgs::GossipTimestampFilter) -> CResult_GossipTimestampFilterDecodeErrorZ { - CResult_GossipTimestampFilterDecodeErrorZ { - contents: CResult_GossipTimestampFilterDecodeErrorZPtr { +/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ { + CResult_ChannelCounterpartyDecodeErrorZ { + contents: CResult_ChannelCounterpartyDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } -#[no_mangle] -/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ in the error state. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_GossipTimestampFilterDecodeErrorZ { - CResult_GossipTimestampFilterDecodeErrorZ { - contents: CResult_GossipTimestampFilterDecodeErrorZPtr { +#[no_mangle] +/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ { + CResult_ChannelCounterpartyDecodeErrorZ { + contents: CResult_ChannelCounterpartyDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21127,13 +22048,13 @@ pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_is_ok(o: &CResult_GossipTimestampFilterDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_GossipTimestampFilterDecodeErrorZ. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_free(_res: CResult_GossipTimestampFilterDecodeErrorZ) { } -impl Drop for CResult_GossipTimestampFilterDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { } +impl Drop for CResult_ChannelCounterpartyDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21146,16 +22067,16 @@ impl Drop for CResult_GossipTimestampFilterDecodeErrorZ { } } } -impl From> for CResult_GossipTimestampFilterDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelCounterpartyDecodeErrorZ { + 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_GossipTimestampFilterDecodeErrorZPtr { result } + CResult_ChannelCounterpartyDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_GossipTimestampFilterDecodeErrorZPtr { err } + CResult_ChannelCounterpartyDecodeErrorZPtr { err } }; Self { contents, @@ -21163,96 +22084,188 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_GossipTimestampFilterDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_GossipTimestampFilterDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_GossipTimestampFilterDecodeErrorZ_clone(orig: &CResult_GossipTimestampFilterDecodeErrorZ) -> CResult_GossipTimestampFilterDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::channel_state::InboundHTLCStateDetails or not -pub enum COption_InboundHTLCStateDetailsZ { - /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::InboundHTLCStateDetails - Some(crate::lightning::ln::channel_state::InboundHTLCStateDetails), - /// When we're in this state, this COption_InboundHTLCStateDetailsZ contains nothing +/// An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not +pub enum COption_ChannelShutdownStateZ { + /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState + Some(crate::lightning::ln::channel_state::ChannelShutdownState), + /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing None } -impl COption_InboundHTLCStateDetailsZ { +impl COption_ChannelShutdownStateZ { #[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::channel_state::InboundHTLCStateDetails { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::ln::channel_state::ChannelShutdownState { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_InboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::InboundHTLCStateDetails -pub extern "C" fn COption_InboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::InboundHTLCStateDetails) -> COption_InboundHTLCStateDetailsZ { - COption_InboundHTLCStateDetailsZ::Some(o) +/// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState +pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> COption_ChannelShutdownStateZ { + COption_ChannelShutdownStateZ::Some(o) } #[no_mangle] -/// Constructs a new COption_InboundHTLCStateDetailsZ containing nothing -pub extern "C" fn COption_InboundHTLCStateDetailsZ_none() -> COption_InboundHTLCStateDetailsZ { - COption_InboundHTLCStateDetailsZ::None +/// Constructs a new COption_ChannelShutdownStateZ containing nothing +pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ { + COption_ChannelShutdownStateZ::None } #[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::channel_state::InboundHTLCStateDetails, if we are in the Some state -pub extern "C" fn COption_InboundHTLCStateDetailsZ_free(_res: COption_InboundHTLCStateDetailsZ) { } +/// Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state +pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { } #[no_mangle] -/// Creates a new COption_InboundHTLCStateDetailsZ which has the same data as `orig` +/// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_InboundHTLCStateDetailsZ_clone(orig: &COption_InboundHTLCStateDetailsZ) -> COption_InboundHTLCStateDetailsZ { Clone::clone(&orig) } +pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ -pub union CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { +/// A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_InboundHTLCDetailsZ { + /// 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::channel_state::InboundHTLCDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_InboundHTLCDetailsZ { + #[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::channel_state::InboundHTLCDetails] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_InboundHTLCDetailsZ { + 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_InboundHTLCDetailsZ_free(_res: CVec_InboundHTLCDetailsZ) { } +impl Drop for CVec_InboundHTLCDetailsZ { + 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_InboundHTLCDetailsZ { + 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::ln::channel_state::OutboundHTLCDetailss of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_OutboundHTLCDetailsZ { + /// 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::channel_state::OutboundHTLCDetails, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_OutboundHTLCDetailsZ { + #[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::channel_state::OutboundHTLCDetails] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_OutboundHTLCDetailsZ { + 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_OutboundHTLCDetailsZ_free(_res: CVec_OutboundHTLCDetailsZ) { } +impl Drop for CVec_OutboundHTLCDetailsZ { + 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_OutboundHTLCDetailsZ { + 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_ChannelDetailsDecodeErrorZ +pub union CResult_ChannelDetailsDecodeErrorZPtr { /// 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_InboundHTLCStateDetailsZ, + pub result: *mut crate::lightning::ln::channel_state::ChannelDetails, /// 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_COption_InboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_InboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - /// The contents of this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ, accessible via either +pub struct CResult_ChannelDetailsDecodeErrorZ { + /// The contents of this CResult_ChannelDetailsDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr, - /// Whether this CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ represents a success state. + pub contents: CResult_ChannelDetailsDecodeErrorZPtr, + /// Whether this CResult_ChannelDetailsDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_InboundHTLCStateDetailsZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ { + CResult_ChannelDetailsDecodeErrorZ { + contents: CResult_ChannelDetailsDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_ChannelDetailsDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ { + CResult_ChannelDetailsDecodeErrorZ { + contents: CResult_ChannelDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21260,13 +22273,13 @@ pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_err(e: cr } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) { } -impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelDetailsDecodeErrorZ. +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { } +impl Drop for CResult_ChannelDetailsDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21279,16 +22292,16 @@ impl Drop for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { } } } -impl From> for CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelDetailsDecodeErrorZ { + 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_InboundHTLCStateDetailsZDecodeErrorZPtr { result } + CResult_ChannelDetailsDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { err } + CResult_ChannelDetailsDecodeErrorZPtr { err } }; Self { contents, @@ -21296,59 +22309,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_InboundHTLCStateDetailsZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelDetailsDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ 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. -pub extern "C" fn CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_InboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_InboundHTLCDetailsDecodeErrorZ -pub union CResult_InboundHTLCDetailsDecodeErrorZPtr { +/// The contents of CResult_ChannelShutdownStateDecodeErrorZ +pub union CResult_ChannelShutdownStateDecodeErrorZPtr { /// 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::channel_state::InboundHTLCDetails, + pub result: *mut crate::lightning::ln::channel_state::ChannelShutdownState, /// 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_InboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::InboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::channel_state::ChannelShutdownState 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_InboundHTLCDetailsDecodeErrorZ { - /// The contents of this CResult_InboundHTLCDetailsDecodeErrorZ, accessible via either +pub struct CResult_ChannelShutdownStateDecodeErrorZ { + /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_InboundHTLCDetailsDecodeErrorZPtr, - /// Whether this CResult_InboundHTLCDetailsDecodeErrorZ represents a success state. + pub contents: CResult_ChannelShutdownStateDecodeErrorZPtr, + /// Whether this CResult_ChannelShutdownStateDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the success state. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::InboundHTLCDetails) -> CResult_InboundHTLCDetailsDecodeErrorZ { - CResult_InboundHTLCDetailsDecodeErrorZ { - contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ { + CResult_ChannelShutdownStateDecodeErrorZ { + contents: CResult_ChannelShutdownStateDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ in the error state. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InboundHTLCDetailsDecodeErrorZ { - CResult_InboundHTLCDetailsDecodeErrorZ { - contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ { + CResult_ChannelShutdownStateDecodeErrorZ { + contents: CResult_ChannelShutdownStateDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21356,13 +22369,13 @@ pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_InboundHTLCDetailsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_InboundHTLCDetailsDecodeErrorZ. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_free(_res: CResult_InboundHTLCDetailsDecodeErrorZ) { } -impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelShutdownStateDecodeErrorZ. +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { } +impl Drop for CResult_ChannelShutdownStateDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21375,16 +22388,16 @@ impl Drop for CResult_InboundHTLCDetailsDecodeErrorZ { } } } -impl From> for CResult_InboundHTLCDetailsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelShutdownStateDecodeErrorZ { + 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_InboundHTLCDetailsDecodeErrorZPtr { result } + CResult_ChannelShutdownStateDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_InboundHTLCDetailsDecodeErrorZPtr { err } + CResult_ChannelShutdownStateDecodeErrorZPtr { err } }; Self { contents, @@ -21392,96 +22405,97 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_InboundHTLCDetailsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelShutdownStateDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_InboundHTLCDetailsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_InboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_InboundHTLCDetailsDecodeErrorZ) -> CResult_InboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::channel_state::OutboundHTLCStateDetails or not -pub enum COption_OutboundHTLCStateDetailsZ { - /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains a crate::lightning::ln::channel_state::OutboundHTLCStateDetails - Some(crate::lightning::ln::channel_state::OutboundHTLCStateDetails), - /// When we're in this state, this COption_OutboundHTLCStateDetailsZ contains nothing - None +/// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_FutureZ { + /// 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::wakers::Future, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_OutboundHTLCStateDetailsZ { - #[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() +impl CVec_FutureZ { + #[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 take(mut self) -> crate::lightning::ln::channel_state::OutboundHTLCStateDetails { - if let Self::Some(v) = self { v } else { unreachable!() } + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::util::wakers::Future] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -#[no_mangle] -/// Constructs a new COption_OutboundHTLCStateDetailsZ containing a crate::lightning::ln::channel_state::OutboundHTLCStateDetails -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_some(o: crate::lightning::ln::channel_state::OutboundHTLCStateDetails) -> COption_OutboundHTLCStateDetailsZ { - COption_OutboundHTLCStateDetailsZ::Some(o) +impl From> for CVec_FutureZ { + 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_OutboundHTLCStateDetailsZ containing nothing -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_none() -> COption_OutboundHTLCStateDetailsZ { - COption_OutboundHTLCStateDetailsZ::None +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_FutureZ_free(_res: CVec_FutureZ) { } +impl Drop for CVec_FutureZ { + 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] -/// Frees any resources associated with the crate::lightning::ln::channel_state::OutboundHTLCStateDetails, if we are in the Some state -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_free(_res: COption_OutboundHTLCStateDetailsZ) { } -#[no_mangle] -/// Creates a new COption_OutboundHTLCStateDetailsZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_OutboundHTLCStateDetailsZ_clone(orig: &COption_OutboundHTLCStateDetailsZ) -> COption_OutboundHTLCStateDetailsZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ -pub union CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { +/// The contents of CResult_HeldHtlcAvailableDecodeErrorZ +pub union CResult_HeldHtlcAvailableDecodeErrorZPtr { /// 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_OutboundHTLCStateDetailsZ, + pub result: *mut crate::lightning::onion_message::async_payments::HeldHtlcAvailable, /// 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_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_OutboundHTLCStateDetailsZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_HeldHtlcAvailableDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::HeldHtlcAvailable 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_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - /// The contents of this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ, accessible via either +pub struct CResult_HeldHtlcAvailableDecodeErrorZ { + /// The contents of this CResult_HeldHtlcAvailableDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr, - /// Whether this CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ represents a success state. + pub contents: CResult_HeldHtlcAvailableDecodeErrorZPtr, + /// Whether this CResult_HeldHtlcAvailableDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_ok(o: crate::c_types::derived::COption_OutboundHTLCStateDetailsZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the success state. +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::HeldHtlcAvailable) -> CResult_HeldHtlcAvailableDecodeErrorZ { + CResult_HeldHtlcAvailableDecodeErrorZ { + contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { +/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ in the error state. +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HeldHtlcAvailableDecodeErrorZ { + CResult_HeldHtlcAvailableDecodeErrorZ { + contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21489,13 +22503,13 @@ pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_err(e: c } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_is_ok(o: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_is_ok(o: &CResult_HeldHtlcAvailableDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_free(_res: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) { } -impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { +/// Frees any resources used by the CResult_HeldHtlcAvailableDecodeErrorZ. +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_free(_res: CResult_HeldHtlcAvailableDecodeErrorZ) { } +impl Drop for CResult_HeldHtlcAvailableDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21508,16 +22522,16 @@ impl Drop for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { } } } -impl From> for CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_HeldHtlcAvailableDecodeErrorZ { + 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_OutboundHTLCStateDetailsZDecodeErrorZPtr { result } + CResult_HeldHtlcAvailableDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { err } + CResult_HeldHtlcAvailableDecodeErrorZPtr { err } }; Self { contents, @@ -21525,59 +22539,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ_clone(orig: &CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ) -> CResult_COption_OutboundHTLCStateDetailsZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_clone(orig: &CResult_HeldHtlcAvailableDecodeErrorZ) -> CResult_HeldHtlcAvailableDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OutboundHTLCDetailsDecodeErrorZ -pub union CResult_OutboundHTLCDetailsDecodeErrorZPtr { +/// The contents of CResult_ReleaseHeldHtlcDecodeErrorZ +pub union CResult_ReleaseHeldHtlcDecodeErrorZPtr { /// 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::channel_state::OutboundHTLCDetails, + pub result: *mut crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, /// 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_OutboundHTLCDetailsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::OutboundHTLCDetails on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ReleaseHeldHtlcDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::ReleaseHeldHtlc 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_OutboundHTLCDetailsDecodeErrorZ { - /// The contents of this CResult_OutboundHTLCDetailsDecodeErrorZ, accessible via either +pub struct CResult_ReleaseHeldHtlcDecodeErrorZ { + /// The contents of this CResult_ReleaseHeldHtlcDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr, - /// Whether this CResult_OutboundHTLCDetailsDecodeErrorZ represents a success state. + pub contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr, + /// Whether this CResult_ReleaseHeldHtlcDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the success state. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::OutboundHTLCDetails) -> CResult_OutboundHTLCDetailsDecodeErrorZ { - CResult_OutboundHTLCDetailsDecodeErrorZ { - contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the success state. +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc) -> CResult_ReleaseHeldHtlcDecodeErrorZ { + CResult_ReleaseHeldHtlcDecodeErrorZ { + contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ in the error state. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutboundHTLCDetailsDecodeErrorZ { - CResult_OutboundHTLCDetailsDecodeErrorZ { - contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { +/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ in the error state. +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReleaseHeldHtlcDecodeErrorZ { + CResult_ReleaseHeldHtlcDecodeErrorZ { + contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21585,13 +22599,13 @@ pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_is_ok(o: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_is_ok(o: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OutboundHTLCDetailsDecodeErrorZ. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_free(_res: CResult_OutboundHTLCDetailsDecodeErrorZ) { } -impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ { +/// Frees any resources used by the CResult_ReleaseHeldHtlcDecodeErrorZ. +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_free(_res: CResult_ReleaseHeldHtlcDecodeErrorZ) { } +impl Drop for CResult_ReleaseHeldHtlcDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21604,16 +22618,16 @@ impl Drop for CResult_OutboundHTLCDetailsDecodeErrorZ { } } } -impl From> for CResult_OutboundHTLCDetailsDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ReleaseHeldHtlcDecodeErrorZ { + 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_OutboundHTLCDetailsDecodeErrorZPtr { result } + CResult_ReleaseHeldHtlcDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OutboundHTLCDetailsDecodeErrorZPtr { err } + CResult_ReleaseHeldHtlcDecodeErrorZPtr { err } }; Self { contents, @@ -21621,59 +22635,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OutboundHTLCDetailsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OutboundHTLCDetailsDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OutboundHTLCDetailsDecodeErrorZ_clone(orig: &CResult_OutboundHTLCDetailsDecodeErrorZ) -> CResult_OutboundHTLCDetailsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_clone(orig: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> CResult_ReleaseHeldHtlcDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CounterpartyForwardingInfoDecodeErrorZ -pub union CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// The contents of CResult_AsyncPaymentsMessageDecodeErrorZ +pub union CResult_AsyncPaymentsMessageDecodeErrorZPtr { /// 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::channel_state::CounterpartyForwardingInfo, + pub result: *mut crate::lightning::onion_message::async_payments::AsyncPaymentsMessage, /// 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_CounterpartyForwardingInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::CounterpartyForwardingInfo on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_AsyncPaymentsMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::async_payments::AsyncPaymentsMessage 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_CounterpartyForwardingInfoDecodeErrorZ { - /// The contents of this CResult_CounterpartyForwardingInfoDecodeErrorZ, accessible via either +pub struct CResult_AsyncPaymentsMessageDecodeErrorZ { + /// The contents of this CResult_AsyncPaymentsMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr, - /// Whether this CResult_CounterpartyForwardingInfoDecodeErrorZ represents a success state. + pub contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr, + /// Whether this CResult_AsyncPaymentsMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::CounterpartyForwardingInfo) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { - CResult_CounterpartyForwardingInfoDecodeErrorZ { - contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage) -> CResult_AsyncPaymentsMessageDecodeErrorZ { + CResult_AsyncPaymentsMessageDecodeErrorZ { + contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { - CResult_CounterpartyForwardingInfoDecodeErrorZ { - contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { +/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AsyncPaymentsMessageDecodeErrorZ { + CResult_AsyncPaymentsMessageDecodeErrorZ { + contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21681,13 +22695,13 @@ pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_err(e: crate::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_is_ok(o: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> bool { +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_is_ok(o: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CounterpartyForwardingInfoDecodeErrorZ. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_free(_res: CResult_CounterpartyForwardingInfoDecodeErrorZ) { } -impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ { +/// Frees any resources used by the CResult_AsyncPaymentsMessageDecodeErrorZ. +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_free(_res: CResult_AsyncPaymentsMessageDecodeErrorZ) { } +impl Drop for CResult_AsyncPaymentsMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21700,16 +22714,16 @@ impl Drop for CResult_CounterpartyForwardingInfoDecodeErrorZ { } } } -impl From> for CResult_CounterpartyForwardingInfoDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_AsyncPaymentsMessageDecodeErrorZ { + 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_CounterpartyForwardingInfoDecodeErrorZPtr { result } + CResult_AsyncPaymentsMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyForwardingInfoDecodeErrorZPtr { err } + CResult_AsyncPaymentsMessageDecodeErrorZPtr { err } }; Self { contents, @@ -21717,59 +22731,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CounterpartyForwardingInfoDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CounterpartyForwardingInfoDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CounterpartyForwardingInfoDecodeErrorZ_clone(orig: &CResult_CounterpartyForwardingInfoDecodeErrorZ) -> CResult_CounterpartyForwardingInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_clone(orig: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> CResult_AsyncPaymentsMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelCounterpartyDecodeErrorZ -pub union CResult_ChannelCounterpartyDecodeErrorZPtr { +/// The contents of CResult_OffersMessageDecodeErrorZ +pub union CResult_OffersMessageDecodeErrorZPtr { /// 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::channel_state::ChannelCounterparty, + pub result: *mut crate::lightning::onion_message::offers::OffersMessage, /// 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_ChannelCounterpartyDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::ChannelCounterparty on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_OffersMessageDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::offers::OffersMessage 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_ChannelCounterpartyDecodeErrorZ { - /// The contents of this CResult_ChannelCounterpartyDecodeErrorZ, accessible via either +pub struct CResult_OffersMessageDecodeErrorZ { + /// The contents of this CResult_OffersMessageDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelCounterpartyDecodeErrorZPtr, - /// Whether this CResult_ChannelCounterpartyDecodeErrorZ represents a success state. + pub contents: CResult_OffersMessageDecodeErrorZPtr, + /// Whether this CResult_OffersMessageDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelCounterparty) -> CResult_ChannelCounterpartyDecodeErrorZ { - CResult_ChannelCounterpartyDecodeErrorZ { - contents: CResult_ChannelCounterpartyDecodeErrorZPtr { +/// Creates a new CResult_OffersMessageDecodeErrorZ in the success state. +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ { + CResult_OffersMessageDecodeErrorZ { + contents: CResult_OffersMessageDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelCounterpartyDecodeErrorZ { - CResult_ChannelCounterpartyDecodeErrorZ { - contents: CResult_ChannelCounterpartyDecodeErrorZPtr { +/// Creates a new CResult_OffersMessageDecodeErrorZ in the error state. +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ { + CResult_OffersMessageDecodeErrorZ { + contents: CResult_OffersMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -21777,13 +22791,13 @@ pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_err(e: crate::lightnin } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_is_ok(o: &CResult_ChannelCounterpartyDecodeErrorZ) -> bool { +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelCounterpartyDecodeErrorZ. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_free(_res: CResult_ChannelCounterpartyDecodeErrorZ) { } -impl Drop for CResult_ChannelCounterpartyDecodeErrorZ { +/// Frees any resources used by the CResult_OffersMessageDecodeErrorZ. +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { } +impl Drop for CResult_OffersMessageDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -21796,16 +22810,16 @@ impl Drop for CResult_ChannelCounterpartyDecodeErrorZ { } } } -impl From> for CResult_ChannelCounterpartyDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OffersMessageDecodeErrorZ { + 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_ChannelCounterpartyDecodeErrorZPtr { result } + CResult_OffersMessageDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelCounterpartyDecodeErrorZPtr { err } + CResult_OffersMessageDecodeErrorZPtr { err } }; Self { contents, @@ -21813,188 +22827,187 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelCounterpartyDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_OffersMessageDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelCounterpartyDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_OffersMessageDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelCounterpartyDecodeErrorZ_clone(orig: &CResult_ChannelCounterpartyDecodeErrorZ) -> CResult_ChannelCounterpartyDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::ln::channel_state::ChannelShutdownState or not -pub enum COption_ChannelShutdownStateZ { - /// When we're in this state, this COption_ChannelShutdownStateZ contains a crate::lightning::ln::channel_state::ChannelShutdownState - Some(crate::lightning::ln::channel_state::ChannelShutdownState), - /// When we're in this state, this COption_ChannelShutdownStateZ contains nothing +/// 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 } -impl COption_ChannelShutdownStateZ { +impl COption_HTLCClaimZ { #[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::channel_state::ChannelShutdownState { + #[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] -/// Constructs a new COption_ChannelShutdownStateZ containing a crate::lightning::ln::channel_state::ChannelShutdownState -pub extern "C" fn COption_ChannelShutdownStateZ_some(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> COption_ChannelShutdownStateZ { - COption_ChannelShutdownStateZ::Some(o) +/// 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) } #[no_mangle] -/// Constructs a new COption_ChannelShutdownStateZ containing nothing -pub extern "C" fn COption_ChannelShutdownStateZ_none() -> COption_ChannelShutdownStateZ { - COption_ChannelShutdownStateZ::None +/// Constructs a new COption_HTLCClaimZ containing nothing +pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ { + COption_HTLCClaimZ::None } #[no_mangle] -/// Frees any resources associated with the crate::lightning::ln::channel_state::ChannelShutdownState, if we are in the Some state -pub extern "C" fn COption_ChannelShutdownStateZ_free(_res: COption_ChannelShutdownStateZ) { } -#[no_mangle] -/// Creates a new COption_ChannelShutdownStateZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_ChannelShutdownStateZ_clone(orig: &COption_ChannelShutdownStateZ) -> COption_ChannelShutdownStateZ { Clone::clone(&orig) } +/// 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)] -/// A dynamically-allocated array of crate::lightning::ln::channel_state::InboundHTLCDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_InboundHTLCDetailsZ { - /// 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::channel_state::InboundHTLCDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_InboundHTLCDetailsZ { - #[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::channel_state::InboundHTLCDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } +/// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ +pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + /// 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::CounterpartyCommitmentSecrets, + /// 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, } -impl From> for CVec_InboundHTLCDetailsZ { - 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() } } - } +#[repr(C)] +/// 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`. +pub struct CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr, + /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ represents a success state. + pub result_ok: bool, } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_InboundHTLCDetailsZ_free(_res: CVec_InboundHTLCDetailsZ) { } -impl Drop for CVec_InboundHTLCDetailsZ { - 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_InboundHTLCDetailsZ { - 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) +/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::ln::channel_state::OutboundHTLCDetailss of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_OutboundHTLCDetailsZ { - /// 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::channel_state::OutboundHTLCDetails, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_OutboundHTLCDetailsZ { - #[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::channel_state::OutboundHTLCDetails] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[no_mangle] +/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + err: Box::into_raw(Box::new(e)), + }, + result_ok: false, } } -impl From> for CVec_OutboundHTLCDetailsZ { - 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() } } - } +/// Checks if the given object is currently in the success state +#[no_mangle] +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> bool { + o.result_ok } #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_OutboundHTLCDetailsZ_free(_res: CVec_OutboundHTLCDetailsZ) { } -impl Drop for CVec_OutboundHTLCDetailsZ { +/// Frees any resources used by the CResult_CounterpartyCommitmentSecretsDecodeErrorZ. +pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { } +impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = 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_OutboundHTLCDetailsZ { - 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_CounterpartyCommitmentSecretsDecodeErrorZ { + 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_CounterpartyCommitmentSecretsDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ which has the same data as `orig` +/// 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_ChannelDetailsDecodeErrorZ -pub union CResult_ChannelDetailsDecodeErrorZPtr { +/// 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::lightning::ln::channel_state::ChannelDetails, + 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::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_ChannelDetailsDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::ChannelDetails on success and a crate::lightning::ln::msgs::DecodeError 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_ChannelDetailsDecodeErrorZ { - /// The contents of this CResult_ChannelDetailsDecodeErrorZ, 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_ChannelDetailsDecodeErrorZPtr, - /// Whether this CResult_ChannelDetailsDecodeErrorZ 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_ChannelDetailsDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelDetails) -> CResult_ChannelDetailsDecodeErrorZ { - CResult_ChannelDetailsDecodeErrorZ { - contents: CResult_ChannelDetailsDecodeErrorZPtr { +/// 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_ChannelDetailsDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelDetailsDecodeErrorZ { - CResult_ChannelDetailsDecodeErrorZ { - contents: CResult_ChannelDetailsDecodeErrorZPtr { +/// 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, @@ -22002,13 +23015,13 @@ pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_is_ok(o: &CResult_ChannelDetailsDecodeErrorZ) -> 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_ChannelDetailsDecodeErrorZ. -pub extern "C" fn CResult_ChannelDetailsDecodeErrorZ_free(_res: CResult_ChannelDetailsDecodeErrorZ) { } -impl Drop for CResult_ChannelDetailsDecodeErrorZ { +/// 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() } { @@ -22021,16 +23034,16 @@ impl Drop for CResult_ChannelDetailsDecodeErrorZ { } } } -impl From> for CResult_ChannelDetailsDecodeErrorZ { - 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_ChannelDetailsDecodeErrorZPtr { result } + CResult_TxCreationKeysDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelDetailsDecodeErrorZPtr { err } + CResult_TxCreationKeysDecodeErrorZPtr { err } }; Self { contents, @@ -22038,59 +23051,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelDetailsDecodeErrorZPtr { - 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_ChannelDetailsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelDetailsDecodeErrorZ 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_ChannelDetailsDecodeErrorZ_clone(orig: &CResult_ChannelDetailsDecodeErrorZ) -> CResult_ChannelDetailsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_clone(orig: &CResult_TxCreationKeysDecodeErrorZ) -> CResult_TxCreationKeysDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelShutdownStateDecodeErrorZ -pub union CResult_ChannelShutdownStateDecodeErrorZPtr { +/// 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::lightning::ln::channel_state::ChannelShutdownState, + 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::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_ChannelShutdownStateDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::channel_state::ChannelShutdownState 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`. -pub struct CResult_ChannelShutdownStateDecodeErrorZ { - /// The contents of this CResult_ChannelShutdownStateDecodeErrorZ, 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_ChannelShutdownStateDecodeErrorZPtr, - /// Whether this CResult_ChannelShutdownStateDecodeErrorZ 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_ChannelShutdownStateDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_ok(o: crate::lightning::ln::channel_state::ChannelShutdownState) -> CResult_ChannelShutdownStateDecodeErrorZ { - CResult_ChannelShutdownStateDecodeErrorZ { - contents: CResult_ChannelShutdownStateDecodeErrorZPtr { +/// 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_ChannelShutdownStateDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelShutdownStateDecodeErrorZ { - CResult_ChannelShutdownStateDecodeErrorZ { - contents: CResult_ChannelShutdownStateDecodeErrorZPtr { +/// 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, @@ -22098,13 +23111,13 @@ pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_is_ok(o: &CResult_ChannelShutdownStateDecodeErrorZ) -> 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_ChannelShutdownStateDecodeErrorZ. -pub extern "C" fn CResult_ChannelShutdownStateDecodeErrorZ_free(_res: CResult_ChannelShutdownStateDecodeErrorZ) { } -impl Drop for CResult_ChannelShutdownStateDecodeErrorZ { +/// 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() } { @@ -22117,16 +23130,16 @@ impl Drop for CResult_ChannelShutdownStateDecodeErrorZ { } } } -impl From> for CResult_ChannelShutdownStateDecodeErrorZ { - 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_ChannelShutdownStateDecodeErrorZPtr { result } + CResult_ChannelPublicKeysDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelShutdownStateDecodeErrorZPtr { err } + CResult_ChannelPublicKeysDecodeErrorZPtr { err } }; Self { contents, @@ -22134,97 +23147,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelShutdownStateDecodeErrorZPtr { - 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_ChannelShutdownStateDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelPublicKeysDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelShutdownStateDecodeErrorZ 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_ChannelShutdownStateDecodeErrorZ_clone(orig: &CResult_ChannelShutdownStateDecodeErrorZ) -> CResult_ChannelShutdownStateDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A dynamically-allocated array of crate::lightning::util::wakers::Futures of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_FutureZ { - /// 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::wakers::Future, - /// The number of elements pointed to by `data`. - pub datalen: usize -} -impl CVec_FutureZ { - #[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::wakers::Future] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } - } -} -impl From> for CVec_FutureZ { - 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_FutureZ_free(_res: CVec_FutureZ) { } -impl Drop for CVec_FutureZ { - fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = unsafe { Box::from_raw(core::slice::from_raw_parts_mut(self.data, self.datalen)) }; - } -} +pub extern "C" fn CResult_ChannelPublicKeysDecodeErrorZ_clone(orig: &CResult_ChannelPublicKeysDecodeErrorZ) -> CResult_ChannelPublicKeysDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HeldHtlcAvailableDecodeErrorZ -pub union CResult_HeldHtlcAvailableDecodeErrorZPtr { +/// 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::onion_message::async_payments::HeldHtlcAvailable, + 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_HeldHtlcAvailableDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::async_payments::HeldHtlcAvailable 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_HeldHtlcAvailableDecodeErrorZ { - /// The contents of this CResult_HeldHtlcAvailableDecodeErrorZ, 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_HeldHtlcAvailableDecodeErrorZPtr, - /// Whether this CResult_HeldHtlcAvailableDecodeErrorZ 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_HeldHtlcAvailableDecodeErrorZ in the success state. -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::HeldHtlcAvailable) -> CResult_HeldHtlcAvailableDecodeErrorZ { - CResult_HeldHtlcAvailableDecodeErrorZ { - contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { +/// 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_HeldHtlcAvailableDecodeErrorZ in the error state. -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HeldHtlcAvailableDecodeErrorZ { - CResult_HeldHtlcAvailableDecodeErrorZ { - contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { +/// 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, @@ -22232,13 +23207,13 @@ pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_err(e: crate::lightning: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_is_ok(o: &CResult_HeldHtlcAvailableDecodeErrorZ) -> 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_HeldHtlcAvailableDecodeErrorZ. -pub extern "C" fn CResult_HeldHtlcAvailableDecodeErrorZ_free(_res: CResult_HeldHtlcAvailableDecodeErrorZ) { } -impl Drop for CResult_HeldHtlcAvailableDecodeErrorZ { +/// 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() } { @@ -22251,16 +23226,16 @@ impl Drop for CResult_HeldHtlcAvailableDecodeErrorZ { } } } -impl From> for CResult_HeldHtlcAvailableDecodeErrorZ { - 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_HeldHtlcAvailableDecodeErrorZPtr { result } + CResult_HTLCOutputInCommitmentDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HeldHtlcAvailableDecodeErrorZPtr { err } + CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err } }; Self { contents, @@ -22268,59 +23243,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HeldHtlcAvailableDecodeErrorZPtr { - 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_HeldHtlcAvailableDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HeldHtlcAvailableDecodeErrorZ 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_HeldHtlcAvailableDecodeErrorZ_clone(orig: &CResult_HeldHtlcAvailableDecodeErrorZ) -> CResult_HeldHtlcAvailableDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_clone(orig: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> CResult_HTLCOutputInCommitmentDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ReleaseHeldHtlcDecodeErrorZ -pub union CResult_ReleaseHeldHtlcDecodeErrorZPtr { +/// 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::onion_message::async_payments::ReleaseHeldHtlc, + 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_ReleaseHeldHtlcDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::async_payments::ReleaseHeldHtlc 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_ReleaseHeldHtlcDecodeErrorZ { - /// The contents of this CResult_ReleaseHeldHtlcDecodeErrorZ, 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_ReleaseHeldHtlcDecodeErrorZPtr, - /// Whether this CResult_ReleaseHeldHtlcDecodeErrorZ 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_ReleaseHeldHtlcDecodeErrorZ in the success state. -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc) -> CResult_ReleaseHeldHtlcDecodeErrorZ { - CResult_ReleaseHeldHtlcDecodeErrorZ { - contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { +/// 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_ReleaseHeldHtlcDecodeErrorZ in the error state. -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ReleaseHeldHtlcDecodeErrorZ { - CResult_ReleaseHeldHtlcDecodeErrorZ { - contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { +/// 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, @@ -22328,13 +23303,13 @@ pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_is_ok(o: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> 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_ReleaseHeldHtlcDecodeErrorZ. -pub extern "C" fn CResult_ReleaseHeldHtlcDecodeErrorZ_free(_res: CResult_ReleaseHeldHtlcDecodeErrorZ) { } -impl Drop for CResult_ReleaseHeldHtlcDecodeErrorZ { +/// 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() } { @@ -22347,16 +23322,16 @@ impl Drop for CResult_ReleaseHeldHtlcDecodeErrorZ { } } } -impl From> for CResult_ReleaseHeldHtlcDecodeErrorZ { - 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_ReleaseHeldHtlcDecodeErrorZPtr { result } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ReleaseHeldHtlcDecodeErrorZPtr { err } + CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err } }; Self { contents, @@ -22364,59 +23339,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ReleaseHeldHtlcDecodeErrorZPtr { - 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_ReleaseHeldHtlcDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ReleaseHeldHtlcDecodeErrorZ 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_ReleaseHeldHtlcDecodeErrorZ_clone(orig: &CResult_ReleaseHeldHtlcDecodeErrorZ) -> CResult_ReleaseHeldHtlcDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_CounterpartyChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> CResult_CounterpartyChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_AsyncPaymentsMessageDecodeErrorZ -pub union CResult_AsyncPaymentsMessageDecodeErrorZPtr { +/// 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::onion_message::async_payments::AsyncPaymentsMessage, + 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, } #[repr(C)] -/// A CResult_AsyncPaymentsMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::async_payments::AsyncPaymentsMessage on success and a crate::lightning::ln::msgs::DecodeError 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_AsyncPaymentsMessageDecodeErrorZ { - /// The contents of this CResult_AsyncPaymentsMessageDecodeErrorZ, 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_AsyncPaymentsMessageDecodeErrorZPtr, - /// Whether this CResult_AsyncPaymentsMessageDecodeErrorZ 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_AsyncPaymentsMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::async_payments::AsyncPaymentsMessage) -> CResult_AsyncPaymentsMessageDecodeErrorZ { - CResult_AsyncPaymentsMessageDecodeErrorZ { - contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { +/// 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_AsyncPaymentsMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AsyncPaymentsMessageDecodeErrorZ { - CResult_AsyncPaymentsMessageDecodeErrorZ { - contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { +/// 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, @@ -22424,13 +23399,13 @@ pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_is_ok(o: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> 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_AsyncPaymentsMessageDecodeErrorZ. -pub extern "C" fn CResult_AsyncPaymentsMessageDecodeErrorZ_free(_res: CResult_AsyncPaymentsMessageDecodeErrorZ) { } -impl Drop for CResult_AsyncPaymentsMessageDecodeErrorZ { +/// 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() } { @@ -22443,16 +23418,16 @@ impl Drop for CResult_AsyncPaymentsMessageDecodeErrorZ { } } } -impl From> for CResult_AsyncPaymentsMessageDecodeErrorZ { - 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_AsyncPaymentsMessageDecodeErrorZPtr { result } + CResult_ChannelTransactionParametersDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_AsyncPaymentsMessageDecodeErrorZPtr { err } + CResult_ChannelTransactionParametersDecodeErrorZPtr { err } }; Self { contents, @@ -22460,59 +23435,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_AsyncPaymentsMessageDecodeErrorZPtr { - 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_AsyncPaymentsMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelTransactionParametersDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_AsyncPaymentsMessageDecodeErrorZ 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_AsyncPaymentsMessageDecodeErrorZ_clone(orig: &CResult_AsyncPaymentsMessageDecodeErrorZ) -> CResult_AsyncPaymentsMessageDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OffersMessageDecodeErrorZ -pub union CResult_OffersMessageDecodeErrorZPtr { +/// 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::onion_message::offers::OffersMessage, + 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_OffersMessageDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::onion_message::offers::OffersMessage 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_OffersMessageDecodeErrorZ { - /// The contents of this CResult_OffersMessageDecodeErrorZ, 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_OffersMessageDecodeErrorZPtr, - /// Whether this CResult_OffersMessageDecodeErrorZ 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_OffersMessageDecodeErrorZ in the success state. -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_ok(o: crate::lightning::onion_message::offers::OffersMessage) -> CResult_OffersMessageDecodeErrorZ { - CResult_OffersMessageDecodeErrorZ { - contents: CResult_OffersMessageDecodeErrorZPtr { +/// 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_OffersMessageDecodeErrorZ in the error state. -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OffersMessageDecodeErrorZ { - CResult_OffersMessageDecodeErrorZ { - contents: CResult_OffersMessageDecodeErrorZPtr { +/// 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, @@ -22520,13 +23495,13 @@ pub extern "C" fn CResult_OffersMessageDecodeErrorZ_err(e: crate::lightning::ln: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_is_ok(o: &CResult_OffersMessageDecodeErrorZ) -> 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_OffersMessageDecodeErrorZ. -pub extern "C" fn CResult_OffersMessageDecodeErrorZ_free(_res: CResult_OffersMessageDecodeErrorZ) { } -impl Drop for CResult_OffersMessageDecodeErrorZ { +/// 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() } { @@ -22539,16 +23514,16 @@ impl Drop for CResult_OffersMessageDecodeErrorZ { } } } -impl From> for CResult_OffersMessageDecodeErrorZ { - 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_OffersMessageDecodeErrorZPtr { result } + CResult_HolderCommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OffersMessageDecodeErrorZPtr { err } + CResult_HolderCommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -22556,91 +23531,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OffersMessageDecodeErrorZPtr { - 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_OffersMessageDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OffersMessageDecodeErrorZ 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_OffersMessageDecodeErrorZ_clone(orig: &CResult_OffersMessageDecodeErrorZ) -> CResult_OffersMessageDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// 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 -} -impl COption_HTLCClaimZ { - #[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::chan_utils::HTLCClaim { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// 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) -} -#[no_mangle] -/// Constructs a new COption_HTLCClaimZ containing nothing -pub extern "C" fn COption_HTLCClaimZ_none() -> COption_HTLCClaimZ { - COption_HTLCClaimZ::None -} -#[no_mangle] -/// 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) { } +pub extern "C" fn CResult_HolderCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_HolderCommitmentTransactionDecodeErrorZ) -> CResult_HolderCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CounterpartyCommitmentSecretsDecodeErrorZ -pub union CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { +/// 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::CounterpartyCommitmentSecrets, + 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_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_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_CounterpartyCommitmentSecretsDecodeErrorZ { - /// The contents of this CResult_CounterpartyCommitmentSecretsDecodeErrorZ, 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_CounterpartyCommitmentSecretsDecodeErrorZPtr, - /// Whether this CResult_CounterpartyCommitmentSecretsDecodeErrorZ 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_CounterpartyCommitmentSecretsDecodeErrorZ in the success state. -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_ok(o: crate::lightning::ln::chan_utils::CounterpartyCommitmentSecrets) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { +/// 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_CounterpartyCommitmentSecretsDecodeErrorZ in the error state. -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { +/// 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, @@ -22648,13 +23591,13 @@ pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_err(e: crate } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_is_ok(o: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> 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_CounterpartyCommitmentSecretsDecodeErrorZ. -pub extern "C" fn CResult_CounterpartyCommitmentSecretsDecodeErrorZ_free(_res: CResult_CounterpartyCommitmentSecretsDecodeErrorZ) { } -impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { +/// 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() } { @@ -22667,16 +23610,16 @@ impl Drop for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { } } } -impl From> for CResult_CounterpartyCommitmentSecretsDecodeErrorZ { - 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_CounterpartyCommitmentSecretsDecodeErrorZPtr { result } + CResult_BuiltCommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { err } + CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -22684,95 +23627,91 @@ impl From Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_CounterpartyCommitmentSecretsDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_CounterpartyCommitmentSecretsDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CounterpartyCommitmentSecretsDecodeErrorZ 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_CounterpartyCommitmentSecretsDecodeErrorZ_clone(orig: &CResult_CounterpartyCommitmentSecretsDecodeErrorZ) -> CResult_CounterpartyCommitmentSecretsDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_clone(orig: &CResult_BuiltCommitmentTransactionDecodeErrorZ) -> CResult_BuiltCommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TxCreationKeysDecodeErrorZ -pub union CResult_TxCreationKeysDecodeErrorZPtr { +/// 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::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::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_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_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_TxCreationKeysDecodeErrorZ { - /// The contents of this CResult_TxCreationKeysDecodeErrorZ, 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_TxCreationKeysDecodeErrorZPtr, - /// Whether this CResult_TxCreationKeysDecodeErrorZ 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_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_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_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)), +/// 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_TxCreationKeysDecodeErrorZ_is_ok(o: &CResult_TxCreationKeysDecodeErrorZ) -> 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_TxCreationKeysDecodeErrorZ. -pub extern "C" fn CResult_TxCreationKeysDecodeErrorZ_free(_res: CResult_TxCreationKeysDecodeErrorZ) { } -impl Drop for CResult_TxCreationKeysDecodeErrorZ { +/// 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_TxCreationKeysDecodeErrorZ { - 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_TxCreationKeysDecodeErrorZPtr { result } + CResult_TrustedClosingTransactionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TxCreationKeysDecodeErrorZPtr { 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, @@ -22780,59 +23719,42 @@ 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 }))) - } } - } else { - Self { result_ok: false, contents: CResult_TxCreationKeysDecodeErrorZPtr { - 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` -/// 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) } #[repr(C)] -/// The contents of CResult_ChannelPublicKeysDecodeErrorZ -pub union CResult_ChannelPublicKeysDecodeErrorZPtr { +/// 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::ChannelPublicKeys, + 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_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_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_ChannelPublicKeysDecodeErrorZ { - /// The contents of this CResult_ChannelPublicKeysDecodeErrorZ, 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_ChannelPublicKeysDecodeErrorZPtr, - /// Whether this CResult_ChannelPublicKeysDecodeErrorZ 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_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_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_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_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, @@ -22840,13 +23762,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_CommitmentTransactionDecodeErrorZ_is_ok(o: &CResult_CommitmentTransactionDecodeErrorZ) -> 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_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() } { @@ -22859,16 +23781,16 @@ impl Drop for CResult_ChannelPublicKeysDecodeErrorZ { } } } -impl From> for CResult_ChannelPublicKeysDecodeErrorZ { - 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_ChannelPublicKeysDecodeErrorZPtr { result } + CResult_CommitmentTransactionDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelPublicKeysDecodeErrorZPtr { err } + CResult_CommitmentTransactionDecodeErrorZPtr { err } }; Self { contents, @@ -22876,95 +23798,91 @@ 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_CommitmentTransactionDecodeErrorZPtr { + 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_CommitmentTransactionDecodeErrorZPtr { 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_CommitmentTransactionDecodeErrorZ 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_CommitmentTransactionDecodeErrorZ_clone(orig: &CResult_CommitmentTransactionDecodeErrorZ) -> CResult_CommitmentTransactionDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HTLCOutputInCommitmentDecodeErrorZ -pub union CResult_HTLCOutputInCommitmentDecodeErrorZPtr { +/// 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::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, + 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_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_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_HTLCOutputInCommitmentDecodeErrorZ { - /// The contents of this CResult_HTLCOutputInCommitmentDecodeErrorZ, 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_HTLCOutputInCommitmentDecodeErrorZPtr, - /// Whether this CResult_HTLCOutputInCommitmentDecodeErrorZ 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_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_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_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)), +/// 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_HTLCOutputInCommitmentDecodeErrorZ_is_ok(o: &CResult_HTLCOutputInCommitmentDecodeErrorZ) -> 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_HTLCOutputInCommitmentDecodeErrorZ. -pub extern "C" fn CResult_HTLCOutputInCommitmentDecodeErrorZ_free(_res: CResult_HTLCOutputInCommitmentDecodeErrorZ) { } -impl Drop for CResult_HTLCOutputInCommitmentDecodeErrorZ { +/// 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_HTLCOutputInCommitmentDecodeErrorZ { - 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_HTLCOutputInCommitmentDecodeErrorZPtr { result } + CResult_TrustedCommitmentTransactionNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HTLCOutputInCommitmentDecodeErrorZPtr { 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, @@ -22972,95 +23890,74 @@ 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 }))) - } } - } else { - Self { result_ok: false, contents: CResult_HTLCOutputInCommitmentDecodeErrorZPtr { - 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` -/// 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)] -/// The contents of CResult_CounterpartyChannelTransactionParametersDecodeErrorZ -pub union CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { +/// The contents of CResult_CVec_ECDSASignatureZNoneZ +pub union CResult_CVec_ECDSASignatureZNoneZPtr { /// 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, - /// 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::c_types::derived::CVec_ECDSASignatureZ, + /// 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_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_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () 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_CVec_ECDSASignatureZNoneZ { + /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, 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_CVec_ECDSASignatureZNoneZPtr, + /// Whether this CResult_CVec_ECDSASignatureZNoneZ 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_CVec_ECDSASignatureZNoneZ in the success state. +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ { + CResult_CVec_ECDSASignatureZNoneZ { + contents: CResult_CVec_ECDSASignatureZNoneZPtr { 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 { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ { + CResult_CVec_ECDSASignatureZNoneZ { + contents: CResult_CVec_ECDSASignatureZNoneZPtr { + 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_CounterpartyChannelTransactionParametersDecodeErrorZ_is_ok(o: &CResult_CounterpartyChannelTransactionParametersDecodeErrorZ) -> bool { +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> 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_CVec_ECDSASignatureZNoneZ. +pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { } +impl Drop for CResult_CVec_ECDSASignatureZNoneZ { 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_CounterpartyChannelTransactionParametersDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_CVec_ECDSASignatureZNoneZ { + 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_CVec_ECDSASignatureZNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -23068,59 +23965,96 @@ 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_CVec_ECDSASignatureZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CounterpartyChannelTransactionParametersDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_CounterpartyChannelTransactionParametersDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_CVec_ECDSASignatureZNoneZ 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_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelTransactionParametersDecodeErrorZ -pub union CResult_ChannelTransactionParametersDecodeErrorZPtr { +#[derive(Clone)] +/// An enum which can either contain a usize or not +pub enum COption_usizeZ { + /// When we're in this state, this COption_usizeZ contains a usize + Some(usize), + /// When we're in this state, this COption_usizeZ contains nothing + None +} +impl COption_usizeZ { + #[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) -> usize { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_usizeZ containing a usize +pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ { + COption_usizeZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_usizeZ containing nothing +pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ { + COption_usizeZ::None +} +#[no_mangle] +/// Frees any resources associated with the usize, if we are in the Some state +pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { } +#[no_mangle] +/// Creates a new COption_usizeZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) } +#[repr(C)] +/// 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::ChannelTransactionParameters, + 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_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_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_ChannelTransactionParametersDecodeErrorZ { - /// The contents of this CResult_ChannelTransactionParametersDecodeErrorZ, 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_ChannelTransactionParametersDecodeErrorZPtr, - /// Whether this CResult_ChannelTransactionParametersDecodeErrorZ 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_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_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_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 { +/// 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, @@ -23128,13 +24062,13 @@ pub extern "C" fn CResult_ChannelTransactionParametersDecodeErrorZ_err(e: crate: } /// 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_ShutdownScriptDecodeErrorZ_is_ok(o: &CResult_ShutdownScriptDecodeErrorZ) -> 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_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() } { @@ -23147,16 +24081,16 @@ impl Drop for CResult_ChannelTransactionParametersDecodeErrorZ { } } } -impl From> for CResult_ChannelTransactionParametersDecodeErrorZ { - 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_ChannelTransactionParametersDecodeErrorZPtr { result } + CResult_ShutdownScriptDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelTransactionParametersDecodeErrorZPtr { err } + CResult_ShutdownScriptDecodeErrorZPtr { err } }; Self { contents, @@ -23164,59 +24098,59 @@ 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 }))) + 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_ChannelTransactionParametersDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ShutdownScriptDecodeErrorZPtr { 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` +/// 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_ChannelTransactionParametersDecodeErrorZ_clone(orig: &CResult_ChannelTransactionParametersDecodeErrorZ) -> CResult_ChannelTransactionParametersDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ShutdownScriptDecodeErrorZ_clone(orig: &CResult_ShutdownScriptDecodeErrorZ) -> CResult_ShutdownScriptDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HolderCommitmentTransactionDecodeErrorZ -pub union CResult_HolderCommitmentTransactionDecodeErrorZPtr { +/// 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::HolderCommitmentTransaction, + 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, + pub err: *mut crate::lightning::ln::script::InvalidShutdownScript, } #[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_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_HolderCommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_HolderCommitmentTransactionDecodeErrorZ, 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_HolderCommitmentTransactionDecodeErrorZPtr, - /// Whether this CResult_HolderCommitmentTransactionDecodeErrorZ 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_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_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_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_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, @@ -23224,13 +24158,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_ShutdownScriptInvalidShutdownScriptZ_is_ok(o: &CResult_ShutdownScriptInvalidShutdownScriptZ) -> 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_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() } { @@ -23243,16 +24177,16 @@ impl Drop for CResult_HolderCommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_HolderCommitmentTransactionDecodeErrorZ { - 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_HolderCommitmentTransactionDecodeErrorZPtr { result } + CResult_ShutdownScriptInvalidShutdownScriptZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HolderCommitmentTransactionDecodeErrorZPtr { err } + CResult_ShutdownScriptInvalidShutdownScriptZPtr { err } }; Self { contents, @@ -23260,59 +24194,105 @@ 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_ShutdownScriptInvalidShutdownScriptZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_HolderCommitmentTransactionDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_ShutdownScriptInvalidShutdownScriptZPtr { + 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` -/// 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) } +#[no_mangle] +/// 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::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)] -/// The contents of CResult_BuiltCommitmentTransactionDecodeErrorZ -pub union CResult_BuiltCommitmentTransactionDecodeErrorZPtr { +/// The contents of CResult_FundingInfoDecodeErrorZ +pub union CResult_FundingInfoDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::events::FundingInfo, /// 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_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_FundingInfoDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::FundingInfo 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_BuiltCommitmentTransactionDecodeErrorZ { - /// The contents of this CResult_BuiltCommitmentTransactionDecodeErrorZ, accessible via either +pub struct CResult_FundingInfoDecodeErrorZ { + /// The contents of this CResult_FundingInfoDecodeErrorZ, 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_FundingInfoDecodeErrorZPtr, + /// Whether this CResult_FundingInfoDecodeErrorZ 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_FundingInfoDecodeErrorZ in the success state. +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_ok(o: crate::lightning::events::FundingInfo) -> CResult_FundingInfoDecodeErrorZ { + CResult_FundingInfoDecodeErrorZ { + contents: CResult_FundingInfoDecodeErrorZPtr { 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 { +/// Creates a new CResult_FundingInfoDecodeErrorZ in the error state. +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingInfoDecodeErrorZ { + CResult_FundingInfoDecodeErrorZ { + contents: CResult_FundingInfoDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23320,13 +24300,13 @@ pub extern "C" fn CResult_BuiltCommitmentTransactionDecodeErrorZ_err(e: crate::l } /// 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_FundingInfoDecodeErrorZ_is_ok(o: &CResult_FundingInfoDecodeErrorZ) -> 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_FundingInfoDecodeErrorZ. +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_free(_res: CResult_FundingInfoDecodeErrorZ) { } +impl Drop for CResult_FundingInfoDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23339,16 +24319,16 @@ impl Drop for CResult_BuiltCommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_BuiltCommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_FundingInfoDecodeErrorZ { + 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_FundingInfoDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BuiltCommitmentTransactionDecodeErrorZPtr { err } + CResult_FundingInfoDecodeErrorZPtr { err } }; Self { contents, @@ -23356,91 +24336,95 @@ 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 }))) + Self { result_ok: true, contents: CResult_FundingInfoDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BuiltCommitmentTransactionDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_FundingInfoDecodeErrorZPtr { 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` +/// Creates a new CResult_FundingInfoDecodeErrorZ 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) } +pub extern "C" fn CResult_FundingInfoDecodeErrorZ_clone(orig: &CResult_FundingInfoDecodeErrorZ) -> CResult_FundingInfoDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TrustedClosingTransactionNoneZ -pub union CResult_TrustedClosingTransactionNoneZPtr { +/// The contents of CResult_PaymentPurposeDecodeErrorZ +pub union CResult_PaymentPurposeDecodeErrorZPtr { /// 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, - /// 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::events::PaymentPurpose, + /// 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_TrustedClosingTransactionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TrustedClosingTransaction on success and a () on failure. +/// A CResult_PaymentPurposeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TrustedClosingTransactionNoneZ { - /// The contents of this CResult_TrustedClosingTransactionNoneZ, accessible via either +pub struct CResult_PaymentPurposeDecodeErrorZ { + /// The contents of this CResult_PaymentPurposeDecodeErrorZ, 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_PaymentPurposeDecodeErrorZPtr, + /// Whether this CResult_PaymentPurposeDecodeErrorZ 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_PaymentPurposeDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ { + CResult_PaymentPurposeDecodeErrorZ { + contents: CResult_PaymentPurposeDecodeErrorZPtr { 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 { - err: core::ptr::null_mut(), +/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ { + CResult_PaymentPurposeDecodeErrorZ { + contents: CResult_PaymentPurposeDecodeErrorZPtr { + 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_TrustedClosingTransactionNoneZ_is_ok(o: &CResult_TrustedClosingTransactionNoneZ) -> bool { +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> 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_PaymentPurposeDecodeErrorZ. +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { } +impl Drop for CResult_PaymentPurposeDecodeErrorZ { 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_TrustedClosingTransactionNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaymentPurposeDecodeErrorZ { + 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_PaymentPurposeDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_TrustedClosingTransactionNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_PaymentPurposeDecodeErrorZPtr { err } }; Self { contents, @@ -23448,42 +24432,59 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CommitmentTransactionDecodeErrorZ -pub union CResult_CommitmentTransactionDecodeErrorZPtr { +/// The contents of CResult_ClaimedHTLCDecodeErrorZ +pub union CResult_ClaimedHTLCDecodeErrorZPtr { /// 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::events::ClaimedHTLC, /// 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_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::events::ClaimedHTLC 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_ClaimedHTLCDecodeErrorZ { + /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, 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_ClaimedHTLCDecodeErrorZPtr, + /// Whether this CResult_ClaimedHTLCDecodeErrorZ 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_ClaimedHTLCDecodeErrorZ in the success state. +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ { + CResult_ClaimedHTLCDecodeErrorZ { + contents: CResult_ClaimedHTLCDecodeErrorZPtr { 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_ClaimedHTLCDecodeErrorZ in the error state. +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ { + CResult_ClaimedHTLCDecodeErrorZ { + contents: CResult_ClaimedHTLCDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23491,13 +24492,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_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> 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_ClaimedHTLCDecodeErrorZ. +pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { } +impl Drop for CResult_ClaimedHTLCDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23510,16 +24511,16 @@ impl Drop for CResult_CommitmentTransactionDecodeErrorZ { } } } -impl From> for CResult_CommitmentTransactionDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ClaimedHTLCDecodeErrorZ { + 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_ClaimedHTLCDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_CommitmentTransactionDecodeErrorZPtr { err } + CResult_ClaimedHTLCDecodeErrorZPtr { err } }; Self { contents, @@ -23527,91 +24528,132 @@ 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_ClaimedHTLCDecodeErrorZPtr { + 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_ClaimedHTLCDecodeErrorZPtr { 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_ClaimedHTLCDecodeErrorZ 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_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::PathFailure or not +pub enum COption_PathFailureZ { + /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure + Some(crate::lightning::events::PathFailure), + /// When we're in this state, this COption_PathFailureZ contains nothing + None +} +impl COption_PathFailureZ { + #[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::events::PathFailure { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_PathFailureZ containing a crate::lightning::events::PathFailure +pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ { + COption_PathFailureZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_PathFailureZ containing nothing +pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ { + COption_PathFailureZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::PathFailure, if we are in the Some state +pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { } +#[no_mangle] +/// Creates a new COption_PathFailureZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TrustedCommitmentTransactionNoneZ -pub union CResult_TrustedCommitmentTransactionNoneZPtr { +/// The contents of CResult_COption_PathFailureZDecodeErrorZ +pub union CResult_COption_PathFailureZDecodeErrorZPtr { /// 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::c_types::derived::COption_PathFailureZ, + /// 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_TrustedCommitmentTransactionNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::chan_utils::TrustedCommitmentTransaction on success and a () on failure. +/// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TrustedCommitmentTransactionNoneZ { - /// The contents of this CResult_TrustedCommitmentTransactionNoneZ, accessible via either +pub struct CResult_COption_PathFailureZDecodeErrorZ { + /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, 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_COption_PathFailureZDecodeErrorZPtr, + /// Whether this CResult_COption_PathFailureZDecodeErrorZ 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_COption_PathFailureZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ { + CResult_COption_PathFailureZDecodeErrorZ { + contents: CResult_COption_PathFailureZDecodeErrorZPtr { 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_COption_PathFailureZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ { + CResult_COption_PathFailureZDecodeErrorZ { + contents: CResult_COption_PathFailureZDecodeErrorZPtr { + 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_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> 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_COption_PathFailureZDecodeErrorZ. +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { } +impl Drop for CResult_COption_PathFailureZDecodeErrorZ { 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_COption_PathFailureZDecodeErrorZ { + 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_COption_PathFailureZDecodeErrorZPtr { 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_COption_PathFailureZDecodeErrorZPtr { err } }; Self { contents, @@ -23619,74 +24661,132 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_CVec_ECDSASignatureZNoneZ -pub union CResult_CVec_ECDSASignatureZNoneZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::ClosureReason or not +pub enum COption_ClosureReasonZ { + /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason + Some(crate::lightning::events::ClosureReason), + /// When we're in this state, this COption_ClosureReasonZ contains nothing + None +} +impl COption_ClosureReasonZ { + #[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::events::ClosureReason { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason +pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ { + COption_ClosureReasonZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_ClosureReasonZ containing nothing +pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ { + COption_ClosureReasonZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state +pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { } +#[no_mangle] +/// Creates a new COption_ClosureReasonZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_ClosureReasonZDecodeErrorZ +pub union CResult_COption_ClosureReasonZDecodeErrorZPtr { /// 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_ECDSASignatureZ, - /// 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::c_types::derived::COption_ClosureReasonZ, + /// 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_CVec_ECDSASignatureZNoneZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::CVec_ECDSASignatureZ on success and a () on failure. +/// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_CVec_ECDSASignatureZNoneZ { - /// The contents of this CResult_CVec_ECDSASignatureZNoneZ, accessible via either +pub struct CResult_COption_ClosureReasonZDecodeErrorZ { + /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_CVec_ECDSASignatureZNoneZPtr, - /// Whether this CResult_CVec_ECDSASignatureZNoneZ represents a success state. + pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr, + /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the success state. -pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_ok(o: crate::c_types::derived::CVec_ECDSASignatureZ) -> CResult_CVec_ECDSASignatureZNoneZ { - CResult_CVec_ECDSASignatureZNoneZ { - contents: CResult_CVec_ECDSASignatureZNoneZPtr { +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { + CResult_COption_ClosureReasonZDecodeErrorZ { + contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_CVec_ECDSASignatureZNoneZ in the error state. -pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_err() -> CResult_CVec_ECDSASignatureZNoneZ { - CResult_CVec_ECDSASignatureZNoneZ { - contents: CResult_CVec_ECDSASignatureZNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ { + CResult_COption_ClosureReasonZDecodeErrorZ { + contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + 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_CVec_ECDSASignatureZNoneZ_is_ok(o: &CResult_CVec_ECDSASignatureZNoneZ) -> bool { +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_CVec_ECDSASignatureZNoneZ. -pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_free(_res: CResult_CVec_ECDSASignatureZNoneZ) { } -impl Drop for CResult_CVec_ECDSASignatureZNoneZ { +/// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { } +impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ { 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_CVec_ECDSASignatureZNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_ClosureReasonZDecodeErrorZ { + 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_ECDSASignatureZNoneZPtr { result } + CResult_COption_ClosureReasonZDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_CVec_ECDSASignatureZNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_COption_ClosureReasonZDecodeErrorZPtr { err } }; Self { contents, @@ -23694,96 +24794,96 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_CVec_ECDSASignatureZNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_CVec_ECDSASignatureZNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_CVec_ECDSASignatureZNoneZ which has the same data as `orig` +/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_CVec_ECDSASignatureZNoneZ_clone(orig: &CResult_CVec_ECDSASignatureZNoneZ) -> CResult_CVec_ECDSASignatureZNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] -/// An enum which can either contain a usize or not -pub enum COption_usizeZ { - /// When we're in this state, this COption_usizeZ contains a usize - Some(usize), - /// When we're in this state, this COption_usizeZ contains nothing +/// An enum which can either contain a crate::lightning::events::HTLCDestination or not +pub enum COption_HTLCDestinationZ { + /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination + Some(crate::lightning::events::HTLCDestination), + /// When we're in this state, this COption_HTLCDestinationZ contains nothing None } -impl COption_usizeZ { +impl COption_HTLCDestinationZ { #[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) -> usize { + #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::HTLCDestination { if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Constructs a new COption_usizeZ containing a usize -pub extern "C" fn COption_usizeZ_some(o: usize) -> COption_usizeZ { - COption_usizeZ::Some(o) +/// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination +pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ { + COption_HTLCDestinationZ::Some(o) } #[no_mangle] -/// Constructs a new COption_usizeZ containing nothing -pub extern "C" fn COption_usizeZ_none() -> COption_usizeZ { - COption_usizeZ::None +/// Constructs a new COption_HTLCDestinationZ containing nothing +pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ { + COption_HTLCDestinationZ::None } #[no_mangle] -/// Frees any resources associated with the usize, if we are in the Some state -pub extern "C" fn COption_usizeZ_free(_res: COption_usizeZ) { } +/// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state +pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { } #[no_mangle] -/// Creates a new COption_usizeZ which has the same data as `orig` +/// Creates a new COption_HTLCDestinationZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_usizeZ_clone(orig: &COption_usizeZ) -> COption_usizeZ { Clone::clone(&orig) } +pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownScriptDecodeErrorZ -pub union CResult_ShutdownScriptDecodeErrorZPtr { +/// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ +pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr { /// 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::c_types::derived::COption_HTLCDestinationZ, /// 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_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ShutdownScriptDecodeErrorZ { - /// The contents of this CResult_ShutdownScriptDecodeErrorZ, accessible via either +pub struct CResult_COption_HTLCDestinationZDecodeErrorZ { + /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, 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_COption_HTLCDestinationZDecodeErrorZPtr, + /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ 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_COption_HTLCDestinationZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { + CResult_COption_HTLCDestinationZDecodeErrorZ { + contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { 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_COption_HTLCDestinationZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ { + CResult_COption_HTLCDestinationZDecodeErrorZ { + contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23791,13 +24891,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_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> 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_COption_HTLCDestinationZDecodeErrorZ. +pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { } +impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23810,16 +24910,16 @@ impl Drop for CResult_ShutdownScriptDecodeErrorZ { } } } -impl From> for CResult_ShutdownScriptDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_HTLCDestinationZDecodeErrorZ { + 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_COption_HTLCDestinationZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownScriptDecodeErrorZPtr { err } + CResult_COption_HTLCDestinationZDecodeErrorZPtr { err } }; Self { contents, @@ -23827,59 +24927,96 @@ 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_COption_HTLCDestinationZDecodeErrorZPtr { + 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_COption_HTLCDestinationZDecodeErrorZPtr { 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_COption_HTLCDestinationZDecodeErrorZ 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_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ShutdownScriptInvalidShutdownScriptZ -pub union CResult_ShutdownScriptInvalidShutdownScriptZPtr { +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not +pub enum COption_PaymentFailureReasonZ { + /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason + Some(crate::lightning::events::PaymentFailureReason), + /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing + None +} +impl COption_PaymentFailureReasonZ { + #[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::events::PaymentFailureReason { + if let Self::Some(v) = self { v } else { unreachable!() } + } +} +#[no_mangle] +/// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason +pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ { + COption_PaymentFailureReasonZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_PaymentFailureReasonZ containing nothing +pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ { + COption_PaymentFailureReasonZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state +pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { } +#[no_mangle] +/// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_COption_PaymentFailureReasonZDecodeErrorZ +pub union CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { /// 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::c_types::derived::COption_PaymentFailureReasonZ, /// 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_COption_PaymentFailureReasonZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_PaymentFailureReasonZ 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_COption_PaymentFailureReasonZDecodeErrorZ { + /// The contents of this CResult_COption_PaymentFailureReasonZDecodeErrorZ, 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_COption_PaymentFailureReasonZDecodeErrorZPtr, + /// Whether this CResult_COption_PaymentFailureReasonZDecodeErrorZ 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_COption_PaymentFailureReasonZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PaymentFailureReasonZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { + CResult_COption_PaymentFailureReasonZDecodeErrorZ { + contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { 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_COption_PaymentFailureReasonZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { + CResult_COption_PaymentFailureReasonZDecodeErrorZ { + contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -23887,13 +25024,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_COption_PaymentFailureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> 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_COption_PaymentFailureReasonZDecodeErrorZ. +pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(_res: CResult_COption_PaymentFailureReasonZDecodeErrorZ) { } +impl Drop for CResult_COption_PaymentFailureReasonZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -23906,16 +25043,16 @@ impl Drop for CResult_ShutdownScriptInvalidShutdownScriptZ { } } } -impl From> for CResult_ShutdownScriptInvalidShutdownScriptZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_PaymentFailureReasonZDecodeErrorZ { + 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_COption_PaymentFailureReasonZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ShutdownScriptInvalidShutdownScriptZPtr { err } + CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { err } }; Self { contents, @@ -23923,201 +25060,179 @@ 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_COption_PaymentFailureReasonZDecodeErrorZPtr { + 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_COption_PaymentFailureReasonZDecodeErrorZPtr { + 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_COption_PaymentFailureReasonZDecodeErrorZ 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_COption_PaymentFailureReasonZDecodeErrorZ_clone(orig: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::c_types::Transactions of arbitrary size. +#[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)] +/// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs of arbitrary size. /// This corresponds to std::vector in C++ -pub struct CVec_TransactionZ { +pub struct CVec_ClaimedHTLCZ { /// 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, + pub data: *mut crate::lightning::events::ClaimedHTLC, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_TransactionZ { - #[allow(unused)] pub(crate) fn into_rust(&mut self) -> Vec { +impl CVec_ClaimedHTLCZ { + #[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] { + #[allow(unused)] pub(crate) fn as_slice(&self) -> &[crate::lightning::events::ClaimedHTLC] { unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } } -impl From> for CVec_TransactionZ { - fn from(v: Vec) -> Self { +impl From> for CVec_ClaimedHTLCZ { + 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)] -/// The contents of CResult_FundingInfoDecodeErrorZ -pub union CResult_FundingInfoDecodeErrorZPtr { - /// 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::events::FundingInfo, - /// 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_FundingInfoDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::events::FundingInfo 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_FundingInfoDecodeErrorZ { - /// The contents of this CResult_FundingInfoDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_FundingInfoDecodeErrorZPtr, - /// Whether this CResult_FundingInfoDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_FundingInfoDecodeErrorZ in the success state. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_ok(o: crate::lightning::events::FundingInfo) -> CResult_FundingInfoDecodeErrorZ { - CResult_FundingInfoDecodeErrorZ { - contents: CResult_FundingInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_FundingInfoDecodeErrorZ in the error state. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_FundingInfoDecodeErrorZ { - CResult_FundingInfoDecodeErrorZ { - contents: CResult_FundingInfoDecodeErrorZPtr { - 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_FundingInfoDecodeErrorZ_is_ok(o: &CResult_FundingInfoDecodeErrorZ) -> bool { - o.result_ok + } } #[no_mangle] -/// Frees any resources used by the CResult_FundingInfoDecodeErrorZ. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_free(_res: CResult_FundingInfoDecodeErrorZ) { } -impl Drop for CResult_FundingInfoDecodeErrorZ { +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { } +impl Drop for CVec_ClaimedHTLCZ { 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_FundingInfoDecodeErrorZ { - 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_FundingInfoDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_FundingInfoDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } +impl Clone for CVec_ClaimedHTLCZ { + 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 Clone for CResult_FundingInfoDecodeErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_FundingInfoDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_FundingInfoDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } +#[repr(C)] +#[derive(Clone)] +/// An enum which can either contain a crate::lightning::events::Event or not +pub enum COption_EventZ { + /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event + Some(crate::lightning::events::Event), + /// When we're in this state, this COption_EventZ contains nothing + None +} +impl COption_EventZ { + #[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::events::Event { + if let Self::Some(v) = self { v } else { unreachable!() } } } #[no_mangle] -/// Creates a new CResult_FundingInfoDecodeErrorZ which has the same data as `orig` +/// Constructs a new COption_EventZ containing a crate::lightning::events::Event +pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ { + COption_EventZ::Some(o) +} +#[no_mangle] +/// Constructs a new COption_EventZ containing nothing +pub extern "C" fn COption_EventZ_none() -> COption_EventZ { + COption_EventZ::None +} +#[no_mangle] +/// Frees any resources associated with the crate::lightning::events::Event, if we are in the Some state +pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { } +#[no_mangle] +/// Creates a new COption_EventZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_FundingInfoDecodeErrorZ_clone(orig: &CResult_FundingInfoDecodeErrorZ) -> CResult_FundingInfoDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PaymentPurposeDecodeErrorZ -pub union CResult_PaymentPurposeDecodeErrorZPtr { +/// The contents of CResult_COption_EventZDecodeErrorZ +pub union CResult_COption_EventZDecodeErrorZPtr { /// 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::events::PaymentPurpose, + pub result: *mut crate::c_types::derived::COption_EventZ, /// 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_PaymentPurposeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::events::PaymentPurpose on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_COption_EventZDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PaymentPurposeDecodeErrorZ { - /// The contents of this CResult_PaymentPurposeDecodeErrorZ, accessible via either +pub struct CResult_COption_EventZDecodeErrorZ { + /// The contents of this CResult_COption_EventZDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentPurposeDecodeErrorZPtr, - /// Whether this CResult_PaymentPurposeDecodeErrorZ represents a success state. + pub contents: CResult_COption_EventZDecodeErrorZPtr, + /// Whether this CResult_COption_EventZDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the success state. -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_ok(o: crate::lightning::events::PaymentPurpose) -> CResult_PaymentPurposeDecodeErrorZ { - CResult_PaymentPurposeDecodeErrorZ { - contents: CResult_PaymentPurposeDecodeErrorZPtr { +/// Creates a new CResult_COption_EventZDecodeErrorZ in the success state. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ { + CResult_COption_EventZDecodeErrorZ { + contents: CResult_COption_EventZDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PaymentPurposeDecodeErrorZ in the error state. -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentPurposeDecodeErrorZ { - CResult_PaymentPurposeDecodeErrorZ { - contents: CResult_PaymentPurposeDecodeErrorZPtr { +/// Creates a new CResult_COption_EventZDecodeErrorZ in the error state. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ { + CResult_COption_EventZDecodeErrorZ { + contents: CResult_COption_EventZDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24125,13 +25240,13 @@ pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_is_ok(o: &CResult_PaymentPurposeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PaymentPurposeDecodeErrorZ. -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_free(_res: CResult_PaymentPurposeDecodeErrorZ) { } -impl Drop for CResult_PaymentPurposeDecodeErrorZ { +/// Frees any resources used by the CResult_COption_EventZDecodeErrorZ. +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { } +impl Drop for CResult_COption_EventZDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24144,16 +25259,16 @@ impl Drop for CResult_PaymentPurposeDecodeErrorZ { } } } -impl From> for CResult_PaymentPurposeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_COption_EventZDecodeErrorZ { + 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_PaymentPurposeDecodeErrorZPtr { result } + CResult_COption_EventZDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentPurposeDecodeErrorZPtr { err } + CResult_COption_EventZDecodeErrorZPtr { err } }; Self { contents, @@ -24161,59 +25276,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentPurposeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PaymentPurposeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_COption_EventZDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PaymentPurposeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_COption_EventZDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentPurposeDecodeErrorZ_clone(orig: &CResult_PaymentPurposeDecodeErrorZ) -> CResult_PaymentPurposeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ClaimedHTLCDecodeErrorZ -pub union CResult_ClaimedHTLCDecodeErrorZPtr { +/// The contents of CResult_NonceDecodeErrorZ +pub union CResult_NonceDecodeErrorZPtr { /// 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::events::ClaimedHTLC, + pub result: *mut crate::lightning::offers::nonce::Nonce, /// 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_ClaimedHTLCDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::events::ClaimedHTLC on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NonceDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::offers::nonce::Nonce 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_ClaimedHTLCDecodeErrorZ { - /// The contents of this CResult_ClaimedHTLCDecodeErrorZ, accessible via either +pub struct CResult_NonceDecodeErrorZ { + /// The contents of this CResult_NonceDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ClaimedHTLCDecodeErrorZPtr, - /// Whether this CResult_ClaimedHTLCDecodeErrorZ represents a success state. + pub contents: CResult_NonceDecodeErrorZPtr, + /// Whether this CResult_NonceDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the success state. -pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_ok(o: crate::lightning::events::ClaimedHTLC) -> CResult_ClaimedHTLCDecodeErrorZ { - CResult_ClaimedHTLCDecodeErrorZ { - contents: CResult_ClaimedHTLCDecodeErrorZPtr { +/// Creates a new CResult_NonceDecodeErrorZ in the success state. +pub extern "C" fn CResult_NonceDecodeErrorZ_ok(o: crate::lightning::offers::nonce::Nonce) -> CResult_NonceDecodeErrorZ { + CResult_NonceDecodeErrorZ { + contents: CResult_NonceDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ClaimedHTLCDecodeErrorZ in the error state. -pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ClaimedHTLCDecodeErrorZ { - CResult_ClaimedHTLCDecodeErrorZ { - contents: CResult_ClaimedHTLCDecodeErrorZPtr { +/// Creates a new CResult_NonceDecodeErrorZ in the error state. +pub extern "C" fn CResult_NonceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NonceDecodeErrorZ { + CResult_NonceDecodeErrorZ { + contents: CResult_NonceDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24221,13 +25336,13 @@ pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_err(e: crate::lightning::ln::m } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_is_ok(o: &CResult_ClaimedHTLCDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NonceDecodeErrorZ_is_ok(o: &CResult_NonceDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ClaimedHTLCDecodeErrorZ. -pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_free(_res: CResult_ClaimedHTLCDecodeErrorZ) { } -impl Drop for CResult_ClaimedHTLCDecodeErrorZ { +/// Frees any resources used by the CResult_NonceDecodeErrorZ. +pub extern "C" fn CResult_NonceDecodeErrorZ_free(_res: CResult_NonceDecodeErrorZ) { } +impl Drop for CResult_NonceDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24240,16 +25355,16 @@ impl Drop for CResult_ClaimedHTLCDecodeErrorZ { } } } -impl From> for CResult_ClaimedHTLCDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NonceDecodeErrorZ { + 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_ClaimedHTLCDecodeErrorZPtr { result } + CResult_NonceDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ClaimedHTLCDecodeErrorZPtr { err } + CResult_NonceDecodeErrorZPtr { err } }; Self { contents, @@ -24257,96 +25372,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ClaimedHTLCDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NonceDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ClaimedHTLCDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NonceDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ClaimedHTLCDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NonceDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ClaimedHTLCDecodeErrorZ_clone(orig: &CResult_ClaimedHTLCDecodeErrorZ) -> CResult_ClaimedHTLCDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NonceDecodeErrorZ_clone(orig: &CResult_NonceDecodeErrorZ) -> CResult_NonceDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::PathFailure or not -pub enum COption_PathFailureZ { - /// When we're in this state, this COption_PathFailureZ contains a crate::lightning::events::PathFailure - Some(crate::lightning::events::PathFailure), - /// When we're in this state, this COption_PathFailureZ contains nothing - None +/// A dynamically-allocated array of crate::lightning_types::routing::RouteHintHops of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_RouteHintHopZ { + /// 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_types::routing::RouteHintHop, + /// The number of elements pointed to by `data`. + pub datalen: usize } -impl COption_PathFailureZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl CVec_RouteHintHopZ { + #[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::lightning_types::routing::RouteHintHop] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PathFailure { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl From> for CVec_RouteHintHopZ { + 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_PathFailureZ containing a crate::lightning::events::PathFailure -pub extern "C" fn COption_PathFailureZ_some(o: crate::lightning::events::PathFailure) -> COption_PathFailureZ { - COption_PathFailureZ::Some(o) +/// Frees the buffer pointed to by `data` if `datalen` is non-0. +pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { } +impl Drop for CVec_RouteHintHopZ { + 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_PathFailureZ containing nothing -pub extern "C" fn COption_PathFailureZ_none() -> COption_PathFailureZ { - COption_PathFailureZ::None +impl Clone for CVec_RouteHintHopZ { + 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::events::PathFailure, if we are in the Some state -pub extern "C" fn COption_PathFailureZ_free(_res: COption_PathFailureZ) { } -#[no_mangle] -/// Creates a new COption_PathFailureZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PathFailureZ_clone(orig: &COption_PathFailureZ) -> COption_PathFailureZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_PathFailureZDecodeErrorZ -pub union CResult_COption_PathFailureZDecodeErrorZPtr { +/// The contents of CResult_SiPrefixBolt11ParseErrorZ +pub union CResult_SiPrefixBolt11ParseErrorZPtr { /// 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_PathFailureZ, + 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::ln::msgs::DecodeError, + pub err: *mut crate::lightning_invoice::Bolt11ParseError, } #[repr(C)] -/// A CResult_COption_PathFailureZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_PathFailureZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_PathFailureZDecodeErrorZ { - /// The contents of this CResult_COption_PathFailureZDecodeErrorZ, accessible via either +pub struct CResult_SiPrefixBolt11ParseErrorZ { + /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_PathFailureZDecodeErrorZPtr, - /// Whether this CResult_COption_PathFailureZDecodeErrorZ represents a success state. + pub contents: CResult_SiPrefixBolt11ParseErrorZPtr, + /// Whether this CResult_SiPrefixBolt11ParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PathFailureZ) -> CResult_COption_PathFailureZDecodeErrorZ { - CResult_COption_PathFailureZDecodeErrorZ { - contents: CResult_COption_PathFailureZDecodeErrorZPtr { +/// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the success state. +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ { + CResult_SiPrefixBolt11ParseErrorZ { + contents: CResult_SiPrefixBolt11ParseErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_PathFailureZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PathFailureZDecodeErrorZ { - CResult_COption_PathFailureZDecodeErrorZ { - contents: CResult_COption_PathFailureZDecodeErrorZPtr { +/// Creates a new CResult_SiPrefixBolt11ParseErrorZ in the error state. +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ { + CResult_SiPrefixBolt11ParseErrorZ { + contents: CResult_SiPrefixBolt11ParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24354,13 +25478,13 @@ pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_err(e: crate::lightni } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_is_ok(o: &CResult_COption_PathFailureZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_PathFailureZDecodeErrorZ. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_free(_res: CResult_COption_PathFailureZDecodeErrorZ) { } -impl Drop for CResult_COption_PathFailureZDecodeErrorZ { +/// Frees any resources used by the CResult_SiPrefixBolt11ParseErrorZ. +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { } +impl Drop for CResult_SiPrefixBolt11ParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24373,16 +25497,16 @@ impl Drop for CResult_COption_PathFailureZDecodeErrorZ { } } } -impl From> for CResult_COption_PathFailureZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SiPrefixBolt11ParseErrorZ { + 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_PathFailureZDecodeErrorZPtr { result } + CResult_SiPrefixBolt11ParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_PathFailureZDecodeErrorZPtr { err } + CResult_SiPrefixBolt11ParseErrorZPtr { err } }; Self { contents, @@ -24390,96 +25514,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_PathFailureZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_PathFailureZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SiPrefixBolt11ParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_PathFailureZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_PathFailureZDecodeErrorZ_clone(orig: &CResult_COption_PathFailureZDecodeErrorZ) -> CResult_COption_PathFailureZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::ClosureReason or not -pub enum COption_ClosureReasonZ { - /// When we're in this state, this COption_ClosureReasonZ contains a crate::lightning::events::ClosureReason - Some(crate::lightning::events::ClosureReason), - /// When we're in this state, this COption_ClosureReasonZ contains nothing - None -} -impl COption_ClosureReasonZ { - #[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::events::ClosureReason { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_ClosureReasonZ containing a crate::lightning::events::ClosureReason -pub extern "C" fn COption_ClosureReasonZ_some(o: crate::lightning::events::ClosureReason) -> COption_ClosureReasonZ { - COption_ClosureReasonZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_ClosureReasonZ containing nothing -pub extern "C" fn COption_ClosureReasonZ_none() -> COption_ClosureReasonZ { - COption_ClosureReasonZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::events::ClosureReason, if we are in the Some state -pub extern "C" fn COption_ClosureReasonZ_free(_res: COption_ClosureReasonZ) { } -#[no_mangle] -/// Creates a new COption_ClosureReasonZ which has the same data as `orig` +/// Creates a new CResult_SiPrefixBolt11ParseErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_ClosureReasonZ_clone(orig: &COption_ClosureReasonZ) -> COption_ClosureReasonZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_ClosureReasonZDecodeErrorZ -pub union CResult_COption_ClosureReasonZDecodeErrorZPtr { +/// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ +pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { /// 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_ClosureReasonZ, + pub result: *mut crate::lightning_invoice::Bolt11Invoice, /// 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::ParseOrSemanticError, } #[repr(C)] -/// A CResult_COption_ClosureReasonZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_ClosureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::Bolt11Invoice 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_COption_ClosureReasonZDecodeErrorZ { - /// The contents of this CResult_COption_ClosureReasonZDecodeErrorZ, accessible via either +pub struct CResult_Bolt11InvoiceParseOrSemanticErrorZ { + /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_ClosureReasonZDecodeErrorZPtr, - /// Whether this CResult_COption_ClosureReasonZDecodeErrorZ represents a success state. + pub contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr, + /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_ClosureReasonZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { - CResult_COption_ClosureReasonZDecodeErrorZ { - contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { + CResult_Bolt11InvoiceParseOrSemanticErrorZ { + contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_ClosureReasonZDecodeErrorZ { - CResult_COption_ClosureReasonZDecodeErrorZ { - contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { + CResult_Bolt11InvoiceParseOrSemanticErrorZ { + contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24487,13 +25574,13 @@ pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_ClosureReasonZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_ClosureReasonZDecodeErrorZ. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_free(_res: CResult_COption_ClosureReasonZDecodeErrorZ) { } -impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt11InvoiceParseOrSemanticErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { } +impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24506,16 +25593,16 @@ impl Drop for CResult_COption_ClosureReasonZDecodeErrorZ { } } } -impl From> for CResult_COption_ClosureReasonZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt11InvoiceParseOrSemanticErrorZ { + 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_ClosureReasonZDecodeErrorZPtr { result } + CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_ClosureReasonZDecodeErrorZPtr { err } + CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err } }; Self { contents, @@ -24523,96 +25610,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_ClosureReasonZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_ClosureReasonZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_ClosureReasonZDecodeErrorZ_clone(orig: &CResult_COption_ClosureReasonZDecodeErrorZ) -> CResult_COption_ClosureReasonZDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::HTLCDestination or not -pub enum COption_HTLCDestinationZ { - /// When we're in this state, this COption_HTLCDestinationZ contains a crate::lightning::events::HTLCDestination - Some(crate::lightning::events::HTLCDestination), - /// When we're in this state, this COption_HTLCDestinationZ contains nothing - None -} -impl COption_HTLCDestinationZ { - #[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::events::HTLCDestination { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_HTLCDestinationZ containing a crate::lightning::events::HTLCDestination -pub extern "C" fn COption_HTLCDestinationZ_some(o: crate::lightning::events::HTLCDestination) -> COption_HTLCDestinationZ { - COption_HTLCDestinationZ::Some(o) -} -#[no_mangle] -/// Constructs a new COption_HTLCDestinationZ containing nothing -pub extern "C" fn COption_HTLCDestinationZ_none() -> COption_HTLCDestinationZ { - COption_HTLCDestinationZ::None -} -#[no_mangle] -/// Frees any resources associated with the crate::lightning::events::HTLCDestination, if we are in the Some state -pub extern "C" fn COption_HTLCDestinationZ_free(_res: COption_HTLCDestinationZ) { } -#[no_mangle] -/// Creates a new COption_HTLCDestinationZ which has the same data as `orig` +/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_HTLCDestinationZ_clone(orig: &COption_HTLCDestinationZ) -> COption_HTLCDestinationZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_HTLCDestinationZDecodeErrorZ -pub union CResult_COption_HTLCDestinationZDecodeErrorZPtr { +/// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ +pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { /// 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_HTLCDestinationZ, + pub result: *mut crate::lightning_invoice::SignedRawBolt11Invoice, /// 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::Bolt11ParseError, } #[repr(C)] -/// A CResult_COption_HTLCDestinationZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_HTLCDestinationZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_COption_HTLCDestinationZDecodeErrorZ { - /// The contents of this CResult_COption_HTLCDestinationZDecodeErrorZ, accessible via either +pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr, - /// Whether this CResult_COption_HTLCDestinationZDecodeErrorZ represents a success state. + pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr, + /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_ok(o: crate::c_types::derived::COption_HTLCDestinationZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { - CResult_COption_HTLCDestinationZDecodeErrorZ { - contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { +/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_HTLCDestinationZDecodeErrorZ { - CResult_COption_HTLCDestinationZDecodeErrorZ { - contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { +/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24620,13 +25670,13 @@ pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_err(e: crate::lig } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_is_ok(o: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_HTLCDestinationZDecodeErrorZ. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_free(_res: CResult_COption_HTLCDestinationZDecodeErrorZ) { } -impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ { +/// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { } +impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24639,16 +25689,16 @@ impl Drop for CResult_COption_HTLCDestinationZDecodeErrorZ { } } } -impl From> for CResult_COption_HTLCDestinationZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { + 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_HTLCDestinationZDecodeErrorZPtr { result } + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_HTLCDestinationZDecodeErrorZPtr { err } + CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err } }; Self { contents, @@ -24656,96 +25706,105 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_HTLCDestinationZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_HTLCDestinationZDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_HTLCDestinationZDecodeErrorZ_clone(orig: &CResult_COption_HTLCDestinationZDecodeErrorZ) -> CResult_COption_HTLCDestinationZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) } #[repr(C)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::PaymentFailureReason or not -pub enum COption_PaymentFailureReasonZ { - /// When we're in this state, this COption_PaymentFailureReasonZ contains a crate::lightning::events::PaymentFailureReason - Some(crate::lightning::events::PaymentFailureReason), - /// When we're in this state, this COption_PaymentFailureReasonZ contains nothing - None +/// A tuple of 3 elements. See the individual fields for the types contained. +pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + /// The element at position 0 + pub a: crate::lightning_invoice::RawBolt11Invoice, + /// The element at position 1 + pub b: crate::c_types::ThirtyTwoBytes, + /// The element at position 2 + pub c: crate::lightning_invoice::Bolt11InvoiceSignature, } -impl COption_PaymentFailureReasonZ { - #[allow(unused)] pub(crate) fn is_some(&self) -> bool { - if let Self::None = self { false } else { true } +impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self { + Self { + a: tup.0, + b: tup.1, + c: tup.2, + } } - #[allow(unused)] pub(crate) fn is_none(&self) -> bool { - !self.is_some() +} +impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) { + (self.a, self.b, self.c) } - #[allow(unused)] pub(crate) fn take(mut self) -> crate::lightning::events::PaymentFailureReason { - if let Self::Some(v) = self { v } else { unreachable!() } +} +impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + fn clone(&self) -> Self { + Self { + a: Clone::clone(&self.a), + b: Clone::clone(&self.b), + c: Clone::clone(&self.c), + } } } #[no_mangle] -/// Constructs a new COption_PaymentFailureReasonZ containing a crate::lightning::events::PaymentFailureReason -pub extern "C" fn COption_PaymentFailureReasonZ_some(o: crate::lightning::events::PaymentFailureReason) -> COption_PaymentFailureReasonZ { - COption_PaymentFailureReasonZ::Some(o) -} +/// 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_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) } +/// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. #[no_mangle] -/// Constructs a new COption_PaymentFailureReasonZ containing nothing -pub extern "C" fn COption_PaymentFailureReasonZ_none() -> COption_PaymentFailureReasonZ { - COption_PaymentFailureReasonZ::None +pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: crate::lightning_invoice::RawBolt11Invoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::Bolt11InvoiceSignature) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { + C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, } } + #[no_mangle] -/// Frees any resources associated with the crate::lightning::events::PaymentFailureReason, if we are in the Some state -pub extern "C" fn COption_PaymentFailureReasonZ_free(_res: COption_PaymentFailureReasonZ) { } -#[no_mangle] -/// Creates a new COption_PaymentFailureReasonZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_PaymentFailureReasonZ_clone(orig: &COption_PaymentFailureReasonZ) -> COption_PaymentFailureReasonZ { Clone::clone(&orig) } +/// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. +pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { } #[repr(C)] -/// The contents of CResult_COption_PaymentFailureReasonZDecodeErrorZ -pub union CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { +/// The contents of CResult_PayeePubKeySecp256k1ErrorZ +pub union CResult_PayeePubKeySecp256k1ErrorZPtr { /// 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_PaymentFailureReasonZ, + 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_COption_PaymentFailureReasonZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_PaymentFailureReasonZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PayeePubKeySecp256k1ErrorZ 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_COption_PaymentFailureReasonZDecodeErrorZ { - /// The contents of this CResult_COption_PaymentFailureReasonZDecodeErrorZ, accessible via either +pub struct CResult_PayeePubKeySecp256k1ErrorZ { + /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr, - /// Whether this CResult_COption_PaymentFailureReasonZDecodeErrorZ represents a success state. + pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr, + /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_ok(o: crate::c_types::derived::COption_PaymentFailureReasonZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { - CResult_COption_PaymentFailureReasonZDecodeErrorZ { - contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { +/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ { + CResult_PayeePubKeySecp256k1ErrorZ { + contents: CResult_PayeePubKeySecp256k1ErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { - CResult_COption_PaymentFailureReasonZDecodeErrorZ { - contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { +/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ { + CResult_PayeePubKeySecp256k1ErrorZ { + contents: CResult_PayeePubKeySecp256k1ErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -24753,13 +25812,13 @@ pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_err(e: crate } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_is_ok(o: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_COption_PaymentFailureReasonZDecodeErrorZ. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_free(_res: CResult_COption_PaymentFailureReasonZDecodeErrorZ) { } -impl Drop for CResult_COption_PaymentFailureReasonZDecodeErrorZ { +/// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { } +impl Drop for CResult_PayeePubKeySecp256k1ErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -24772,16 +25831,16 @@ impl Drop for CResult_COption_PaymentFailureReasonZDecodeErrorZ { } } } -impl From> for CResult_COption_PaymentFailureReasonZDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PayeePubKeySecp256k1ErrorZ { + 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_PaymentFailureReasonZDecodeErrorZPtr { result } + CResult_PayeePubKeySecp256k1ErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { err } + CResult_PayeePubKeySecp256k1ErrorZPtr { err } }; Self { contents, @@ -24789,84 +25848,47 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_COption_PaymentFailureReasonZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_PaymentFailureReasonZDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_COption_PaymentFailureReasonZDecodeErrorZ_clone(orig: &CResult_COption_PaymentFailureReasonZDecodeErrorZ) -> CResult_COption_PaymentFailureReasonZDecodeErrorZ { 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` +/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ 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) } +pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning::events::ClaimedHTLCs 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_ClaimedHTLCZ { +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::events::ClaimedHTLC, + pub data: *mut crate::lightning_invoice::PrivateRoute, /// The number of elements pointed to by `data`. pub datalen: usize } -impl CVec_ClaimedHTLCZ { - #[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::lightning::events::ClaimedHTLC] { + #[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_ClaimedHTLCZ { - 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() } } @@ -24874,94 +25896,57 @@ impl From> for CVec_ClaimedHTLCZ { } #[no_mangle] /// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_ClaimedHTLCZ_free(_res: CVec_ClaimedHTLCZ) { } -impl Drop for CVec_ClaimedHTLCZ { +pub extern "C" fn CVec_PrivateRouteZ_free(_res: CVec_PrivateRouteZ) { } +impl Drop for CVec_PrivateRouteZ { 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_ClaimedHTLCZ { - 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)] -#[derive(Clone)] -/// An enum which can either contain a crate::lightning::events::Event or not -pub enum COption_EventZ { - /// When we're in this state, this COption_EventZ contains a crate::lightning::events::Event - Some(crate::lightning::events::Event), - /// When we're in this state, this COption_EventZ contains nothing - None -} -impl COption_EventZ { - #[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::events::Event { - if let Self::Some(v) = self { v } else { unreachable!() } - } -} -#[no_mangle] -/// Constructs a new COption_EventZ containing a crate::lightning::events::Event -pub extern "C" fn COption_EventZ_some(o: crate::lightning::events::Event) -> COption_EventZ { - COption_EventZ::Some(o) + 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_EventZ containing nothing -pub extern "C" fn COption_EventZ_none() -> COption_EventZ { - COption_EventZ::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::events::Event, if we are in the Some state -pub extern "C" fn COption_EventZ_free(_res: COption_EventZ) { } -#[no_mangle] -/// Creates a new COption_EventZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn COption_EventZ_clone(orig: &COption_EventZ) -> COption_EventZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_COption_EventZDecodeErrorZ -pub union CResult_COption_EventZDecodeErrorZPtr { +/// 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_EventZ, + 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_EventZDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::c_types::derived::COption_EventZ on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_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_EventZDecodeErrorZ { - /// The contents of this CResult_COption_EventZDecodeErrorZ, 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_EventZDecodeErrorZPtr, - /// Whether this CResult_COption_EventZDecodeErrorZ 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_EventZDecodeErrorZ in the success state. -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_ok(o: crate::c_types::derived::COption_EventZ) -> CResult_COption_EventZDecodeErrorZ { - CResult_COption_EventZDecodeErrorZ { - contents: CResult_COption_EventZDecodeErrorZPtr { +/// 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_EventZDecodeErrorZ in the error state. -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_COption_EventZDecodeErrorZ { - CResult_COption_EventZDecodeErrorZ { - contents: CResult_COption_EventZDecodeErrorZPtr { +/// 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, @@ -24969,13 +25954,13 @@ pub extern "C" fn CResult_COption_EventZDecodeErrorZ_err(e: crate::lightning::ln } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_is_ok(o: &CResult_COption_EventZDecodeErrorZ) -> 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_EventZDecodeErrorZ. -pub extern "C" fn CResult_COption_EventZDecodeErrorZ_free(_res: CResult_COption_EventZDecodeErrorZ) { } -impl Drop for CResult_COption_EventZDecodeErrorZ { +/// 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() } { @@ -24988,16 +25973,16 @@ impl Drop for CResult_COption_EventZDecodeErrorZ { } } } -impl From> for CResult_COption_EventZDecodeErrorZ { - 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_EventZDecodeErrorZPtr { result } + CResult_PositiveTimestampCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_COption_EventZDecodeErrorZPtr { err } + CResult_PositiveTimestampCreationErrorZPtr { err } }; Self { contents, @@ -25005,59 +25990,58 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_COption_EventZDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_COption_EventZDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PositiveTimestampCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_COption_EventZDecodeErrorZ 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 CResult_COption_EventZDecodeErrorZ_clone(orig: &CResult_COption_EventZDecodeErrorZ) -> CResult_COption_EventZDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PositiveTimestampCreationErrorZ_clone(orig: &CResult_PositiveTimestampCreationErrorZ) -> CResult_PositiveTimestampCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NonceDecodeErrorZ -pub union CResult_NonceDecodeErrorZPtr { - /// 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::offers::nonce::Nonce, +/// The contents of CResult_NoneBolt11SemanticErrorZ +pub union CResult_NoneBolt11SemanticErrorZPtr { + /// 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::Bolt11SemanticError, } #[repr(C)] -/// A CResult_NonceDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::offers::nonce::Nonce on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation, +/// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_NonceDecodeErrorZ { - /// The contents of this CResult_NonceDecodeErrorZ, accessible via either +pub struct CResult_NoneBolt11SemanticErrorZ { + /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NonceDecodeErrorZPtr, - /// Whether this CResult_NonceDecodeErrorZ represents a success state. + pub contents: CResult_NoneBolt11SemanticErrorZPtr, + /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NonceDecodeErrorZ in the success state. -pub extern "C" fn CResult_NonceDecodeErrorZ_ok(o: crate::lightning::offers::nonce::Nonce) -> CResult_NonceDecodeErrorZ { - CResult_NonceDecodeErrorZ { - contents: CResult_NonceDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), +/// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ { + CResult_NoneBolt11SemanticErrorZ { + contents: CResult_NoneBolt11SemanticErrorZPtr { + result: core::ptr::null_mut(), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NonceDecodeErrorZ in the error state. -pub extern "C" fn CResult_NonceDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NonceDecodeErrorZ { - CResult_NonceDecodeErrorZ { - contents: CResult_NonceDecodeErrorZPtr { +/// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ { + CResult_NoneBolt11SemanticErrorZ { + contents: CResult_NoneBolt11SemanticErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25065,18 +26049,15 @@ pub extern "C" fn CResult_NonceDecodeErrorZ_err(e: crate::lightning::ln::msgs::D } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NonceDecodeErrorZ_is_ok(o: &CResult_NonceDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NonceDecodeErrorZ. -pub extern "C" fn CResult_NonceDecodeErrorZ_free(_res: CResult_NonceDecodeErrorZ) { } -impl Drop for CResult_NonceDecodeErrorZ { +/// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { } +impl Drop for CResult_NoneBolt11SemanticErrorZ { 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) }; @@ -25084,16 +26065,16 @@ impl Drop for CResult_NonceDecodeErrorZ { } } } -impl From> for CResult_NonceDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NoneBolt11SemanticErrorZ { + fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self { let contents = if o.result_ok { - let result = unsafe { o.contents.result }; - unsafe { o.contents.result = core::ptr::null_mut() }; - CResult_NonceDecodeErrorZPtr { result } + let _ = unsafe { Box::from_raw(o.contents.result) }; + o.contents.result = core::ptr::null_mut(); + CResult_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NonceDecodeErrorZPtr { err } + CResult_NoneBolt11SemanticErrorZPtr { err } }; Self { contents, @@ -25101,105 +26082,155 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NonceDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr { + result: core::ptr::null_mut() } } } else { - Self { result_ok: false, contents: CResult_NonceDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NonceDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NonceDecodeErrorZ_clone(orig: &CResult_NonceDecodeErrorZ) -> CResult_NonceDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// A dynamically-allocated array of crate::lightning_types::routing::RouteHintHops of arbitrary size. -/// This corresponds to std::vector in C++ -pub struct CVec_RouteHintHopZ { - /// 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_types::routing::RouteHintHop, - /// The number of elements pointed to by `data`. - pub datalen: usize +/// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ +pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { + /// 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::Bolt11Invoice, + /// 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::Bolt11SemanticError, } -impl CVec_RouteHintHopZ { - #[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_types::routing::RouteHintHop] { - unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } +#[repr(C)] +/// A CResult_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ { + /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr, + /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { + CResult_Bolt11InvoiceBolt11SemanticErrorZ { + contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, } } -impl From> for CVec_RouteHintHopZ { - 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_Bolt11InvoiceBolt11SemanticErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { + CResult_Bolt11InvoiceBolt11SemanticErrorZ { + contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { + 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_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool { + o.result_ok +} #[no_mangle] -/// Frees the buffer pointed to by `data` if `datalen` is non-0. -pub extern "C" fn CVec_RouteHintHopZ_free(_res: CVec_RouteHintHopZ) { } -impl Drop for CVec_RouteHintHopZ { +/// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { } +impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ { fn drop(&mut self) { - if self.datalen == 0 { return; } - let _ = 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 From> for CResult_Bolt11InvoiceBolt11SemanticErrorZ { + 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_Bolt11InvoiceBolt11SemanticErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } } } -impl Clone for CVec_RouteHintHopZ { +impl Clone for CResult_Bolt11InvoiceBolt11SemanticErrorZ { 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_Bolt11InvoiceBolt11SemanticErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } } } +#[no_mangle] +/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SiPrefixBolt11ParseErrorZ -pub union CResult_SiPrefixBolt11ParseErrorZPtr { +/// 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 crate::lightning_invoice::SiPrefix, + 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_invoice::Bolt11ParseError, + pub err: *mut crate::lightning_invoice::CreationError, } #[repr(C)] -/// A CResult_SiPrefixBolt11ParseErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::SiPrefix on success and a crate::lightning_invoice::Bolt11ParseError 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_SiPrefixBolt11ParseErrorZ { - /// The contents of this CResult_SiPrefixBolt11ParseErrorZ, 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_SiPrefixBolt11ParseErrorZPtr, - /// Whether this CResult_SiPrefixBolt11ParseErrorZ 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_SiPrefixBolt11ParseErrorZ in the success state. -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SiPrefix) -> CResult_SiPrefixBolt11ParseErrorZ { - CResult_SiPrefixBolt11ParseErrorZ { - contents: CResult_SiPrefixBolt11ParseErrorZPtr { +/// 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_SiPrefixBolt11ParseErrorZ in the error state. -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SiPrefixBolt11ParseErrorZ { - CResult_SiPrefixBolt11ParseErrorZ { - contents: CResult_SiPrefixBolt11ParseErrorZPtr { +/// 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, @@ -25207,13 +26238,13 @@ pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_err(e: crate::lightning_invo } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_is_ok(o: &CResult_SiPrefixBolt11ParseErrorZ) -> 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_SiPrefixBolt11ParseErrorZ. -pub extern "C" fn CResult_SiPrefixBolt11ParseErrorZ_free(_res: CResult_SiPrefixBolt11ParseErrorZ) { } -impl Drop for CResult_SiPrefixBolt11ParseErrorZ { +/// 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() } { @@ -25226,16 +26257,16 @@ impl Drop for CResult_SiPrefixBolt11ParseErrorZ { } } } -impl From> for CResult_SiPrefixBolt11ParseErrorZ { - 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_SiPrefixBolt11ParseErrorZPtr { result } + CResult_DescriptionCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SiPrefixBolt11ParseErrorZPtr { err } + CResult_DescriptionCreationErrorZPtr { err } }; Self { contents, @@ -25243,59 +26274,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SiPrefixBolt11ParseErrorZPtr { - 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_SiPrefixBolt11ParseErrorZPtr { - 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_SiPrefixBolt11ParseErrorZ 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_SiPrefixBolt11ParseErrorZ_clone(orig: &CResult_SiPrefixBolt11ParseErrorZ) -> CResult_SiPrefixBolt11ParseErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_DescriptionCreationErrorZ_clone(orig: &CResult_DescriptionCreationErrorZ) -> CResult_DescriptionCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceParseOrSemanticErrorZ -pub union CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { +/// 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::Bolt11Invoice, + 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::ParseOrSemanticError, + pub err: *mut crate::lightning_invoice::CreationError, } #[repr(C)] -/// A CResult_Bolt11InvoiceParseOrSemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::ParseOrSemanticError 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_Bolt11InvoiceParseOrSemanticErrorZ { - /// The contents of this CResult_Bolt11InvoiceParseOrSemanticErrorZ, 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_Bolt11InvoiceParseOrSemanticErrorZPtr, - /// Whether this CResult_Bolt11InvoiceParseOrSemanticErrorZ 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_Bolt11InvoiceParseOrSemanticErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { - CResult_Bolt11InvoiceParseOrSemanticErrorZ { - contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { +/// 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_Bolt11InvoiceParseOrSemanticErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::lightning_invoice::ParseOrSemanticError) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { - CResult_Bolt11InvoiceParseOrSemanticErrorZ { - contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { +/// 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, @@ -25303,13 +26334,13 @@ pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_err(e: crate::light } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> 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_Bolt11InvoiceParseOrSemanticErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_free(_res: CResult_Bolt11InvoiceParseOrSemanticErrorZ) { } -impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ { +/// 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() } { @@ -25322,16 +26353,16 @@ impl Drop for CResult_Bolt11InvoiceParseOrSemanticErrorZ { } } } -impl From> for CResult_Bolt11InvoiceParseOrSemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +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_Bolt11InvoiceParseOrSemanticErrorZPtr { result } + CResult_PrivateRouteCreationErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { err } + CResult_PrivateRouteCreationErrorZPtr { err } }; Self { contents, @@ -25339,59 +26370,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceParseOrSemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + 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_Bolt11InvoiceParseOrSemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_PrivateRouteCreationErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceParseOrSemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_PrivateRouteCreationErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt11InvoiceParseOrSemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceParseOrSemanticErrorZ) -> CResult_Bolt11InvoiceParseOrSemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PrivateRouteCreationErrorZ_clone(orig: &CResult_PrivateRouteCreationErrorZ) -> CResult_PrivateRouteCreationErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ -pub union CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { +/// The contents of CResult_OutPointDecodeErrorZ +pub union CResult_OutPointDecodeErrorZPtr { /// 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::SignedRawBolt11Invoice, + pub result: *mut crate::lightning::chain::transaction::OutPoint, /// 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::Bolt11ParseError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::SignedRawBolt11Invoice on success and a crate::lightning_invoice::Bolt11ParseError on failure. +/// A CResult_OutPointDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - /// The contents of this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ, accessible via either +pub struct CResult_OutPointDecodeErrorZ { + /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr, - /// Whether this CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ represents a success state. + pub contents: CResult_OutPointDecodeErrorZPtr, + /// Whether this CResult_OutPointDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the success state. -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_ok(o: crate::lightning_invoice::SignedRawBolt11Invoice) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { +/// Creates a new CResult_OutPointDecodeErrorZ in the success state. +pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ { + CResult_OutPointDecodeErrorZ { + contents: CResult_OutPointDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ in the error state. -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate::lightning_invoice::Bolt11ParseError) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { +/// Creates a new CResult_OutPointDecodeErrorZ in the error state. +pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ { + CResult_OutPointDecodeErrorZ { + contents: CResult_OutPointDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25399,13 +26430,13 @@ pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_err(e: crate:: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_is_ok(o: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> bool { +pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ. -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_free(_res: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) { } -impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { +/// Frees any resources used by the CResult_OutPointDecodeErrorZ. +pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { } +impl Drop for CResult_OutPointDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25418,16 +26449,16 @@ impl Drop for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { } } } -impl From> for CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_OutPointDecodeErrorZ { + 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_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { result } + CResult_OutPointDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { err } + CResult_OutPointDecodeErrorZPtr { err } }; Self { contents, @@ -25435,105 +26466,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_SignedRawBolt11InvoiceBolt11ParseErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ_clone(orig: &CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ) -> CResult_SignedRawBolt11InvoiceBolt11ParseErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// A tuple of 3 elements. See the individual fields for the types contained. -pub struct C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - /// The element at position 0 - pub a: crate::lightning_invoice::RawBolt11Invoice, - /// The element at position 1 - pub b: crate::c_types::ThirtyTwoBytes, - /// The element at position 2 - pub c: crate::lightning_invoice::Bolt11InvoiceSignature, -} -impl From<(crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)> for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - fn from (tup: (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature)) -> Self { - Self { - a: tup.0, - b: tup.1, - c: tup.2, - } - } -} -impl C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - #[allow(unused)] pub(crate) fn to_rust(mut self) -> (crate::lightning_invoice::RawBolt11Invoice, crate::c_types::ThirtyTwoBytes, crate::lightning_invoice::Bolt11InvoiceSignature) { - (self.a, self.b, self.c) - } -} -impl Clone for C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - fn clone(&self) -> Self { - Self { - a: Clone::clone(&self.a), - b: Clone::clone(&self.b), - c: Clone::clone(&self.c), + Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr { + 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_OutPointDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_clone(orig: &C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { Clone::clone(&orig) } -/// Creates a new C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ from the contained elements. -#[no_mangle] -pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_new(a: crate::lightning_invoice::RawBolt11Invoice, b: crate::c_types::ThirtyTwoBytes, c: crate::lightning_invoice::Bolt11InvoiceSignature) -> C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { - C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ { a, b, c, } -} - -#[no_mangle] -/// Frees any resources used by the C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ. -pub extern "C" fn C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ_free(_res: C3Tuple_RawBolt11Invoice_u832Bolt11InvoiceSignatureZ) { } +pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PayeePubKeySecp256k1ErrorZ -pub union CResult_PayeePubKeySecp256k1ErrorZPtr { +/// The contents of CResult_BigSizeDecodeErrorZ +pub union CResult_BigSizeDecodeErrorZPtr { /// 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::lightning::util::ser::BigSize, /// 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_PayeePubKeySecp256k1ErrorZ 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_BigSizeDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::ser::BigSize 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_PayeePubKeySecp256k1ErrorZ { - /// The contents of this CResult_PayeePubKeySecp256k1ErrorZ, accessible via either +pub struct CResult_BigSizeDecodeErrorZ { + /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PayeePubKeySecp256k1ErrorZPtr, - /// Whether this CResult_PayeePubKeySecp256k1ErrorZ represents a success state. + pub contents: CResult_BigSizeDecodeErrorZPtr, + /// Whether this CResult_BigSizeDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the success state. -pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_ok(o: crate::lightning_invoice::PayeePubKey) -> CResult_PayeePubKeySecp256k1ErrorZ { - CResult_PayeePubKeySecp256k1ErrorZ { - contents: CResult_PayeePubKeySecp256k1ErrorZPtr { +/// Creates a new CResult_BigSizeDecodeErrorZ in the success state. +pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ { + CResult_BigSizeDecodeErrorZ { + contents: CResult_BigSizeDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ in the error state. -pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp256k1Error) -> CResult_PayeePubKeySecp256k1ErrorZ { - CResult_PayeePubKeySecp256k1ErrorZ { - contents: CResult_PayeePubKeySecp256k1ErrorZPtr { +/// Creates a new CResult_BigSizeDecodeErrorZ in the error state. +pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ { + CResult_BigSizeDecodeErrorZ { + contents: CResult_BigSizeDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25541,13 +26526,13 @@ pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_err(e: crate::c_types::Secp } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_is_ok(o: &CResult_PayeePubKeySecp256k1ErrorZ) -> bool { +pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_PayeePubKeySecp256k1ErrorZ. -pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_free(_res: CResult_PayeePubKeySecp256k1ErrorZ) { } -impl Drop for CResult_PayeePubKeySecp256k1ErrorZ { +/// Frees any resources used by the CResult_BigSizeDecodeErrorZ. +pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { } +impl Drop for CResult_BigSizeDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25560,16 +26545,16 @@ impl Drop for CResult_PayeePubKeySecp256k1ErrorZ { } } } -impl From> for CResult_PayeePubKeySecp256k1ErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BigSizeDecodeErrorZ { + 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_PayeePubKeySecp256k1ErrorZPtr { result } + CResult_BigSizeDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PayeePubKeySecp256k1ErrorZPtr { err } + CResult_BigSizeDecodeErrorZPtr { err } }; Self { contents, @@ -25577,105 +26562,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_PayeePubKeySecp256k1ErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_PayeePubKeySecp256k1ErrorZ which has the same data as `orig` +/// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PayeePubKeySecp256k1ErrorZ_clone(orig: &CResult_PayeePubKeySecp256k1ErrorZ) -> CResult_PayeePubKeySecp256k1ErrorZ { 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; } - let _ = 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_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PositiveTimestampCreationErrorZ -pub union CResult_PositiveTimestampCreationErrorZPtr { +/// The contents of CResult_UntrustedStringDecodeErrorZ +pub union CResult_UntrustedStringDecodeErrorZPtr { /// 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_types::string::UntrustedString, /// 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_UntrustedStringDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_PositiveTimestampCreationErrorZ { - /// The contents of this CResult_PositiveTimestampCreationErrorZ, accessible via either +pub struct CResult_UntrustedStringDecodeErrorZ { + /// The contents of this CResult_UntrustedStringDecodeErrorZ, 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_UntrustedStringDecodeErrorZPtr, + /// Whether this CResult_UntrustedStringDecodeErrorZ 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_UntrustedStringDecodeErrorZ in the success state. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning_types::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ { + CResult_UntrustedStringDecodeErrorZ { + contents: CResult_UntrustedStringDecodeErrorZPtr { 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_UntrustedStringDecodeErrorZ in the error state. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ { + CResult_UntrustedStringDecodeErrorZ { + contents: CResult_UntrustedStringDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25683,13 +26622,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_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> 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_UntrustedStringDecodeErrorZ. +pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { } +impl Drop for CResult_UntrustedStringDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25702,16 +26641,16 @@ impl Drop for CResult_PositiveTimestampCreationErrorZ { } } } -impl From> for CResult_PositiveTimestampCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_UntrustedStringDecodeErrorZ { + 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_UntrustedStringDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PositiveTimestampCreationErrorZPtr { err } + CResult_UntrustedStringDecodeErrorZPtr { err } }; Self { contents, @@ -25719,58 +26658,59 @@ 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_UntrustedStringDecodeErrorZPtr { + 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_UntrustedStringDecodeErrorZPtr { + 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_UntrustedStringDecodeErrorZ 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_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_NoneBolt11SemanticErrorZ -pub union CResult_NoneBolt11SemanticErrorZPtr { - /// 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_HostnameDecodeErrorZ +pub union CResult_HostnameDecodeErrorZPtr { + /// 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::util::ser::Hostname, /// 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::Bolt11SemanticError, + pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_NoneBolt11SemanticErrorZ represents the result of a fallible operation, -/// containing a () on success and a crate::lightning_invoice::Bolt11SemanticError on failure. +/// A CResult_HostnameDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::ser::Hostname 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_NoneBolt11SemanticErrorZ { - /// The contents of this CResult_NoneBolt11SemanticErrorZ, accessible via either +pub struct CResult_HostnameDecodeErrorZ { + /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_NoneBolt11SemanticErrorZPtr, - /// Whether this CResult_NoneBolt11SemanticErrorZ represents a success state. + pub contents: CResult_HostnameDecodeErrorZPtr, + /// Whether this CResult_HostnameDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_NoneBolt11SemanticErrorZ in the success state. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_ok() -> CResult_NoneBolt11SemanticErrorZ { - CResult_NoneBolt11SemanticErrorZ { - contents: CResult_NoneBolt11SemanticErrorZPtr { - result: core::ptr::null_mut(), +/// Creates a new CResult_HostnameDecodeErrorZ in the success state. +pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ { + CResult_HostnameDecodeErrorZ { + contents: CResult_HostnameDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_NoneBolt11SemanticErrorZ in the error state. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_NoneBolt11SemanticErrorZ { - CResult_NoneBolt11SemanticErrorZ { - contents: CResult_NoneBolt11SemanticErrorZPtr { +/// Creates a new CResult_HostnameDecodeErrorZ in the error state. +pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ { + CResult_HostnameDecodeErrorZ { + contents: CResult_HostnameDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25778,15 +26718,18 @@ pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_err(e: crate::lightning_invoi } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_is_ok(o: &CResult_NoneBolt11SemanticErrorZ) -> bool { +pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_NoneBolt11SemanticErrorZ. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_free(_res: CResult_NoneBolt11SemanticErrorZ) { } -impl Drop for CResult_NoneBolt11SemanticErrorZ { +/// Frees any resources used by the CResult_HostnameDecodeErrorZ. +pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { } +impl Drop for CResult_HostnameDecodeErrorZ { 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) }; @@ -25794,16 +26737,16 @@ impl Drop for CResult_NoneBolt11SemanticErrorZ { } } } -impl From> for CResult_NoneBolt11SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl<(), crate::lightning_invoice::Bolt11SemanticError>) -> Self { +impl From> for CResult_HostnameDecodeErrorZ { + 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_NoneBolt11SemanticErrorZPtr { result: core::ptr::null_mut() } + let result = unsafe { o.contents.result }; + unsafe { o.contents.result = core::ptr::null_mut() }; + CResult_HostnameDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_NoneBolt11SemanticErrorZPtr { err } + CResult_HostnameDecodeErrorZPtr { err } }; Self { contents, @@ -25811,95 +26754,91 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_NoneBolt11SemanticErrorZPtr { - result: core::ptr::null_mut() + Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_NoneBolt11SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_NoneBolt11SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_NoneBolt11SemanticErrorZ_clone(orig: &CResult_NoneBolt11SemanticErrorZ) -> CResult_NoneBolt11SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceBolt11SemanticErrorZ -pub union CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { +/// The contents of CResult_TransactionU16LenLimitedNoneZ +pub union CResult_TransactionU16LenLimitedNoneZPtr { /// 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::Bolt11Invoice, - /// 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::Bolt11SemanticError, + pub result: *mut crate::lightning::util::ser::TransactionU16LenLimited, + /// 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_Bolt11InvoiceBolt11SemanticErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::Bolt11SemanticError on failure. +/// A CResult_TransactionU16LenLimitedNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_Bolt11InvoiceBolt11SemanticErrorZ { - /// The contents of this CResult_Bolt11InvoiceBolt11SemanticErrorZ, accessible via either +pub struct CResult_TransactionU16LenLimitedNoneZ { + /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr, - /// Whether this CResult_Bolt11InvoiceBolt11SemanticErrorZ represents a success state. + pub contents: CResult_TransactionU16LenLimitedNoneZPtr, + /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { - CResult_Bolt11InvoiceBolt11SemanticErrorZ { - contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { +/// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state. +pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ { + CResult_TransactionU16LenLimitedNoneZ { + contents: CResult_TransactionU16LenLimitedNoneZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_err(e: crate::lightning_invoice::Bolt11SemanticError) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { - CResult_Bolt11InvoiceBolt11SemanticErrorZ { - contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { - err: Box::into_raw(Box::new(e)), +/// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state. +pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ { + CResult_TransactionU16LenLimitedNoneZ { + contents: CResult_TransactionU16LenLimitedNoneZPtr { + 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_Bolt11InvoiceBolt11SemanticErrorZ_is_ok(o: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> bool { +pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_Bolt11InvoiceBolt11SemanticErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_free(_res: CResult_Bolt11InvoiceBolt11SemanticErrorZ) { } -impl Drop for CResult_Bolt11InvoiceBolt11SemanticErrorZ { +/// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ. +pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { } +impl Drop for CResult_TransactionU16LenLimitedNoneZ { 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_Bolt11InvoiceBolt11SemanticErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TransactionU16LenLimitedNoneZ { + 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_Bolt11InvoiceBolt11SemanticErrorZPtr { result } + CResult_TransactionU16LenLimitedNoneZPtr { result } } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { err } + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() } }; Self { contents, @@ -25907,59 +26846,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_Bolt11InvoiceBolt11SemanticErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr { + err: core::ptr::null_mut() } } } } } #[no_mangle] -/// Creates a new CResult_Bolt11InvoiceBolt11SemanticErrorZ which has the same data as `orig` +/// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt11InvoiceBolt11SemanticErrorZ_clone(orig: &CResult_Bolt11InvoiceBolt11SemanticErrorZ) -> CResult_Bolt11InvoiceBolt11SemanticErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_DescriptionCreationErrorZ -pub union CResult_DescriptionCreationErrorZPtr { +/// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ +pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr { /// 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::lightning::util::ser::TransactionU16LenLimited, /// 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_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::util::ser::TransactionU16LenLimited 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_TransactionU16LenLimitedDecodeErrorZ { + /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, 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_TransactionU16LenLimitedDecodeErrorZPtr, + /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ 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_TransactionU16LenLimitedDecodeErrorZ in the success state. +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ { + CResult_TransactionU16LenLimitedDecodeErrorZ { + contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { 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_TransactionU16LenLimitedDecodeErrorZ in the error state. +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ { + CResult_TransactionU16LenLimitedDecodeErrorZ { + contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -25967,13 +26906,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_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> 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_TransactionU16LenLimitedDecodeErrorZ. +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { } +impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -25986,16 +26925,16 @@ impl Drop for CResult_DescriptionCreationErrorZ { } } } -impl From> for CResult_DescriptionCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_TransactionU16LenLimitedDecodeErrorZ { + 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_TransactionU16LenLimitedDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_DescriptionCreationErrorZPtr { err } + CResult_TransactionU16LenLimitedDecodeErrorZPtr { err } }; Self { contents, @@ -26003,59 +26942,59 @@ 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 }))) + Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { + 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 }))) + Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_DescriptionCreationErrorZ which has the same data as `orig` +/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ 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) } +pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_PrivateRouteCreationErrorZ -pub union CResult_PrivateRouteCreationErrorZPtr { +/// The contents of CResult_ChannelIdDecodeErrorZ +pub union CResult_ChannelIdDecodeErrorZPtr { /// 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, + pub result: *mut crate::lightning::ln::types::ChannelId, /// 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_PrivateRouteCreationErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::PrivateRoute on success and a crate::lightning_invoice::CreationError on failure. +/// A CResult_ChannelIdDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::ln::types::ChannelId 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_PrivateRouteCreationErrorZ { - /// The contents of this CResult_PrivateRouteCreationErrorZ, accessible via either +pub struct CResult_ChannelIdDecodeErrorZ { + /// The contents of this CResult_ChannelIdDecodeErrorZ, 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 contents: CResult_ChannelIdDecodeErrorZPtr, + /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state. pub result_ok: bool, } #[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 { +/// Creates a new CResult_ChannelIdDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ { + CResult_ChannelIdDecodeErrorZ { + contents: CResult_ChannelIdDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[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 { +/// Creates a new CResult_ChannelIdDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ { + CResult_ChannelIdDecodeErrorZ { + contents: CResult_ChannelIdDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26063,13 +27002,13 @@ pub extern "C" fn CResult_PrivateRouteCreationErrorZ_err(e: crate::lightning_inv } /// 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 { +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool { o.result_ok } #[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 any resources used by the CResult_ChannelIdDecodeErrorZ. +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { } +impl Drop for CResult_ChannelIdDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26082,16 +27021,16 @@ impl Drop for CResult_PrivateRouteCreationErrorZ { } } } -impl From> for CResult_PrivateRouteCreationErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelIdDecodeErrorZ { + 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 } + CResult_ChannelIdDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PrivateRouteCreationErrorZPtr { err } + CResult_ChannelIdDecodeErrorZPtr { err } }; Self { contents, @@ -26099,59 +27038,59 @@ 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 }))) + Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr { + 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 }))) + Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr { + 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` +/// Creates a new CResult_ChannelIdDecodeErrorZ 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) } +pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_OutPointDecodeErrorZ -pub union CResult_OutPointDecodeErrorZPtr { +/// The contents of CResult_InitFeaturesDecodeErrorZ +pub union CResult_InitFeaturesDecodeErrorZPtr { /// 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::transaction::OutPoint, + pub result: *mut crate::lightning_types::features::InitFeatures, /// 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_OutPointDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::chain::transaction::OutPoint on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_InitFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::InitFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_OutPointDecodeErrorZ { - /// The contents of this CResult_OutPointDecodeErrorZ, accessible via either +pub struct CResult_InitFeaturesDecodeErrorZ { + /// The contents of this CResult_InitFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_OutPointDecodeErrorZPtr, - /// Whether this CResult_OutPointDecodeErrorZ represents a success state. + pub contents: CResult_InitFeaturesDecodeErrorZPtr, + /// Whether this CResult_InitFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_OutPointDecodeErrorZ in the success state. -pub extern "C" fn CResult_OutPointDecodeErrorZ_ok(o: crate::lightning::chain::transaction::OutPoint) -> CResult_OutPointDecodeErrorZ { - CResult_OutPointDecodeErrorZ { - contents: CResult_OutPointDecodeErrorZPtr { +/// Creates a new CResult_InitFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::InitFeatures) -> CResult_InitFeaturesDecodeErrorZ { + CResult_InitFeaturesDecodeErrorZ { + contents: CResult_InitFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_OutPointDecodeErrorZ in the error state. -pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_OutPointDecodeErrorZ { - CResult_OutPointDecodeErrorZ { - contents: CResult_OutPointDecodeErrorZPtr { +/// Creates a new CResult_InitFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_InitFeaturesDecodeErrorZ { + CResult_InitFeaturesDecodeErrorZ { + contents: CResult_InitFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26159,13 +27098,13 @@ pub extern "C" fn CResult_OutPointDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_OutPointDecodeErrorZ_is_ok(o: &CResult_OutPointDecodeErrorZ) -> bool { +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_is_ok(o: &CResult_InitFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_OutPointDecodeErrorZ. -pub extern "C" fn CResult_OutPointDecodeErrorZ_free(_res: CResult_OutPointDecodeErrorZ) { } -impl Drop for CResult_OutPointDecodeErrorZ { +/// Frees any resources used by the CResult_InitFeaturesDecodeErrorZ. +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_free(_res: CResult_InitFeaturesDecodeErrorZ) { } +impl Drop for CResult_InitFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26178,16 +27117,16 @@ impl Drop for CResult_OutPointDecodeErrorZ { } } } -impl From> for CResult_OutPointDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_InitFeaturesDecodeErrorZ { + 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_OutPointDecodeErrorZPtr { result } + CResult_InitFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_OutPointDecodeErrorZPtr { err } + CResult_InitFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -26195,59 +27134,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_OutPointDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_InitFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_OutPointDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_InitFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_OutPointDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_InitFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_OutPointDecodeErrorZ_clone(orig: &CResult_OutPointDecodeErrorZ) -> CResult_OutPointDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_InitFeaturesDecodeErrorZ_clone(orig: &CResult_InitFeaturesDecodeErrorZ) -> CResult_InitFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_BigSizeDecodeErrorZ -pub union CResult_BigSizeDecodeErrorZPtr { +/// The contents of CResult_ChannelFeaturesDecodeErrorZ +pub union CResult_ChannelFeaturesDecodeErrorZPtr { /// 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::util::ser::BigSize, + pub result: *mut crate::lightning_types::features::ChannelFeatures, /// 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_BigSizeDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::BigSize on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::ChannelFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_BigSizeDecodeErrorZ { - /// The contents of this CResult_BigSizeDecodeErrorZ, accessible via either +pub struct CResult_ChannelFeaturesDecodeErrorZ { + /// The contents of this CResult_ChannelFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_BigSizeDecodeErrorZPtr, - /// Whether this CResult_BigSizeDecodeErrorZ represents a success state. + pub contents: CResult_ChannelFeaturesDecodeErrorZPtr, + /// Whether this CResult_ChannelFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_BigSizeDecodeErrorZ in the success state. -pub extern "C" fn CResult_BigSizeDecodeErrorZ_ok(o: crate::lightning::util::ser::BigSize) -> CResult_BigSizeDecodeErrorZ { - CResult_BigSizeDecodeErrorZ { - contents: CResult_BigSizeDecodeErrorZPtr { +/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelFeatures) -> CResult_ChannelFeaturesDecodeErrorZ { + CResult_ChannelFeaturesDecodeErrorZ { + contents: CResult_ChannelFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_BigSizeDecodeErrorZ in the error state. -pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BigSizeDecodeErrorZ { - CResult_BigSizeDecodeErrorZ { - contents: CResult_BigSizeDecodeErrorZPtr { +/// Creates a new CResult_ChannelFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelFeaturesDecodeErrorZ { + CResult_ChannelFeaturesDecodeErrorZ { + contents: CResult_ChannelFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26255,13 +27194,13 @@ pub extern "C" fn CResult_BigSizeDecodeErrorZ_err(e: crate::lightning::ln::msgs: } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_BigSizeDecodeErrorZ_is_ok(o: &CResult_BigSizeDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_BigSizeDecodeErrorZ. -pub extern "C" fn CResult_BigSizeDecodeErrorZ_free(_res: CResult_BigSizeDecodeErrorZ) { } -impl Drop for CResult_BigSizeDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelFeaturesDecodeErrorZ. +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_free(_res: CResult_ChannelFeaturesDecodeErrorZ) { } +impl Drop for CResult_ChannelFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26274,16 +27213,16 @@ impl Drop for CResult_BigSizeDecodeErrorZ { } } } -impl From> for CResult_BigSizeDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelFeaturesDecodeErrorZ { + 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_BigSizeDecodeErrorZPtr { result } + CResult_ChannelFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_BigSizeDecodeErrorZPtr { err } + CResult_ChannelFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -26291,59 +27230,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_BigSizeDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_BigSizeDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_BigSizeDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_BigSizeDecodeErrorZ_clone(orig: &CResult_BigSizeDecodeErrorZ) -> CResult_BigSizeDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelFeaturesDecodeErrorZ) -> CResult_ChannelFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_UntrustedStringDecodeErrorZ -pub union CResult_UntrustedStringDecodeErrorZPtr { +/// The contents of CResult_NodeFeaturesDecodeErrorZ +pub union CResult_NodeFeaturesDecodeErrorZPtr { /// 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_types::string::UntrustedString, + pub result: *mut crate::lightning_types::features::NodeFeatures, /// 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_UntrustedStringDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_types::string::UntrustedString on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_NodeFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::NodeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_UntrustedStringDecodeErrorZ { - /// The contents of this CResult_UntrustedStringDecodeErrorZ, accessible via either +pub struct CResult_NodeFeaturesDecodeErrorZ { + /// The contents of this CResult_NodeFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UntrustedStringDecodeErrorZPtr, - /// Whether this CResult_UntrustedStringDecodeErrorZ represents a success state. + pub contents: CResult_NodeFeaturesDecodeErrorZPtr, + /// Whether this CResult_NodeFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UntrustedStringDecodeErrorZ in the success state. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_ok(o: crate::lightning_types::string::UntrustedString) -> CResult_UntrustedStringDecodeErrorZ { - CResult_UntrustedStringDecodeErrorZ { - contents: CResult_UntrustedStringDecodeErrorZPtr { +/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::NodeFeatures) -> CResult_NodeFeaturesDecodeErrorZ { + CResult_NodeFeaturesDecodeErrorZ { + contents: CResult_NodeFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UntrustedStringDecodeErrorZ in the error state. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UntrustedStringDecodeErrorZ { - CResult_UntrustedStringDecodeErrorZ { - contents: CResult_UntrustedStringDecodeErrorZPtr { +/// Creates a new CResult_NodeFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_NodeFeaturesDecodeErrorZ { + CResult_NodeFeaturesDecodeErrorZ { + contents: CResult_NodeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26351,13 +27290,13 @@ pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_err(e: crate::lightning::l } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_is_ok(o: &CResult_UntrustedStringDecodeErrorZ) -> bool { +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_is_ok(o: &CResult_NodeFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UntrustedStringDecodeErrorZ. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_free(_res: CResult_UntrustedStringDecodeErrorZ) { } -impl Drop for CResult_UntrustedStringDecodeErrorZ { +/// Frees any resources used by the CResult_NodeFeaturesDecodeErrorZ. +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_free(_res: CResult_NodeFeaturesDecodeErrorZ) { } +impl Drop for CResult_NodeFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26370,16 +27309,16 @@ impl Drop for CResult_UntrustedStringDecodeErrorZ { } } } -impl From> for CResult_UntrustedStringDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_NodeFeaturesDecodeErrorZ { + 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_UntrustedStringDecodeErrorZPtr { result } + CResult_NodeFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UntrustedStringDecodeErrorZPtr { err } + CResult_NodeFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -26387,59 +27326,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UntrustedStringDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_NodeFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UntrustedStringDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_NodeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UntrustedStringDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_NodeFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UntrustedStringDecodeErrorZ_clone(orig: &CResult_UntrustedStringDecodeErrorZ) -> CResult_UntrustedStringDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_NodeFeaturesDecodeErrorZ_clone(orig: &CResult_NodeFeaturesDecodeErrorZ) -> CResult_NodeFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_HostnameDecodeErrorZ -pub union CResult_HostnameDecodeErrorZPtr { +/// The contents of CResult_Bolt11InvoiceFeaturesDecodeErrorZ +pub union CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { /// 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::util::ser::Hostname, + pub result: *mut crate::lightning_types::features::Bolt11InvoiceFeatures, /// 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_HostnameDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::Hostname on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::Bolt11InvoiceFeatures 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_HostnameDecodeErrorZ { - /// The contents of this CResult_HostnameDecodeErrorZ, accessible via either +pub struct CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + /// The contents of this CResult_Bolt11InvoiceFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_HostnameDecodeErrorZPtr, - /// Whether this CResult_HostnameDecodeErrorZ represents a success state. + pub contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr, + /// Whether this CResult_Bolt11InvoiceFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_HostnameDecodeErrorZ in the success state. -pub extern "C" fn CResult_HostnameDecodeErrorZ_ok(o: crate::lightning::util::ser::Hostname) -> CResult_HostnameDecodeErrorZ { - CResult_HostnameDecodeErrorZ { - contents: CResult_HostnameDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt11InvoiceFeatures) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_HostnameDecodeErrorZ in the error state. -pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_HostnameDecodeErrorZ { - CResult_HostnameDecodeErrorZ { - contents: CResult_HostnameDecodeErrorZPtr { +/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26447,13 +27386,13 @@ pub extern "C" fn CResult_HostnameDecodeErrorZ_err(e: crate::lightning::ln::msgs } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_HostnameDecodeErrorZ_is_ok(o: &CResult_HostnameDecodeErrorZ) -> bool { +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_HostnameDecodeErrorZ. -pub extern "C" fn CResult_HostnameDecodeErrorZ_free(_res: CResult_HostnameDecodeErrorZ) { } -impl Drop for CResult_HostnameDecodeErrorZ { +/// Frees any resources used by the CResult_Bolt11InvoiceFeaturesDecodeErrorZ. +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt11InvoiceFeaturesDecodeErrorZ) { } +impl Drop for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26466,16 +27405,16 @@ impl Drop for CResult_HostnameDecodeErrorZ { } } } -impl From> for CResult_HostnameDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + 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_HostnameDecodeErrorZPtr { result } + CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_HostnameDecodeErrorZPtr { err } + CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -26483,91 +27422,95 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_HostnameDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_HostnameDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_Bolt11InvoiceFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_HostnameDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_Bolt11InvoiceFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_HostnameDecodeErrorZ_clone(orig: &CResult_HostnameDecodeErrorZ) -> CResult_HostnameDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt11InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt11InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt11InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TransactionU16LenLimitedNoneZ -pub union CResult_TransactionU16LenLimitedNoneZPtr { +/// The contents of CResult_Bolt12InvoiceFeaturesDecodeErrorZ +pub union CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { /// 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::util::ser::TransactionU16LenLimited, - /// 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_types::features::Bolt12InvoiceFeatures, + /// 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_TransactionU16LenLimitedNoneZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a () on failure. +/// A CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::Bolt12InvoiceFeatures 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_TransactionU16LenLimitedNoneZ { - /// The contents of this CResult_TransactionU16LenLimitedNoneZ, accessible via either +pub struct CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + /// The contents of this CResult_Bolt12InvoiceFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TransactionU16LenLimitedNoneZPtr, - /// Whether this CResult_TransactionU16LenLimitedNoneZ represents a success state. + pub contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr, + /// Whether this CResult_Bolt12InvoiceFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedNoneZ in the success state. -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedNoneZ { - CResult_TransactionU16LenLimitedNoneZ { - contents: CResult_TransactionU16LenLimitedNoneZPtr { +/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::Bolt12InvoiceFeatures) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedNoneZ in the error state. -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_err() -> CResult_TransactionU16LenLimitedNoneZ { - CResult_TransactionU16LenLimitedNoneZ { - contents: CResult_TransactionU16LenLimitedNoneZPtr { - err: core::ptr::null_mut(), +/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { + 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_TransactionU16LenLimitedNoneZ_is_ok(o: &CResult_TransactionU16LenLimitedNoneZ) -> bool { +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_is_ok(o: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TransactionU16LenLimitedNoneZ. -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_free(_res: CResult_TransactionU16LenLimitedNoneZ) { } -impl Drop for CResult_TransactionU16LenLimitedNoneZ { +/// Frees any resources used by the CResult_Bolt12InvoiceFeaturesDecodeErrorZ. +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_free(_res: CResult_Bolt12InvoiceFeaturesDecodeErrorZ) { } +impl Drop for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { 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_TransactionU16LenLimitedNoneZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + 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_TransactionU16LenLimitedNoneZPtr { result } + CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { result } } else { - let _ = unsafe { Box::from_raw(o.contents.err) }; - o.contents.err = core::ptr::null_mut(); - CResult_TransactionU16LenLimitedNoneZPtr { err: core::ptr::null_mut() } + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -26575,59 +27518,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TransactionU16LenLimitedNoneZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TransactionU16LenLimitedNoneZPtr { - err: core::ptr::null_mut() + Self { result_ok: false, contents: CResult_Bolt12InvoiceFeaturesDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedNoneZ which has the same data as `orig` +/// Creates a new CResult_Bolt12InvoiceFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TransactionU16LenLimitedNoneZ_clone(orig: &CResult_TransactionU16LenLimitedNoneZ) -> CResult_TransactionU16LenLimitedNoneZ { Clone::clone(&orig) } +pub extern "C" fn CResult_Bolt12InvoiceFeaturesDecodeErrorZ_clone(orig: &CResult_Bolt12InvoiceFeaturesDecodeErrorZ) -> CResult_Bolt12InvoiceFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_TransactionU16LenLimitedDecodeErrorZ -pub union CResult_TransactionU16LenLimitedDecodeErrorZPtr { +/// The contents of CResult_BlindedHopFeaturesDecodeErrorZ +pub union CResult_BlindedHopFeaturesDecodeErrorZPtr { /// 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::util::ser::TransactionU16LenLimited, + pub result: *mut crate::lightning_types::features::BlindedHopFeatures, /// 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_TransactionU16LenLimitedDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::util::ser::TransactionU16LenLimited on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_BlindedHopFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::BlindedHopFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_TransactionU16LenLimitedDecodeErrorZ { - /// The contents of this CResult_TransactionU16LenLimitedDecodeErrorZ, accessible via either +pub struct CResult_BlindedHopFeaturesDecodeErrorZ { + /// The contents of this CResult_BlindedHopFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr, - /// Whether this CResult_TransactionU16LenLimitedDecodeErrorZ represents a success state. + pub contents: CResult_BlindedHopFeaturesDecodeErrorZPtr, + /// Whether this CResult_BlindedHopFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the success state. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_ok(o: crate::lightning::util::ser::TransactionU16LenLimited) -> CResult_TransactionU16LenLimitedDecodeErrorZ { - CResult_TransactionU16LenLimitedDecodeErrorZ { - contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { +/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::BlindedHopFeatures) -> CResult_BlindedHopFeaturesDecodeErrorZ { + CResult_BlindedHopFeaturesDecodeErrorZ { + contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ in the error state. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_TransactionU16LenLimitedDecodeErrorZ { - CResult_TransactionU16LenLimitedDecodeErrorZ { - contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { +/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_BlindedHopFeaturesDecodeErrorZ { + CResult_BlindedHopFeaturesDecodeErrorZ { + contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26635,13 +27578,13 @@ pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_err(e: crate::lig } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_is_ok(o: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> bool { +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_is_ok(o: &CResult_BlindedHopFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_TransactionU16LenLimitedDecodeErrorZ. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_free(_res: CResult_TransactionU16LenLimitedDecodeErrorZ) { } -impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ { +/// Frees any resources used by the CResult_BlindedHopFeaturesDecodeErrorZ. +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_free(_res: CResult_BlindedHopFeaturesDecodeErrorZ) { } +impl Drop for CResult_BlindedHopFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26654,16 +27597,16 @@ impl Drop for CResult_TransactionU16LenLimitedDecodeErrorZ { } } } -impl From> for CResult_TransactionU16LenLimitedDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_BlindedHopFeaturesDecodeErrorZ { + 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_TransactionU16LenLimitedDecodeErrorZPtr { result } + CResult_BlindedHopFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_TransactionU16LenLimitedDecodeErrorZPtr { err } + CResult_BlindedHopFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -26671,59 +27614,59 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_TransactionU16LenLimitedDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_BlindedHopFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_TransactionU16LenLimitedDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_BlindedHopFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_TransactionU16LenLimitedDecodeErrorZ_clone(orig: &CResult_TransactionU16LenLimitedDecodeErrorZ) -> CResult_TransactionU16LenLimitedDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_BlindedHopFeaturesDecodeErrorZ_clone(orig: &CResult_BlindedHopFeaturesDecodeErrorZ) -> CResult_BlindedHopFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] -/// The contents of CResult_ChannelIdDecodeErrorZ -pub union CResult_ChannelIdDecodeErrorZPtr { +/// The contents of CResult_ChannelTypeFeaturesDecodeErrorZ +pub union CResult_ChannelTypeFeaturesDecodeErrorZPtr { /// 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::types::ChannelId, + pub result: *mut crate::lightning_types::features::ChannelTypeFeatures, /// 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_ChannelIdDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::ln::types::ChannelId on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_ChannelTypeFeaturesDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning_types::features::ChannelTypeFeatures on success and a crate::lightning::ln::msgs::DecodeError on failure. /// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_ChannelIdDecodeErrorZ { - /// The contents of this CResult_ChannelIdDecodeErrorZ, accessible via either +pub struct CResult_ChannelTypeFeaturesDecodeErrorZ { + /// The contents of this CResult_ChannelTypeFeaturesDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_ChannelIdDecodeErrorZPtr, - /// Whether this CResult_ChannelIdDecodeErrorZ represents a success state. + pub contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr, + /// Whether this CResult_ChannelTypeFeaturesDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_ChannelIdDecodeErrorZ in the success state. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_ok(o: crate::lightning::ln::types::ChannelId) -> CResult_ChannelIdDecodeErrorZ { - CResult_ChannelIdDecodeErrorZ { - contents: CResult_ChannelIdDecodeErrorZPtr { +/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the success state. +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_ok(o: crate::lightning_types::features::ChannelTypeFeatures) -> CResult_ChannelTypeFeaturesDecodeErrorZ { + CResult_ChannelTypeFeaturesDecodeErrorZ { + contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_ChannelIdDecodeErrorZ in the error state. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelIdDecodeErrorZ { - CResult_ChannelIdDecodeErrorZ { - contents: CResult_ChannelIdDecodeErrorZPtr { +/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ in the error state. +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_ChannelTypeFeaturesDecodeErrorZ { + CResult_ChannelTypeFeaturesDecodeErrorZ { + contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -26731,13 +27674,13 @@ pub extern "C" fn CResult_ChannelIdDecodeErrorZ_err(e: crate::lightning::ln::msg } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_is_ok(o: &CResult_ChannelIdDecodeErrorZ) -> bool { +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_is_ok(o: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_ChannelIdDecodeErrorZ. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_free(_res: CResult_ChannelIdDecodeErrorZ) { } -impl Drop for CResult_ChannelIdDecodeErrorZ { +/// Frees any resources used by the CResult_ChannelTypeFeaturesDecodeErrorZ. +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_free(_res: CResult_ChannelTypeFeaturesDecodeErrorZ) { } +impl Drop for CResult_ChannelTypeFeaturesDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -26750,16 +27693,16 @@ impl Drop for CResult_ChannelIdDecodeErrorZ { } } } -impl From> for CResult_ChannelIdDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_ChannelTypeFeaturesDecodeErrorZ { + 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_ChannelIdDecodeErrorZPtr { result } + CResult_ChannelTypeFeaturesDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_ChannelIdDecodeErrorZPtr { err } + CResult_ChannelTypeFeaturesDecodeErrorZPtr { err } }; Self { contents, @@ -26767,23 +27710,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_ChannelIdDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_ChannelIdDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_ChannelTypeFeaturesDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_ChannelIdDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_ChannelTypeFeaturesDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ChannelIdDecodeErrorZ_clone(orig: &CResult_ChannelIdDecodeErrorZ) -> CResult_ChannelIdDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_ChannelTypeFeaturesDecodeErrorZ_clone(orig: &CResult_ChannelTypeFeaturesDecodeErrorZ) -> CResult_ChannelTypeFeaturesDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// A tuple of 2 elements. See the individual fields for the types contained. pub struct C2Tuple__u832u16Z { @@ -27263,127 +28206,31 @@ pub union CResult_PaymentContextDecodeErrorZPtr { pub err: *mut crate::lightning::ln::msgs::DecodeError, } #[repr(C)] -/// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::payment::PaymentContext 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_PaymentContextDecodeErrorZ { - /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_PaymentContextDecodeErrorZPtr, - /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_PaymentContextDecodeErrorZ in the success state. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ { - CResult_PaymentContextDecodeErrorZ { - contents: CResult_PaymentContextDecodeErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_PaymentContextDecodeErrorZ in the error state. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ { - CResult_PaymentContextDecodeErrorZ { - contents: CResult_PaymentContextDecodeErrorZPtr { - 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_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_PaymentContextDecodeErrorZ. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { } -impl Drop for CResult_PaymentContextDecodeErrorZ { - 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_PaymentContextDecodeErrorZ { - 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_PaymentContextDecodeErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_PaymentContextDecodeErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_PaymentContextDecodeErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) } -#[repr(C)] -/// The contents of CResult_UnknownPaymentContextDecodeErrorZ -pub union CResult_UnknownPaymentContextDecodeErrorZPtr { - /// 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::blinded_path::payment::UnknownPaymentContext, - /// 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_UnknownPaymentContextDecodeErrorZ represents the result of a fallible operation, -/// containing a crate::lightning::blinded_path::payment::UnknownPaymentContext on success and a crate::lightning::ln::msgs::DecodeError on failure. +/// A CResult_PaymentContextDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::payment::PaymentContext 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_UnknownPaymentContextDecodeErrorZ { - /// The contents of this CResult_UnknownPaymentContextDecodeErrorZ, accessible via either +pub struct CResult_PaymentContextDecodeErrorZ { + /// The contents of this CResult_PaymentContextDecodeErrorZ, accessible via either /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_UnknownPaymentContextDecodeErrorZPtr, - /// Whether this CResult_UnknownPaymentContextDecodeErrorZ represents a success state. + pub contents: CResult_PaymentContextDecodeErrorZPtr, + /// Whether this CResult_PaymentContextDecodeErrorZ represents a success state. pub result_ok: bool, } #[no_mangle] -/// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the success state. -pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> CResult_UnknownPaymentContextDecodeErrorZ { - CResult_UnknownPaymentContextDecodeErrorZ { - contents: CResult_UnknownPaymentContextDecodeErrorZPtr { +/// Creates a new CResult_PaymentContextDecodeErrorZ in the success state. +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::payment::PaymentContext) -> CResult_PaymentContextDecodeErrorZ { + CResult_PaymentContextDecodeErrorZ { + contents: CResult_PaymentContextDecodeErrorZPtr { result: Box::into_raw(Box::new(o)), }, result_ok: true, } } #[no_mangle] -/// Creates a new CResult_UnknownPaymentContextDecodeErrorZ in the error state. -pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_UnknownPaymentContextDecodeErrorZ { - CResult_UnknownPaymentContextDecodeErrorZ { - contents: CResult_UnknownPaymentContextDecodeErrorZPtr { +/// Creates a new CResult_PaymentContextDecodeErrorZ in the error state. +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_PaymentContextDecodeErrorZ { + CResult_PaymentContextDecodeErrorZ { + contents: CResult_PaymentContextDecodeErrorZPtr { err: Box::into_raw(Box::new(e)), }, result_ok: false, @@ -27391,13 +28238,13 @@ pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_err(e: crate::lightn } /// Checks if the given object is currently in the success state #[no_mangle] -pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_is_ok(o: &CResult_UnknownPaymentContextDecodeErrorZ) -> bool { +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_is_ok(o: &CResult_PaymentContextDecodeErrorZ) -> bool { o.result_ok } #[no_mangle] -/// Frees any resources used by the CResult_UnknownPaymentContextDecodeErrorZ. -pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_free(_res: CResult_UnknownPaymentContextDecodeErrorZ) { } -impl Drop for CResult_UnknownPaymentContextDecodeErrorZ { +/// Frees any resources used by the CResult_PaymentContextDecodeErrorZ. +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_free(_res: CResult_PaymentContextDecodeErrorZ) { } +impl Drop for CResult_PaymentContextDecodeErrorZ { fn drop(&mut self) { if self.result_ok { if unsafe { !(self.contents.result as *mut ()).is_null() } { @@ -27410,16 +28257,16 @@ impl Drop for CResult_UnknownPaymentContextDecodeErrorZ { } } } -impl From> for CResult_UnknownPaymentContextDecodeErrorZ { - fn from(mut o: crate::c_types::CResultTempl) -> Self { +impl From> for CResult_PaymentContextDecodeErrorZ { + 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_UnknownPaymentContextDecodeErrorZPtr { result } + CResult_PaymentContextDecodeErrorZPtr { result } } else { let err = unsafe { o.contents.err }; unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_UnknownPaymentContextDecodeErrorZPtr { err } + CResult_PaymentContextDecodeErrorZPtr { err } }; Self { contents, @@ -27427,23 +28274,23 @@ impl From Self { if self.result_ok { - Self { result_ok: true, contents: CResult_UnknownPaymentContextDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + Self { result_ok: true, contents: CResult_PaymentContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) } } } else { - Self { result_ok: false, contents: CResult_UnknownPaymentContextDecodeErrorZPtr { + Self { result_ok: false, contents: CResult_PaymentContextDecodeErrorZPtr { err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) } } } } } #[no_mangle] -/// Creates a new CResult_UnknownPaymentContextDecodeErrorZ which has the same data as `orig` +/// Creates a new CResult_PaymentContextDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_UnknownPaymentContextDecodeErrorZ_clone(orig: &CResult_UnknownPaymentContextDecodeErrorZ) -> CResult_UnknownPaymentContextDecodeErrorZ { Clone::clone(&orig) } +pub extern "C" fn CResult_PaymentContextDecodeErrorZ_clone(orig: &CResult_PaymentContextDecodeErrorZ) -> CResult_PaymentContextDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] /// The contents of CResult_Bolt12OfferContextDecodeErrorZ pub union CResult_Bolt12OfferContextDecodeErrorZPtr { @@ -27811,23 +28658,253 @@ impl From Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_ResponderDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_ResponderDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_ResponderDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_ResponderDecodeErrorZ_clone(orig: &CResult_ResponderDecodeErrorZ) -> CResult_ResponderDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_OnionMessagePathNoneZ +pub union CResult_OnionMessagePathNoneZPtr { + /// 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::messenger::OnionMessagePath, + /// 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_OnionMessagePathNoneZ represents the result of a fallible operation, +/// containing a crate::lightning::onion_message::messenger::OnionMessagePath on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_OnionMessagePathNoneZ { + /// The contents of this CResult_OnionMessagePathNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_OnionMessagePathNoneZPtr, + /// Whether this CResult_OnionMessagePathNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_OnionMessagePathNoneZ in the success state. +pub extern "C" fn CResult_OnionMessagePathNoneZ_ok(o: crate::lightning::onion_message::messenger::OnionMessagePath) -> CResult_OnionMessagePathNoneZ { + CResult_OnionMessagePathNoneZ { + contents: CResult_OnionMessagePathNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_OnionMessagePathNoneZ in the error state. +pub extern "C" fn CResult_OnionMessagePathNoneZ_err() -> CResult_OnionMessagePathNoneZ { + CResult_OnionMessagePathNoneZ { + contents: CResult_OnionMessagePathNoneZPtr { + 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_OnionMessagePathNoneZ_is_ok(o: &CResult_OnionMessagePathNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_OnionMessagePathNoneZ. +pub extern "C" fn CResult_OnionMessagePathNoneZ_free(_res: CResult_OnionMessagePathNoneZ) { } +impl Drop for CResult_OnionMessagePathNoneZ { + 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_OnionMessagePathNoneZ { + 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_OnionMessagePathNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_OnionMessagePathNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_OnionMessagePathNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_OnionMessagePathNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_OnionMessagePathNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_OnionMessagePathNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_OnionMessagePathNoneZ_clone(orig: &CResult_OnionMessagePathNoneZ) -> CResult_OnionMessagePathNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_CVec_BlindedMessagePathZNoneZ +pub union CResult_CVec_BlindedMessagePathZNoneZPtr { + /// 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_BlindedMessagePathZ, + /// 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_CVec_BlindedMessagePathZNoneZ represents the result of a fallible operation, +/// containing a crate::c_types::derived::CVec_BlindedMessagePathZ on success and a () on failure. +/// `result_ok` indicates the overall state, and the contents are provided via `contents`. +pub struct CResult_CVec_BlindedMessagePathZNoneZ { + /// The contents of this CResult_CVec_BlindedMessagePathZNoneZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_CVec_BlindedMessagePathZNoneZPtr, + /// Whether this CResult_CVec_BlindedMessagePathZNoneZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the success state. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_ok(o: crate::c_types::derived::CVec_BlindedMessagePathZ) -> CResult_CVec_BlindedMessagePathZNoneZ { + CResult_CVec_BlindedMessagePathZNoneZ { + contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ in the error state. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_err() -> CResult_CVec_BlindedMessagePathZNoneZ { + CResult_CVec_BlindedMessagePathZNoneZ { + contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + 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_CVec_BlindedMessagePathZNoneZ_is_ok(o: &CResult_CVec_BlindedMessagePathZNoneZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_CVec_BlindedMessagePathZNoneZ. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_free(_res: CResult_CVec_BlindedMessagePathZNoneZ) { } +impl Drop for CResult_CVec_BlindedMessagePathZNoneZ { + 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_CVec_BlindedMessagePathZNoneZ { + 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_BlindedMessagePathZNoneZPtr { result } + } else { + let _ = unsafe { Box::from_raw(o.contents.err) }; + o.contents.err = core::ptr::null_mut(); + CResult_CVec_BlindedMessagePathZNoneZPtr { err: core::ptr::null_mut() } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_CVec_BlindedMessagePathZNoneZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_CVec_BlindedMessagePathZNoneZPtr { + err: core::ptr::null_mut() + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_CVec_BlindedMessagePathZNoneZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_CVec_BlindedMessagePathZNoneZ_clone(orig: &CResult_CVec_BlindedMessagePathZNoneZ) -> CResult_CVec_BlindedMessagePathZNoneZ { Clone::clone(&orig) } +#[repr(C)] +/// A dynamically-allocated array of crate::lightning::blinded_path::message::MessageForwardNodes of arbitrary size. +/// This corresponds to std::vector in C++ +pub struct CVec_MessageForwardNodeZ { + /// 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::blinded_path::message::MessageForwardNode, + /// The number of elements pointed to by `data`. + pub datalen: usize +} +impl CVec_MessageForwardNodeZ { + #[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::blinded_path::message::MessageForwardNode] { + unsafe { core::slice::from_raw_parts_mut(self.data, self.datalen) } + } +} +impl From> for CVec_MessageForwardNodeZ { + 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_MessageForwardNodeZ_free(_res: CVec_MessageForwardNodeZ) { } +impl Drop for CVec_MessageForwardNodeZ { + 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_MessageForwardNodeZ { fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_ResponderDecodeErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_ResponderDecodeErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } + 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] -/// Creates a new CResult_ResponderDecodeErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_ResponderDecodeErrorZ_clone(orig: &CResult_ResponderDecodeErrorZ) -> CResult_ResponderDecodeErrorZ { Clone::clone(&orig) } #[repr(C)] #[derive(Clone)] /// An enum which can either contain a crate::lightning::blinded_path::message::MessageContext or not @@ -28430,102 +29507,6 @@ impl Clone for CVec_PhantomRouteHintsZ { } } #[repr(C)] -/// The contents of CResult_Bolt11InvoiceSignOrCreationErrorZ -pub union CResult_Bolt11InvoiceSignOrCreationErrorZPtr { - /// 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::Bolt11Invoice, - /// 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::SignOrCreationError, -} -#[repr(C)] -/// A CResult_Bolt11InvoiceSignOrCreationErrorZ represents the result of a fallible operation, -/// containing a crate::lightning_invoice::Bolt11Invoice on success and a crate::lightning_invoice::SignOrCreationError on failure. -/// `result_ok` indicates the overall state, and the contents are provided via `contents`. -pub struct CResult_Bolt11InvoiceSignOrCreationErrorZ { - /// The contents of this CResult_Bolt11InvoiceSignOrCreationErrorZ, accessible via either - /// `err` or `result` depending on the state of `result_ok`. - pub contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr, - /// Whether this CResult_Bolt11InvoiceSignOrCreationErrorZ represents a success state. - pub result_ok: bool, -} -#[no_mangle] -/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the success state. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_ok(o: crate::lightning_invoice::Bolt11Invoice) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { - CResult_Bolt11InvoiceSignOrCreationErrorZ { - contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { - result: Box::into_raw(Box::new(o)), - }, - result_ok: true, - } -} -#[no_mangle] -/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ in the error state. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_err(e: crate::lightning_invoice::SignOrCreationError) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { - CResult_Bolt11InvoiceSignOrCreationErrorZ { - contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { - 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_Bolt11InvoiceSignOrCreationErrorZ_is_ok(o: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> bool { - o.result_ok -} -#[no_mangle] -/// Frees any resources used by the CResult_Bolt11InvoiceSignOrCreationErrorZ. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_free(_res: CResult_Bolt11InvoiceSignOrCreationErrorZ) { } -impl Drop for CResult_Bolt11InvoiceSignOrCreationErrorZ { - 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_Bolt11InvoiceSignOrCreationErrorZ { - 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_Bolt11InvoiceSignOrCreationErrorZPtr { result } - } else { - let err = unsafe { o.contents.err }; - unsafe { o.contents.err = core::ptr::null_mut(); } - CResult_Bolt11InvoiceSignOrCreationErrorZPtr { err } - }; - Self { - contents, - result_ok: o.result_ok, - } - } -} -impl Clone for CResult_Bolt11InvoiceSignOrCreationErrorZ { - fn clone(&self) -> Self { - if self.result_ok { - Self { result_ok: true, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { - result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) - } } - } else { - Self { result_ok: false, contents: CResult_Bolt11InvoiceSignOrCreationErrorZPtr { - err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) - } } - } - } -} -#[no_mangle] -/// Creates a new CResult_Bolt11InvoiceSignOrCreationErrorZ which has the same data as `orig` -/// but with all dynamically-allocated buffers duplicated in new buffers. -pub extern "C" fn CResult_Bolt11InvoiceSignOrCreationErrorZ_clone(orig: &CResult_Bolt11InvoiceSignOrCreationErrorZ) -> CResult_Bolt11InvoiceSignOrCreationErrorZ { Clone::clone(&orig) } -#[repr(C)] /// The contents of CResult_InvoiceErrorDecodeErrorZ pub union CResult_InvoiceErrorDecodeErrorZPtr { /// A pointer to the contents in the success state. @@ -30286,3 +31267,195 @@ impl Clone for CResult_OffersContextDecodeErrorZ { /// Creates a new CResult_OffersContextDecodeErrorZ which has the same data as `orig` /// but with all dynamically-allocated buffers duplicated in new buffers. pub extern "C" fn CResult_OffersContextDecodeErrorZ_clone(orig: &CResult_OffersContextDecodeErrorZ) -> CResult_OffersContextDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_AsyncPaymentsContextDecodeErrorZ +pub union CResult_AsyncPaymentsContextDecodeErrorZPtr { + /// 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::blinded_path::message::AsyncPaymentsContext, + /// 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_AsyncPaymentsContextDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::message::AsyncPaymentsContext 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_AsyncPaymentsContextDecodeErrorZ { + /// The contents of this CResult_AsyncPaymentsContextDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_AsyncPaymentsContextDecodeErrorZPtr, + /// Whether this CResult_AsyncPaymentsContextDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the success state. +pub extern "C" fn CResult_AsyncPaymentsContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::message::AsyncPaymentsContext) -> CResult_AsyncPaymentsContextDecodeErrorZ { + CResult_AsyncPaymentsContextDecodeErrorZ { + contents: CResult_AsyncPaymentsContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_AsyncPaymentsContextDecodeErrorZ in the error state. +pub extern "C" fn CResult_AsyncPaymentsContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_AsyncPaymentsContextDecodeErrorZ { + CResult_AsyncPaymentsContextDecodeErrorZ { + contents: CResult_AsyncPaymentsContextDecodeErrorZPtr { + 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_AsyncPaymentsContextDecodeErrorZ_is_ok(o: &CResult_AsyncPaymentsContextDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_AsyncPaymentsContextDecodeErrorZ. +pub extern "C" fn CResult_AsyncPaymentsContextDecodeErrorZ_free(_res: CResult_AsyncPaymentsContextDecodeErrorZ) { } +impl Drop for CResult_AsyncPaymentsContextDecodeErrorZ { + 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_AsyncPaymentsContextDecodeErrorZ { + 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_AsyncPaymentsContextDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_AsyncPaymentsContextDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_AsyncPaymentsContextDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_AsyncPaymentsContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_AsyncPaymentsContextDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_AsyncPaymentsContextDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_AsyncPaymentsContextDecodeErrorZ_clone(orig: &CResult_AsyncPaymentsContextDecodeErrorZ) -> CResult_AsyncPaymentsContextDecodeErrorZ { Clone::clone(&orig) } +#[repr(C)] +/// The contents of CResult_DNSResolverContextDecodeErrorZ +pub union CResult_DNSResolverContextDecodeErrorZPtr { + /// 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::blinded_path::message::DNSResolverContext, + /// 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_DNSResolverContextDecodeErrorZ represents the result of a fallible operation, +/// containing a crate::lightning::blinded_path::message::DNSResolverContext 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_DNSResolverContextDecodeErrorZ { + /// The contents of this CResult_DNSResolverContextDecodeErrorZ, accessible via either + /// `err` or `result` depending on the state of `result_ok`. + pub contents: CResult_DNSResolverContextDecodeErrorZPtr, + /// Whether this CResult_DNSResolverContextDecodeErrorZ represents a success state. + pub result_ok: bool, +} +#[no_mangle] +/// Creates a new CResult_DNSResolverContextDecodeErrorZ in the success state. +pub extern "C" fn CResult_DNSResolverContextDecodeErrorZ_ok(o: crate::lightning::blinded_path::message::DNSResolverContext) -> CResult_DNSResolverContextDecodeErrorZ { + CResult_DNSResolverContextDecodeErrorZ { + contents: CResult_DNSResolverContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(o)), + }, + result_ok: true, + } +} +#[no_mangle] +/// Creates a new CResult_DNSResolverContextDecodeErrorZ in the error state. +pub extern "C" fn CResult_DNSResolverContextDecodeErrorZ_err(e: crate::lightning::ln::msgs::DecodeError) -> CResult_DNSResolverContextDecodeErrorZ { + CResult_DNSResolverContextDecodeErrorZ { + contents: CResult_DNSResolverContextDecodeErrorZPtr { + 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_DNSResolverContextDecodeErrorZ_is_ok(o: &CResult_DNSResolverContextDecodeErrorZ) -> bool { + o.result_ok +} +#[no_mangle] +/// Frees any resources used by the CResult_DNSResolverContextDecodeErrorZ. +pub extern "C" fn CResult_DNSResolverContextDecodeErrorZ_free(_res: CResult_DNSResolverContextDecodeErrorZ) { } +impl Drop for CResult_DNSResolverContextDecodeErrorZ { + 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_DNSResolverContextDecodeErrorZ { + 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_DNSResolverContextDecodeErrorZPtr { result } + } else { + let err = unsafe { o.contents.err }; + unsafe { o.contents.err = core::ptr::null_mut(); } + CResult_DNSResolverContextDecodeErrorZPtr { err } + }; + Self { + contents, + result_ok: o.result_ok, + } + } +} +impl Clone for CResult_DNSResolverContextDecodeErrorZ { + fn clone(&self) -> Self { + if self.result_ok { + Self { result_ok: true, contents: CResult_DNSResolverContextDecodeErrorZPtr { + result: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.result }))) + } } + } else { + Self { result_ok: false, contents: CResult_DNSResolverContextDecodeErrorZPtr { + err: Box::into_raw(Box::new(::clone(unsafe { &*self.contents.err }))) + } } + } + } +} +#[no_mangle] +/// Creates a new CResult_DNSResolverContextDecodeErrorZ which has the same data as `orig` +/// but with all dynamically-allocated buffers duplicated in new buffers. +pub extern "C" fn CResult_DNSResolverContextDecodeErrorZ_clone(orig: &CResult_DNSResolverContextDecodeErrorZ) -> CResult_DNSResolverContextDecodeErrorZ { Clone::clone(&orig) } diff --git a/lightning-c-bindings/src/lightning/blinded_path/message.rs b/lightning-c-bindings/src/lightning/blinded_path/message.rs index 382a728..0c30ae4 100644 --- a/lightning-c-bindings/src/lightning/blinded_path/message.rs +++ b/lightning-c-bindings/src/lightning/blinded_path/message.rs @@ -502,6 +502,17 @@ pub enum MessageContext { /// [`OffersMessage`]: crate::onion_message::offers::OffersMessage Offers( crate::lightning::blinded_path::message::OffersContext), + /// Context specific to an [`AsyncPaymentsMessage`]. + /// + /// [`AsyncPaymentsMessage`]: crate::onion_message::async_payments::AsyncPaymentsMessage + AsyncPayments( + crate::lightning::blinded_path::message::AsyncPaymentsContext), + /// Represents a context for a blinded path used in a reply path when requesting a DNSSEC proof + /// in a [`DNSResolverMessage`]. + /// + /// [`DNSResolverMessage`]: crate::onion_message::dns_resolution::DNSResolverMessage + DNSResolver( + crate::lightning::blinded_path::message::DNSResolverContext), /// Context specific to a [`CustomOnionMessageHandler::CustomMessage`]. /// /// [`CustomOnionMessageHandler::CustomMessage`]: crate::onion_message::messenger::CustomOnionMessageHandler::CustomMessage @@ -521,6 +532,18 @@ impl MessageContext { a_nonref.into_native(), ) }, + MessageContext::AsyncPayments (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeMessageContext::AsyncPayments ( + a_nonref.into_native(), + ) + }, + MessageContext::DNSResolver (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeMessageContext::DNSResolver ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, MessageContext::Custom (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 }); }; @@ -538,6 +561,16 @@ impl MessageContext { a.into_native(), ) }, + MessageContext::AsyncPayments (mut a, ) => { + nativeMessageContext::AsyncPayments ( + a.into_native(), + ) + }, + MessageContext::DNSResolver (mut a, ) => { + nativeMessageContext::DNSResolver ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, MessageContext::Custom (mut a, ) => { let mut local_a = Vec::new(); for mut item in a.into_rust().drain(..) { local_a.push( { item }); }; nativeMessageContext::Custom ( @@ -556,6 +589,18 @@ impl MessageContext { crate::lightning::blinded_path::message::OffersContext::native_into(a_nonref), ) }, + nativeMessageContext::AsyncPayments (ref a, ) => { + let mut a_nonref = Clone::clone(a); + MessageContext::AsyncPayments ( + crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(a_nonref), + ) + }, + nativeMessageContext::DNSResolver (ref a, ) => { + let mut a_nonref = Clone::clone(a); + MessageContext::DNSResolver ( + crate::lightning::blinded_path::message::DNSResolverContext { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, nativeMessageContext::Custom (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( { item }); }; @@ -573,6 +618,16 @@ impl MessageContext { crate::lightning::blinded_path::message::OffersContext::native_into(a), ) }, + nativeMessageContext::AsyncPayments (mut a, ) => { + MessageContext::AsyncPayments ( + crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(a), + ) + }, + nativeMessageContext::DNSResolver (mut a, ) => { + MessageContext::DNSResolver ( + crate::lightning::blinded_path::message::DNSResolverContext { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, nativeMessageContext::Custom (mut a, ) => { let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { item }); }; MessageContext::Custom ( @@ -606,6 +661,16 @@ pub extern "C" fn MessageContext_offers(a: crate::lightning::blinded_path::messa MessageContext::Offers(a, ) } #[no_mangle] +/// Utility method to constructs a new AsyncPayments-variant MessageContext +pub extern "C" fn MessageContext_async_payments(a: crate::lightning::blinded_path::message::AsyncPaymentsContext) -> MessageContext { + MessageContext::AsyncPayments(a, ) +} +#[no_mangle] +/// Utility method to constructs a new DNSResolver-variant MessageContext +pub extern "C" fn MessageContext_dnsresolver(a: crate::lightning::blinded_path::message::DNSResolverContext) -> MessageContext { + MessageContext::DNSResolver(a, ) +} +#[no_mangle] /// Utility method to constructs a new Custom-variant MessageContext pub extern "C" fn MessageContext_custom(a: crate::c_types::derived::CVec_u8Z) -> MessageContext { MessageContext::Custom(a, ) @@ -676,6 +741,17 @@ pub enum OffersContext { /// /// [`Bolt12Invoice::payment_hash`]: crate::offers::invoice::Bolt12Invoice::payment_hash payment_hash: crate::c_types::ThirtyTwoBytes, + /// A nonce used for authenticating that a received [`InvoiceError`] is for a valid + /// sent [`Bolt12Invoice`]. + /// + /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice + nonce: crate::lightning::offers::nonce::Nonce, + /// Authentication code for the [`PaymentHash`], which should be checked when the context is + /// used to log the received [`InvoiceError`]. + /// + /// [`InvoiceError`]: crate::offers::invoice_error::InvoiceError + hmac: crate::c_types::ThirtyTwoBytes, }, } use lightning::blinded_path::message::OffersContext as OffersContextImport; @@ -702,10 +778,14 @@ impl OffersContext { hmac: local_hmac_nonref, } }, - OffersContext::InboundPayment {ref payment_hash, } => { + OffersContext::InboundPayment {ref payment_hash, ref nonce, ref hmac, } => { let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut nonce_nonref = Clone::clone(nonce); + let mut hmac_nonref = Clone::clone(hmac); nativeOffersContext::InboundPayment { - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), + nonce: *unsafe { Box::from_raw(nonce_nonref.take_inner()) }, + hmac: hmac_nonref.data, } }, } @@ -726,9 +806,11 @@ impl OffersContext { hmac: local_hmac, } }, - OffersContext::InboundPayment {mut payment_hash, } => { + OffersContext::InboundPayment {mut payment_hash, mut nonce, mut hmac, } => { nativeOffersContext::InboundPayment { - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), + nonce: *unsafe { Box::from_raw(nonce.take_inner()) }, + hmac: hmac.data, } }, } @@ -754,10 +836,14 @@ impl OffersContext { hmac: local_hmac_nonref, } }, - nativeOffersContext::InboundPayment {ref payment_hash, } => { + nativeOffersContext::InboundPayment {ref payment_hash, ref nonce, ref hmac, } => { let mut payment_hash_nonref = Clone::clone(payment_hash); + let mut nonce_nonref = Clone::clone(nonce); + let mut hmac_nonref = Clone::clone(hmac); OffersContext::InboundPayment { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, + nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce_nonref), is_owned: true }, + hmac: crate::c_types::ThirtyTwoBytes { data: hmac_nonref }, } }, } @@ -778,9 +864,11 @@ impl OffersContext { hmac: local_hmac, } }, - nativeOffersContext::InboundPayment {mut payment_hash, } => { + nativeOffersContext::InboundPayment {mut payment_hash, mut nonce, mut hmac, } => { OffersContext::InboundPayment { payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, + nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, + hmac: crate::c_types::ThirtyTwoBytes { data: hmac }, } }, } @@ -822,9 +910,11 @@ pub extern "C" fn OffersContext_outbound_payment(payment_id: crate::c_types::Thi } #[no_mangle] /// Utility method to constructs a new InboundPayment-variant OffersContext -pub extern "C" fn OffersContext_inbound_payment(payment_hash: crate::c_types::ThirtyTwoBytes) -> OffersContext { +pub extern "C" fn OffersContext_inbound_payment(payment_hash: crate::c_types::ThirtyTwoBytes, nonce: crate::lightning::offers::nonce::Nonce, hmac: crate::c_types::ThirtyTwoBytes) -> OffersContext { OffersContext::InboundPayment { payment_hash, + nonce, + hmac, } } /// Get a string which allows debug introspection of a OffersContext object @@ -836,6 +926,128 @@ pub extern "C" fn OffersContext_debug_str_void(o: *const c_void) -> Str { pub extern "C" fn OffersContext_eq(a: &OffersContext, b: &OffersContext) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } +/// Contains data specific to an [`AsyncPaymentsMessage`]. +/// +/// [`AsyncPaymentsMessage`]: crate::onion_message::async_payments::AsyncPaymentsMessage +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum AsyncPaymentsContext { + /// Context contained within the reply [`BlindedMessagePath`] we put in outbound + /// [`HeldHtlcAvailable`] messages, provided back to us in corresponding [`ReleaseHeldHtlc`] + /// messages. + /// + /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + OutboundPayment { + /// ID used when payment to the originating [`Offer`] was initiated. Useful for us to identify + /// which of our pending outbound payments should be released to its often-offline payee. + /// + /// [`Offer`]: crate::offers::offer::Offer + payment_id: crate::c_types::ThirtyTwoBytes, + /// A nonce used for authenticating that a [`ReleaseHeldHtlc`] message is valid for a preceding + /// [`HeldHtlcAvailable`] message. + /// + /// [`ReleaseHeldHtlc`]: crate::onion_message::async_payments::ReleaseHeldHtlc + /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + nonce: crate::lightning::offers::nonce::Nonce, + /// Authentication code for the [`PaymentId`]. + /// + /// Prevents the recipient from being able to deanonymize us by creating a blinded path to us + /// containing the expected [`PaymentId`]. + hmac: crate::c_types::ThirtyTwoBytes, + }, +} +use lightning::blinded_path::message::AsyncPaymentsContext as AsyncPaymentsContextImport; +pub(crate) type nativeAsyncPaymentsContext = AsyncPaymentsContextImport; + +impl AsyncPaymentsContext { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeAsyncPaymentsContext { + match self { + AsyncPaymentsContext::OutboundPayment {ref payment_id, ref nonce, ref hmac, } => { + let mut payment_id_nonref = Clone::clone(payment_id); + let mut nonce_nonref = Clone::clone(nonce); + let mut hmac_nonref = Clone::clone(hmac); + nativeAsyncPaymentsContext::OutboundPayment { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), + nonce: *unsafe { Box::from_raw(nonce_nonref.take_inner()) }, + hmac: hmac_nonref.data, + } + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeAsyncPaymentsContext { + match self { + AsyncPaymentsContext::OutboundPayment {mut payment_id, mut nonce, mut hmac, } => { + nativeAsyncPaymentsContext::OutboundPayment { + payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), + nonce: *unsafe { Box::from_raw(nonce.take_inner()) }, + hmac: hmac.data, + } + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &AsyncPaymentsContextImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeAsyncPaymentsContext) }; + match native { + nativeAsyncPaymentsContext::OutboundPayment {ref payment_id, ref nonce, ref hmac, } => { + let mut payment_id_nonref = Clone::clone(payment_id); + let mut nonce_nonref = Clone::clone(nonce); + let mut hmac_nonref = Clone::clone(hmac); + AsyncPaymentsContext::OutboundPayment { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, + nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce_nonref), is_owned: true }, + hmac: crate::c_types::ThirtyTwoBytes { data: hmac_nonref }, + } + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeAsyncPaymentsContext) -> Self { + match native { + nativeAsyncPaymentsContext::OutboundPayment {mut payment_id, mut nonce, mut hmac, } => { + AsyncPaymentsContext::OutboundPayment { + payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, + nonce: crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, + hmac: crate::c_types::ThirtyTwoBytes { data: hmac }, + } + }, + } + } +} +/// Frees any resources used by the AsyncPaymentsContext +#[no_mangle] +pub extern "C" fn AsyncPaymentsContext_free(this_ptr: AsyncPaymentsContext) { } +/// Creates a copy of the AsyncPaymentsContext +#[no_mangle] +pub extern "C" fn AsyncPaymentsContext_clone(orig: &AsyncPaymentsContext) -> AsyncPaymentsContext { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn AsyncPaymentsContext_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const AsyncPaymentsContext)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn AsyncPaymentsContext_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut AsyncPaymentsContext) }; +} +#[no_mangle] +/// Utility method to constructs a new OutboundPayment-variant AsyncPaymentsContext +pub extern "C" fn AsyncPaymentsContext_outbound_payment(payment_id: crate::c_types::ThirtyTwoBytes, nonce: crate::lightning::offers::nonce::Nonce, hmac: crate::c_types::ThirtyTwoBytes) -> AsyncPaymentsContext { + AsyncPaymentsContext::OutboundPayment { + payment_id, + nonce, + hmac, + } +} +/// Get a string which allows debug introspection of a AsyncPaymentsContext object +pub extern "C" fn AsyncPaymentsContext_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::message::AsyncPaymentsContext }).into()} #[no_mangle] /// Serialize the MessageContext object into a byte array which can be read by MessageContext_read pub extern "C" fn MessageContext_write(obj: &crate::lightning::blinded_path::message::MessageContext) -> crate::c_types::derived::CVec_u8Z { @@ -868,3 +1080,165 @@ pub extern "C" fn OffersContext_read(ser: crate::c_types::u8slice) -> crate::c_t let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::blinded_path::message::OffersContext::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } +#[no_mangle] +/// Serialize the AsyncPaymentsContext object into a byte array which can be read by AsyncPaymentsContext_read +pub extern "C" fn AsyncPaymentsContext_write(obj: &crate::lightning::blinded_path::message::AsyncPaymentsContext) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn AsyncPaymentsContext_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + AsyncPaymentsContext_write(unsafe { &*(obj as *const AsyncPaymentsContext) }) +} +#[no_mangle] +/// Read a AsyncPaymentsContext from a byte array, created by AsyncPaymentsContext_write +pub extern "C" fn AsyncPaymentsContext_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_AsyncPaymentsContextDecodeErrorZ { + 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::blinded_path::message::AsyncPaymentsContext::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} + +use lightning::blinded_path::message::DNSResolverContext as nativeDNSResolverContextImport; +pub(crate) type nativeDNSResolverContext = nativeDNSResolverContextImport; + +/// Contains a simple nonce for use in a blinded path's context. +/// +/// Such a context is required when receiving a [`DNSSECProof`] message. +/// +/// [`DNSSECProof`]: crate::onion_message::dns_resolution::DNSSECProof +#[must_use] +#[repr(C)] +pub struct DNSResolverContext { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeDNSResolverContext, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for DNSResolverContext { + type Target = nativeDNSResolverContext; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for DNSResolverContext { } +unsafe impl core::marker::Sync for DNSResolverContext { } +impl Drop for DNSResolverContext { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeDNSResolverContext>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the DNSResolverContext, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn DNSResolverContext_free(this_obj: DNSResolverContext) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn DNSResolverContext_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDNSResolverContext) }; +} +#[allow(unused)] +impl DNSResolverContext { + pub(crate) fn get_native_ref(&self) -> &'static nativeDNSResolverContext { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDNSResolverContext { + 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 nativeDNSResolverContext { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// A nonce which uniquely describes a DNS resolution. +/// +/// When we receive a DNSSEC proof message, we should check that it was sent over the blinded +/// path we included in the request by comparing a stored nonce with this one. +#[no_mangle] +pub extern "C" fn DNSResolverContext_get_nonce(this_ptr: &DNSResolverContext) -> *const [u8; 16] { + let mut inner_val = &mut this_ptr.get_native_mut_ref().nonce; + inner_val +} +/// A nonce which uniquely describes a DNS resolution. +/// +/// When we receive a DNSSEC proof message, we should check that it was sent over the blinded +/// path we included in the request by comparing a stored nonce with this one. +#[no_mangle] +pub extern "C" fn DNSResolverContext_set_nonce(this_ptr: &mut DNSResolverContext, mut val: crate::c_types::SixteenBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.nonce = val.data; +} +/// Constructs a new DNSResolverContext given each field +#[must_use] +#[no_mangle] +pub extern "C" fn DNSResolverContext_new(mut nonce_arg: crate::c_types::SixteenBytes) -> DNSResolverContext { + DNSResolverContext { inner: ObjOps::heap_alloc(nativeDNSResolverContext { + nonce: nonce_arg.data, + }), is_owned: true } +} +impl Clone for DNSResolverContext { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeDNSResolverContext>::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 DNSResolverContext_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDNSResolverContext)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the DNSResolverContext +pub extern "C" fn DNSResolverContext_clone(orig: &DNSResolverContext) -> DNSResolverContext { + orig.clone() +} +/// Get a string which allows debug introspection of a DNSResolverContext object +pub extern "C" fn DNSResolverContext_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::message::DNSResolverContext }).into()} +/// Generates a non-cryptographic 64-bit hash of the DNSResolverContext. +#[no_mangle] +pub extern "C" fn DNSResolverContext_hash(o: &DNSResolverContext) -> u64 { + if o.inner.is_null() { return 0; } + // 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.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} +/// Checks if two DNSResolverContexts 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 DNSResolverContext_eq(a: &DNSResolverContext, b: &DNSResolverContext) -> 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 } +} +#[no_mangle] +/// Serialize the DNSResolverContext object into a byte array which can be read by DNSResolverContext_read +pub extern "C" fn DNSResolverContext_write(obj: &crate::lightning::blinded_path::message::DNSResolverContext) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn DNSResolverContext_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::blinded_path::message::nativeDNSResolverContext) }) +} +#[no_mangle] +/// Read a DNSResolverContext from a byte array, created by DNSResolverContext_write +pub extern "C" fn DNSResolverContext_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_DNSResolverContextDecodeErrorZ { + 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::blinded_path::message::DNSResolverContext { 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/blinded_path/payment.rs b/lightning-c-bindings/src/lightning/blinded_path/payment.rs index 58be01e..a8623ba 100644 --- a/lightning-c-bindings/src/lightning/blinded_path/payment.rs +++ b/lightning-c-bindings/src/lightning/blinded_path/payment.rs @@ -714,6 +714,8 @@ pub(crate) type nativeReceiveTlvs = nativeReceiveTlvsImport; /// Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and /// may not be valid if received by another lightning implementation. +/// +/// Can only be constructed by calling [`UnauthenticatedReceiveTlvs::authenticate`]. #[must_use] #[repr(C)] pub struct ReceiveTlvs { @@ -769,53 +771,143 @@ impl ReceiveTlvs { Self { inner: self.inner, is_owned: false } } } +impl Clone for ReceiveTlvs { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeReceiveTlvs>::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 ReceiveTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReceiveTlvs)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ReceiveTlvs +pub extern "C" fn ReceiveTlvs_clone(orig: &ReceiveTlvs) -> ReceiveTlvs { + orig.clone() +} +/// Get a string which allows debug introspection of a ReceiveTlvs object +pub extern "C" fn ReceiveTlvs_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::ReceiveTlvs }).into()} +/// Returns the underlying TLVs. +#[must_use] +#[no_mangle] +pub extern "C" fn ReceiveTlvs_tlvs(this_arg: &crate::lightning::blinded_path::payment::ReceiveTlvs) -> crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tlvs(); + crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::blinded_path::payment::UnauthenticatedReceiveTlvs<>) as *mut _) }, is_owned: false } +} + + +use lightning::blinded_path::payment::UnauthenticatedReceiveTlvs as nativeUnauthenticatedReceiveTlvsImport; +pub(crate) type nativeUnauthenticatedReceiveTlvs = nativeUnauthenticatedReceiveTlvsImport; + +/// An unauthenticated [`ReceiveTlvs`]. +#[must_use] +#[repr(C)] +pub struct UnauthenticatedReceiveTlvs { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeUnauthenticatedReceiveTlvs, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for UnauthenticatedReceiveTlvs { + type Target = nativeUnauthenticatedReceiveTlvs; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for UnauthenticatedReceiveTlvs { } +unsafe impl core::marker::Sync for UnauthenticatedReceiveTlvs { } +impl Drop for UnauthenticatedReceiveTlvs { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeUnauthenticatedReceiveTlvs>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the UnauthenticatedReceiveTlvs, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn UnauthenticatedReceiveTlvs_free(this_obj: UnauthenticatedReceiveTlvs) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn UnauthenticatedReceiveTlvs_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnauthenticatedReceiveTlvs) }; +} +#[allow(unused)] +impl UnauthenticatedReceiveTlvs { + pub(crate) fn get_native_ref(&self) -> &'static nativeUnauthenticatedReceiveTlvs { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnauthenticatedReceiveTlvs { + 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 nativeUnauthenticatedReceiveTlvs { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} /// Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. #[no_mangle] -pub extern "C" fn ReceiveTlvs_get_payment_secret(this_ptr: &ReceiveTlvs) -> *const [u8; 32] { +pub extern "C" fn UnauthenticatedReceiveTlvs_get_payment_secret(this_ptr: &UnauthenticatedReceiveTlvs) -> *const [u8; 32] { let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_secret; &inner_val.0 } /// Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together. #[no_mangle] -pub extern "C" fn ReceiveTlvs_set_payment_secret(this_ptr: &mut ReceiveTlvs, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_secret = ::lightning::ln::types::PaymentSecret(val.data); +pub extern "C" fn UnauthenticatedReceiveTlvs_set_payment_secret(this_ptr: &mut UnauthenticatedReceiveTlvs, mut val: crate::c_types::ThirtyTwoBytes) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_secret = ::lightning::types::payment::PaymentSecret(val.data); } /// Constraints for the receiver of this payment. #[no_mangle] -pub extern "C" fn ReceiveTlvs_get_payment_constraints(this_ptr: &ReceiveTlvs) -> crate::lightning::blinded_path::payment::PaymentConstraints { +pub extern "C" fn UnauthenticatedReceiveTlvs_get_payment_constraints(this_ptr: &UnauthenticatedReceiveTlvs) -> crate::lightning::blinded_path::payment::PaymentConstraints { let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_constraints; crate::lightning::blinded_path::payment::PaymentConstraints { inner: unsafe { ObjOps::nonnull_ptr_to_inner((inner_val as *const lightning::blinded_path::payment::PaymentConstraints<>) as *mut _) }, is_owned: false } } /// Constraints for the receiver of this payment. #[no_mangle] -pub extern "C" fn ReceiveTlvs_set_payment_constraints(this_ptr: &mut ReceiveTlvs, mut val: crate::lightning::blinded_path::payment::PaymentConstraints) { +pub extern "C" fn UnauthenticatedReceiveTlvs_set_payment_constraints(this_ptr: &mut UnauthenticatedReceiveTlvs, mut val: crate::lightning::blinded_path::payment::PaymentConstraints) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_constraints = *unsafe { Box::from_raw(val.take_inner()) }; } /// Context for the receiver of this payment. #[no_mangle] -pub extern "C" fn ReceiveTlvs_get_payment_context(this_ptr: &ReceiveTlvs) -> crate::lightning::blinded_path::payment::PaymentContext { +pub extern "C" fn UnauthenticatedReceiveTlvs_get_payment_context(this_ptr: &UnauthenticatedReceiveTlvs) -> crate::lightning::blinded_path::payment::PaymentContext { let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_context; crate::lightning::blinded_path::payment::PaymentContext::from_native(inner_val) } /// Context for the receiver of this payment. #[no_mangle] -pub extern "C" fn ReceiveTlvs_set_payment_context(this_ptr: &mut ReceiveTlvs, mut val: crate::lightning::blinded_path::payment::PaymentContext) { +pub extern "C" fn UnauthenticatedReceiveTlvs_set_payment_context(this_ptr: &mut UnauthenticatedReceiveTlvs, mut val: crate::lightning::blinded_path::payment::PaymentContext) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_context = val.into_native(); } -/// Constructs a new ReceiveTlvs given each field +/// Constructs a new UnauthenticatedReceiveTlvs given each field #[must_use] #[no_mangle] -pub extern "C" fn ReceiveTlvs_new(mut payment_secret_arg: crate::c_types::ThirtyTwoBytes, mut payment_constraints_arg: crate::lightning::blinded_path::payment::PaymentConstraints, mut payment_context_arg: crate::lightning::blinded_path::payment::PaymentContext) -> ReceiveTlvs { - ReceiveTlvs { inner: ObjOps::heap_alloc(nativeReceiveTlvs { - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret_arg.data), +pub extern "C" fn UnauthenticatedReceiveTlvs_new(mut payment_secret_arg: crate::c_types::ThirtyTwoBytes, mut payment_constraints_arg: crate::lightning::blinded_path::payment::PaymentConstraints, mut payment_context_arg: crate::lightning::blinded_path::payment::PaymentContext) -> UnauthenticatedReceiveTlvs { + UnauthenticatedReceiveTlvs { inner: ObjOps::heap_alloc(nativeUnauthenticatedReceiveTlvs { + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret_arg.data), payment_constraints: *unsafe { Box::from_raw(payment_constraints_arg.take_inner()) }, payment_context: payment_context_arg.into_native(), }), is_owned: true } } -impl Clone for ReceiveTlvs { +impl Clone for UnauthenticatedReceiveTlvs { fn clone(&self) -> Self { Self { - inner: if <*mut nativeReceiveTlvs>::is_null(self.inner) { core::ptr::null_mut() } else { + inner: if <*mut nativeUnauthenticatedReceiveTlvs>::is_null(self.inner) { core::ptr::null_mut() } else { ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) }, is_owned: true, } @@ -823,17 +915,26 @@ impl Clone for ReceiveTlvs { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn ReceiveTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeReceiveTlvs)).clone() })) as *mut c_void +pub(crate) extern "C" fn UnauthenticatedReceiveTlvs_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnauthenticatedReceiveTlvs)).clone() })) as *mut c_void } #[no_mangle] -/// Creates a copy of the ReceiveTlvs -pub extern "C" fn ReceiveTlvs_clone(orig: &ReceiveTlvs) -> ReceiveTlvs { +/// Creates a copy of the UnauthenticatedReceiveTlvs +pub extern "C" fn UnauthenticatedReceiveTlvs_clone(orig: &UnauthenticatedReceiveTlvs) -> UnauthenticatedReceiveTlvs { orig.clone() } -/// Get a string which allows debug introspection of a ReceiveTlvs object -pub extern "C" fn ReceiveTlvs_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::ReceiveTlvs }).into()} +/// Get a string which allows debug introspection of a UnauthenticatedReceiveTlvs object +pub extern "C" fn UnauthenticatedReceiveTlvs_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs }).into()} +/// Creates an authenticated [`ReceiveTlvs`], which includes an HMAC and the provide [`Nonce`] +/// that can be use later to verify it authenticity. +#[must_use] +#[no_mangle] +pub extern "C" fn UnauthenticatedReceiveTlvs_authenticate(mut this_arg: crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs, mut nonce: crate::lightning::offers::nonce::Nonce, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::lightning::blinded_path::payment::ReceiveTlvs { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).authenticate(*unsafe { Box::from_raw(nonce.take_inner()) }, expanded_key.get_native_ref()); + crate::lightning::blinded_path::payment::ReceiveTlvs { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + use lightning::blinded_path::payment::PaymentRelay as nativePaymentRelayImport; pub(crate) type nativePaymentRelay = nativePaymentRelayImport; @@ -1088,9 +1189,6 @@ pub extern "C" fn PaymentConstraints_debug_str_void(o: *const c_void) -> Str { #[must_use] #[repr(C)] pub enum PaymentContext { - /// The payment context was unknown. - Unknown( - crate::lightning::blinded_path::payment::UnknownPaymentContext), /// The payment was made for an invoice requested from a BOLT 12 [`Offer`]. /// /// [`Offer`]: crate::offers::offer::Offer @@ -1109,12 +1207,6 @@ impl PaymentContext { #[allow(unused)] pub(crate) fn to_native(&self) -> nativePaymentContext { match self { - PaymentContext::Unknown (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativePaymentContext::Unknown ( - *unsafe { Box::from_raw(a_nonref.take_inner()) }, - ) - }, PaymentContext::Bolt12Offer (ref a, ) => { let mut a_nonref = Clone::clone(a); nativePaymentContext::Bolt12Offer ( @@ -1132,11 +1224,6 @@ impl PaymentContext { #[allow(unused)] pub(crate) fn into_native(self) -> nativePaymentContext { match self { - PaymentContext::Unknown (mut a, ) => { - nativePaymentContext::Unknown ( - *unsafe { Box::from_raw(a.take_inner()) }, - ) - }, PaymentContext::Bolt12Offer (mut a, ) => { nativePaymentContext::Bolt12Offer ( *unsafe { Box::from_raw(a.take_inner()) }, @@ -1153,12 +1240,6 @@ impl PaymentContext { pub(crate) fn from_native(native: &PaymentContextImport) -> Self { let native = unsafe { &*(native as *const _ as *const c_void as *const nativePaymentContext) }; match native { - nativePaymentContext::Unknown (ref a, ) => { - let mut a_nonref = Clone::clone(a); - PaymentContext::Unknown ( - crate::lightning::blinded_path::payment::UnknownPaymentContext { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, - ) - }, nativePaymentContext::Bolt12Offer (ref a, ) => { let mut a_nonref = Clone::clone(a); PaymentContext::Bolt12Offer ( @@ -1176,11 +1257,6 @@ impl PaymentContext { #[allow(unused)] pub(crate) fn native_into(native: nativePaymentContext) -> Self { match native { - nativePaymentContext::Unknown (mut a, ) => { - PaymentContext::Unknown ( - crate::lightning::blinded_path::payment::UnknownPaymentContext { inner: ObjOps::heap_alloc(a), is_owned: true }, - ) - }, nativePaymentContext::Bolt12Offer (mut a, ) => { PaymentContext::Bolt12Offer ( crate::lightning::blinded_path::payment::Bolt12OfferContext { inner: ObjOps::heap_alloc(a), is_owned: true }, @@ -1213,11 +1289,6 @@ pub(crate) extern "C" fn PaymentContext_free_void(this_ptr: *mut c_void) { let _ = unsafe { Box::from_raw(this_ptr as *mut PaymentContext) }; } #[no_mangle] -/// Utility method to constructs a new Unknown-variant PaymentContext -pub extern "C" fn PaymentContext_unknown(a: crate::lightning::blinded_path::payment::UnknownPaymentContext) -> PaymentContext { - PaymentContext::Unknown(a, ) -} -#[no_mangle] /// Utility method to constructs a new Bolt12Offer-variant PaymentContext pub extern "C" fn PaymentContext_bolt12_offer(a: crate::lightning::blinded_path::payment::Bolt12OfferContext) -> PaymentContext { PaymentContext::Bolt12Offer(a, ) @@ -1237,97 +1308,6 @@ pub extern "C" fn PaymentContext_eq(a: &PaymentContext, b: &PaymentContext) -> b if &a.to_native() == &b.to_native() { true } else { false } } -use lightning::blinded_path::payment::UnknownPaymentContext as nativeUnknownPaymentContextImport; -pub(crate) type nativeUnknownPaymentContext = nativeUnknownPaymentContextImport; - -/// An unknown payment context. -#[must_use] -#[repr(C)] -pub struct UnknownPaymentContext { - /// A pointer to the opaque Rust object. - - /// Nearly everywhere, 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 nativeUnknownPaymentContext, - /// Indicates that this is the only struct which contains the same pointer. - - /// Rust 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 core::ops::Deref for UnknownPaymentContext { - type Target = nativeUnknownPaymentContext; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for UnknownPaymentContext { } -unsafe impl core::marker::Sync for UnknownPaymentContext { } -impl Drop for UnknownPaymentContext { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeUnknownPaymentContext>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the UnknownPaymentContext, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn UnknownPaymentContext_free(this_obj: UnknownPaymentContext) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn UnknownPaymentContext_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnknownPaymentContext) }; -} -#[allow(unused)] -impl UnknownPaymentContext { - pub(crate) fn get_native_ref(&self) -> &'static nativeUnknownPaymentContext { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnknownPaymentContext { - 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 nativeUnknownPaymentContext { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -impl Clone for UnknownPaymentContext { - fn clone(&self) -> Self { - Self { - inner: if <*mut nativeUnknownPaymentContext>::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 UnknownPaymentContext_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeUnknownPaymentContext)).clone() })) as *mut c_void -} -#[no_mangle] -/// Creates a copy of the UnknownPaymentContext -pub extern "C" fn UnknownPaymentContext_clone(orig: &UnknownPaymentContext) -> UnknownPaymentContext { - orig.clone() -} -/// Get a string which allows debug introspection of a UnknownPaymentContext object -pub extern "C" fn UnknownPaymentContext_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::blinded_path::payment::UnknownPaymentContext }).into()} -/// Checks if two UnknownPaymentContexts 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 UnknownPaymentContext_eq(a: &UnknownPaymentContext, b: &UnknownPaymentContext) -> 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 } -} - use lightning::blinded_path::payment::Bolt12OfferContext as nativeBolt12OfferContextImport; pub(crate) type nativeBolt12OfferContext = nativeBolt12OfferContextImport; @@ -1580,6 +1560,15 @@ pub(crate) extern "C" fn ReceiveTlvs_write_void(obj: *const c_void) -> crate::c_ crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::blinded_path::payment::nativeReceiveTlvs) }) } #[no_mangle] +/// Serialize the UnauthenticatedReceiveTlvs object into a byte array which can be read by UnauthenticatedReceiveTlvs_read +pub extern "C" fn UnauthenticatedReceiveTlvs_write(obj: &crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn UnauthenticatedReceiveTlvs_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::blinded_path::payment::nativeUnauthenticatedReceiveTlvs) }) +} +#[no_mangle] /// Serialize the PaymentRelay object into a byte array which can be read by PaymentRelay_read pub extern "C" fn PaymentRelay_write(obj: &crate::lightning::blinded_path::payment::PaymentRelay) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) @@ -1628,22 +1617,6 @@ pub extern "C" fn PaymentContext_read(ser: crate::c_types::u8slice) -> crate::c_ local_res } #[no_mangle] -/// Serialize the UnknownPaymentContext object into a byte array which can be read by UnknownPaymentContext_read -pub extern "C" fn UnknownPaymentContext_write(obj: &crate::lightning::blinded_path::payment::UnknownPaymentContext) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn UnknownPaymentContext_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::blinded_path::payment::nativeUnknownPaymentContext) }) -} -#[no_mangle] -/// Read a UnknownPaymentContext from a byte array, created by UnknownPaymentContext_write -pub extern "C" fn UnknownPaymentContext_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_UnknownPaymentContextDecodeErrorZ { - 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::blinded_path::payment::UnknownPaymentContext { 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 Bolt12OfferContext object into a byte array which can be read by Bolt12OfferContext_read pub extern "C" fn Bolt12OfferContext_write(obj: &crate::lightning::blinded_path::payment::Bolt12OfferContext) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) diff --git a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs index 851c182..513b080 100644 --- a/lightning-c-bindings/src/lightning/chain/chainmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/chainmonitor.rs @@ -152,6 +152,13 @@ pub struct Persist { /// /// Archiving the data in a backup location (rather than deleting it fully) is useful for /// hedging against data loss in case of unexpected failure. + /// + /// Note that if a crash occurs during the archiving process, and its implementation is not + /// atomic, a state may emerge with the archival operation only being partially complete. In + /// that scenario, the monitor may still be loaded on startup pending successful completion of + /// the archive process. Additionally, because the archive operation could be retried on + /// restart, this method must in that case be idempotent, ensuring it can handle scenarios where + /// the monitor already exists in the archive. pub archive_persisted_channel: extern "C" fn (this_arg: *const c_void, channel_funding_outpoint: crate::lightning::chain::transaction::OutPoint), /// 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. diff --git a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs index 4a51287..15e3d17 100644 --- a/lightning-c-bindings/src/lightning/chain/channelmonitor.rs +++ b/lightning-c-bindings/src/lightning/chain/channelmonitor.rs @@ -102,11 +102,9 @@ impl ChannelMonitorUpdate { /// [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given /// ChannelMonitor when ChannelManager::channel_monitor_updated is called. /// -/// The only instances we allow where update_id values are not strictly increasing have a -/// special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that -/// will force close the channel by broadcasting the latest commitment transaction or -/// special post-force-close updates, like providing preimages necessary to claim outputs on the -/// broadcast commitment transaction. See its docs for more details. +/// Note that for [`ChannelMonitorUpdate`]s generated on LDK versions prior to 0.1 after the +/// channel was closed, this value may be [`u64::MAX`]. In that case, multiple updates may +/// appear with the same ID, and all should be replayed. /// /// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress #[no_mangle] @@ -122,11 +120,9 @@ pub extern "C" fn ChannelMonitorUpdate_get_update_id(this_ptr: &ChannelMonitorUp /// [`ChannelMonitorUpdateStatus::InProgress`] have been applied to all copies of a given /// ChannelMonitor when ChannelManager::channel_monitor_updated is called. /// -/// The only instances we allow where update_id values are not strictly increasing have a -/// special update ID of [`CLOSED_CHANNEL_UPDATE_ID`]. This update ID is used for updates that -/// will force close the channel by broadcasting the latest commitment transaction or -/// special post-force-close updates, like providing preimages necessary to claim outputs on the -/// broadcast commitment transaction. See its docs for more details. +/// Note that for [`ChannelMonitorUpdate`]s generated on LDK versions prior to 0.1 after the +/// channel was closed, this value may be [`u64::MAX`]. In that case, multiple updates may +/// appear with the same ID, and all should be replayed. /// /// [`ChannelMonitorUpdateStatus::InProgress`]: super::ChannelMonitorUpdateStatus::InProgress #[no_mangle] @@ -187,17 +183,6 @@ pub extern "C" fn ChannelMonitorUpdate_eq(a: &ChannelMonitorUpdate, b: &ChannelM if a.inner.is_null() || b.inner.is_null() { return false; } if a.get_native_ref() == b.get_native_ref() { true } else { false } } -/// The update ID used for a [`ChannelMonitorUpdate`] that is either: -/// -///\t(1) attempting to force close the channel by broadcasting our latest commitment transaction or -///\t(2) providing a preimage (after the channel has been force closed) from a forward link that -///\t\tallows us to spend an HTLC output on this channel's (the backward link's) broadcasted -///\t\tcommitment transaction. -/// -/// No other [`ChannelMonitorUpdate`]s are allowed after force-close. - -#[no_mangle] -pub static CLOSED_CHANNEL_UPDATE_ID: u64 = lightning::chain::channelmonitor::CLOSED_CHANNEL_UPDATE_ID; #[no_mangle] /// Serialize the ChannelMonitorUpdate object into a byte array which can be read by ChannelMonitorUpdate_read pub extern "C" fn ChannelMonitorUpdate_write(obj: &crate::lightning::chain::channelmonitor::ChannelMonitorUpdate) -> crate::c_types::derived::CVec_u8Z { @@ -846,8 +831,8 @@ impl Balance { nativeBalance::ContentiousClaimable { amount_satoshis: amount_satoshis_nonref, timeout_height: timeout_height_nonref, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), - payment_preimage: ::lightning::ln::types::PaymentPreimage(payment_preimage_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_nonref.data), } }, Balance::MaybeTimeoutClaimableHTLC {ref amount_satoshis, ref claimable_height, ref payment_hash, ref outbound_payment, } => { @@ -858,7 +843,7 @@ impl Balance { nativeBalance::MaybeTimeoutClaimableHTLC { amount_satoshis: amount_satoshis_nonref, claimable_height: claimable_height_nonref, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), outbound_payment: outbound_payment_nonref, } }, @@ -869,7 +854,7 @@ impl Balance { nativeBalance::MaybePreimageClaimableHTLC { amount_satoshis: amount_satoshis_nonref, expiry_height: expiry_height_nonref, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), } }, Balance::CounterpartyRevokedOutputClaimable {ref amount_satoshis, } => { @@ -904,15 +889,15 @@ impl Balance { nativeBalance::ContentiousClaimable { amount_satoshis: amount_satoshis, timeout_height: timeout_height, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), - payment_preimage: ::lightning::ln::types::PaymentPreimage(payment_preimage.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage.data), } }, Balance::MaybeTimeoutClaimableHTLC {mut amount_satoshis, mut claimable_height, mut payment_hash, mut outbound_payment, } => { nativeBalance::MaybeTimeoutClaimableHTLC { amount_satoshis: amount_satoshis, claimable_height: claimable_height, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), outbound_payment: outbound_payment, } }, @@ -920,7 +905,7 @@ impl Balance { nativeBalance::MaybePreimageClaimableHTLC { amount_satoshis: amount_satoshis, expiry_height: expiry_height, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), } }, Balance::CounterpartyRevokedOutputClaimable {mut amount_satoshis, } => { @@ -1268,6 +1253,8 @@ pub extern "C" fn ChannelMonitor_update_monitor(this_arg: &crate::lightning::cha /// Gets the update_id from the latest ChannelMonitorUpdate which was applied to this /// ChannelMonitor. +/// +/// Note that for channels closed prior to LDK 0.1, this may return [`u64::MAX`]. #[must_use] #[no_mangle] pub extern "C" fn ChannelMonitor_get_latest_update_id(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor) -> u64 { @@ -1337,8 +1324,8 @@ pub extern "C" fn ChannelMonitor_get_and_clear_pending_monitor_events(this_arg: /// [`BumpTransaction`]: crate::events::Event::BumpTransaction #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_process_pending_events(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, handler: &crate::lightning::events::EventHandler) -> crate::c_types::derived::CResult_NoneReplayEventZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_pending_events(handler); +pub extern "C" fn ChannelMonitor_process_pending_events(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, handler: &crate::lightning::events::EventHandler, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::CResult_NoneReplayEventZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.process_pending_events(handler, logger); 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::events::ReplayEvent { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } @@ -1585,15 +1572,24 @@ pub extern "C" fn ChannelMonitor_get_spendable_outputs(this_arg: &crate::lightni } /// Checks if the monitor is fully resolved. Resolved monitor is one that has claimed all of -/// its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set). +/// its outputs and balances (i.e. [`Self::get_claimable_balances`] returns an empty set) and +/// which does not have any payment preimages for HTLCs which are still pending on other +/// channels. /// -/// This function returns true only if [`Self::get_claimable_balances`] has been empty for at least +/// Additionally may update state to track when the balances set became empty. +/// +/// This function returns a tuple of two booleans, the first indicating whether the monitor is +/// fully resolved, and the second whether the monitor needs persistence to ensure it is +/// reliably marked as resolved within 4032 blocks. +/// +/// The first boolean is true only if [`Self::get_claimable_balances`] has been empty for at least /// 4032 blocks as an additional protection against any bugs resulting in spuriously empty balance sets. #[must_use] #[no_mangle] -pub extern "C" fn ChannelMonitor_is_fully_resolved(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> bool { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_fully_resolved(logger); - ret +pub extern "C" fn ChannelMonitor_check_and_update_full_resolution_status(this_arg: &crate::lightning::chain::channelmonitor::ChannelMonitor, logger: &crate::lightning::util::logger::Logger) -> crate::c_types::derived::C2Tuple_boolboolZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.check_and_update_full_resolution_status(logger); + let (mut orig_ret_0, mut orig_ret_1) = ret; let mut local_ret = (orig_ret_0, orig_ret_1).into(); + local_ret } /// Gets the balances in this channel which are either claimable by us if we were to diff --git a/lightning-c-bindings/src/lightning/events/mod.rs b/lightning-c-bindings/src/lightning/events/mod.rs index 8b4c756..ff28906 100644 --- a/lightning-c-bindings/src/lightning/events/mod.rs +++ b/lightning-c-bindings/src/lightning/events/mod.rs @@ -219,6 +219,10 @@ pub enum PaymentPurpose { /// The context of the payment such as information about the corresponding [`Offer`] and /// [`InvoiceRequest`]. /// + /// This includes the Human Readable Name which the sender indicated they were paying to, + /// for possible recipient disambiguation if you're using a single wildcard DNS entry to + /// resolve to many recipients. + /// /// [`Offer`]: crate::offers::offer::Offer /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest payment_context: crate::lightning::blinded_path::payment::Bolt12OfferContext, @@ -257,39 +261,39 @@ impl PaymentPurpose { match self { PaymentPurpose::Bolt11InvoicePayment {ref payment_preimage, ref payment_secret, } => { let mut payment_preimage_nonref = Clone::clone(payment_preimage); - let mut local_payment_preimage_nonref = { /*payment_preimage_nonref*/ let payment_preimage_nonref_opt = payment_preimage_nonref; if payment_preimage_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_nonref_opt.take() }.data) }})} }; + let mut local_payment_preimage_nonref = { /*payment_preimage_nonref*/ let payment_preimage_nonref_opt = payment_preimage_nonref; if payment_preimage_nonref_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ payment_preimage_nonref_opt.take() }.data) }})} }; let mut payment_secret_nonref = Clone::clone(payment_secret); nativePaymentPurpose::Bolt11InvoicePayment { payment_preimage: local_payment_preimage_nonref, - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret_nonref.data), + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret_nonref.data), } }, PaymentPurpose::Bolt12OfferPayment {ref payment_preimage, ref payment_secret, ref payment_context, } => { let mut payment_preimage_nonref = Clone::clone(payment_preimage); - let mut local_payment_preimage_nonref = { /*payment_preimage_nonref*/ let payment_preimage_nonref_opt = payment_preimage_nonref; if payment_preimage_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_nonref_opt.take() }.data) }})} }; + let mut local_payment_preimage_nonref = { /*payment_preimage_nonref*/ let payment_preimage_nonref_opt = payment_preimage_nonref; if payment_preimage_nonref_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ payment_preimage_nonref_opt.take() }.data) }})} }; let mut payment_secret_nonref = Clone::clone(payment_secret); let mut payment_context_nonref = Clone::clone(payment_context); nativePaymentPurpose::Bolt12OfferPayment { payment_preimage: local_payment_preimage_nonref, - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret_nonref.data), + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret_nonref.data), payment_context: *unsafe { Box::from_raw(payment_context_nonref.take_inner()) }, } }, PaymentPurpose::Bolt12RefundPayment {ref payment_preimage, ref payment_secret, ref payment_context, } => { let mut payment_preimage_nonref = Clone::clone(payment_preimage); - let mut local_payment_preimage_nonref = { /*payment_preimage_nonref*/ let payment_preimage_nonref_opt = payment_preimage_nonref; if payment_preimage_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_nonref_opt.take() }.data) }})} }; + let mut local_payment_preimage_nonref = { /*payment_preimage_nonref*/ let payment_preimage_nonref_opt = payment_preimage_nonref; if payment_preimage_nonref_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ payment_preimage_nonref_opt.take() }.data) }})} }; let mut payment_secret_nonref = Clone::clone(payment_secret); let mut payment_context_nonref = Clone::clone(payment_context); nativePaymentPurpose::Bolt12RefundPayment { payment_preimage: local_payment_preimage_nonref, - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret_nonref.data), + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret_nonref.data), payment_context: *unsafe { Box::from_raw(payment_context_nonref.take_inner()) }, } }, PaymentPurpose::SpontaneousPayment (ref a, ) => { let mut a_nonref = Clone::clone(a); nativePaymentPurpose::SpontaneousPayment ( - ::lightning::ln::types::PaymentPreimage(a_nonref.data), + ::lightning::types::payment::PaymentPreimage(a_nonref.data), ) }, } @@ -298,31 +302,31 @@ impl PaymentPurpose { pub(crate) fn into_native(self) -> nativePaymentPurpose { match self { PaymentPurpose::Bolt11InvoicePayment {mut payment_preimage, mut payment_secret, } => { - let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; + let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; nativePaymentPurpose::Bolt11InvoicePayment { payment_preimage: local_payment_preimage, - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret.data), + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret.data), } }, PaymentPurpose::Bolt12OfferPayment {mut payment_preimage, mut payment_secret, mut payment_context, } => { - let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; + let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; nativePaymentPurpose::Bolt12OfferPayment { payment_preimage: local_payment_preimage, - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret.data), + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret.data), payment_context: *unsafe { Box::from_raw(payment_context.take_inner()) }, } }, PaymentPurpose::Bolt12RefundPayment {mut payment_preimage, mut payment_secret, mut payment_context, } => { - let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; + let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; nativePaymentPurpose::Bolt12RefundPayment { payment_preimage: local_payment_preimage, - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret.data), + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret.data), payment_context: *unsafe { Box::from_raw(payment_context.take_inner()) }, } }, PaymentPurpose::SpontaneousPayment (mut a, ) => { nativePaymentPurpose::SpontaneousPayment ( - ::lightning::ln::types::PaymentPreimage(a.data), + ::lightning::types::payment::PaymentPreimage(a.data), ) }, } @@ -1309,7 +1313,7 @@ impl HTLCDestination { HTLCDestination::FailedPayment {ref payment_hash, } => { let mut payment_hash_nonref = Clone::clone(payment_hash); nativeHTLCDestination::FailedPayment { - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), } }, } @@ -1337,7 +1341,7 @@ impl HTLCDestination { HTLCDestination::InvalidOnion => nativeHTLCDestination::InvalidOnion, HTLCDestination::FailedPayment {mut payment_hash, } => { nativeHTLCDestination::FailedPayment { - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), } }, } @@ -1498,12 +1502,12 @@ pub enum PaymentFailureReason { /// /// [`ChannelManager::abandon_payment`]: crate::ln::channelmanager::ChannelManager::abandon_payment UserAbandoned, - /// We exhausted all of our retry attempts while trying to send the payment, or we - /// exhausted the [`Retry::Timeout`] if the user set one. If at any point a retry - /// attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will + ///We exhausted all of our retry attempts while trying to send the payment, or we + ///exhausted the [`Retry::Timeout`] if the user set one. + /// If at any point a retry attempt failed while being forwarded along the path, an [`Event::PaymentPathFailed`] will /// have come before this. /// - /// [`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout + ///[`Retry::Timeout`]: crate::ln::channelmanager::Retry::Timeout RetriesExhausted, /// The payment expired while retrying, based on the provided /// [`PaymentParameters::expiry_time`]. @@ -1513,11 +1517,15 @@ pub enum PaymentFailureReason { /// [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time /// [`InvoiceRequestExpired`]: Self::InvoiceRequestExpired PaymentExpired, - /// We failed to find a route while retrying the payment. + /// We failed to find a route while sending or retrying the payment. /// /// Note that this generally indicates that we've exhausted the available set of possible /// routes - we tried the payment over a few routes but were not able to find any further /// candidate routes beyond those. + /// + /// Also used for [`BlindedPathCreationFailed`] when downgrading to versions prior to 0.0.124. + /// + /// [`BlindedPathCreationFailed`]: Self::BlindedPathCreationFailed RouteNotFound, /// This error should generally never happen. This likely means that there is a problem with /// your router. @@ -1530,6 +1538,12 @@ pub enum PaymentFailureReason { /// /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest InvoiceRequestRejected, + /// Failed to create a blinded path back to ourselves. + /// We attempted to initiate payment to a static invoice but failed to create a reply path for our + /// [`HeldHtlcAvailable`] message. + /// + /// [`HeldHtlcAvailable`]: crate::onion_message::async_payments::HeldHtlcAvailable + BlindedPathCreationFailed, } use lightning::events::PaymentFailureReason as PaymentFailureReasonImport; pub(crate) type nativePaymentFailureReason = PaymentFailureReasonImport; @@ -1547,6 +1561,7 @@ impl PaymentFailureReason { PaymentFailureReason::UnknownRequiredFeatures => nativePaymentFailureReason::UnknownRequiredFeatures, PaymentFailureReason::InvoiceRequestExpired => nativePaymentFailureReason::InvoiceRequestExpired, PaymentFailureReason::InvoiceRequestRejected => nativePaymentFailureReason::InvoiceRequestRejected, + PaymentFailureReason::BlindedPathCreationFailed => nativePaymentFailureReason::BlindedPathCreationFailed, } } #[allow(unused)] @@ -1561,6 +1576,7 @@ impl PaymentFailureReason { PaymentFailureReason::UnknownRequiredFeatures => nativePaymentFailureReason::UnknownRequiredFeatures, PaymentFailureReason::InvoiceRequestExpired => nativePaymentFailureReason::InvoiceRequestExpired, PaymentFailureReason::InvoiceRequestRejected => nativePaymentFailureReason::InvoiceRequestRejected, + PaymentFailureReason::BlindedPathCreationFailed => nativePaymentFailureReason::BlindedPathCreationFailed, } } #[allow(unused)] @@ -1576,6 +1592,7 @@ impl PaymentFailureReason { nativePaymentFailureReason::UnknownRequiredFeatures => PaymentFailureReason::UnknownRequiredFeatures, nativePaymentFailureReason::InvoiceRequestExpired => PaymentFailureReason::InvoiceRequestExpired, nativePaymentFailureReason::InvoiceRequestRejected => PaymentFailureReason::InvoiceRequestRejected, + nativePaymentFailureReason::BlindedPathCreationFailed => PaymentFailureReason::BlindedPathCreationFailed, } } #[allow(unused)] @@ -1590,6 +1607,7 @@ impl PaymentFailureReason { nativePaymentFailureReason::UnknownRequiredFeatures => PaymentFailureReason::UnknownRequiredFeatures, nativePaymentFailureReason::InvoiceRequestExpired => PaymentFailureReason::InvoiceRequestExpired, nativePaymentFailureReason::InvoiceRequestRejected => PaymentFailureReason::InvoiceRequestRejected, + nativePaymentFailureReason::BlindedPathCreationFailed => PaymentFailureReason::BlindedPathCreationFailed, } } } @@ -1644,6 +1662,10 @@ pub extern "C" fn PaymentFailureReason_invoice_request_expired() -> PaymentFailu /// Utility method to constructs a new InvoiceRequestRejected-variant PaymentFailureReason pub extern "C" fn PaymentFailureReason_invoice_request_rejected() -> PaymentFailureReason { PaymentFailureReason::InvoiceRequestRejected} +#[no_mangle] +/// Utility method to constructs a new BlindedPathCreationFailed-variant PaymentFailureReason +pub extern "C" fn PaymentFailureReason_blinded_path_creation_failed() -> PaymentFailureReason { + PaymentFailureReason::BlindedPathCreationFailed} /// Get a string which allows debug introspection of a PaymentFailureReason object pub extern "C" fn PaymentFailureReason_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::PaymentFailureReason }).into()} @@ -1669,6 +1691,110 @@ pub extern "C" fn PaymentFailureReason_read(ser: crate::c_types::u8slice) -> cra let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_res_0 = if o.is_none() { crate::c_types::derived::COption_PaymentFailureReasonZ::None } else { crate::c_types::derived::COption_PaymentFailureReasonZ::Some( { crate::lightning::events::PaymentFailureReason::native_into(o.unwrap()) }) }; local_res_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; local_res } +/// Used to indicate the kind of funding for this channel by the channel acceptor (us). +/// +/// Allows the differentiation between a request for a dual-funded and non-dual-funded channel. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum InboundChannelFunds { + /// For a non-dual-funded channel, the `push_msat` value from the channel initiator to us. + PushMsat( + u64), + /// Indicates the open request is for a dual funded channel. + /// + /// Note that these channels do not support starting with initial funds pushed from the counterparty, + /// who is the channel opener in this case. + DualFunded, +} +use lightning::events::InboundChannelFunds as InboundChannelFundsImport; +pub(crate) type nativeInboundChannelFunds = InboundChannelFundsImport; + +impl InboundChannelFunds { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeInboundChannelFunds { + match self { + InboundChannelFunds::PushMsat (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeInboundChannelFunds::PushMsat ( + a_nonref, + ) + }, + InboundChannelFunds::DualFunded => nativeInboundChannelFunds::DualFunded, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeInboundChannelFunds { + match self { + InboundChannelFunds::PushMsat (mut a, ) => { + nativeInboundChannelFunds::PushMsat ( + a, + ) + }, + InboundChannelFunds::DualFunded => nativeInboundChannelFunds::DualFunded, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &InboundChannelFundsImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeInboundChannelFunds) }; + match native { + nativeInboundChannelFunds::PushMsat (ref a, ) => { + let mut a_nonref = Clone::clone(a); + InboundChannelFunds::PushMsat ( + a_nonref, + ) + }, + nativeInboundChannelFunds::DualFunded => InboundChannelFunds::DualFunded, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeInboundChannelFunds) -> Self { + match native { + nativeInboundChannelFunds::PushMsat (mut a, ) => { + InboundChannelFunds::PushMsat ( + a, + ) + }, + nativeInboundChannelFunds::DualFunded => InboundChannelFunds::DualFunded, + } + } +} +/// Frees any resources used by the InboundChannelFunds +#[no_mangle] +pub extern "C" fn InboundChannelFunds_free(this_ptr: InboundChannelFunds) { } +/// Creates a copy of the InboundChannelFunds +#[no_mangle] +pub extern "C" fn InboundChannelFunds_clone(orig: &InboundChannelFunds) -> InboundChannelFunds { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InboundChannelFunds_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const InboundChannelFunds)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn InboundChannelFunds_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut InboundChannelFunds) }; +} +#[no_mangle] +/// Utility method to constructs a new PushMsat-variant InboundChannelFunds +pub extern "C" fn InboundChannelFunds_push_msat(a: u64) -> InboundChannelFunds { + InboundChannelFunds::PushMsat(a, ) +} +#[no_mangle] +/// Utility method to constructs a new DualFunded-variant InboundChannelFunds +pub extern "C" fn InboundChannelFunds_dual_funded() -> InboundChannelFunds { + InboundChannelFunds::DualFunded} +/// Get a string which allows debug introspection of a InboundChannelFunds object +pub extern "C" fn InboundChannelFunds_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::events::InboundChannelFunds }).into()} +/// Checks if two InboundChannelFundss contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn InboundChannelFunds_eq(a: &InboundChannelFunds, b: &InboundChannelFunds) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} /// An Event which you should probably take some action in response to. /// /// Note that while Writeable and Readable are implemented for Event, you probably shouldn't use @@ -1836,6 +1962,14 @@ pub enum Event { /// /// [`ChannelManager::claim_funds`]: crate::ln::channelmanager::ChannelManager::claim_funds claim_deadline: crate::c_types::derived::COption_u32Z, + /// A unique ID describing this payment (derived from the list of HTLCs in the payment). + /// + /// Payers may pay for the same [`PaymentHash`] multiple times (though this is unsafe and + /// an intermediary node may steal the funds). Thus, in order to accurately track when + /// payments are received and claimed, you should use this identifier. + /// + /// Only filled in for payments received on LDK versions 0.1 and higher. + payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, }, /// Indicates a payment has been claimed and we've received money! /// @@ -1887,6 +2021,14 @@ pub enum Event { /// /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None onion_fields: crate::lightning::ln::outbound_payment::RecipientOnionFields, + /// A unique ID describing this payment (derived from the list of HTLCs in the payment). + /// + /// Payers may pay for the same [`PaymentHash`] multiple times (though this is unsafe and + /// an intermediary node may steal the funds). Thus, in order to accurately track when + /// payments are received and claimed, you should use this identifier. + /// + /// Only filled in for payments received on LDK versions 0.1 and higher. + payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ, }, /// Indicates that a peer connection with a node is needed in order to send an [`OnionMessage`]. /// @@ -2233,6 +2375,20 @@ pub enum Event { /// caveat described for the `total_fee_earned_msat` field. Moreover it will be `None` for /// events generated or serialized by versions prior to 0.0.122. next_user_channel_id: crate::c_types::derived::COption_U128Z, + /// The node id of the previous node. + /// + /// This is only `None` for HTLCs received prior to 0.1 or for events serialized by + /// versions prior to 0.1 + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + prev_node_id: crate::c_types::PublicKey, + /// The node id of the next node. + /// + /// This is only `None` for HTLCs received prior to 0.1 or for events serialized by + /// versions prior to 0.1 + /// + /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None + next_node_id: crate::c_types::PublicKey, /// The total fee, in milli-satoshis, which was earned as a result of the payment. /// /// Note that if we force-closed the channel over which we forwarded an HTLC while the HTLC @@ -2379,6 +2535,17 @@ pub enum Event { /// /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None channel_funding_txo: crate::lightning::chain::transaction::OutPoint, + /// An upper bound on the our last local balance in msats before the channel was closed. + /// + /// Will overstate our balance as it ignores pending outbound HTLCs and transaction fees. + /// + /// For more accurate balances including fee information see + /// [`ChainMonitor::get_claimable_balances`]. + /// + /// This field will be `None` only for objects serialized prior to LDK 0.1. + /// + /// [`ChainMonitor::get_claimable_balances`]: crate::chain::chainmonitor::ChainMonitor::get_claimable_balances + last_local_balance_msat: crate::c_types::derived::COption_u64Z, }, /// Used to indicate to the user that they can abandon the funding transaction and recycle the /// inputs for another purpose. @@ -2396,16 +2563,17 @@ pub enum Event { }, /// Indicates a request to open a new channel by a peer. /// - /// To accept the request, call [`ChannelManager::accept_inbound_channel`]. To reject the request, - /// call [`ChannelManager::force_close_without_broadcasting_txn`]. Note that a ['ChannelClosed`] - /// event will _not_ be triggered if the channel is rejected. + /// To accept the request (and in the case of a dual-funded channel, not contribute funds), + /// call [`ChannelManager::accept_inbound_channel`]. + /// To reject the request, call [`ChannelManager::force_close_without_broadcasting_txn`]. + /// Note that a ['ChannelClosed`] event will _not_ be triggered if the channel is rejected. /// /// The event is only triggered when a new open channel request is received and the /// [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. /// /// # Failure Behavior and Persistence /// This event will eventually be replayed after failures-to-handle (i.e., the event handler - /// returning `Err(ReplayEvent ())`) and will be persisted across restarts. + /// returning `Err(ReplayEvent ())`) and won't be persisted across restarts. /// /// [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel /// [`ChannelManager::force_close_without_broadcasting_txn`]: crate::ln::channelmanager::ChannelManager::force_close_without_broadcasting_txn @@ -2432,8 +2600,10 @@ pub enum Event { counterparty_node_id: crate::c_types::PublicKey, /// The channel value of the requested channel. funding_satoshis: u64, - /// Our starting balance in the channel if the request is accepted, in milli-satoshi. - push_msat: u64, + /// If `channel_negotiation_type` is `InboundChannelFunds::DualFunded`, this indicates that the peer wishes to + /// open a dual-funded channel. Otherwise, this field will be `InboundChannelFunds::PushMsats`, + /// indicating the `push_msats` value our peer is pushing to us for a non-dual-funded channel. + channel_negotiation_type: crate::lightning::events::InboundChannelFunds, /// The features that this channel will operate with. If you reject the channel, a /// well-behaved counterparty may automatically re-attempt the channel with a new set of /// feature flags. @@ -2559,7 +2729,7 @@ impl Event { former_temporary_channel_id: *unsafe { Box::from_raw(former_temporary_channel_id_nonref.take_inner()) }, } }, - Event::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, ref claim_deadline, } => { + Event::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, ref claim_deadline, ref payment_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); @@ -2574,9 +2744,11 @@ impl Event { 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() }})} }; let mut claim_deadline_nonref = Clone::clone(claim_deadline); let mut local_claim_deadline_nonref = if claim_deadline_nonref.is_some() { Some( { claim_deadline_nonref.take() }) } else { None }; + let mut payment_id_nonref = Clone::clone(payment_id); + let mut local_payment_id_nonref = { /*payment_id_nonref*/ let payment_id_nonref_opt = payment_id_nonref; if payment_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_nonref_opt.take() }.data) }})} }; nativeEvent::PaymentClaimable { receiver_node_id: local_receiver_node_id_nonref, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), onion_fields: local_onion_fields_nonref, amount_msat: amount_msat_nonref, counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat_nonref, @@ -2584,9 +2756,10 @@ impl Event { via_channel_id: local_via_channel_id_nonref, via_user_channel_id: local_via_user_channel_id_nonref, claim_deadline: local_claim_deadline_nonref, + payment_id: local_payment_id_nonref, } }, - Event::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref htlcs, ref sender_intended_total_msat, ref onion_fields, } => { + Event::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref htlcs, ref sender_intended_total_msat, ref onion_fields, ref payment_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); @@ -2598,14 +2771,17 @@ impl Event { let mut local_sender_intended_total_msat_nonref = if sender_intended_total_msat_nonref.is_some() { Some( { sender_intended_total_msat_nonref.take() }) } else { None }; let mut onion_fields_nonref = Clone::clone(onion_fields); let mut local_onion_fields_nonref = if onion_fields_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(onion_fields_nonref.take_inner()) } }) }; + let mut payment_id_nonref = Clone::clone(payment_id); + let mut local_payment_id_nonref = { /*payment_id_nonref*/ let payment_id_nonref_opt = payment_id_nonref; if payment_id_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_nonref_opt.take() }.data) }})} }; nativeEvent::PaymentClaimed { receiver_node_id: local_receiver_node_id_nonref, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), amount_msat: amount_msat_nonref, purpose: purpose_nonref.into_native(), htlcs: local_htlcs_nonref, sender_intended_total_msat: local_sender_intended_total_msat_nonref, onion_fields: local_onion_fields_nonref, + payment_id: local_payment_id_nonref, } }, Event::ConnectionNeeded {ref node_id, ref addresses, } => { @@ -2640,15 +2816,15 @@ impl Event { 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, - payment_preimage: ::lightning::ln::types::PaymentPreimage(payment_preimage_nonref.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), fee_paid_msat: local_fee_paid_msat_nonref, } }, Event::PaymentFailed {ref payment_id, ref payment_hash, ref reason, } => { let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); - let mut local_payment_hash_nonref = { /*payment_hash_nonref*/ let payment_hash_nonref_opt = payment_hash_nonref; if payment_hash_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; + let mut local_payment_hash_nonref = { /*payment_hash_nonref*/ let payment_hash_nonref_opt = payment_hash_nonref; if payment_hash_nonref_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; let mut reason_nonref = Clone::clone(reason); let mut local_reason_nonref = { /*reason_nonref*/ let reason_nonref_opt = reason_nonref; if reason_nonref_opt.is_none() { None } else { Some({ { { reason_nonref_opt.take() }.into_native() }})} }; nativeEvent::PaymentFailed { @@ -2660,7 +2836,7 @@ impl Event { Event::PaymentPathSuccessful {ref payment_id, ref payment_hash, ref path, } => { let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); - let mut local_payment_hash_nonref = { /*payment_hash_nonref*/ let payment_hash_nonref_opt = payment_hash_nonref; if payment_hash_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; + let mut local_payment_hash_nonref = { /*payment_hash_nonref*/ let payment_hash_nonref_opt = payment_hash_nonref; if payment_hash_nonref_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; let mut path_nonref = Clone::clone(path); nativeEvent::PaymentPathSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), @@ -2679,7 +2855,7 @@ impl Event { let mut local_short_channel_id_nonref = if short_channel_id_nonref.is_some() { Some( { short_channel_id_nonref.take() }) } else { None }; nativeEvent::PaymentPathFailed { payment_id: local_payment_id_nonref, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), payment_failed_permanently: payment_failed_permanently_nonref, failure: failure_nonref.into_native(), path: *unsafe { Box::from_raw(path_nonref.take_inner()) }, @@ -2692,7 +2868,7 @@ impl Event { let mut path_nonref = Clone::clone(path); nativeEvent::ProbeSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), path: *unsafe { Box::from_raw(path_nonref.take_inner()) }, } }, @@ -2704,7 +2880,7 @@ impl Event { 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), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), path: *unsafe { Box::from_raw(path_nonref.take_inner()) }, short_channel_id: local_short_channel_id_nonref, } @@ -2724,7 +2900,7 @@ impl Event { 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::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), inbound_amount_msat: inbound_amount_msat_nonref, expected_outbound_amount_msat: expected_outbound_amount_msat_nonref, } @@ -2739,7 +2915,7 @@ impl Event { channel_id: local_channel_id_nonref, } }, - Event::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref prev_user_channel_id, ref next_user_channel_id, ref total_fee_earned_msat, ref skimmed_fee_msat, ref claim_from_onchain_tx, ref outbound_amount_forwarded_msat, } => { + Event::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref prev_user_channel_id, ref next_user_channel_id, ref prev_node_id, ref next_node_id, ref total_fee_earned_msat, ref skimmed_fee_msat, ref claim_from_onchain_tx, ref outbound_amount_forwarded_msat, } => { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); let mut local_prev_channel_id_nonref = if prev_channel_id_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(prev_channel_id_nonref.take_inner()) } }) }; let mut next_channel_id_nonref = Clone::clone(next_channel_id); @@ -2748,6 +2924,10 @@ impl Event { let mut local_prev_user_channel_id_nonref = { /*prev_user_channel_id_nonref*/ let prev_user_channel_id_nonref_opt = prev_user_channel_id_nonref; if prev_user_channel_id_nonref_opt.is_none() { None } else { Some({ { { prev_user_channel_id_nonref_opt.take() }.into() }})} }; let mut next_user_channel_id_nonref = Clone::clone(next_user_channel_id); let mut local_next_user_channel_id_nonref = { /*next_user_channel_id_nonref*/ let next_user_channel_id_nonref_opt = next_user_channel_id_nonref; if next_user_channel_id_nonref_opt.is_none() { None } else { Some({ { { next_user_channel_id_nonref_opt.take() }.into() }})} }; + let mut prev_node_id_nonref = Clone::clone(prev_node_id); + let mut local_prev_node_id_nonref = if prev_node_id_nonref.is_null() { None } else { Some( { prev_node_id_nonref.into_rust() }) }; + let mut next_node_id_nonref = Clone::clone(next_node_id); + let mut local_next_node_id_nonref = if next_node_id_nonref.is_null() { None } else { Some( { next_node_id_nonref.into_rust() }) }; let mut total_fee_earned_msat_nonref = Clone::clone(total_fee_earned_msat); let mut local_total_fee_earned_msat_nonref = if total_fee_earned_msat_nonref.is_some() { Some( { total_fee_earned_msat_nonref.take() }) } else { None }; let mut skimmed_fee_msat_nonref = Clone::clone(skimmed_fee_msat); @@ -2760,6 +2940,8 @@ impl Event { next_channel_id: local_next_channel_id_nonref, prev_user_channel_id: local_prev_user_channel_id_nonref, next_user_channel_id: local_next_user_channel_id_nonref, + prev_node_id: local_prev_node_id_nonref, + next_node_id: local_next_node_id_nonref, total_fee_earned_msat: local_total_fee_earned_msat_nonref, skimmed_fee_msat: local_skimmed_fee_msat_nonref, claim_from_onchain_tx: claim_from_onchain_tx_nonref, @@ -2796,7 +2978,7 @@ impl Event { channel_type: *unsafe { Box::from_raw(channel_type_nonref.take_inner()) }, } }, - Event::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo, } => { + Event::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo, ref last_local_balance_msat, } => { 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); @@ -2806,6 +2988,8 @@ impl Event { let mut local_channel_capacity_sats_nonref = if channel_capacity_sats_nonref.is_some() { Some( { channel_capacity_sats_nonref.take() }) } else { None }; let mut channel_funding_txo_nonref = Clone::clone(channel_funding_txo); let mut local_channel_funding_txo_nonref = if channel_funding_txo_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_funding_txo_nonref.take_inner()) } }) }; + let mut last_local_balance_msat_nonref = Clone::clone(last_local_balance_msat); + let mut local_last_local_balance_msat_nonref = if last_local_balance_msat_nonref.is_some() { Some( { last_local_balance_msat_nonref.take() }) } else { None }; nativeEvent::ChannelClosed { channel_id: *unsafe { Box::from_raw(channel_id_nonref.take_inner()) }, user_channel_id: user_channel_id_nonref.into(), @@ -2813,6 +2997,7 @@ impl Event { counterparty_node_id: local_counterparty_node_id_nonref, channel_capacity_sats: local_channel_capacity_sats_nonref, channel_funding_txo: local_channel_funding_txo_nonref, + last_local_balance_msat: local_last_local_balance_msat_nonref, } }, Event::DiscardFunding {ref channel_id, ref funding_info, } => { @@ -2823,11 +3008,11 @@ impl Event { funding_info: funding_info_nonref.into_native(), } }, - Event::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref push_msat, ref channel_type, ref is_announced, ref params, } => { + Event::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref channel_negotiation_type, ref channel_type, ref is_announced, ref params, } => { 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_negotiation_type_nonref = Clone::clone(channel_negotiation_type); let mut channel_type_nonref = Clone::clone(channel_type); let mut is_announced_nonref = Clone::clone(is_announced); let mut params_nonref = Clone::clone(params); @@ -2835,7 +3020,7 @@ impl Event { temporary_channel_id: *unsafe { Box::from_raw(temporary_channel_id_nonref.take_inner()) }, counterparty_node_id: counterparty_node_id_nonref.into_rust(), funding_satoshis: funding_satoshis_nonref, - push_msat: push_msat_nonref, + channel_negotiation_type: channel_negotiation_type_nonref.into_native(), channel_type: *unsafe { Box::from_raw(channel_type_nonref.take_inner()) }, is_announced: is_announced_nonref, params: *unsafe { Box::from_raw(params_nonref.take_inner()) }, @@ -2892,15 +3077,16 @@ impl Event { former_temporary_channel_id: *unsafe { Box::from_raw(former_temporary_channel_id.take_inner()) }, } }, - Event::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, mut claim_deadline, } => { + Event::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, mut claim_deadline, mut payment_id, } => { let mut local_receiver_node_id = if receiver_node_id.is_null() { None } else { Some( { receiver_node_id.into_rust() }) }; let mut local_onion_fields = if onion_fields.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(onion_fields.take_inner()) } }) }; let mut local_via_channel_id = if via_channel_id.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(via_channel_id.take_inner()) } }) }; 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() }})} }; let mut local_claim_deadline = if claim_deadline.is_some() { Some( { claim_deadline.take() }) } else { None }; + let mut local_payment_id = { /*payment_id*/ let payment_id_opt = payment_id; if payment_id_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_opt.take() }.data) }})} }; nativeEvent::PaymentClaimable { receiver_node_id: local_receiver_node_id, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), onion_fields: local_onion_fields, amount_msat: amount_msat, counterparty_skimmed_fee_msat: counterparty_skimmed_fee_msat, @@ -2908,21 +3094,24 @@ impl Event { via_channel_id: local_via_channel_id, via_user_channel_id: local_via_user_channel_id, claim_deadline: local_claim_deadline, + payment_id: local_payment_id, } }, - Event::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut htlcs, mut sender_intended_total_msat, mut onion_fields, } => { + Event::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut htlcs, mut sender_intended_total_msat, mut onion_fields, mut payment_id, } => { let mut local_receiver_node_id = if receiver_node_id.is_null() { None } else { Some( { receiver_node_id.into_rust() }) }; let mut local_htlcs = Vec::new(); for mut item in htlcs.into_rust().drain(..) { local_htlcs.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; let mut local_sender_intended_total_msat = if sender_intended_total_msat.is_some() { Some( { sender_intended_total_msat.take() }) } else { None }; let mut local_onion_fields = if onion_fields.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(onion_fields.take_inner()) } }) }; + let mut local_payment_id = { /*payment_id*/ let payment_id_opt = payment_id; if payment_id_opt.is_none() { None } else { Some({ { ::lightning::ln::channelmanager::PaymentId({ payment_id_opt.take() }.data) }})} }; nativeEvent::PaymentClaimed { receiver_node_id: local_receiver_node_id, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), amount_msat: amount_msat, purpose: purpose.into_native(), htlcs: local_htlcs, sender_intended_total_msat: local_sender_intended_total_msat, onion_fields: local_onion_fields, + payment_id: local_payment_id, } }, Event::ConnectionNeeded {mut node_id, mut addresses, } => { @@ -2947,13 +3136,13 @@ impl Event { let mut local_fee_paid_msat = if fee_paid_msat.is_some() { Some( { fee_paid_msat.take() }) } else { None }; nativeEvent::PaymentSent { payment_id: local_payment_id, - payment_preimage: ::lightning::ln::types::PaymentPreimage(payment_preimage.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), fee_paid_msat: local_fee_paid_msat, } }, Event::PaymentFailed {mut payment_id, mut payment_hash, mut reason, } => { - let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_opt.take() }.data) }})} }; + let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_opt.take() }.data) }})} }; let mut local_reason = { /*reason*/ let reason_opt = reason; if reason_opt.is_none() { None } else { Some({ { { reason_opt.take() }.into_native() }})} }; nativeEvent::PaymentFailed { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), @@ -2962,7 +3151,7 @@ impl Event { } }, Event::PaymentPathSuccessful {mut payment_id, mut payment_hash, mut path, } => { - let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_opt.take() }.data) }})} }; + let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_opt.take() }.data) }})} }; nativeEvent::PaymentPathSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), payment_hash: local_payment_hash, @@ -2974,7 +3163,7 @@ impl Event { let mut local_short_channel_id = if short_channel_id.is_some() { Some( { short_channel_id.take() }) } else { None }; nativeEvent::PaymentPathFailed { payment_id: local_payment_id, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), payment_failed_permanently: payment_failed_permanently, failure: failure.into_native(), path: *unsafe { Box::from_raw(path.take_inner()) }, @@ -2984,7 +3173,7 @@ impl Event { Event::ProbeSuccessful {mut payment_id, mut payment_hash, mut path, } => { nativeEvent::ProbeSuccessful { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), path: *unsafe { Box::from_raw(path.take_inner()) }, } }, @@ -2992,7 +3181,7 @@ impl Event { let mut local_short_channel_id = if short_channel_id.is_some() { Some( { short_channel_id.take() }) } else { None }; nativeEvent::ProbeFailed { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), path: *unsafe { Box::from_raw(path.take_inner()) }, short_channel_id: local_short_channel_id, } @@ -3006,7 +3195,7 @@ impl Event { nativeEvent::HTLCIntercepted { intercept_id: ::lightning::ln::channelmanager::InterceptId(intercept_id.data), requested_next_hop_scid: requested_next_hop_scid, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), inbound_amount_msat: inbound_amount_msat, expected_outbound_amount_msat: expected_outbound_amount_msat, } @@ -3019,11 +3208,13 @@ impl Event { channel_id: local_channel_id, } }, - Event::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut prev_user_channel_id, mut next_user_channel_id, mut total_fee_earned_msat, mut skimmed_fee_msat, mut claim_from_onchain_tx, mut outbound_amount_forwarded_msat, } => { + Event::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut prev_user_channel_id, mut next_user_channel_id, mut prev_node_id, mut next_node_id, mut total_fee_earned_msat, mut skimmed_fee_msat, mut claim_from_onchain_tx, mut outbound_amount_forwarded_msat, } => { let mut local_prev_channel_id = if prev_channel_id.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(prev_channel_id.take_inner()) } }) }; let mut local_next_channel_id = if next_channel_id.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(next_channel_id.take_inner()) } }) }; let mut local_prev_user_channel_id = { /*prev_user_channel_id*/ let prev_user_channel_id_opt = prev_user_channel_id; if prev_user_channel_id_opt.is_none() { None } else { Some({ { { prev_user_channel_id_opt.take() }.into() }})} }; let mut local_next_user_channel_id = { /*next_user_channel_id*/ let next_user_channel_id_opt = next_user_channel_id; if next_user_channel_id_opt.is_none() { None } else { Some({ { { next_user_channel_id_opt.take() }.into() }})} }; + let mut local_prev_node_id = if prev_node_id.is_null() { None } else { Some( { prev_node_id.into_rust() }) }; + let mut local_next_node_id = if next_node_id.is_null() { None } else { Some( { next_node_id.into_rust() }) }; let mut local_total_fee_earned_msat = if total_fee_earned_msat.is_some() { Some( { total_fee_earned_msat.take() }) } else { None }; let mut local_skimmed_fee_msat = if skimmed_fee_msat.is_some() { Some( { skimmed_fee_msat.take() }) } else { None }; let mut local_outbound_amount_forwarded_msat = if outbound_amount_forwarded_msat.is_some() { Some( { outbound_amount_forwarded_msat.take() }) } else { None }; @@ -3032,6 +3223,8 @@ impl Event { next_channel_id: local_next_channel_id, prev_user_channel_id: local_prev_user_channel_id, next_user_channel_id: local_next_user_channel_id, + prev_node_id: local_prev_node_id, + next_node_id: local_next_node_id, total_fee_earned_msat: local_total_fee_earned_msat, skimmed_fee_msat: local_skimmed_fee_msat, claim_from_onchain_tx: claim_from_onchain_tx, @@ -3058,10 +3251,11 @@ impl Event { channel_type: *unsafe { Box::from_raw(channel_type.take_inner()) }, } }, - Event::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, mut counterparty_node_id, mut channel_capacity_sats, mut channel_funding_txo, } => { + Event::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, mut counterparty_node_id, mut channel_capacity_sats, mut channel_funding_txo, mut last_local_balance_msat, } => { let mut local_counterparty_node_id = if counterparty_node_id.is_null() { None } else { Some( { counterparty_node_id.into_rust() }) }; let mut local_channel_capacity_sats = if channel_capacity_sats.is_some() { Some( { channel_capacity_sats.take() }) } else { None }; let mut local_channel_funding_txo = if channel_funding_txo.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_funding_txo.take_inner()) } }) }; + let mut local_last_local_balance_msat = if last_local_balance_msat.is_some() { Some( { last_local_balance_msat.take() }) } else { None }; nativeEvent::ChannelClosed { channel_id: *unsafe { Box::from_raw(channel_id.take_inner()) }, user_channel_id: user_channel_id.into(), @@ -3069,6 +3263,7 @@ impl Event { counterparty_node_id: local_counterparty_node_id, channel_capacity_sats: local_channel_capacity_sats, channel_funding_txo: local_channel_funding_txo, + last_local_balance_msat: local_last_local_balance_msat, } }, Event::DiscardFunding {mut channel_id, mut funding_info, } => { @@ -3077,12 +3272,12 @@ impl Event { funding_info: funding_info.into_native(), } }, - Event::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut push_msat, mut channel_type, mut is_announced, mut params, } => { + Event::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut channel_negotiation_type, mut channel_type, mut is_announced, mut params, } => { nativeEvent::OpenChannelRequest { temporary_channel_id: *unsafe { Box::from_raw(temporary_channel_id.take_inner()) }, counterparty_node_id: counterparty_node_id.into_rust(), funding_satoshis: funding_satoshis, - push_msat: push_msat, + channel_negotiation_type: channel_negotiation_type.into_native(), channel_type: *unsafe { Box::from_raw(channel_type.take_inner()) }, is_announced: is_announced, params: *unsafe { Box::from_raw(params.take_inner()) }, @@ -3144,7 +3339,7 @@ impl Event { former_temporary_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(former_temporary_channel_id_nonref), is_owned: true }, } }, - nativeEvent::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, ref claim_deadline, } => { + nativeEvent::PaymentClaimable {ref receiver_node_id, ref payment_hash, ref onion_fields, ref amount_msat, ref counterparty_skimmed_fee_msat, ref purpose, ref via_channel_id, ref via_user_channel_id, ref claim_deadline, ref payment_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); @@ -3159,6 +3354,8 @@ impl Event { 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() }) }; let mut claim_deadline_nonref = Clone::clone(claim_deadline); let mut local_claim_deadline_nonref = if claim_deadline_nonref.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { claim_deadline_nonref.unwrap() }) }; + let mut payment_id_nonref = Clone::clone(payment_id); + let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.unwrap().0 } }) }; Event::PaymentClaimable { receiver_node_id: local_receiver_node_id_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, @@ -3169,9 +3366,10 @@ impl Event { via_channel_id: local_via_channel_id_nonref, via_user_channel_id: local_via_user_channel_id_nonref, claim_deadline: local_claim_deadline_nonref, + payment_id: local_payment_id_nonref, } }, - nativeEvent::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref htlcs, ref sender_intended_total_msat, ref onion_fields, } => { + nativeEvent::PaymentClaimed {ref receiver_node_id, ref payment_hash, ref amount_msat, ref purpose, ref htlcs, ref sender_intended_total_msat, ref onion_fields, ref payment_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); @@ -3183,6 +3381,8 @@ impl Event { let mut local_sender_intended_total_msat_nonref = if sender_intended_total_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { sender_intended_total_msat_nonref.unwrap() }) }; let mut onion_fields_nonref = Clone::clone(onion_fields); let mut local_onion_fields_nonref = crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: if onion_fields_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((onion_fields_nonref.unwrap())) } }, is_owned: true }; + let mut payment_id_nonref = Clone::clone(payment_id); + let mut local_payment_id_nonref = if payment_id_nonref.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.unwrap().0 } }) }; Event::PaymentClaimed { receiver_node_id: local_receiver_node_id_nonref, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash_nonref.0 }, @@ -3191,6 +3391,7 @@ impl Event { htlcs: local_htlcs_nonref.into(), sender_intended_total_msat: local_sender_intended_total_msat_nonref, onion_fields: local_onion_fields_nonref, + payment_id: local_payment_id_nonref, } }, nativeEvent::ConnectionNeeded {ref node_id, ref addresses, } => { @@ -3324,7 +3525,7 @@ impl Event { channel_id: local_channel_id_nonref, } }, - nativeEvent::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref prev_user_channel_id, ref next_user_channel_id, ref total_fee_earned_msat, ref skimmed_fee_msat, ref claim_from_onchain_tx, ref outbound_amount_forwarded_msat, } => { + nativeEvent::PaymentForwarded {ref prev_channel_id, ref next_channel_id, ref prev_user_channel_id, ref next_user_channel_id, ref prev_node_id, ref next_node_id, ref total_fee_earned_msat, ref skimmed_fee_msat, ref claim_from_onchain_tx, ref outbound_amount_forwarded_msat, } => { let mut prev_channel_id_nonref = Clone::clone(prev_channel_id); let mut local_prev_channel_id_nonref = crate::lightning::ln::types::ChannelId { inner: if prev_channel_id_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((prev_channel_id_nonref.unwrap())) } }, is_owned: true }; let mut next_channel_id_nonref = Clone::clone(next_channel_id); @@ -3333,6 +3534,10 @@ impl Event { let mut local_prev_user_channel_id_nonref = if prev_user_channel_id_nonref.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { prev_user_channel_id_nonref.unwrap().into() }) }; let mut next_user_channel_id_nonref = Clone::clone(next_user_channel_id); let mut local_next_user_channel_id_nonref = if next_user_channel_id_nonref.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { next_user_channel_id_nonref.unwrap().into() }) }; + let mut prev_node_id_nonref = Clone::clone(prev_node_id); + let mut local_prev_node_id_nonref = if prev_node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(prev_node_id_nonref.unwrap())) } }; + let mut next_node_id_nonref = Clone::clone(next_node_id); + let mut local_next_node_id_nonref = if next_node_id_nonref.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(next_node_id_nonref.unwrap())) } }; let mut total_fee_earned_msat_nonref = Clone::clone(total_fee_earned_msat); let mut local_total_fee_earned_msat_nonref = if total_fee_earned_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { total_fee_earned_msat_nonref.unwrap() }) }; let mut skimmed_fee_msat_nonref = Clone::clone(skimmed_fee_msat); @@ -3345,6 +3550,8 @@ impl Event { next_channel_id: local_next_channel_id_nonref, prev_user_channel_id: local_prev_user_channel_id_nonref, next_user_channel_id: local_next_user_channel_id_nonref, + prev_node_id: local_prev_node_id_nonref, + next_node_id: local_next_node_id_nonref, total_fee_earned_msat: local_total_fee_earned_msat_nonref, skimmed_fee_msat: local_skimmed_fee_msat_nonref, claim_from_onchain_tx: claim_from_onchain_tx_nonref, @@ -3381,7 +3588,7 @@ impl Event { channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type_nonref), is_owned: true }, } }, - nativeEvent::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo, } => { + nativeEvent::ChannelClosed {ref channel_id, ref user_channel_id, ref reason, ref counterparty_node_id, ref channel_capacity_sats, ref channel_funding_txo, ref last_local_balance_msat, } => { 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); @@ -3391,6 +3598,8 @@ impl Event { let mut local_channel_capacity_sats_nonref = if channel_capacity_sats_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { channel_capacity_sats_nonref.unwrap() }) }; let mut channel_funding_txo_nonref = Clone::clone(channel_funding_txo); let mut local_channel_funding_txo_nonref = crate::lightning::chain::transaction::OutPoint { inner: if channel_funding_txo_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_funding_txo_nonref.unwrap())) } }, is_owned: true }; + let mut last_local_balance_msat_nonref = Clone::clone(last_local_balance_msat); + let mut local_last_local_balance_msat_nonref = if last_local_balance_msat_nonref.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { last_local_balance_msat_nonref.unwrap() }) }; Event::ChannelClosed { channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id_nonref), is_owned: true }, user_channel_id: user_channel_id_nonref.into(), @@ -3398,6 +3607,7 @@ impl Event { counterparty_node_id: local_counterparty_node_id_nonref, channel_capacity_sats: local_channel_capacity_sats_nonref, channel_funding_txo: local_channel_funding_txo_nonref, + last_local_balance_msat: local_last_local_balance_msat_nonref, } }, nativeEvent::DiscardFunding {ref channel_id, ref funding_info, } => { @@ -3408,11 +3618,11 @@ impl Event { funding_info: crate::lightning::events::FundingInfo::native_into(funding_info_nonref), } }, - nativeEvent::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref push_msat, ref channel_type, ref is_announced, ref params, } => { + nativeEvent::OpenChannelRequest {ref temporary_channel_id, ref counterparty_node_id, ref funding_satoshis, ref channel_negotiation_type, ref channel_type, ref is_announced, ref params, } => { 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_negotiation_type_nonref = Clone::clone(channel_negotiation_type); let mut channel_type_nonref = Clone::clone(channel_type); let mut is_announced_nonref = Clone::clone(is_announced); let mut params_nonref = Clone::clone(params); @@ -3420,7 +3630,7 @@ impl Event { temporary_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(temporary_channel_id_nonref), is_owned: true }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id_nonref), funding_satoshis: funding_satoshis_nonref, - push_msat: push_msat_nonref, + channel_negotiation_type: crate::lightning::events::InboundChannelFunds::native_into(channel_negotiation_type_nonref), channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type_nonref), is_owned: true }, is_announced: is_announced_nonref, params: crate::lightning::ln::msgs::ChannelParameters { inner: ObjOps::heap_alloc(params_nonref), is_owned: true }, @@ -3477,12 +3687,13 @@ impl Event { former_temporary_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(former_temporary_channel_id), is_owned: true }, } }, - nativeEvent::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, mut claim_deadline, } => { + nativeEvent::PaymentClaimable {mut receiver_node_id, mut payment_hash, mut onion_fields, mut amount_msat, mut counterparty_skimmed_fee_msat, mut purpose, mut via_channel_id, mut via_user_channel_id, mut claim_deadline, mut payment_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_onion_fields = crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: if onion_fields.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((onion_fields.unwrap())) } }, is_owned: true }; let mut local_via_channel_id = crate::lightning::ln::types::ChannelId { inner: if via_channel_id.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((via_channel_id.unwrap())) } }, is_owned: true }; 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() }) }; let mut local_claim_deadline = if claim_deadline.is_none() { crate::c_types::derived::COption_u32Z::None } else { crate::c_types::derived::COption_u32Z::Some( { claim_deadline.unwrap() }) }; + let mut local_payment_id = if payment_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id.unwrap().0 } }) }; Event::PaymentClaimable { receiver_node_id: local_receiver_node_id, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, @@ -3493,13 +3704,15 @@ impl Event { via_channel_id: local_via_channel_id, via_user_channel_id: local_via_user_channel_id, claim_deadline: local_claim_deadline, + payment_id: local_payment_id, } }, - nativeEvent::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut htlcs, mut sender_intended_total_msat, mut onion_fields, } => { + nativeEvent::PaymentClaimed {mut receiver_node_id, mut payment_hash, mut amount_msat, mut purpose, mut htlcs, mut sender_intended_total_msat, mut onion_fields, mut payment_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_htlcs = Vec::new(); for mut item in htlcs.drain(..) { local_htlcs.push( { crate::lightning::events::ClaimedHTLC { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; let mut local_sender_intended_total_msat = if sender_intended_total_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { sender_intended_total_msat.unwrap() }) }; let mut local_onion_fields = crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: if onion_fields.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((onion_fields.unwrap())) } }, is_owned: true }; + let mut local_payment_id = if payment_id.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some( { crate::c_types::ThirtyTwoBytes { data: payment_id.unwrap().0 } }) }; Event::PaymentClaimed { receiver_node_id: local_receiver_node_id, payment_hash: crate::c_types::ThirtyTwoBytes { data: payment_hash.0 }, @@ -3508,6 +3721,7 @@ impl Event { htlcs: local_htlcs.into(), sender_intended_total_msat: local_sender_intended_total_msat, onion_fields: local_onion_fields, + payment_id: local_payment_id, } }, nativeEvent::ConnectionNeeded {mut node_id, mut addresses, } => { @@ -3604,11 +3818,13 @@ impl Event { channel_id: local_channel_id, } }, - nativeEvent::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut prev_user_channel_id, mut next_user_channel_id, mut total_fee_earned_msat, mut skimmed_fee_msat, mut claim_from_onchain_tx, mut outbound_amount_forwarded_msat, } => { + nativeEvent::PaymentForwarded {mut prev_channel_id, mut next_channel_id, mut prev_user_channel_id, mut next_user_channel_id, mut prev_node_id, mut next_node_id, mut total_fee_earned_msat, mut skimmed_fee_msat, mut claim_from_onchain_tx, mut outbound_amount_forwarded_msat, } => { let mut local_prev_channel_id = crate::lightning::ln::types::ChannelId { inner: if prev_channel_id.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((prev_channel_id.unwrap())) } }, is_owned: true }; let mut local_next_channel_id = crate::lightning::ln::types::ChannelId { inner: if next_channel_id.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((next_channel_id.unwrap())) } }, is_owned: true }; let mut local_prev_user_channel_id = if prev_user_channel_id.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { prev_user_channel_id.unwrap().into() }) }; let mut local_next_user_channel_id = if next_user_channel_id.is_none() { crate::c_types::derived::COption_U128Z::None } else { crate::c_types::derived::COption_U128Z::Some( { next_user_channel_id.unwrap().into() }) }; + let mut local_prev_node_id = if prev_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(prev_node_id.unwrap())) } }; + let mut local_next_node_id = if next_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(next_node_id.unwrap())) } }; let mut local_total_fee_earned_msat = if total_fee_earned_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { total_fee_earned_msat.unwrap() }) }; let mut local_skimmed_fee_msat = if skimmed_fee_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { skimmed_fee_msat.unwrap() }) }; let mut local_outbound_amount_forwarded_msat = if outbound_amount_forwarded_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { outbound_amount_forwarded_msat.unwrap() }) }; @@ -3617,6 +3833,8 @@ impl Event { next_channel_id: local_next_channel_id, prev_user_channel_id: local_prev_user_channel_id, next_user_channel_id: local_next_user_channel_id, + prev_node_id: local_prev_node_id, + next_node_id: local_next_node_id, total_fee_earned_msat: local_total_fee_earned_msat, skimmed_fee_msat: local_skimmed_fee_msat, claim_from_onchain_tx: claim_from_onchain_tx, @@ -3643,10 +3861,11 @@ impl Event { channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type), is_owned: true }, } }, - nativeEvent::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, mut counterparty_node_id, mut channel_capacity_sats, mut channel_funding_txo, } => { + nativeEvent::ChannelClosed {mut channel_id, mut user_channel_id, mut reason, mut counterparty_node_id, mut channel_capacity_sats, mut channel_funding_txo, mut last_local_balance_msat, } => { let mut local_counterparty_node_id = if counterparty_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(counterparty_node_id.unwrap())) } }; let mut local_channel_capacity_sats = if channel_capacity_sats.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { channel_capacity_sats.unwrap() }) }; let mut local_channel_funding_txo = crate::lightning::chain::transaction::OutPoint { inner: if channel_funding_txo.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((channel_funding_txo.unwrap())) } }, is_owned: true }; + let mut local_last_local_balance_msat = if last_local_balance_msat.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { last_local_balance_msat.unwrap() }) }; Event::ChannelClosed { channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(channel_id), is_owned: true }, user_channel_id: user_channel_id.into(), @@ -3654,6 +3873,7 @@ impl Event { counterparty_node_id: local_counterparty_node_id, channel_capacity_sats: local_channel_capacity_sats, channel_funding_txo: local_channel_funding_txo, + last_local_balance_msat: local_last_local_balance_msat, } }, nativeEvent::DiscardFunding {mut channel_id, mut funding_info, } => { @@ -3662,12 +3882,12 @@ impl Event { funding_info: crate::lightning::events::FundingInfo::native_into(funding_info), } }, - nativeEvent::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut push_msat, mut channel_type, mut is_announced, mut params, } => { + nativeEvent::OpenChannelRequest {mut temporary_channel_id, mut counterparty_node_id, mut funding_satoshis, mut channel_negotiation_type, mut channel_type, mut is_announced, mut params, } => { Event::OpenChannelRequest { temporary_channel_id: crate::lightning::ln::types::ChannelId { inner: ObjOps::heap_alloc(temporary_channel_id), is_owned: true }, counterparty_node_id: crate::c_types::PublicKey::from_rust(&counterparty_node_id), funding_satoshis: funding_satoshis, - push_msat: push_msat, + channel_negotiation_type: crate::lightning::events::InboundChannelFunds::native_into(channel_negotiation_type), channel_type: crate::lightning_types::features::ChannelTypeFeatures { inner: ObjOps::heap_alloc(channel_type), is_owned: true }, is_announced: is_announced, params: crate::lightning::ln::msgs::ChannelParameters { inner: ObjOps::heap_alloc(params), is_owned: true }, @@ -3740,7 +3960,7 @@ pub extern "C" fn Event_funding_tx_broadcast_safe(channel_id: crate::lightning:: } #[no_mangle] /// 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, onion_fields: crate::lightning::ln::outbound_payment::RecipientOnionFields, amount_msat: u64, counterparty_skimmed_fee_msat: u64, purpose: crate::lightning::events::PaymentPurpose, via_channel_id: crate::lightning::ln::types::ChannelId, via_user_channel_id: crate::c_types::derived::COption_U128Z, claim_deadline: crate::c_types::derived::COption_u32Z) -> Event { +pub extern "C" fn Event_payment_claimable(receiver_node_id: crate::c_types::PublicKey, payment_hash: crate::c_types::ThirtyTwoBytes, onion_fields: crate::lightning::ln::outbound_payment::RecipientOnionFields, amount_msat: u64, counterparty_skimmed_fee_msat: u64, purpose: crate::lightning::events::PaymentPurpose, via_channel_id: crate::lightning::ln::types::ChannelId, via_user_channel_id: crate::c_types::derived::COption_U128Z, claim_deadline: crate::c_types::derived::COption_u32Z, payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> Event { Event::PaymentClaimable { receiver_node_id, payment_hash, @@ -3751,11 +3971,12 @@ pub extern "C" fn Event_payment_claimable(receiver_node_id: crate::c_types::Publ via_channel_id, via_user_channel_id, claim_deadline, + payment_id, } } #[no_mangle] /// Utility method to constructs a new PaymentClaimed-variant 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::events::PaymentPurpose, htlcs: crate::c_types::derived::CVec_ClaimedHTLCZ, sender_intended_total_msat: crate::c_types::derived::COption_u64Z, onion_fields: crate::lightning::ln::outbound_payment::RecipientOnionFields) -> 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::events::PaymentPurpose, htlcs: crate::c_types::derived::CVec_ClaimedHTLCZ, sender_intended_total_msat: crate::c_types::derived::COption_u64Z, onion_fields: crate::lightning::ln::outbound_payment::RecipientOnionFields, payment_id: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> Event { Event::PaymentClaimed { receiver_node_id, payment_hash, @@ -3764,6 +3985,7 @@ pub extern "C" fn Event_payment_claimed(receiver_node_id: crate::c_types::Public htlcs, sender_intended_total_msat, onion_fields, + payment_id, } } #[no_mangle] @@ -3871,12 +4093,14 @@ pub extern "C" fn Event_spendable_outputs(outputs: crate::c_types::derived::CVec } #[no_mangle] /// Utility method to constructs a new PaymentForwarded-variant Event -pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::lightning::ln::types::ChannelId, next_channel_id: crate::lightning::ln::types::ChannelId, prev_user_channel_id: crate::c_types::derived::COption_U128Z, next_user_channel_id: crate::c_types::derived::COption_U128Z, total_fee_earned_msat: crate::c_types::derived::COption_u64Z, skimmed_fee_msat: crate::c_types::derived::COption_u64Z, claim_from_onchain_tx: bool, outbound_amount_forwarded_msat: crate::c_types::derived::COption_u64Z) -> Event { +pub extern "C" fn Event_payment_forwarded(prev_channel_id: crate::lightning::ln::types::ChannelId, next_channel_id: crate::lightning::ln::types::ChannelId, prev_user_channel_id: crate::c_types::derived::COption_U128Z, next_user_channel_id: crate::c_types::derived::COption_U128Z, prev_node_id: crate::c_types::PublicKey, next_node_id: crate::c_types::PublicKey, total_fee_earned_msat: crate::c_types::derived::COption_u64Z, skimmed_fee_msat: crate::c_types::derived::COption_u64Z, claim_from_onchain_tx: bool, outbound_amount_forwarded_msat: crate::c_types::derived::COption_u64Z) -> Event { Event::PaymentForwarded { prev_channel_id, next_channel_id, prev_user_channel_id, next_user_channel_id, + prev_node_id, + next_node_id, total_fee_earned_msat, skimmed_fee_msat, claim_from_onchain_tx, @@ -3907,7 +4131,7 @@ pub extern "C" fn Event_channel_ready(channel_id: crate::lightning::ln::types::C } #[no_mangle] /// Utility method to constructs a new ChannelClosed-variant Event -pub extern "C" fn Event_channel_closed(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, reason: crate::lightning::events::ClosureReason, counterparty_node_id: crate::c_types::PublicKey, channel_capacity_sats: crate::c_types::derived::COption_u64Z, channel_funding_txo: crate::lightning::chain::transaction::OutPoint) -> Event { +pub extern "C" fn Event_channel_closed(channel_id: crate::lightning::ln::types::ChannelId, user_channel_id: crate::c_types::U128, reason: crate::lightning::events::ClosureReason, counterparty_node_id: crate::c_types::PublicKey, channel_capacity_sats: crate::c_types::derived::COption_u64Z, channel_funding_txo: crate::lightning::chain::transaction::OutPoint, last_local_balance_msat: crate::c_types::derived::COption_u64Z) -> Event { Event::ChannelClosed { channel_id, user_channel_id, @@ -3915,6 +4139,7 @@ pub extern "C" fn Event_channel_closed(channel_id: crate::lightning::ln::types:: counterparty_node_id, channel_capacity_sats, channel_funding_txo, + last_local_balance_msat, } } #[no_mangle] @@ -3927,12 +4152,12 @@ pub extern "C" fn Event_discard_funding(channel_id: crate::lightning::ln::types: } #[no_mangle] /// Utility method to constructs a new OpenChannelRequest-variant Event -pub extern "C" fn Event_open_channel_request(temporary_channel_id: crate::lightning::ln::types::ChannelId, counterparty_node_id: crate::c_types::PublicKey, funding_satoshis: u64, push_msat: u64, channel_type: crate::lightning_types::features::ChannelTypeFeatures, is_announced: bool, params: crate::lightning::ln::msgs::ChannelParameters) -> Event { +pub extern "C" fn Event_open_channel_request(temporary_channel_id: crate::lightning::ln::types::ChannelId, counterparty_node_id: crate::c_types::PublicKey, funding_satoshis: u64, channel_negotiation_type: crate::lightning::events::InboundChannelFunds, channel_type: crate::lightning_types::features::ChannelTypeFeatures, is_announced: bool, params: crate::lightning::ln::msgs::ChannelParameters) -> Event { Event::OpenChannelRequest { temporary_channel_id, counterparty_node_id, funding_satoshis, - push_msat, + channel_negotiation_type, channel_type, is_announced, params, diff --git a/lightning-c-bindings/src/lightning/ln/bolt11_payment.rs b/lightning-c-bindings/src/lightning/ln/bolt11_payment.rs index 1e91910..75abcb2 100644 --- a/lightning-c-bindings/src/lightning/ln/bolt11_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/bolt11_payment.rs @@ -17,9 +17,9 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -/// Builds the necessary parameters to pay or pre-flight probe the given zero-amount -/// [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or -/// [`ChannelManager::send_preflight_probes`]. +/// Builds the necessary parameters to pay or pre-flight probe the given variable-amount +/// (also known as 'zero-amount') [`Bolt11Invoice`] using +/// [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`]. /// /// Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the /// same [`PaymentHash`] has never been paid before. @@ -30,8 +30,8 @@ use alloc::{vec::Vec, boxed::Box}; /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment /// [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes #[no_mangle] -pub extern "C" fn payment_parameters_from_zero_amount_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut amount_msat: u64) -> crate::c_types::derived::CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { - let mut ret = lightning::ln::bolt11_payment::payment_parameters_from_zero_amount_invoice(invoice.get_native_ref(), amount_msat); +pub extern "C" fn payment_parameters_from_variable_amount_invoice(invoice: &crate::lightning_invoice::Bolt11Invoice, mut amount_msat: u64) -> crate::c_types::derived::CResult_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ { + let mut ret = lightning::ln::bolt11_payment::payment_parameters_from_variable_amount_invoice(invoice.get_native_ref(), amount_msat); 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, mut orig_ret_0_2) = o; let mut local_ret_0 = (crate::c_types::ThirtyTwoBytes { data: orig_ret_0_0.0 }, crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }, crate::lightning::routing::router::RouteParameters { inner: ObjOps::heap_alloc(orig_ret_0_2), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -43,7 +43,7 @@ pub extern "C" fn payment_parameters_from_zero_amount_invoice(invoice: &crate::l /// same [`PaymentHash`] has never been paid before. /// /// Will always succeed unless the invoice has no amount specified, in which case -/// [`payment_parameters_from_zero_amount_invoice`] should be used. +/// [`payment_parameters_from_variable_amount_invoice`] should be used. /// /// [`ChannelManager::send_payment`]: crate::ln::channelmanager::ChannelManager::send_payment /// [`ChannelManager::send_preflight_probes`]: crate::ln::channelmanager::ChannelManager::send_preflight_probes diff --git a/lightning-c-bindings/src/lightning/ln/chan_utils.rs b/lightning-c-bindings/src/lightning/ln/chan_utils.rs index a5fa45c..89c8f65 100644 --- a/lightning-c-bindings/src/lightning/ln/chan_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/chan_utils.rs @@ -887,7 +887,7 @@ pub extern "C" fn HTLCOutputInCommitment_get_payment_hash(this_ptr: &HTLCOutputI /// The hash of the preimage which unlocks this HTLC. #[no_mangle] pub extern "C" fn HTLCOutputInCommitment_set_payment_hash(this_ptr: &mut HTLCOutputInCommitment, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::ln::types::PaymentHash(val.data); + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::types::payment::PaymentHash(val.data); } /// The position within the commitment transactions' outputs. This may be None if the value is /// below the dust limit (in which case no output appears in the commitment transaction and the @@ -915,7 +915,7 @@ pub extern "C" fn HTLCOutputInCommitment_new(mut offered_arg: bool, mut amount_m offered: offered_arg, amount_msat: amount_msat_arg, cltv_expiry: cltv_expiry_arg, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_arg.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_arg.data), transaction_output_index: local_transaction_output_index_arg, }), is_owned: true } } @@ -1008,7 +1008,7 @@ pub extern "C" fn build_htlc_transaction(commitment_txid: *const [u8; 32], mut f /// Returns the witness required to satisfy and spend a HTLC input. #[no_mangle] pub extern "C" fn build_htlc_input_witness(mut local_sig: crate::c_types::ECDSASignature, mut remote_sig: crate::c_types::ECDSASignature, mut preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut redeem_script: crate::c_types::u8slice, channel_type_features: &crate::lightning_types::features::ChannelTypeFeatures) -> crate::c_types::Witness { - let mut local_preimage = { /*preimage*/ let preimage_opt = preimage; if preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ preimage_opt.take() }.data) }})} }; + let mut local_preimage = { /*preimage*/ let preimage_opt = preimage; if preimage_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ preimage_opt.take() }.data) }})} }; let mut ret = lightning::ln::chan_utils::build_htlc_input_witness(&local_sig.into_rust(), &remote_sig.into_rust(), &local_preimage, ::bitcoin::script::Script::from_bytes(redeem_script.to_slice()), channel_type_features.get_native_ref()); crate::c_types::Witness::from_bitcoin(&ret) } diff --git a/lightning-c-bindings/src/lightning/ln/channel_state.rs b/lightning-c-bindings/src/lightning/ln/channel_state.rs index e9dee8a..e960eb0 100644 --- a/lightning-c-bindings/src/lightning/ln/channel_state.rs +++ b/lightning-c-bindings/src/lightning/ln/channel_state.rs @@ -257,7 +257,7 @@ pub extern "C" fn InboundHTLCDetails_get_payment_hash(this_ptr: &InboundHTLCDeta /// The payment hash. #[no_mangle] pub extern "C" fn InboundHTLCDetails_set_payment_hash(this_ptr: &mut InboundHTLCDetails, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::ln::types::PaymentHash(val.data); + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::types::payment::PaymentHash(val.data); } /// The state of the HTLC in the state machine. /// @@ -328,7 +328,7 @@ pub extern "C" fn InboundHTLCDetails_new(mut htlc_id_arg: u64, mut amount_msat_a htlc_id: htlc_id_arg, amount_msat: amount_msat_arg, cltv_expiry: cltv_expiry_arg, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_arg.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_arg.data), state: local_state_arg, is_dust: is_dust_arg, }), is_owned: true } @@ -614,7 +614,7 @@ pub extern "C" fn OutboundHTLCDetails_get_payment_hash(this_ptr: &OutboundHTLCDe /// The payment hash. #[no_mangle] pub extern "C" fn OutboundHTLCDetails_set_payment_hash(this_ptr: &mut OutboundHTLCDetails, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::ln::types::PaymentHash(val.data); + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::types::payment::PaymentHash(val.data); } /// The state of the HTLC in the state machine. /// @@ -700,7 +700,7 @@ pub extern "C" fn OutboundHTLCDetails_new(mut htlc_id_arg: crate::c_types::deriv htlc_id: local_htlc_id_arg, amount_msat: amount_msat_arg, cltv_expiry: cltv_expiry_arg, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_arg.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_arg.data), state: local_state_arg, skimmed_fee_msat: local_skimmed_fee_msat_arg, is_dust: is_dust_arg, @@ -1424,42 +1424,11 @@ pub extern "C" fn ChannelDetails_set_feerate_sat_per_1000_weight(this_ptr: &mut let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.feerate_sat_per_1000_weight = local_val; } -/// Our total balance. This is the amount we would get if we close the channel. -/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this -/// amount is not likely to be recoverable on close. -/// -/// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose -/// balance is not available for inclusion in new outbound HTLCs). This further does not include -/// any pending outgoing HTLCs which are awaiting some other resolution to be sent. -/// This does not consider any on-chain fees. -/// -/// See also [`ChannelDetails::outbound_capacity_msat`] -#[no_mangle] -pub extern "C" fn ChannelDetails_get_balance_msat(this_ptr: &ChannelDetails) -> u64 { - let mut inner_val = &mut this_ptr.get_native_mut_ref().balance_msat; - *inner_val -} -/// Our total balance. This is the amount we would get if we close the channel. -/// This value is not exact. Due to various in-flight changes and feerate changes, exactly this -/// amount is not likely to be recoverable on close. -/// -/// This does not include any pending HTLCs which are not yet fully resolved (and, thus, whose -/// balance is not available for inclusion in new outbound HTLCs). This further does not include -/// any pending outgoing HTLCs which are awaiting some other resolution to be sent. -/// This does not consider any on-chain fees. -/// -/// See also [`ChannelDetails::outbound_capacity_msat`] -#[no_mangle] -pub extern "C" fn ChannelDetails_set_balance_msat(this_ptr: &mut ChannelDetails, mut val: u64) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.balance_msat = val; -} /// The available outbound capacity for sending HTLCs to the remote peer. This does not include /// any pending HTLCs which are not yet fully resolved (and, thus, whose balance is not /// available for inclusion in new outbound HTLCs). This further does not include any pending /// outgoing HTLCs which are awaiting some other resolution to be sent. /// -/// See also [`ChannelDetails::balance_msat`] -/// /// This value is not exact. Due to various in-flight changes, feerate changes, and our /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we /// should be able to spend nearly this amount. @@ -1473,8 +1442,6 @@ pub extern "C" fn ChannelDetails_get_outbound_capacity_msat(this_ptr: &ChannelDe /// available for inclusion in new outbound HTLCs). This further does not include any pending /// outgoing HTLCs which are awaiting some other resolution to be sent. /// -/// See also [`ChannelDetails::balance_msat`] -/// /// This value is not exact. Due to various in-flight changes, feerate changes, and our /// conflict-avoidance policy, exactly this amount is not likely to be spendable. However, we /// should be able to spend nearly this amount. @@ -1487,8 +1454,8 @@ pub extern "C" fn ChannelDetails_set_outbound_capacity_msat(this_ptr: &mut Chann /// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us /// to use a limit as close as possible to the HTLC limit we can currently send. /// -/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], -/// [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. +/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and +/// [`ChannelDetails::outbound_capacity_msat`]. #[no_mangle] pub extern "C" fn ChannelDetails_get_next_outbound_htlc_limit_msat(this_ptr: &ChannelDetails) -> u64 { let mut inner_val = &mut this_ptr.get_native_mut_ref().next_outbound_htlc_limit_msat; @@ -1499,8 +1466,8 @@ pub extern "C" fn ChannelDetails_get_next_outbound_htlc_limit_msat(this_ptr: &Ch /// the current state and per-HTLC limit(s). This is intended for use when routing, allowing us /// to use a limit as close as possible to the HTLC limit we can currently send. /// -/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`], -/// [`ChannelDetails::balance_msat`], and [`ChannelDetails::outbound_capacity_msat`]. +/// See also [`ChannelDetails::next_outbound_htlc_minimum_msat`] and +/// [`ChannelDetails::outbound_capacity_msat`]. #[no_mangle] pub extern "C" fn ChannelDetails_set_next_outbound_htlc_limit_msat(this_ptr: &mut ChannelDetails, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.next_outbound_htlc_limit_msat = val; @@ -1793,7 +1760,7 @@ pub extern "C" fn ChannelDetails_set_pending_outbound_htlcs(this_ptr: &mut Chann /// Note that config_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut counterparty_arg: crate::lightning::ln::channel_state::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning_types::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 feerate_sat_per_1000_weight_arg: crate::c_types::derived::COption_u32Z, mut balance_msat_arg: u64, mut outbound_capacity_msat_arg: u64, mut next_outbound_htlc_limit_msat_arg: u64, mut next_outbound_htlc_minimum_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 channel_shutdown_state_arg: crate::c_types::derived::COption_ChannelShutdownStateZ, mut is_usable_arg: bool, mut is_announced_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, mut pending_inbound_htlcs_arg: crate::c_types::derived::CVec_InboundHTLCDetailsZ, mut pending_outbound_htlcs_arg: crate::c_types::derived::CVec_OutboundHTLCDetailsZ) -> ChannelDetails { +pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut counterparty_arg: crate::lightning::ln::channel_state::ChannelCounterparty, mut funding_txo_arg: crate::lightning::chain::transaction::OutPoint, mut channel_type_arg: crate::lightning_types::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 feerate_sat_per_1000_weight_arg: crate::c_types::derived::COption_u32Z, mut outbound_capacity_msat_arg: u64, mut next_outbound_htlc_limit_msat_arg: u64, mut next_outbound_htlc_minimum_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 channel_shutdown_state_arg: crate::c_types::derived::COption_ChannelShutdownStateZ, mut is_usable_arg: bool, mut is_announced_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, mut pending_inbound_htlcs_arg: crate::c_types::derived::CVec_InboundHTLCDetailsZ, mut pending_outbound_htlcs_arg: crate::c_types::derived::CVec_OutboundHTLCDetailsZ) -> 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 }; @@ -1822,7 +1789,6 @@ pub extern "C" fn ChannelDetails_new(mut channel_id_arg: crate::lightning::ln::t unspendable_punishment_reserve: local_unspendable_punishment_reserve_arg, user_channel_id: user_channel_id_arg.into(), feerate_sat_per_1000_weight: local_feerate_sat_per_1000_weight_arg, - balance_msat: balance_msat_arg, outbound_capacity_msat: outbound_capacity_msat_arg, next_outbound_htlc_limit_msat: next_outbound_htlc_limit_msat_arg, next_outbound_htlc_minimum_msat: next_outbound_htlc_minimum_msat_arg, diff --git a/lightning-c-bindings/src/lightning/ln/channelmanager.rs b/lightning-c-bindings/src/lightning/ln/channelmanager.rs index 4ee248d..763bbf5 100644 --- a/lightning-c-bindings/src/lightning/ln/channelmanager.rs +++ b/lightning-c-bindings/src/lightning/ln/channelmanager.rs @@ -116,6 +116,10 @@ pub enum PendingHTLCRouting { custom_tlvs: crate::c_types::derived::CVec_C2Tuple_u64CVec_u8ZZZ, /// Set if this HTLC is the final hop in a multi-hop blinded path. requires_blinded_error: bool, + /// Set if we are receiving a keysend to a blinded path, meaning we created the + /// [`PaymentSecret`] and should verify it using our + /// [`NodeSigner::get_inbound_payment_key`]. + has_recipient_created_payment_secret: bool, }, } use lightning::ln::channelmanager::PendingHTLCRouting as PendingHTLCRoutingImport; @@ -158,7 +162,7 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error_nonref, } }, - PendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, } => { + PendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, ref has_recipient_created_payment_secret, } => { let mut payment_data_nonref = Clone::clone(payment_data); let mut local_payment_data_nonref = if payment_data_nonref.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payment_data_nonref.take_inner()) } }) }; let mut payment_preimage_nonref = Clone::clone(payment_preimage); @@ -168,13 +172,15 @@ impl PendingHTLCRouting { let mut custom_tlvs_nonref = Clone::clone(custom_tlvs); let mut local_custom_tlvs_nonref = Vec::new(); for mut item in custom_tlvs_nonref.into_rust().drain(..) { local_custom_tlvs_nonref.push( { let (mut orig_custom_tlvs_nonref_0_0, mut orig_custom_tlvs_nonref_0_1) = item.to_rust(); let mut local_orig_custom_tlvs_nonref_0_1 = Vec::new(); for mut item in orig_custom_tlvs_nonref_0_1.into_rust().drain(..) { local_orig_custom_tlvs_nonref_0_1.push( { item }); }; let mut local_custom_tlvs_nonref_0 = (orig_custom_tlvs_nonref_0_0, local_orig_custom_tlvs_nonref_0_1); local_custom_tlvs_nonref_0 }); }; let mut requires_blinded_error_nonref = Clone::clone(requires_blinded_error); + let mut has_recipient_created_payment_secret_nonref = Clone::clone(has_recipient_created_payment_secret); nativePendingHTLCRouting::ReceiveKeysend { payment_data: local_payment_data_nonref, - payment_preimage: ::lightning::ln::types::PaymentPreimage(payment_preimage_nonref.data), + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_nonref.data), payment_metadata: local_payment_metadata_nonref, incoming_cltv_expiry: incoming_cltv_expiry_nonref, custom_tlvs: local_custom_tlvs_nonref, requires_blinded_error: requires_blinded_error_nonref, + has_recipient_created_payment_secret: has_recipient_created_payment_secret_nonref, } }, } @@ -205,17 +211,18 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error, } }, - PendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, } => { + PendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, mut has_recipient_created_payment_secret, } => { let mut local_payment_data = if payment_data.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payment_data.take_inner()) } }) }; let mut local_payment_metadata = { /*payment_metadata*/ let payment_metadata_opt = payment_metadata; if payment_metadata_opt.is_none() { None } else { Some({ { let mut local_payment_metadata_0 = Vec::new(); for mut item in { payment_metadata_opt.take() }.into_rust().drain(..) { local_payment_metadata_0.push( { item }); }; local_payment_metadata_0 }})} }; let mut local_custom_tlvs = Vec::new(); for mut item in custom_tlvs.into_rust().drain(..) { local_custom_tlvs.push( { let (mut orig_custom_tlvs_0_0, mut orig_custom_tlvs_0_1) = item.to_rust(); let mut local_orig_custom_tlvs_0_1 = Vec::new(); for mut item in orig_custom_tlvs_0_1.into_rust().drain(..) { local_orig_custom_tlvs_0_1.push( { item }); }; let mut local_custom_tlvs_0 = (orig_custom_tlvs_0_0, local_orig_custom_tlvs_0_1); local_custom_tlvs_0 }); }; nativePendingHTLCRouting::ReceiveKeysend { payment_data: local_payment_data, - payment_preimage: ::lightning::ln::types::PaymentPreimage(payment_preimage.data), + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage.data), payment_metadata: local_payment_metadata, incoming_cltv_expiry: incoming_cltv_expiry, custom_tlvs: local_custom_tlvs, requires_blinded_error: requires_blinded_error, + has_recipient_created_payment_secret: has_recipient_created_payment_secret, } }, } @@ -257,7 +264,7 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error_nonref, } }, - nativePendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, } => { + nativePendingHTLCRouting::ReceiveKeysend {ref payment_data, ref payment_preimage, ref payment_metadata, ref incoming_cltv_expiry, ref custom_tlvs, ref requires_blinded_error, ref has_recipient_created_payment_secret, } => { let mut payment_data_nonref = Clone::clone(payment_data); let mut local_payment_data_nonref = crate::lightning::ln::msgs::FinalOnionHopData { inner: if payment_data_nonref.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((payment_data_nonref.unwrap())) } }, is_owned: true }; let mut payment_preimage_nonref = Clone::clone(payment_preimage); @@ -267,6 +274,7 @@ impl PendingHTLCRouting { let mut custom_tlvs_nonref = Clone::clone(custom_tlvs); let mut local_custom_tlvs_nonref = Vec::new(); for mut item in custom_tlvs_nonref.drain(..) { local_custom_tlvs_nonref.push( { let (mut orig_custom_tlvs_nonref_0_0, mut orig_custom_tlvs_nonref_0_1) = item; let mut local_orig_custom_tlvs_nonref_0_1 = Vec::new(); for mut item in orig_custom_tlvs_nonref_0_1.drain(..) { local_orig_custom_tlvs_nonref_0_1.push( { item }); }; let mut local_custom_tlvs_nonref_0 = (orig_custom_tlvs_nonref_0_0, local_orig_custom_tlvs_nonref_0_1.into()).into(); local_custom_tlvs_nonref_0 }); }; let mut requires_blinded_error_nonref = Clone::clone(requires_blinded_error); + let mut has_recipient_created_payment_secret_nonref = Clone::clone(has_recipient_created_payment_secret); PendingHTLCRouting::ReceiveKeysend { payment_data: local_payment_data_nonref, payment_preimage: crate::c_types::ThirtyTwoBytes { data: payment_preimage_nonref.0 }, @@ -274,6 +282,7 @@ impl PendingHTLCRouting { incoming_cltv_expiry: incoming_cltv_expiry_nonref, custom_tlvs: local_custom_tlvs_nonref.into(), requires_blinded_error: requires_blinded_error_nonref, + has_recipient_created_payment_secret: has_recipient_created_payment_secret_nonref, } }, } @@ -304,7 +313,7 @@ impl PendingHTLCRouting { requires_blinded_error: requires_blinded_error, } }, - nativePendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, } => { + nativePendingHTLCRouting::ReceiveKeysend {mut payment_data, mut payment_preimage, mut payment_metadata, mut incoming_cltv_expiry, mut custom_tlvs, mut requires_blinded_error, mut has_recipient_created_payment_secret, } => { let mut local_payment_data = crate::lightning::ln::msgs::FinalOnionHopData { inner: if payment_data.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((payment_data.unwrap())) } }, is_owned: true }; let mut local_payment_metadata = if payment_metadata.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some( { let mut local_payment_metadata_0 = Vec::new(); for mut item in payment_metadata.unwrap().drain(..) { local_payment_metadata_0.push( { item }); }; local_payment_metadata_0.into() }) }; let mut local_custom_tlvs = Vec::new(); for mut item in custom_tlvs.drain(..) { local_custom_tlvs.push( { let (mut orig_custom_tlvs_0_0, mut orig_custom_tlvs_0_1) = item; let mut local_orig_custom_tlvs_0_1 = Vec::new(); for mut item in orig_custom_tlvs_0_1.drain(..) { local_orig_custom_tlvs_0_1.push( { item }); }; let mut local_custom_tlvs_0 = (orig_custom_tlvs_0_0, local_orig_custom_tlvs_0_1.into()).into(); local_custom_tlvs_0 }); }; @@ -315,6 +324,7 @@ impl PendingHTLCRouting { incoming_cltv_expiry: incoming_cltv_expiry, custom_tlvs: local_custom_tlvs.into(), requires_blinded_error: requires_blinded_error, + has_recipient_created_payment_secret: has_recipient_created_payment_secret, } }, } @@ -362,7 +372,7 @@ pub extern "C" fn PendingHTLCRouting_receive(payment_data: crate::lightning::ln: } #[no_mangle] /// Utility method to constructs a new ReceiveKeysend-variant PendingHTLCRouting -pub extern "C" fn PendingHTLCRouting_receive_keysend(payment_data: crate::lightning::ln::msgs::FinalOnionHopData, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_metadata: crate::c_types::derived::COption_CVec_u8ZZ, incoming_cltv_expiry: u32, custom_tlvs: crate::c_types::derived::CVec_C2Tuple_u64CVec_u8ZZZ, requires_blinded_error: bool) -> PendingHTLCRouting { +pub extern "C" fn PendingHTLCRouting_receive_keysend(payment_data: crate::lightning::ln::msgs::FinalOnionHopData, payment_preimage: crate::c_types::ThirtyTwoBytes, payment_metadata: crate::c_types::derived::COption_CVec_u8ZZ, incoming_cltv_expiry: u32, custom_tlvs: crate::c_types::derived::CVec_C2Tuple_u64CVec_u8ZZZ, requires_blinded_error: bool, has_recipient_created_payment_secret: bool) -> PendingHTLCRouting { PendingHTLCRouting::ReceiveKeysend { payment_data, payment_preimage, @@ -370,6 +380,7 @@ pub extern "C" fn PendingHTLCRouting_receive_keysend(payment_data: crate::lightn incoming_cltv_expiry, custom_tlvs, requires_blinded_error, + has_recipient_created_payment_secret, } } @@ -631,7 +642,7 @@ pub extern "C" fn PendingHTLCInfo_get_payment_hash(this_ptr: &PendingHTLCInfo) - /// Hash of the payment preimage, to lock the payment until the receiver releases the preimage. #[no_mangle] pub extern "C" fn PendingHTLCInfo_set_payment_hash(this_ptr: &mut PendingHTLCInfo, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::ln::types::PaymentHash(val.data); + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::types::payment::PaymentHash(val.data); } /// Amount received in the incoming HTLC. /// @@ -734,7 +745,7 @@ pub extern "C" fn PendingHTLCInfo_new(mut routing_arg: crate::lightning::ln::cha PendingHTLCInfo { inner: ObjOps::heap_alloc(nativePendingHTLCInfo { routing: routing_arg.into_native(), incoming_shared_secret: incoming_shared_secret_arg.data, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_arg.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_arg.data), incoming_amt_msat: local_incoming_amt_msat_arg, outgoing_amt_msat: outgoing_amt_msat_arg, outgoing_cltv_value: outgoing_cltv_value_arg, @@ -848,6 +859,116 @@ pub extern "C" fn BlindedFailure_hash(o: &BlindedFailure) -> u64 { pub extern "C" fn BlindedFailure_eq(a: &BlindedFailure, b: &BlindedFailure) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } +/// A trait defining behavior for creating and verifing the HMAC for authenticating a given data. +#[repr(C)] +pub struct Verification { + /// 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, + /// Constructs an HMAC to include in [`OffersContext`] for the data along with the given + /// [`Nonce`]. + pub hmac_for_offer_payment: extern "C" fn (this_arg: *const c_void, nonce: crate::lightning::offers::nonce::Nonce, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::ThirtyTwoBytes, + /// Authenticates the data using an HMAC and a [`Nonce`] taken from an [`OffersContext`]. + pub verify_for_offer_payment: extern "C" fn (this_arg: *const c_void, hmac: crate::c_types::ThirtyTwoBytes, nonce: crate::lightning::offers::nonce::Nonce, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::derived::CResult_NoneNoneZ, + /// 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 Verification {} +unsafe impl Sync for Verification {} +#[allow(unused)] +pub(crate) fn Verification_clone_fields(orig: &Verification) -> Verification { + Verification { + this_arg: orig.this_arg, + hmac_for_offer_payment: Clone::clone(&orig.hmac_for_offer_payment), + verify_for_offer_payment: Clone::clone(&orig.verify_for_offer_payment), + free: Clone::clone(&orig.free), + } +} + +use lightning::ln::channelmanager::Verification as rustVerification; +impl rustVerification for Verification { + fn hmac_for_offer_payment(&self, mut nonce: lightning::offers::nonce::Nonce, mut expanded_key: &lightning::ln::inbound_payment::ExpandedKey) -> [u8; 32] { + let mut ret = (self.hmac_for_offer_payment)(self.this_arg, crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, &crate::lightning::ln::inbound_payment::ExpandedKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((expanded_key as *const lightning::ln::inbound_payment::ExpandedKey<>) as *mut _) }, is_owned: false }); + ret.data + } + fn verify_for_offer_payment(&self, mut hmac: [u8; 32], mut nonce: lightning::offers::nonce::Nonce, mut expanded_key: &lightning::ln::inbound_payment::ExpandedKey) -> Result<(), ()> { + let mut ret = (self.verify_for_offer_payment)(self.this_arg, crate::c_types::ThirtyTwoBytes { data: hmac }, crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, &crate::lightning::ln::inbound_payment::ExpandedKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((expanded_key as *const lightning::ln::inbound_payment::ExpandedKey<>) 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)) })*/ })}; + local_ret + } +} + +pub struct VerificationRef(Verification); +impl rustVerification for VerificationRef { + fn hmac_for_offer_payment(&self, mut nonce: lightning::offers::nonce::Nonce, mut expanded_key: &lightning::ln::inbound_payment::ExpandedKey) -> [u8; 32] { + let mut ret = (self.0.hmac_for_offer_payment)(self.0.this_arg, crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, &crate::lightning::ln::inbound_payment::ExpandedKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((expanded_key as *const lightning::ln::inbound_payment::ExpandedKey<>) as *mut _) }, is_owned: false }); + ret.data + } + fn verify_for_offer_payment(&self, mut hmac: [u8; 32], mut nonce: lightning::offers::nonce::Nonce, mut expanded_key: &lightning::ln::inbound_payment::ExpandedKey) -> Result<(), ()> { + let mut ret = (self.0.verify_for_offer_payment)(self.0.this_arg, crate::c_types::ThirtyTwoBytes { data: hmac }, crate::lightning::offers::nonce::Nonce { inner: ObjOps::heap_alloc(nonce), is_owned: true }, &crate::lightning::ln::inbound_payment::ExpandedKey { inner: unsafe { ObjOps::nonnull_ptr_to_inner((expanded_key as *const lightning::ln::inbound_payment::ExpandedKey<>) 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)) })*/ })}; + local_ret + } +} + +// 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 Verification { + type Target = VerificationRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const VerificationRef) } + } +} +impl core::ops::DerefMut for Verification { + fn deref_mut(&mut self) -> &mut VerificationRef { + unsafe { &mut *(self as *mut _ as *mut VerificationRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn Verification_free(this_ptr: Verification) { } +impl Drop for Verification { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} +impl From for crate::lightning::ln::channelmanager::Verification { + fn from(obj: nativeUnauthenticatedReceiveTlvs) -> Self { + let rust_obj = crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = UnauthenticatedReceiveTlvs_as_Verification(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(UnauthenticatedReceiveTlvs_free_void); + ret + } +} +/// Constructs a new Verification which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned Verification must be freed before this_arg is +#[no_mangle] +pub extern "C" fn UnauthenticatedReceiveTlvs_as_Verification(this_arg: &UnauthenticatedReceiveTlvs) -> crate::lightning::ln::channelmanager::Verification { + crate::lightning::ln::channelmanager::Verification { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + hmac_for_offer_payment: UnauthenticatedReceiveTlvs_Verification_hmac_for_offer_payment, + verify_for_offer_payment: UnauthenticatedReceiveTlvs_Verification_verify_for_offer_payment, + } +} + +#[must_use] +extern "C" fn UnauthenticatedReceiveTlvs_Verification_hmac_for_offer_payment(this_arg: *const c_void, mut nonce: crate::lightning::offers::nonce::Nonce, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::ThirtyTwoBytes { + let mut ret = ::hmac_for_offer_payment(unsafe { &mut *(this_arg as *mut nativeUnauthenticatedReceiveTlvs) }, *unsafe { Box::from_raw(nonce.take_inner()) }, expanded_key.get_native_ref()); + crate::c_types::ThirtyTwoBytes { data: ret } +} +#[must_use] +extern "C" fn UnauthenticatedReceiveTlvs_Verification_verify_for_offer_payment(this_arg: *const c_void, mut hmac: crate::c_types::ThirtyTwoBytes, mut nonce: crate::lightning::offers::nonce::Nonce, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut ret = ::verify_for_offer_payment(unsafe { &mut *(this_arg as *mut nativeUnauthenticatedReceiveTlvs) }, hmac.data, *unsafe { Box::from_raw(nonce.take_inner()) }, expanded_key.get_native_ref()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + /// This enum is used to specify which error data to send to peers when failing back an HTLC /// using [`ChannelManager::fail_htlc_backwards_with_reason`]. /// @@ -976,7 +1097,7 @@ pub extern "C" fn FailureCode_invalid_onion_payload(a: crate::c_types::derived:: } use lightning::ln::channelmanager::ChannelManager as nativeChannelManagerImport; -pub(crate) type nativeChannelManager = nativeChannelManagerImport; +pub(crate) type nativeChannelManager = nativeChannelManagerImport; /// A lightning node's channel state machine and payment management logic, which facilitates /// sending, forwarding, and receiving payments through lightning channels. @@ -992,6 +1113,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport, /// # tx_broadcaster: &dyn lightning::chain::chaininterface::BroadcasterInterface, -/// # router: &lightning::routing::router::DefaultRouter<&NetworkGraph<&'a L>, &'a L, &ES, &S, SP, SL>, +/// # router: &lightning::routing::router::DefaultRouter<&NetworkGraph<&'a L>, &'a L, &ES, &S>, +/// # message_router: &lightning::onion_message::messenger::DefaultMessageRouter<&NetworkGraph<&'a L>, &'a L, &ES>, /// # logger: &L, /// # entropy_source: &ES, /// # node_signer: &dyn lightning::sign::NodeSigner, @@ -1067,18 +1190,18 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport)>::read(&mut reader, args)?; +/// <(BlockHash, ChannelManager<_, _, _, _, _, _, _, _, _>)>::read(&mut reader, args)?; /// /// // Update the ChannelManager and ChannelMonitors with the latest chain data /// // ... @@ -1303,12 +1426,12 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport(channel_manager: T) { /// # let channel_manager = channel_manager.get_cm(); -/// // Or use utils::create_invoice_from_channelmanager -/// let known_payment_hash = match channel_manager.create_inbound_payment( -/// Some(10_000_000), 3600, None -/// ) { -/// Ok((payment_hash, _payment_secret)) => { -/// println!(\"Creating inbound payment {}\", payment_hash); -/// payment_hash +/// let params = Bolt11InvoiceParameters { +/// amount_msats: Some(10_000_000), +/// invoice_expiry_delta_secs: Some(3600), +/// ..Default::default() +/// }; +/// let invoice = match channel_manager.create_bolt11_invoice(params) { +/// Ok(invoice) => { +/// println!(\"Creating invoice with payment hash {}\", invoice.payment_hash()); +/// invoice /// }, -/// Err(()) => panic!(\"Error creating inbound payment\"), +/// Err(e) => panic!(\"Error creating invoice: {}\", e), /// }; /// /// // On the event processing thread @@ -1336,7 +1461,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport match purpose { /// PaymentPurpose::Bolt11InvoicePayment { payment_preimage: Some(payment_preimage), .. } => { -/// assert_eq!(payment_hash, known_payment_hash); +/// assert_eq!(payment_hash.0, invoice.payment_hash().as_ref()); /// println!(\"Claiming payment {}\", payment_hash); /// channel_manager.claim_funds(payment_preimage); /// }, @@ -1344,7 +1469,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport { -/// assert_ne!(payment_hash, known_payment_hash); +/// assert_ne!(payment_hash.0, invoice.payment_hash().as_ref()); /// println!(\"Claiming spontaneous payment {}\", payment_hash); /// channel_manager.claim_funds(payment_preimage); /// }, @@ -1352,7 +1477,7 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport {}, /// }, /// Event::PaymentClaimed { payment_hash, amount_msat, .. } => { -/// assert_eq!(payment_hash, known_payment_hash); +/// assert_eq!(payment_hash.0, invoice.payment_hash().as_ref()); /// println!(\"Claimed {} msats\", amount_msat); /// }, /// // ... @@ -1363,13 +1488,14 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport( @@ -1472,7 +1598,8 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport( @@ -1528,7 +1655,8 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport( @@ -1698,8 +1826,10 @@ pub(crate) type nativeChannelManager = nativeChannelManagerImport { let mut payment_id_nonref = Clone::clone(payment_id); let mut payment_hash_nonref = Clone::clone(payment_hash); - let mut local_payment_hash_nonref = { /*payment_hash_nonref*/ let payment_hash_nonref_opt = payment_hash_nonref; if payment_hash_nonref_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; + let mut local_payment_hash_nonref = { /*payment_hash_nonref*/ let payment_hash_nonref_opt = payment_hash_nonref; if payment_hash_nonref_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_nonref_opt.take() }.data) }})} }; nativeRecentPaymentDetails::Fulfilled { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), payment_hash: local_payment_hash_nonref, @@ -1995,7 +2134,7 @@ impl RecentPaymentDetails { let mut payment_hash_nonref = Clone::clone(payment_hash); nativeRecentPaymentDetails::Abandoned { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_nonref.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_nonref.data), } }, } @@ -2011,12 +2150,12 @@ impl RecentPaymentDetails { RecentPaymentDetails::Pending {mut payment_id, mut payment_hash, mut total_msat, } => { nativeRecentPaymentDetails::Pending { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), total_msat: total_msat, } }, RecentPaymentDetails::Fulfilled {mut payment_id, mut payment_hash, } => { - let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_opt.take() }.data) }})} }; + let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_opt.take() }.data) }})} }; nativeRecentPaymentDetails::Fulfilled { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), payment_hash: local_payment_hash, @@ -2025,7 +2164,7 @@ impl RecentPaymentDetails { RecentPaymentDetails::Abandoned {mut payment_id, mut payment_hash, } => { nativeRecentPaymentDetails::Abandoned { payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash.data), } }, } @@ -2301,8 +2440,8 @@ pub extern "C" fn PhantomRouteHints_clone(orig: &PhantomRouteHints) -> PhantomRo /// [`params.best_block.block_hash`]: chain::BestBlock::block_hash #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_new(mut fee_est: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut router: crate::lightning::routing::router::Router, mut logger: crate::lightning::util::logger::Logger, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut signer_provider: crate::lightning::sign::SignerProvider, mut config: crate::lightning::util::config::UserConfig, mut params: crate::lightning::ln::channelmanager::ChainParameters, mut current_timestamp: u32) -> crate::lightning::ln::channelmanager::ChannelManager { - let mut ret = lightning::ln::channelmanager::ChannelManager::new(fee_est, chain_monitor, tx_broadcaster, router, logger, entropy_source, node_signer, signer_provider, *unsafe { Box::from_raw(config.take_inner()) }, *unsafe { Box::from_raw(params.take_inner()) }, current_timestamp); +pub extern "C" fn ChannelManager_new(mut fee_est: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut router: crate::lightning::routing::router::Router, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut logger: crate::lightning::util::logger::Logger, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut signer_provider: crate::lightning::sign::SignerProvider, mut config: crate::lightning::util::config::UserConfig, mut params: crate::lightning::ln::channelmanager::ChainParameters, mut current_timestamp: u32) -> crate::lightning::ln::channelmanager::ChannelManager { + let mut ret = lightning::ln::channelmanager::ChannelManager::new(fee_est, chain_monitor, tx_broadcaster, router, message_router, logger, entropy_source, node_signer, signer_provider, *unsafe { Box::from_raw(config.take_inner()) }, *unsafe { Box::from_raw(params.take_inner()) }, current_timestamp); crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -2534,14 +2673,8 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.force_close_all_channels_without_broadcasting_txn(error_message.into_string()) } -/// Sends a payment along a given route. -/// -/// This method is *DEPRECATED*, use [`Self::send_payment`] instead. If you wish to fix the -/// route for a payment, do so by matching the [`PaymentId`] passed to -/// [`Router::find_route_with_id`]. -/// -/// Value parameters are provided via the last hop in route, see documentation for [`RouteHop`] -/// fields for more info. +/// Sends a payment to the route found using the provided [`RouteParameters`], retrying failed +/// payment paths based on the provided `Retry`. /// /// May generate [`UpdateHTLCs`] message(s) event on success, which should be relayed (e.g. via /// [`PeerManager::process_events`]). @@ -2549,9 +2682,9 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t /// # Avoiding Duplicate Payments /// /// 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`] or [`Event::PaymentFailed`]) LDK will not stop you from sending a +/// method will error with [`RetryableSendFailure::DuplicatePayment`]. Note, however, that once a +/// payment is no longer pending (either via [`ChannelManager::abandon_payment`], or handling of +/// an [`Event::PaymentSent`] or [`Event::PaymentFailed`]) 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 @@ -2565,25 +2698,9 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t /// using [`ChannelMonitorUpdateStatus::InProgress`]), the payment may be lost on restart. See /// [`ChannelManager::list_recent_payments`] for more information. /// -/// # Possible Error States on [`PaymentSendFailure`] -/// -/// Each path may have a different return value, and [`PaymentSendFailure`] may return a `Vec` with -/// each entry matching the corresponding-index entry in the route paths, see -/// [`PaymentSendFailure`] for more info. +/// Routes are automatically found using the [`Router] provided on startup. To fix a route for a +/// particular payment, match the [`PaymentId`] passed to [`Router::find_route_with_id`]. /// -/// In general, a path may raise: -/// * [`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 as it has been -/// closed, doesn't exist, or the peer is currently disconnected. -/// * [`APIError::MonitorUpdateInProgress`] if a new monitor update failure prevented sending the -/// relevant updates. -/// -/// Note that depending on the type of the [`PaymentSendFailure`] the HTLC may have been -/// irrevocably committed to on our end. In such a case, do NOT retry the payment with a -/// different route unless you intend to pay twice! -/// -/// [`RouteHop`]: crate::routing::router::RouteHop /// [`Event::PaymentSent`]: events::Event::PaymentSent /// [`Event::PaymentFailed`]: events::Event::PaymentFailed /// [`UpdateHTLCs`]: events::MessageSendEvent::UpdateHTLCs @@ -2591,19 +2708,38 @@ pub extern "C" fn ChannelManager_force_close_all_channels_without_broadcasting_t /// [`ChannelMonitorUpdateStatus::InProgress`]: crate::chain::ChannelMonitorUpdateStatus::InProgress #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_payment_with_route(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut route: crate::lightning::routing::router::Route, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_NonePaymentSendFailureZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment_with_route(*unsafe { Box::from_raw(route.take_inner()) }, ::lightning::ln::types::PaymentHash(payment_hash.data), *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::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::outbound_payment::PaymentSendFailure::native_into(e) }).into() }; +pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes, mut route_params: crate::lightning::routing::router::RouteParameters, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CResult_NoneRetryableSendFailureZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment(::lightning::types::payment::PaymentHash(payment_hash.data), *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(route_params.take_inner()) }, retry_strategy.into_native()); + 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::outbound_payment::RetryableSendFailure::native_into(e) }).into() }; local_ret } -/// Similar to [`ChannelManager::send_payment_with_route`], but will automatically find a route based on -/// `route_params` and retry failed payment paths based on `retry_strategy`. +/// Pays the [`Bolt12Invoice`] associated with the `payment_id` encoded in its `payer_metadata`. +/// +/// The invoice's `payer_metadata` is used to authenticate that the invoice was indeed requested +/// before attempting a payment. [`Bolt12PaymentError::UnexpectedInvoice`] is returned if this +/// fails or if the encoded `payment_id` is not recognized. The latter may happen once the +/// payment is no longer tracked because the payment was attempted after: +/// - an invoice for the `payment_id` was already paid, +/// - one full [timer tick] has elapsed since initially requesting the invoice when paying an +/// offer, or +/// - the refund corresponding to the invoice has already expired. +/// +/// To retry the payment, request another invoice using a new `payment_id`. +/// +/// Attempting to pay the same invoice twice while the first payment is still pending will +/// result in a [`Bolt12PaymentError::DuplicateInvoice`]. +/// +/// Otherwise, either [`Event::PaymentSent`] or [`Event::PaymentFailed`] are used to indicate +/// whether or not the payment was successful. +/// +/// [timer tick]: Self::timer_tick_occurred #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes, mut route_params: crate::lightning::routing::router::RouteParameters, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CResult_NoneRetryableSendFailureZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment(::lightning::ln::types::PaymentHash(payment_hash.data), *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(route_params.take_inner()) }, retry_strategy.into_native()); - 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::outbound_payment::RetryableSendFailure::native_into(e) }).into() }; +pub extern "C" fn ChannelManager_send_payment_for_bolt12_invoice(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, invoice: &crate::lightning::offers::invoice::Bolt12Invoice, mut context: crate::c_types::derived::COption_OffersContextZ) -> crate::c_types::derived::CResult_NoneBolt12PaymentErrorZ { + let mut local_context = { /*context*/ let context_opt = context; if context_opt.is_none() { None } else { Some({ { { context_opt.take() }.into_native() }})} }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_payment_for_bolt12_invoice(invoice.get_native_ref(), local_context); + 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::outbound_payment::Bolt12PaymentError::native_into(e) }).into() }; local_ret } @@ -2643,34 +2779,22 @@ 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 -/// 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. /// -/// [`send_payment`]: Self::send_payment -#[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::derived::COption_ThirtyTwoBytesZ, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_ThirtyTwoBytesPaymentSendFailureZ { - let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment(route.get_native_ref(), local_payment_preimage, *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::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::outbound_payment::PaymentSendFailure::native_into(e) }).into() }; - local_ret -} - -/// Similar to [`ChannelManager::send_spontaneous_payment`], but will automatically find a route -/// based on `route_params` and retry failed payment paths based on `retry_strategy`. +/// See [`send_payment`] documentation for more details on the idempotency guarantees provided by +/// the [`PaymentId`] key. /// /// See [`PaymentParameters::for_keysend`] for help in constructing `route_params` for spontaneous /// payments. /// +/// [`send_payment`]: Self::send_payment /// [`PaymentParameters::for_keysend`]: crate::routing::router::PaymentParameters::for_keysend #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_spontaneous_payment_with_retry(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes, mut route_params: crate::lightning::routing::router::RouteParameters, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CResult_ThirtyTwoBytesRetryableSendFailureZ { - let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment_with_retry(local_payment_preimage, *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(route_params.take_inner()) }, retry_strategy.into_native()); +pub extern "C" fn ChannelManager_send_spontaneous_payment(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut recipient_onion: crate::lightning::ln::outbound_payment::RecipientOnionFields, mut payment_id: crate::c_types::ThirtyTwoBytes, mut route_params: crate::lightning::routing::router::RouteParameters, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry) -> crate::c_types::derived::CResult_ThirtyTwoBytesRetryableSendFailureZ { + let mut local_payment_preimage = { /*payment_preimage*/ let payment_preimage_opt = payment_preimage; if payment_preimage_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ payment_preimage_opt.take() }.data) }})} }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_spontaneous_payment(local_payment_preimage, *unsafe { Box::from_raw(recipient_onion.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(route_params.take_inner()) }, retry_strategy.into_native()); 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::outbound_payment::RetryableSendFailure::native_into(e) }).into() }; local_ret } @@ -2680,9 +2804,9 @@ pub extern "C" fn ChannelManager_send_spontaneous_payment_with_retry(this_arg: & /// us to easily discern them from real payments. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManager_send_probe(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut path: crate::lightning::routing::router::Path) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZPaymentSendFailureZ { +pub extern "C" fn ChannelManager_send_probe(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut path: crate::lightning::routing::router::Path) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZProbeSendFailureZ { let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.send_probe(*unsafe { Box::from_raw(path.take_inner()) }); - 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::outbound_payment::PaymentSendFailure::native_into(e) }).into() }; + 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::outbound_payment::ProbeSendFailure::native_into(e) }).into() }; local_ret } @@ -2945,7 +3069,7 @@ pub extern "C" fn ChannelManager_process_pending_htlc_forwards(this_arg: &crate: /// * Forgetting about stale outbound payments, either those that have already been fulfilled /// or those awaiting an invoice that hasn't been delivered in the necessary amount of time. /// The latter is determined using the system clock in `std` and the highest seen block time -/// minus two hours in `no-std`. +/// minus two hours in non-`std`. /// /// Note that this may cause reentrancy through [`chain::Watch::update_channel`] calls or feerate /// estimate fetches. @@ -2972,7 +3096,7 @@ pub extern "C" fn ChannelManager_timer_tick_occurred(this_arg: &crate::lightning /// startup during which time claims that were in-progress at shutdown may be replayed. #[no_mangle] pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, payment_hash: *const [u8; 32]) { - unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards(&::lightning::ln::types::PaymentHash(unsafe { *payment_hash })) + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards(&::lightning::types::payment::PaymentHash(unsafe { *payment_hash })) } /// This is a variant of [`ChannelManager::fail_htlc_backwards`] that allows you to specify the @@ -2981,7 +3105,7 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards(this_arg: &crate::lightning /// See [`FailureCode`] for valid failure codes. #[no_mangle] pub extern "C" fn ChannelManager_fail_htlc_backwards_with_reason(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, payment_hash: *const [u8; 32], mut failure_code: crate::lightning::ln::channelmanager::FailureCode) { - unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards_with_reason(&::lightning::ln::types::PaymentHash(unsafe { *payment_hash }), failure_code.into_native()) + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.fail_htlc_backwards_with_reason(&::lightning::types::payment::PaymentHash(unsafe { *payment_hash }), failure_code.into_native()) } /// Provides a payment preimage in response to [`Event::PaymentClaimable`], generating any @@ -3010,7 +3134,7 @@ pub extern "C" fn ChannelManager_fail_htlc_backwards_with_reason(this_arg: &crat /// [`claim_funds_with_known_custom_tlvs`]: Self::claim_funds_with_known_custom_tlvs #[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::types::PaymentPreimage(payment_preimage.data)) + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds(::lightning::types::payment::PaymentPreimage(payment_preimage.data)) } /// This is a variant of [`claim_funds`] that allows accepting a payment with custom TLVs with @@ -3024,7 +3148,7 @@ pub extern "C" fn ChannelManager_claim_funds(this_arg: &crate::lightning::ln::ch /// [`claim_funds`]: Self::claim_funds #[no_mangle] pub extern "C" fn ChannelManager_claim_funds_with_known_custom_tlvs(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_preimage: crate::c_types::ThirtyTwoBytes) { - unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds_with_known_custom_tlvs(::lightning::ln::types::PaymentPreimage(payment_preimage.data)) + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.claim_funds_with_known_custom_tlvs(::lightning::types::payment::PaymentPreimage(payment_preimage.data)) } /// Gets the node_id held by this ChannelManager @@ -3049,6 +3173,10 @@ pub extern "C" fn ChannelManager_get_our_node_id(this_arg: &crate::lightning::ln /// for zero confirmations. Instead, `accept_inbound_channel_from_trusted_peer_0conf` must be /// used to accept such channels. /// +/// NOTE: LDK makes no attempt to prevent the counterparty from using non-standard inputs which +/// will prevent the funding transaction from being relayed on the bitcoin network and hence being +/// confirmed. +/// /// [`Event::OpenChannelRequest`]: events::Event::OpenChannelRequest /// [`Event::ChannelClosed::user_channel_id`]: events::Event::ChannelClosed::user_channel_id #[must_use] @@ -3085,6 +3213,206 @@ pub extern "C" fn ChannelManager_accept_inbound_channel_from_trusted_peer_0conf( local_ret } +/// When a call to a [`ChannelSigner`] method returns an error, this indicates that the signer +/// is (temporarily) unavailable, and the operation should be retried later. +/// +/// This method allows for that retry - either checking for any signer-pending messages to be +/// attempted in every channel, or in the specifically provided channel. +/// +/// [`ChannelSigner`]: crate::sign::ChannelSigner +#[no_mangle] +pub extern "C" fn ChannelManager_signer_unblocked(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut channel_opt: crate::c_types::derived::COption_C2Tuple_PublicKeyChannelIdZZ) { + let mut local_channel_opt = if channel_opt.is_some() { Some( { let (mut orig_channel_opt_0_0, mut orig_channel_opt_0_1) = channel_opt.take().to_rust(); let mut local_channel_opt_0 = (orig_channel_opt_0_0.into_rust(), *unsafe { Box::from_raw(orig_channel_opt_0_1.take_inner()) }); local_channel_opt_0 }) } else { None }; + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signer_unblocked(local_channel_opt) +} + +/// Utility for creating a BOLT11 invoice that can be verified by [`ChannelManager`] without +/// storing any additional state. It achieves this by including a [`PaymentSecret`] in the +/// invoice which it uses to verify that the invoice has not expired and the payment amount is +/// sufficient, reproducing the [`PaymentPreimage`] if applicable. +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_create_bolt11_invoice(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut params: crate::lightning::ln::channelmanager::Bolt11InvoiceParameters) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_bolt11_invoice(*unsafe { Box::from_raw(params.take_inner()) }); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { 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::ln::channelmanager::Bolt11InvoiceParameters as nativeBolt11InvoiceParametersImport; +pub(crate) type nativeBolt11InvoiceParameters = nativeBolt11InvoiceParametersImport; + +/// Parameters used with [`create_bolt11_invoice`]. +/// +/// [`create_bolt11_invoice`]: ChannelManager::create_bolt11_invoice +#[must_use] +#[repr(C)] +pub struct Bolt11InvoiceParameters { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeBolt11InvoiceParameters, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for Bolt11InvoiceParameters { + type Target = nativeBolt11InvoiceParameters; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for Bolt11InvoiceParameters { } +unsafe impl core::marker::Sync for Bolt11InvoiceParameters { } +impl Drop for Bolt11InvoiceParameters { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeBolt11InvoiceParameters>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the Bolt11InvoiceParameters, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_free(this_obj: Bolt11InvoiceParameters) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Bolt11InvoiceParameters_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBolt11InvoiceParameters) }; +} +#[allow(unused)] +impl Bolt11InvoiceParameters { + pub(crate) fn get_native_ref(&self) -> &'static nativeBolt11InvoiceParameters { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBolt11InvoiceParameters { + 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 nativeBolt11InvoiceParameters { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// The amount for the invoice, if any. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_get_amount_msats(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_u64Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().amount_msats; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// The amount for the invoice, if any. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_set_amount_msats(this_ptr: &mut Bolt11InvoiceParameters, mut val: crate::c_types::derived::COption_u64Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.amount_msats = local_val; +} +/// The description for what the invoice is for, or hash of such description. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_get_description(this_ptr: &Bolt11InvoiceParameters) -> crate::lightning_invoice::Bolt11InvoiceDescription { + let mut inner_val = &mut this_ptr.get_native_mut_ref().description; + crate::lightning_invoice::Bolt11InvoiceDescription::from_native(inner_val) +} +/// The description for what the invoice is for, or hash of such description. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_set_description(this_ptr: &mut Bolt11InvoiceParameters, mut val: crate::lightning_invoice::Bolt11InvoiceDescription) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.description = val.into_native(); +} +/// The invoice expiration relative to its creation time. If not set, the invoice will expire in +/// [`DEFAULT_EXPIRY_TIME`] by default. +/// +/// The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` +/// builds, the highest block timestamp seen is used instead. In the latter case, use a long +/// enough expiry to account for the average block time. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_get_invoice_expiry_delta_secs(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_u32Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().invoice_expiry_delta_secs; + 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 invoice expiration relative to its creation time. If not set, the invoice will expire in +/// [`DEFAULT_EXPIRY_TIME`] by default. +/// +/// The creation time used is the duration since the Unix epoch for `std` builds. For non-`std` +/// builds, the highest block timestamp seen is used instead. In the latter case, use a long +/// enough expiry to account for the average block time. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_set_invoice_expiry_delta_secs(this_ptr: &mut Bolt11InvoiceParameters, 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) }.invoice_expiry_delta_secs = local_val; +} +/// The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use +/// [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. +/// +/// If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be +/// added as well to allow for up to a few new block confirmations during routing. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_get_min_final_cltv_expiry_delta(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_u16Z { + let mut inner_val = &mut this_ptr.get_native_mut_ref().min_final_cltv_expiry_delta; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_u16Z::None } else { crate::c_types::derived::COption_u16Z::Some( { inner_val.unwrap() }) }; + local_inner_val +} +/// The minimum `cltv_expiry` for the last HTLC in the route. If not set, will use +/// [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. +/// +/// If set, must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`], and a three-block buffer will be +/// added as well to allow for up to a few new block confirmations during routing. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_set_min_final_cltv_expiry_delta(this_ptr: &mut Bolt11InvoiceParameters, mut val: crate::c_types::derived::COption_u16Z) { + let mut local_val = if val.is_some() { Some( { val.take() }) } else { None }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.min_final_cltv_expiry_delta = local_val; +} +/// The payment hash used in the invoice. If not set, a payment hash will be generated using a +/// preimage that can be reproduced by [`ChannelManager`] without storing any state. +/// +/// Uses the payment hash if set. 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 Bolt11InvoiceParameters_get_payment_hash(this_ptr: &Bolt11InvoiceParameters) -> crate::c_types::derived::COption_ThirtyTwoBytesZ { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_hash; + let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_ThirtyTwoBytesZ::None } else { crate::c_types::derived::COption_ThirtyTwoBytesZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option is otherwise un-expressable. */ { crate::c_types::ThirtyTwoBytes { data: (*inner_val.as_ref().unwrap()).clone().0 } }) }; + local_inner_val +} +/// The payment hash used in the invoice. If not set, a payment hash will be generated using a +/// preimage that can be reproduced by [`ChannelManager`] without storing any state. +/// +/// Uses the payment hash if set. 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 Bolt11InvoiceParameters_set_payment_hash(this_ptr: &mut Bolt11InvoiceParameters, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ val_opt.take() }.data) }})} }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = local_val; +} +/// Constructs a new Bolt11InvoiceParameters given each field +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_new(mut amount_msats_arg: crate::c_types::derived::COption_u64Z, mut description_arg: crate::lightning_invoice::Bolt11InvoiceDescription, mut invoice_expiry_delta_secs_arg: crate::c_types::derived::COption_u32Z, mut min_final_cltv_expiry_delta_arg: crate::c_types::derived::COption_u16Z, mut payment_hash_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> Bolt11InvoiceParameters { + let mut local_amount_msats_arg = if amount_msats_arg.is_some() { Some( { amount_msats_arg.take() }) } else { None }; + let mut local_invoice_expiry_delta_secs_arg = if invoice_expiry_delta_secs_arg.is_some() { Some( { invoice_expiry_delta_secs_arg.take() }) } else { None }; + let mut local_min_final_cltv_expiry_delta_arg = if min_final_cltv_expiry_delta_arg.is_some() { Some( { min_final_cltv_expiry_delta_arg.take() }) } else { None }; + let mut local_payment_hash_arg = { /*payment_hash_arg*/ let payment_hash_arg_opt = payment_hash_arg; if payment_hash_arg_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_arg_opt.take() }.data) }})} }; + Bolt11InvoiceParameters { inner: ObjOps::heap_alloc(nativeBolt11InvoiceParameters { + amount_msats: local_amount_msats_arg, + description: description_arg.into_native(), + invoice_expiry_delta_secs: local_invoice_expiry_delta_secs_arg, + min_final_cltv_expiry_delta: local_min_final_cltv_expiry_delta_arg, + payment_hash: local_payment_hash_arg, + }), is_owned: true } +} +/// Creates a "default" Bolt11InvoiceParameters. See struct and individual field documentaiton for details on which values are used. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt11InvoiceParameters_default() -> Bolt11InvoiceParameters { + Bolt11InvoiceParameters { inner: ObjOps::heap_alloc(Default::default()), is_owned: true } +} /// Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the /// [`ChannelManager`] when handling [`InvoiceRequest`] messages for the offer. The offer's /// expiration will be `absolute_expiry` if `Some`, otherwise it will not expire. @@ -3127,7 +3455,7 @@ pub extern "C" fn ChannelManager_create_offer_builder(this_arg: &crate::lightnin /// See [Avoiding Duplicate Payments] for other requirements once the payment has been sent. /// /// The builder will have the provided expiration set. Any changes to the expiration on the -/// returned builder will not be honored by [`ChannelManager`]. For `no-std`, the highest seen +/// returned builder will not be honored by [`ChannelManager`]. For non-`std`, the highest seen /// block time minus two hours is used for the current time when determining if the refund has /// expired. /// @@ -3206,7 +3534,7 @@ pub extern "C" fn ChannelManager_create_refund_builder(this_arg: &crate::lightni /// # Limitations /// /// Requires a direct connection to an introduction node in [`Offer::paths`] or to -/// [`Offer::signing_pubkey`], if empty. A similar restriction applies to the responding +/// [`Offer::issuer_signing_pubkey`], if empty. A similar restriction applies to the responding /// [`Bolt12Invoice::payment_paths`]. /// /// # Errors @@ -3247,9 +3575,9 @@ pub extern "C" fn ChannelManager_pay_for_offer(this_arg: &crate::lightning::ln:: /// # Limitations /// /// Requires a direct connection to an introduction node in [`Refund::paths`] or to -/// [`Refund::payer_id`], if empty. This request is best effort; an invoice will be sent to each -/// node meeting the aforementioned criteria, but there's no guarantee that they will be -/// received and no retries will be made. +/// [`Refund::payer_signing_pubkey`], if empty. This request is best effort; an invoice will be +/// sent to each node meeting the aforementioned criteria, but there's no guarantee that they +/// will be received and no retries will be made. /// /// # Errors /// @@ -3267,6 +3595,56 @@ pub extern "C" fn ChannelManager_request_refund_payment(this_arg: &crate::lightn local_ret } +/// Pays for an [`Offer`] looked up using [BIP 353] Human Readable Names resolved by the DNS +/// resolver(s) at `dns_resolvers` which resolve names according to bLIP 32. +/// +/// If the wallet supports paying on-chain schemes, you should instead use +/// [`OMNameResolver::resolve_name`] and [`OMNameResolver::handle_dnssec_proof_for_uri`] (by +/// implementing [`DNSResolverMessageHandler`]) directly to look up a URI and then delegate to +/// your normal URI handling. +/// +/// If `max_total_routing_fee_msat` is not specified, the default from +/// [`RouteParameters::from_payment_params_and_value`] is applied. +/// +/// # Payment +/// +/// The provided `payment_id` is used to ensure that only one invoice is paid for the request +/// when received. See [Avoiding Duplicate Payments] for other requirements once the payment has +/// been sent. +/// +/// To revoke the request, use [`ChannelManager::abandon_payment`] prior to receiving the +/// invoice. If abandoned, or an invoice isn't received in a reasonable amount of time, the +/// payment will fail with an [`Event::InvoiceRequestFailed`]. +/// +/// # Privacy +/// +/// For payer privacy, uses a derived payer id and uses [`MessageRouter::create_blinded_paths`] +/// to construct a [`BlindedPath`] for the reply path. For further privacy implications, see the +/// docs of the parameterized [`Router`], which implements [`MessageRouter`]. +/// +/// # Limitations +/// +/// Requires a direct connection to the given [`Destination`] as well as an introduction node in +/// [`Offer::paths`] or to [`Offer::signing_pubkey`], if empty. A similar restriction applies to +/// the responding [`Bolt12Invoice::payment_paths`]. +/// +/// # Errors +/// +/// Errors if: +/// - a duplicate `payment_id` is provided given the caveats in the aforementioned link, +/// +/// [`Bolt12Invoice::payment_paths`]: crate::offers::invoice::Bolt12Invoice::payment_paths +/// [Avoiding Duplicate Payments]: #avoiding-duplicate-payments +#[must_use] +#[no_mangle] +pub extern "C" fn ChannelManager_pay_for_offer_from_human_readable_name(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut name: crate::lightning::onion_message::dns_resolution::HumanReadableName, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes, mut retry_strategy: crate::lightning::ln::outbound_payment::Retry, mut max_total_routing_fee_msat: crate::c_types::derived::COption_u64Z, mut dns_resolvers: crate::c_types::derived::CVec_DestinationZ) -> crate::c_types::derived::CResult_NoneNoneZ { + let mut local_max_total_routing_fee_msat = if max_total_routing_fee_msat.is_some() { Some( { max_total_routing_fee_msat.take() }) } else { None }; + let mut local_dns_resolvers = Vec::new(); for mut item in dns_resolvers.into_rust().drain(..) { local_dns_resolvers.push( { item.into_native() }); }; + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.pay_for_offer_from_human_readable_name(*unsafe { Box::from_raw(name.take_inner()) }, amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data), retry_strategy.into_native(), local_max_total_routing_fee_msat, local_dns_resolvers); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + /// Gets a payment secret and payment hash for use in an invoice given to a third party wishing /// to pay us. /// @@ -3358,7 +3736,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment(this_arg: &crate::lightn 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, mut min_final_cltv_expiry: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry = if min_final_cltv_expiry.is_some() { Some( { min_final_cltv_expiry.take() }) } else { None }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash(::lightning::ln::types::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs, local_min_final_cltv_expiry); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.create_inbound_payment_for_hash(::lightning::types::payment::PaymentHash(payment_hash.data), local_min_value_msat, invoice_expiry_delta_secs, local_min_final_cltv_expiry); 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( { () /*e*/ }).into() }; local_ret } @@ -3370,7 +3748,7 @@ pub extern "C" fn ChannelManager_create_inbound_payment_for_hash(this_arg: &crat #[must_use] #[no_mangle] pub extern "C" fn ChannelManager_get_payment_preimage(this_arg: &crate::lightning::ln::channelmanager::ChannelManager, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_ThirtyTwoBytesAPIErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_payment_preimage(::lightning::ln::types::PaymentHash(payment_hash.data), ::lightning::ln::types::PaymentSecret(payment_secret.data)); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.get_payment_preimage(::lightning::types::payment::PaymentHash(payment_hash.data), ::lightning::types::payment::PaymentSecret(payment_secret.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::util::errors::APIError::native_into(e) }).into() }; local_ret } @@ -3669,6 +4047,7 @@ pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: &ChannelMana provided_node_features: ChannelManager_ChannelMessageHandler_provided_node_features, provided_init_features: ChannelManager_ChannelMessageHandler_provided_init_features, get_chain_hashes: ChannelManager_ChannelMessageHandler_get_chain_hashes, + message_received: ChannelManager_ChannelMessageHandler_message_received, MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, @@ -3678,103 +4057,103 @@ pub extern "C" fn ChannelManager_as_ChannelMessageHandler(this_arg: &ChannelMana } extern "C" fn ChannelManager_ChannelMessageHandler_handle_open_channel(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OpenChannel) { - ::handle_open_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_open_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_open_channel_v2(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OpenChannelV2) { - ::handle_open_channel_v2(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_open_channel_v2(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_accept_channel(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AcceptChannel) { - ::handle_accept_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_accept_channel(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_accept_channel_v2(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AcceptChannelV2) { - ::handle_accept_channel_v2(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_accept_channel_v2(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_created(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingCreated) { - ::handle_funding_created(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_funding_created(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingSigned) { - ::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_ready(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady) { - ::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Shutdown) { - ::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_closing_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ClosingSigned) { - ::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_stfu(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Stfu) { - ::handle_stfu(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_stfu(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_add_input(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddInput) { - ::handle_tx_add_input(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_add_input(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_add_output(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddOutput) { - ::handle_tx_add_output(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_add_output(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_remove_input(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxRemoveInput) { - ::handle_tx_remove_input(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_remove_input(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_remove_output(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxRemoveOutput) { - ::handle_tx_remove_output(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_remove_output(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_complete(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxComplete) { - ::handle_tx_complete(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_complete(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxSignatures) { - ::handle_tx_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_init_rbf(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxInitRbf) { - ::handle_tx_init_rbf(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_init_rbf(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_ack_rbf(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAckRbf) { - ::handle_tx_ack_rbf(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_ack_rbf(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_tx_abort(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAbort) { - ::handle_tx_abort(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_abort(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateAddHTLC) { - ::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFulfillHTLC) { - ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailHTLC) { - ::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fail_malformed_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailMalformedHTLC) { - ::handle_update_fail_malformed_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fail_malformed_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::CommitmentSigned) { - ::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::RevokeAndACK) { - ::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_update_fee(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFee) { - ::handle_update_fee(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fee(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures) { - ::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust()) + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust()) } #[must_use] extern "C" fn ChannelManager_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref(), inbound); + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) { - ::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate) { - ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ChannelManager_ChannelMessageHandler_handle_error(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ErrorMessage) { - ::handle_error(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_error(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust(), msg.get_native_ref()) } #[must_use] extern "C" fn ChannelManager_ChannelMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { @@ -3783,7 +4162,7 @@ extern "C" fn ChannelManager_ChannelMessageHandler_provided_node_features(this_a } #[must_use] extern "C" fn ChannelManager_ChannelMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, &their_node_id.into_rust()); + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, their_node_id.into_rust()); crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] @@ -3792,6 +4171,9 @@ extern "C" fn ChannelManager_ChannelMessageHandler_get_chain_hashes(this_arg: *c let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: *item.as_ref() } }); }; local_ret_0.into() }) }; local_ret } +extern "C" fn ChannelManager_ChannelMessageHandler_message_received(this_arg: *const c_void) { + ::message_received(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ) +} impl From for crate::lightning::onion_message::offers::OffersMessageHandler { fn from(obj: nativeChannelManager) -> Self { @@ -3847,21 +4229,21 @@ pub extern "C" fn ChannelManager_as_AsyncPaymentsMessageHandler(this_arg: &Chann crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - held_htlc_available: ChannelManager_AsyncPaymentsMessageHandler_held_htlc_available, - release_held_htlc: ChannelManager_AsyncPaymentsMessageHandler_release_held_htlc, + handle_held_htlc_available: ChannelManager_AsyncPaymentsMessageHandler_handle_held_htlc_available, + handle_release_held_htlc: ChannelManager_AsyncPaymentsMessageHandler_handle_release_held_htlc, release_pending_messages: ChannelManager_AsyncPaymentsMessageHandler_release_pending_messages, } } #[must_use] -extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; - let mut ret = ::held_htlc_available(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); + let mut ret = ::handle_held_htlc_available(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; local_ret } -extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_release_held_htlc(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc) { - ::release_held_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }) +extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_handle_release_held_htlc(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext) { + ::handle_release_held_htlc(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native()) } #[must_use] extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_release_pending_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { @@ -3870,6 +4252,52 @@ extern "C" fn ChannelManager_AsyncPaymentsMessageHandler_release_pending_message local_ret.into() } +impl From for crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler { + fn from(obj: nativeChannelManager) -> Self { + let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = ChannelManager_as_DNSResolverMessageHandler(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(ChannelManager_free_void); + ret + } +} +/// Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is +#[no_mangle] +pub extern "C" fn ChannelManager_as_DNSResolverMessageHandler(this_arg: &ChannelManager) -> crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler { + crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + handle_dnssec_query: ChannelManager_DNSResolverMessageHandler_handle_dnssec_query, + handle_dnssec_proof: ChannelManager_DNSResolverMessageHandler_handle_dnssec_proof, + provided_node_features: ChannelManager_DNSResolverMessageHandler_provided_node_features, + release_pending_messages: ChannelManager_DNSResolverMessageHandler_release_pending_messages, + } +} + +#[must_use] +extern "C" fn ChannelManager_DNSResolverMessageHandler_handle_dnssec_query(this_arg: *const c_void, mut message: crate::lightning::onion_message::dns_resolution::DNSSECQuery, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + let mut ret = ::handle_dnssec_query(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; + local_ret +} +extern "C" fn ChannelManager_DNSResolverMessageHandler_handle_dnssec_proof(this_arg: *const c_void, mut message: crate::lightning::onion_message::dns_resolution::DNSSECProof, mut context: crate::lightning::blinded_path::message::DNSResolverContext) { + ::handle_dnssec_proof(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, *unsafe { Box::from_raw(message.take_inner()) }, *unsafe { Box::from_raw(context.take_inner()) }) +} +#[must_use] +extern "C" fn ChannelManager_DNSResolverMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn ChannelManager_DNSResolverMessageHandler_release_pending_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + let mut ret = ::release_pending_messages(unsafe { &mut *(this_arg as *mut nativeChannelManager) }, ); + 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_ret_0 = (crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::MessageSendInstructions::native_into(orig_ret_0_1)).into(); local_ret_0 }); }; + local_ret.into() +} + impl From for crate::lightning::blinded_path::NodeIdLookUp { fn from(obj: nativeChannelManager) -> Self { let rust_obj = crate::lightning::ln::channelmanager::ChannelManager { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -3997,7 +4425,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::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::sign::EntropySource, crate::lightning::sign::NodeSigner, crate::lightning::sign::SignerProvider, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::routing::router::Router, crate::lightning::util::logger::Logger, >; +pub(crate) type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImport<'static, crate::lightning::chain::Watch, crate::lightning::chain::chaininterface::BroadcasterInterface, crate::lightning::sign::EntropySource, crate::lightning::sign::NodeSigner, crate::lightning::sign::SignerProvider, crate::lightning::chain::chaininterface::FeeEstimator, crate::lightning::routing::router::Router, crate::lightning::onion_message::messenger::MessageRouter, crate::lightning::util::logger::Logger, >; /// Arguments for the creation of a ChannelManager that are not deserialized. /// @@ -4011,9 +4439,12 @@ pub(crate) type nativeChannelManagerReadArgs = nativeChannelManagerReadArgsImpor /// 3) If you are not fetching full blocks, register all relevant [`ChannelMonitor`] outpoints the /// same way you would handle a [`chain::Filter`] call using /// [`ChannelMonitor::get_outputs_to_watch`] and [`ChannelMonitor::get_funding_txo`]. -/// 4) Reconnect blocks on your [`ChannelMonitor`]s. -/// 5) Disconnect/connect blocks on the [`ChannelManager`]. -/// 6) Re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. +/// 4) Disconnect/connect blocks on your [`ChannelMonitor`]s to get them in sync with the chain. +/// 5) Disconnect/connect blocks on the [`ChannelManager`] to get it in sync with the chain. +/// 6) Optionally re-persist the [`ChannelMonitor`]s to ensure the latest state is on disk. +/// This is important if you have replayed a nontrivial number of blocks in step (4), allowing +/// you to avoid having to replay the same blocks if you shut down quickly after startup. It is +/// otherwise not required. /// Note that if you're using a [`ChainMonitor`] for your [`chain::Watch`] implementation, you /// will likely accomplish this as a side-effect of calling [`chain::Watch::watch_channel`] in /// the next step. @@ -4189,6 +4620,19 @@ pub extern "C" fn ChannelManagerReadArgs_get_router(this_ptr: &ChannelManagerRea pub extern "C" fn ChannelManagerReadArgs_set_router(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::lightning::routing::router::Router) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.router = val; } +/// The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, +/// [`Refund`]s, and any reply paths. +#[no_mangle] +pub extern "C" fn ChannelManagerReadArgs_get_message_router(this_ptr: &ChannelManagerReadArgs) -> *const crate::lightning::onion_message::messenger::MessageRouter { + let mut inner_val = &mut this_ptr.get_native_mut_ref().message_router; + inner_val +} +/// The [`MessageRouter`] used for constructing [`BlindedMessagePath`]s for [`Offer`]s, +/// [`Refund`]s, and any reply paths. +#[no_mangle] +pub extern "C" fn ChannelManagerReadArgs_set_message_router(this_ptr: &mut ChannelManagerReadArgs, mut val: crate::lightning::onion_message::messenger::MessageRouter) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.message_router = val; +} /// The Logger for use in the ChannelManager and which may be used to log information during /// deserialization. #[no_mangle] @@ -4220,9 +4664,9 @@ pub extern "C" fn ChannelManagerReadArgs_set_default_config(this_ptr: &mut Chann /// populate a HashMap directly from C. #[must_use] #[no_mangle] -pub extern "C" fn ChannelManagerReadArgs_new(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut signer_provider: crate::lightning::sign::SignerProvider, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut router: crate::lightning::routing::router::Router, mut logger: crate::lightning::util::logger::Logger, mut default_config: crate::lightning::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> crate::lightning::ln::channelmanager::ChannelManagerReadArgs { - let mut local_channel_monitors = Vec::new(); for mut item in channel_monitors.into_rust().drain(..) { local_channel_monitors.push( { item.get_native_mut_ref() }); }; - let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, router, logger, *unsafe { Box::from_raw(default_config.take_inner()) }, local_channel_monitors); +pub extern "C" fn ChannelManagerReadArgs_new(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut signer_provider: crate::lightning::sign::SignerProvider, mut fee_estimator: crate::lightning::chain::chaininterface::FeeEstimator, mut chain_monitor: crate::lightning::chain::Watch, mut tx_broadcaster: crate::lightning::chain::chaininterface::BroadcasterInterface, mut router: crate::lightning::routing::router::Router, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut logger: crate::lightning::util::logger::Logger, mut default_config: crate::lightning::util::config::UserConfig, mut channel_monitors: crate::c_types::derived::CVec_ChannelMonitorZ) -> crate::lightning::ln::channelmanager::ChannelManagerReadArgs { + let mut local_channel_monitors = Vec::new(); for mut item in channel_monitors.into_rust().drain(..) { local_channel_monitors.push( { item.get_native_ref() }); }; + let mut ret = lightning::ln::channelmanager::ChannelManagerReadArgs::new(entropy_source, node_signer, signer_provider, fee_estimator, chain_monitor, tx_broadcaster, router, message_router, logger, *unsafe { Box::from_raw(default_config.take_inner()) }, local_channel_monitors); crate::lightning::ln::channelmanager::ChannelManagerReadArgs { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -4230,7 +4674,10 @@ pub extern "C" fn ChannelManagerReadArgs_new(mut entropy_source: crate::lightnin /// Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write pub extern "C" fn C2Tuple_ThirtyTwoBytesChannelManagerZ_read(ser: crate::c_types::u8slice, arg: crate::lightning::ln::channelmanager::ChannelManagerReadArgs) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ { 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.as_ref() }, 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 } +use crate::lightning::blinded_path::payment::nativeUnauthenticatedReceiveTlvs as nativeUnauthenticatedReceiveTlvs; +use crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs; +use crate::lightning::blinded_path::payment::UnauthenticatedReceiveTlvs_free_void; diff --git a/lightning-c-bindings/src/lightning/ln/features.rs b/lightning-c-bindings/src/lightning/ln/features.rs deleted file mode 100644 index 985db0d..0000000 --- a/lightning-c-bindings/src/lightning/ln/features.rs +++ /dev/null @@ -1,139 +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. - -//! Feature flag definitions for the Lightning protocol according to [BOLT #9]. -//! -//! See [`lightning_types::features`] for the list of features currently supported. -//! -//! Note that the use of types via this module is deprecated and will be removed in a future -//! version. Instead, use feature objects via [`lightning::types::features`]. -//! -//! [`lightning::types::features`]: crate::types::features -//! [BOLT #9]: https://github.com/lightning/bolts/blob/master/09-features.md - -use alloc::str::FromStr; -use alloc::string::String; -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}; - -#[no_mangle] -/// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read -pub extern "C" fn InitFeatures_write(obj: &crate::lightning_types::features::InitFeatures) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeInitFeatures) }) -} -#[no_mangle] -/// Read a InitFeatures from a byte array, created by InitFeatures_write -pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ { - 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_types::features::InitFeatures { 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 ChannelFeatures object into a byte array which can be read by ChannelFeatures_read -pub extern "C" fn ChannelFeatures_write(obj: &crate::lightning_types::features::ChannelFeatures) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeChannelFeatures) }) -} -#[no_mangle] -/// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write -pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ { - 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_types::features::ChannelFeatures { 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 NodeFeatures object into a byte array which can be read by NodeFeatures_read -pub extern "C" fn NodeFeatures_write(obj: &crate::lightning_types::features::NodeFeatures) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeNodeFeatures) }) -} -#[no_mangle] -/// Read a NodeFeatures from a byte array, created by NodeFeatures_write -pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ { - 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_types::features::NodeFeatures { 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 Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read -pub extern "C" fn Bolt11InvoiceFeatures_write(obj: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn Bolt11InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBolt11InvoiceFeatures) }) -} -#[no_mangle] -/// Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write -pub extern "C" fn Bolt11InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_Bolt11InvoiceFeaturesDecodeErrorZ { - 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_types::features::Bolt11InvoiceFeatures { 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 Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read -pub extern "C" fn Bolt12InvoiceFeatures_write(obj: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn Bolt12InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBolt12InvoiceFeatures) }) -} -#[no_mangle] -/// Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write -pub extern "C" fn Bolt12InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_Bolt12InvoiceFeaturesDecodeErrorZ { - 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_types::features::Bolt12InvoiceFeatures { 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 BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read -pub extern "C" fn BlindedHopFeatures_write(obj: &crate::lightning_types::features::BlindedHopFeatures) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn BlindedHopFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBlindedHopFeatures) }) -} -#[no_mangle] -/// Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write -pub extern "C" fn BlindedHopFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedHopFeaturesDecodeErrorZ { - 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_types::features::BlindedHopFeatures { 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 ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read -pub extern "C" fn ChannelTypeFeatures_write(obj: &crate::lightning_types::features::ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) -} -#[allow(unused)] -pub(crate) extern "C" fn ChannelTypeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { - crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeChannelTypeFeatures) }) -} -#[no_mangle] -/// Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write -pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTypeFeaturesDecodeErrorZ { - 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_types::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 -} diff --git a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs index 3d8972c..3503b23 100644 --- a/lightning-c-bindings/src/lightning/ln/inbound_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/inbound_payment.rs @@ -21,10 +21,9 @@ use alloc::{vec::Vec, boxed::Box}; use lightning::ln::inbound_payment::ExpandedKey as nativeExpandedKeyImport; pub(crate) type nativeExpandedKey = nativeExpandedKeyImport; -/// A set of keys that were HKDF-expanded from an initial call to -/// [`NodeSigner::get_inbound_payment_key_material`]. +/// A set of keys that were HKDF-expanded. Returned by [`NodeSigner::get_inbound_payment_key`]. /// -/// [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material +/// [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key #[must_use] #[repr(C)] pub struct ExpandedKey { @@ -80,13 +79,54 @@ impl ExpandedKey { Self { inner: self.inner, is_owned: false } } } +/// Generates a non-cryptographic 64-bit hash of the ExpandedKey. +#[no_mangle] +pub extern "C" fn ExpandedKey_hash(o: &ExpandedKey) -> u64 { + if o.inner.is_null() { return 0; } + // 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.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} +impl Clone for ExpandedKey { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeExpandedKey>::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 ExpandedKey_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeExpandedKey)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the ExpandedKey +pub extern "C" fn ExpandedKey_clone(orig: &ExpandedKey) -> ExpandedKey { + orig.clone() +} +/// Checks if two ExpandedKeys 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 ExpandedKey_eq(a: &ExpandedKey, b: &ExpandedKey) -> 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 } +} +/// Get a string which allows debug introspection of a ExpandedKey object +pub extern "C" fn ExpandedKey_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::inbound_payment::ExpandedKey }).into()} /// Create a new [`ExpandedKey`] for generating an inbound payment hash and secret. /// /// It is recommended to cache this value and not regenerate it for each new inbound payment. #[must_use] #[no_mangle] -pub extern "C" fn ExpandedKey_new(key_material: *const [u8; 32]) -> crate::lightning::ln::inbound_payment::ExpandedKey { - let mut ret = lightning::ln::inbound_payment::ExpandedKey::new(&::lightning::sign::KeyMaterial( unsafe { *key_material })); +pub extern "C" fn ExpandedKey_new(mut key_material: crate::c_types::ThirtyTwoBytes) -> crate::lightning::ln::inbound_payment::ExpandedKey { + let mut ret = lightning::ln::inbound_payment::ExpandedKey::new(key_material.data); crate::lightning::ln::inbound_payment::ExpandedKey { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -94,9 +134,8 @@ pub extern "C" fn ExpandedKey_new(key_material: *const [u8; 32]) -> crate::light /// `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without /// a `ChannelManager`. /// -/// `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then -/// calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not -/// regenerate it for each new inbound payment. +/// `keys` is generated by calling [`NodeSigner::get_inbound_payment_key`]. It is recommended to +/// cache this value and not regenerate it for each new inbound payment. /// /// `current_time` is a Unix timestamp representing the current time. /// @@ -104,7 +143,7 @@ pub extern "C" fn ExpandedKey_new(key_material: *const [u8; 32]) -> crate::light /// on versions of LDK prior to 0.0.114. /// /// [phantom node payments]: crate::sign::PhantomKeysManager -/// [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material +/// [`NodeSigner::get_inbound_payment_key`]: crate::sign::NodeSigner::get_inbound_payment_key #[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, entropy_source: &crate::lightning::sign::EntropySource, mut current_time: u64, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; @@ -128,7 +167,7 @@ pub extern "C" fn create(keys: &crate::lightning::ln::inbound_payment::ExpandedK pub extern "C" fn create_from_hash(keys: &crate::lightning::ln::inbound_payment::ExpandedKey, mut min_value_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut invoice_expiry_delta_secs: u32, mut current_time: u64, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_ThirtyTwoBytesNoneZ { let mut local_min_value_msat = if min_value_msat.is_some() { Some( { min_value_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; - let mut ret = lightning::ln::inbound_payment::create_from_hash(keys.get_native_ref(), local_min_value_msat, ::lightning::ln::types::PaymentHash(payment_hash.data), invoice_expiry_delta_secs, current_time, local_min_final_cltv_expiry_delta); + let mut ret = lightning::ln::inbound_payment::create_from_hash(keys.get_native_ref(), local_min_value_msat, ::lightning::types::payment::PaymentHash(payment_hash.data), invoice_expiry_delta_secs, current_time, local_min_final_cltv_expiry_delta); 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( { () /*e*/ }).into() }; local_ret } diff --git a/lightning-c-bindings/src/lightning/ln/invoice_utils.rs b/lightning-c-bindings/src/lightning/ln/invoice_utils.rs index b9835c8..8714863 100644 --- a/lightning-c-bindings/src/lightning/ln/invoice_utils.rs +++ b/lightning-c-bindings/src/lightning/ln/invoice_utils.rs @@ -55,12 +55,11 @@ use alloc::{vec::Vec, boxed::Box}; /// [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels /// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA /// -/// This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not -/// available and the current time is supplied by the caller. +///This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller. #[no_mangle] pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; - let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_opt.take() }.data) }})} }; + let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_opt.take() }.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 local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; let mut ret = lightning::ln::invoice_utils::create_phantom_invoice::(local_amt_msat, local_payment_hash, description.into_string(), invoice_expiry_delta_secs, local_phantom_route_hints, entropy_source, node_signer, logger, network.into_native(), local_min_final_cltv_expiry_delta, core::time::Duration::from_secs(duration_since_epoch)); @@ -104,12 +103,11 @@ pub extern "C" fn create_phantom_invoice(mut amt_msat: crate::c_types::derived:: /// [`ChannelManager::create_inbound_payment_for_hash`]: crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash /// [`PhantomRouteHints::channels`]: crate::ln::channelmanager::PhantomRouteHints::channels /// -/// This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not -/// available and the current time is supplied by the caller. +///This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not available and the current time is supplied by the caller. #[no_mangle] pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: crate::c_types::derived::COption_u64Z, mut payment_hash: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut invoice_expiry_delta_secs: u32, mut description_hash: crate::lightning_invoice::Sha256, mut phantom_route_hints: crate::c_types::derived::CVec_PhantomRouteHintsZ, mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut network: crate::lightning_invoice::Currency, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z, mut duration_since_epoch: u64) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; - let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_opt.take() }.data) }})} }; + let mut local_payment_hash = { /*payment_hash*/ let payment_hash_opt = payment_hash; if payment_hash_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_opt.take() }.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 local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; let mut ret = lightning::ln::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, entropy_source, node_signer, logger, network.into_native(), local_min_final_cltv_expiry_delta, core::time::Duration::from_secs(duration_since_epoch)); @@ -133,10 +131,10 @@ pub extern "C" fn create_phantom_invoice_with_description_hash(mut amt_msat: cra /// /// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA #[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut node_signer: crate::lightning::sign::NodeSigner, 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, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { +pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; - let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager::(channelmanager.get_native_ref(), node_signer, logger, network.into_native(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); + let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager::(channelmanager.get_native_ref(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { 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 } @@ -158,47 +156,40 @@ pub extern "C" fn create_invoice_from_channelmanager(channelmanager: &crate::lig /// /// [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: crate::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA #[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut node_signer: crate::lightning::sign::NodeSigner, 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, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { +pub extern "C" fn create_invoice_from_channelmanager_with_description_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; - let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager_with_description_hash::(channelmanager.get_native_ref(), node_signer, logger, network.into_native(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); + let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager_with_description_hash::(channelmanager.get_native_ref(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { 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 } -/// See [`create_invoice_from_channelmanager_with_description_hash`] -/// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not -/// available and the current time is supplied by the caller. -#[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut node_signer: crate::lightning::sign::NodeSigner, 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, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { - let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; - let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; - let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch::(channelmanager.get_native_ref(), node_signer, 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, local_min_final_cltv_expiry_delta); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { 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 -} - -/// See [`create_invoice_from_channelmanager`] -/// This version can be used in a `no_std` environment, where [`std::time::SystemTime`] is not -/// available and the current time is supplied by the caller. +/// See [`create_invoice_from_channelmanager`]. +/// +/// This version allows for providing custom [`PaymentHash`] and description hash 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 and want to set the +/// description hash. #[no_mangle] -pub extern "C" fn create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut node_signer: crate::lightning::sign::NodeSigner, 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 min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { +pub extern "C" fn create_invoice_from_channelmanager_with_description_hash_and_payment_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description_hash: crate::lightning_invoice::Sha256, mut invoice_expiry_delta_secs: u32, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; - let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager_and_duration_since_epoch::(channelmanager.get_native_ref(), node_signer, logger, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs, local_min_final_cltv_expiry_delta); + let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager_with_description_hash_and_payment_hash::(channelmanager.get_native_ref(), local_amt_msat, *unsafe { Box::from_raw(description_hash.take_inner()) }, invoice_expiry_delta_secs, ::lightning::types::payment::PaymentHash(payment_hash.data), local_min_final_cltv_expiry_delta); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { 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 } -/// See [`create_invoice_from_channelmanager_and_duration_since_epoch`] +/// See [`create_invoice_from_channelmanager`]. +/// /// 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 create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut node_signer: crate::lightning::sign::NodeSigner, 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, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { +pub extern "C" fn create_invoice_from_channelmanager_with_payment_hash(channelmanager: &crate::lightning::ln::channelmanager::ChannelManager, mut amt_msat: crate::c_types::derived::COption_u64Z, mut description: crate::c_types::Str, mut invoice_expiry_delta_secs: u32, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut min_final_cltv_expiry_delta: crate::c_types::derived::COption_u16Z) -> crate::c_types::derived::CResult_Bolt11InvoiceSignOrCreationErrorZ { let mut local_amt_msat = if amt_msat.is_some() { Some( { amt_msat.take() }) } else { None }; let mut local_min_final_cltv_expiry_delta = if min_final_cltv_expiry_delta.is_some() { Some( { min_final_cltv_expiry_delta.take() }) } else { None }; - let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash::(channelmanager.get_native_ref(), node_signer, logger, network.into_native(), local_amt_msat, description.into_string(), core::time::Duration::from_secs(duration_since_epoch), invoice_expiry_delta_secs, ::lightning::ln::types::PaymentHash(payment_hash.data), local_min_final_cltv_expiry_delta); + let mut ret = lightning::ln::invoice_utils::create_invoice_from_channelmanager_with_payment_hash::(channelmanager.get_native_ref(), local_amt_msat, description.into_string(), invoice_expiry_delta_secs, ::lightning::types::payment::PaymentHash(payment_hash.data), local_min_final_cltv_expiry_delta); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning_invoice::Bolt11Invoice { 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 } diff --git a/lightning-c-bindings/src/lightning/ln/mod.rs b/lightning-c-bindings/src/lightning/ln/mod.rs index 6029722..e8b2407 100644 --- a/lightning-c-bindings/src/lightning/ln/mod.rs +++ b/lightning-c-bindings/src/lightning/ln/mod.rs @@ -7,12 +7,6 @@ // source was automatically generated. //! Implementations of various parts of the Lightning protocol are in this module. -//! -//! Note that the re-exports of [`PaymentHash`], [`PaymentPreimage`], and [`PaymentSecret`] here -//! are deprecated and will be removed in a future version. Instead, use them via -//! [`lightning::types::payment`]. -//! -//! [`lightning::types::payment`]: crate::types::payment use alloc::str::FromStr; use alloc::string::String; @@ -31,13 +25,136 @@ pub mod inbound_payment; pub mod msgs; pub mod peer_handler; pub mod chan_utils; -pub mod features; pub mod script; pub mod types; pub mod invoice_utils; pub mod bolt11_payment; pub mod outbound_payment; pub mod wire; +mod features { + +use alloc::str::FromStr; +use alloc::string::String; +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}; + +#[no_mangle] +/// Serialize the InitFeatures object into a byte array which can be read by InitFeatures_read +pub extern "C" fn InitFeatures_write(obj: &crate::lightning_types::features::InitFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn InitFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeInitFeatures) }) +} +#[no_mangle] +/// Read a InitFeatures from a byte array, created by InitFeatures_write +pub extern "C" fn InitFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InitFeaturesDecodeErrorZ { + 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_types::features::InitFeatures { 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 ChannelFeatures object into a byte array which can be read by ChannelFeatures_read +pub extern "C" fn ChannelFeatures_write(obj: &crate::lightning_types::features::ChannelFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn ChannelFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeChannelFeatures) }) +} +#[no_mangle] +/// Read a ChannelFeatures from a byte array, created by ChannelFeatures_write +pub extern "C" fn ChannelFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelFeaturesDecodeErrorZ { + 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_types::features::ChannelFeatures { 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 NodeFeatures object into a byte array which can be read by NodeFeatures_read +pub extern "C" fn NodeFeatures_write(obj: &crate::lightning_types::features::NodeFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn NodeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeNodeFeatures) }) +} +#[no_mangle] +/// Read a NodeFeatures from a byte array, created by NodeFeatures_write +pub extern "C" fn NodeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_NodeFeaturesDecodeErrorZ { + 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_types::features::NodeFeatures { 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 Bolt11InvoiceFeatures object into a byte array which can be read by Bolt11InvoiceFeatures_read +pub extern "C" fn Bolt11InvoiceFeatures_write(obj: &crate::lightning_types::features::Bolt11InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn Bolt11InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBolt11InvoiceFeatures) }) +} +#[no_mangle] +/// Read a Bolt11InvoiceFeatures from a byte array, created by Bolt11InvoiceFeatures_write +pub extern "C" fn Bolt11InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_Bolt11InvoiceFeaturesDecodeErrorZ { + 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_types::features::Bolt11InvoiceFeatures { 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 Bolt12InvoiceFeatures object into a byte array which can be read by Bolt12InvoiceFeatures_read +pub extern "C" fn Bolt12InvoiceFeatures_write(obj: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn Bolt12InvoiceFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBolt12InvoiceFeatures) }) +} +#[no_mangle] +/// Read a Bolt12InvoiceFeatures from a byte array, created by Bolt12InvoiceFeatures_write +pub extern "C" fn Bolt12InvoiceFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_Bolt12InvoiceFeaturesDecodeErrorZ { + 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_types::features::Bolt12InvoiceFeatures { 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 BlindedHopFeatures object into a byte array which can be read by BlindedHopFeatures_read +pub extern "C" fn BlindedHopFeatures_write(obj: &crate::lightning_types::features::BlindedHopFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn BlindedHopFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeBlindedHopFeatures) }) +} +#[no_mangle] +/// Read a BlindedHopFeatures from a byte array, created by BlindedHopFeatures_write +pub extern "C" fn BlindedHopFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_BlindedHopFeaturesDecodeErrorZ { + 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_types::features::BlindedHopFeatures { 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 ChannelTypeFeatures object into a byte array which can be read by ChannelTypeFeatures_read +pub extern "C" fn ChannelTypeFeatures_write(obj: &crate::lightning_types::features::ChannelTypeFeatures) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn ChannelTypeFeatures_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning_types::features::nativeChannelTypeFeatures) }) +} +#[no_mangle] +/// Read a ChannelTypeFeatures from a byte array, created by ChannelTypeFeatures_write +pub extern "C" fn ChannelTypeFeatures_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_ChannelTypeFeaturesDecodeErrorZ { + 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_types::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 +} +} mod peer_channel_encryptor { use alloc::str::FromStr; diff --git a/lightning-c-bindings/src/lightning/ln/msgs.rs b/lightning-c-bindings/src/lightning/ln/msgs.rs index 89c8181..bea1da6 100644 --- a/lightning-c-bindings/src/lightning/ln/msgs.rs +++ b/lightning-c-bindings/src/lightning/ln/msgs.rs @@ -53,7 +53,7 @@ pub enum DecodeError { ShortRead, /// A length descriptor in the packet didn't describe the later data correctly. BadLengthDescriptor, - /// Error from [`std::io`]. + /// Error from [`crate::io`]. Io( crate::c_types::IOError), /// The message included zlib-compressed values, which we don't support. @@ -944,9 +944,10 @@ pub extern "C" fn Pong_eq(a: &Pong, b: &Pong) -> bool { use lightning::ln::msgs::CommonOpenChannelFields as nativeCommonOpenChannelFieldsImport; pub(crate) type nativeCommonOpenChannelFields = nativeCommonOpenChannelFieldsImport; -/// Contains fields that are both common to [`open_channel`] and `open_channel2` messages. +/// Contains fields that are both common to [`open_channel`] and [`open_channel2`] messages. /// /// [`open_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel-message +/// [`open_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel2-message #[must_use] #[repr(C)] pub struct CommonOpenChannelFields { @@ -1647,10 +1648,11 @@ pub extern "C" fn OpenChannel_eq(a: &OpenChannel, b: &OpenChannel) -> bool { use lightning::ln::msgs::OpenChannelV2 as nativeOpenChannelV2Import; pub(crate) type nativeOpenChannelV2 = nativeOpenChannelV2Import; -/// An open_channel2 message to be sent by or received from the channel initiator. +/// An [`open_channel2`] message to be sent by or received from the channel initiator. /// /// Used in V2 channel establishment /// +/// [`open_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-open_channel2-message #[must_use] #[repr(C)] pub struct OpenChannelV2 { @@ -1821,9 +1823,10 @@ pub extern "C" fn OpenChannelV2_eq(a: &OpenChannelV2, b: &OpenChannelV2) -> bool use lightning::ln::msgs::CommonAcceptChannelFields as nativeCommonAcceptChannelFieldsImport; pub(crate) type nativeCommonAcceptChannelFields = nativeCommonAcceptChannelFieldsImport; -/// Contains fields that are both common to [`accept_channel`] and `accept_channel2` messages. +/// Contains fields that are both common to [`accept_channel`] and [`accept_channel2`] messages. /// /// [`accept_channel`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel-message +/// [`accept_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel2-message #[must_use] #[repr(C)] pub struct CommonAcceptChannelFields { @@ -2277,10 +2280,11 @@ pub extern "C" fn AcceptChannel_eq(a: &AcceptChannel, b: &AcceptChannel) -> bool use lightning::ln::msgs::AcceptChannelV2 as nativeAcceptChannelV2Import; pub(crate) type nativeAcceptChannelV2 = nativeAcceptChannelV2Import; -/// An accept_channel2 message to be sent by or received from the channel accepter. +/// An [`accept_channel2`] message to be sent by or received from the channel accepter. /// /// Used in V2 channel establishment /// +/// [`accept_channel2`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-accept_channel2-message #[must_use] #[repr(C)] pub struct AcceptChannelV2 { @@ -3464,8 +3468,9 @@ pub extern "C" fn SpliceLocked_eq(a: &SpliceLocked, b: &SpliceLocked) -> bool { use lightning::ln::msgs::TxAddInput as nativeTxAddInputImport; pub(crate) type nativeTxAddInput = nativeTxAddInputImport; -/// A tx_add_input message for adding an input during interactive transaction construction +/// A [`tx_add_input`] message for adding an input during interactive transaction construction /// +/// [`tx_add_input`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_add_input-message #[must_use] #[repr(C)] pub struct TxAddInput { @@ -3652,8 +3657,9 @@ pub extern "C" fn TxAddInput_eq(a: &TxAddInput, b: &TxAddInput) -> bool { use lightning::ln::msgs::TxAddOutput as nativeTxAddOutputImport; pub(crate) type nativeTxAddOutput = nativeTxAddOutputImport; -/// A tx_add_output message for adding an output during interactive transaction construction. +/// A [`tx_add_output`] message for adding an output during interactive transaction construction. /// +/// [`tx_add_output`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_add_output-message #[must_use] #[repr(C)] pub struct TxAddOutput { @@ -3811,8 +3817,9 @@ pub extern "C" fn TxAddOutput_eq(a: &TxAddOutput, b: &TxAddOutput) -> bool { use lightning::ln::msgs::TxRemoveInput as nativeTxRemoveInputImport; pub(crate) type nativeTxRemoveInput = nativeTxRemoveInputImport; -/// A tx_remove_input message for removing an input during interactive transaction construction. +/// A [`tx_remove_input`] message for removing an input during interactive transaction construction. /// +/// [`tx_remove_input`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_remove_input-and-tx_remove_output-messages #[must_use] #[repr(C)] pub struct TxRemoveInput { @@ -3944,8 +3951,9 @@ pub extern "C" fn TxRemoveInput_eq(a: &TxRemoveInput, b: &TxRemoveInput) -> bool use lightning::ln::msgs::TxRemoveOutput as nativeTxRemoveOutputImport; pub(crate) type nativeTxRemoveOutput = nativeTxRemoveOutputImport; -/// A tx_remove_output message for removing an output during interactive transaction construction. +/// A [`tx_remove_output`] message for removing an output during interactive transaction construction. /// +/// [`tx_remove_output`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_remove_input-and-tx_remove_output-messages #[must_use] #[repr(C)] pub struct TxRemoveOutput { @@ -4077,9 +4085,10 @@ pub extern "C" fn TxRemoveOutput_eq(a: &TxRemoveOutput, b: &TxRemoveOutput) -> b use lightning::ln::msgs::TxComplete as nativeTxCompleteImport; pub(crate) type nativeTxComplete = nativeTxCompleteImport; -/// A tx_complete message signalling the conclusion of a peer's transaction contributions during +/// [`A tx_complete`] message signalling the conclusion of a peer's transaction contributions during /// interactive transaction construction. /// +/// [`tx_complete`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_complete-message #[must_use] #[repr(C)] pub struct TxComplete { @@ -4199,9 +4208,10 @@ pub extern "C" fn TxComplete_eq(a: &TxComplete, b: &TxComplete) -> bool { use lightning::ln::msgs::TxSignatures as nativeTxSignaturesImport; pub(crate) type nativeTxSignatures = nativeTxSignaturesImport; -/// A tx_signatures message containing the sender's signatures for a transaction constructed with +/// A [`tx_signatures`] message containing the sender's signatures for a transaction constructed with /// interactive transaction construction. /// +/// [`tx_signatures`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_signatures-message #[must_use] #[repr(C)] pub struct TxSignatures { @@ -4365,9 +4375,10 @@ pub extern "C" fn TxSignatures_eq(a: &TxSignatures, b: &TxSignatures) -> bool { use lightning::ln::msgs::TxInitRbf as nativeTxInitRbfImport; pub(crate) type nativeTxInitRbf = nativeTxInitRbfImport; -/// A tx_init_rbf message which initiates a replacement of the transaction after it's been +/// A [`tx_init_rbf`] message which initiates a replacement of the transaction after it's been /// completed. /// +/// [`tx_init_rbf`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_init_rbf-message #[must_use] #[repr(C)] pub struct TxInitRbf { @@ -4528,9 +4539,10 @@ pub extern "C" fn TxInitRbf_eq(a: &TxInitRbf, b: &TxInitRbf) -> bool { use lightning::ln::msgs::TxAckRbf as nativeTxAckRbfImport; pub(crate) type nativeTxAckRbf = nativeTxAckRbfImport; -/// A tx_ack_rbf message which acknowledges replacement of the transaction after it's been +/// A [`tx_ack_rbf`] message which acknowledges replacement of the transaction after it's been /// completed. /// +/// [`tx_ack_rbf`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_ack_rbf-message #[must_use] #[repr(C)] pub struct TxAckRbf { @@ -4667,8 +4679,9 @@ pub extern "C" fn TxAckRbf_eq(a: &TxAckRbf, b: &TxAckRbf) -> bool { use lightning::ln::msgs::TxAbort as nativeTxAbortImport; pub(crate) type nativeTxAbort = nativeTxAbortImport; -/// A tx_abort message which signals the cancellation of an in-progress transaction negotiation. +/// A [`tx_abort`] message which signals the cancellation of an in-progress transaction negotiation. /// +/// [`tx_abort`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#the-tx_abort-message #[must_use] #[repr(C)] pub struct TxAbort { @@ -5351,7 +5364,7 @@ pub extern "C" fn UpdateAddHTLC_get_payment_hash(this_ptr: &UpdateAddHTLC) -> *c /// The payment hash, the pre-image of which controls HTLC redemption #[no_mangle] pub extern "C" fn UpdateAddHTLC_set_payment_hash(this_ptr: &mut UpdateAddHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::ln::types::PaymentHash(val.data); + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = ::lightning::types::payment::PaymentHash(val.data); } /// The expiry height of the HTLC #[no_mangle] @@ -5425,7 +5438,7 @@ pub extern "C" fn UpdateAddHTLC_new(mut channel_id_arg: crate::lightning::ln::ty channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, htlc_id: htlc_id_arg, amount_msat: amount_msat_arg, - payment_hash: ::lightning::ln::types::PaymentHash(payment_hash_arg.data), + payment_hash: ::lightning::types::payment::PaymentHash(payment_hash_arg.data), cltv_expiry: cltv_expiry_arg, skimmed_fee_msat: local_skimmed_fee_msat_arg, onion_routing_packet: *unsafe { Box::from_raw(onion_routing_packet_arg.take_inner()) }, @@ -5699,7 +5712,7 @@ pub extern "C" fn UpdateFulfillHTLC_get_payment_preimage(this_ptr: &UpdateFulfil /// The pre-image of the payment hash, allowing HTLC redemption #[no_mangle] pub extern "C" fn UpdateFulfillHTLC_set_payment_preimage(this_ptr: &mut UpdateFulfillHTLC, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_preimage = ::lightning::ln::types::PaymentPreimage(val.data); + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_preimage = ::lightning::types::payment::PaymentPreimage(val.data); } /// Constructs a new UpdateFulfillHTLC given each field #[must_use] @@ -5708,7 +5721,7 @@ pub extern "C" fn UpdateFulfillHTLC_new(mut channel_id_arg: crate::lightning::ln UpdateFulfillHTLC { inner: ObjOps::heap_alloc(nativeUpdateFulfillHTLC { channel_id: *unsafe { Box::from_raw(channel_id_arg.take_inner()) }, htlc_id: htlc_id_arg, - payment_preimage: ::lightning::ln::types::PaymentPreimage(payment_preimage_arg.data), + payment_preimage: ::lightning::types::payment::PaymentPreimage(payment_preimage_arg.data), }), is_owned: true } } impl Clone for UpdateFulfillHTLC { @@ -10150,6 +10163,13 @@ pub struct ChannelMessageHandler { /// If it's `None`, then no particular network chain hash compatibility will be enforced when /// connecting to peers. pub get_chain_hashes: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ, + /// Indicates that a message was received from any peer for any handler. + /// Called before the message is passed to the appropriate handler. + /// Useful for indicating that a network connection is active. + /// + /// Note: Since this function is called frequently, it should be as + /// efficient as possible for its intended purpose. + pub message_received: extern "C" fn (this_arg: *const c_void), /// Implementation of MessageSendEventsProvider for this object. pub MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider, /// Frees any resources associated with this object given its this_arg pointer. @@ -10197,6 +10217,7 @@ pub(crate) fn ChannelMessageHandler_clone_fields(orig: &ChannelMessageHandler) - provided_node_features: Clone::clone(&orig.provided_node_features), provided_init_features: Clone::clone(&orig.provided_init_features), get_chain_hashes: Clone::clone(&orig.get_chain_hashes), + message_received: Clone::clone(&orig.message_received), MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider_clone_fields(&orig.MessageSendEventsProvider), free: Clone::clone(&orig.free), } @@ -10218,109 +10239,109 @@ impl lightning::events::MessageSendEventsProvider for ChannelMessageHandlerRef { use lightning::ln::msgs::ChannelMessageHandler as rustChannelMessageHandler; impl rustChannelMessageHandler for ChannelMessageHandler { - fn handle_open_channel(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannel) { + fn handle_open_channel(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannel) { (self.handle_open_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::OpenChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OpenChannel<>) as *mut _) }, is_owned: false }) } - fn handle_open_channel_v2(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannelV2) { + fn handle_open_channel_v2(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannelV2) { (self.handle_open_channel_v2)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::OpenChannelV2 { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OpenChannelV2<>) as *mut _) }, is_owned: false }) } - fn handle_accept_channel(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannel) { + fn handle_accept_channel(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannel) { (self.handle_accept_channel)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AcceptChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AcceptChannel<>) as *mut _) }, is_owned: false }) } - fn handle_accept_channel_v2(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannelV2) { + fn handle_accept_channel_v2(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannelV2) { (self.handle_accept_channel_v2)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AcceptChannelV2 { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AcceptChannelV2<>) as *mut _) }, is_owned: false }) } - fn handle_funding_created(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) { + fn handle_funding_created(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) { (self.handle_funding_created)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingCreated { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingCreated<>) as *mut _) }, is_owned: false }) } - fn handle_funding_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) { + fn handle_funding_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) { (self.handle_funding_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingSigned<>) as *mut _) }, is_owned: false }) } - fn handle_channel_ready(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReady) { + fn handle_channel_ready(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReady) { (self.handle_channel_ready)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReady { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReady<>) as *mut _) }, is_owned: false }) } - fn handle_shutdown(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Shutdown) { + fn handle_shutdown(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Shutdown) { (self.handle_shutdown)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Shutdown { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Shutdown<>) as *mut _) }, is_owned: false }) } - fn handle_closing_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) { + fn handle_closing_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) { (self.handle_closing_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ClosingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ClosingSigned<>) as *mut _) }, is_owned: false }) } - fn handle_stfu(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Stfu) { + fn handle_stfu(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Stfu) { (self.handle_stfu)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Stfu { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Stfu<>) as *mut _) }, is_owned: false }) } - fn handle_tx_add_input(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddInput) { + fn handle_tx_add_input(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddInput) { (self.handle_tx_add_input)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAddInput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAddInput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_add_output(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddOutput) { + fn handle_tx_add_output(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddOutput) { (self.handle_tx_add_output)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAddOutput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAddOutput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_remove_input(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveInput) { + fn handle_tx_remove_input(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveInput) { (self.handle_tx_remove_input)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxRemoveInput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxRemoveInput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_remove_output(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveOutput) { + fn handle_tx_remove_output(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveOutput) { (self.handle_tx_remove_output)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxRemoveOutput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxRemoveOutput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_complete(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxComplete) { + fn handle_tx_complete(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxComplete) { (self.handle_tx_complete)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxComplete { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxComplete<>) as *mut _) }, is_owned: false }) } - fn handle_tx_signatures(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxSignatures) { + fn handle_tx_signatures(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxSignatures) { (self.handle_tx_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxSignatures<>) as *mut _) }, is_owned: false }) } - fn handle_tx_init_rbf(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxInitRbf) { + fn handle_tx_init_rbf(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxInitRbf) { (self.handle_tx_init_rbf)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxInitRbf { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxInitRbf<>) as *mut _) }, is_owned: false }) } - fn handle_tx_ack_rbf(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAckRbf) { + fn handle_tx_ack_rbf(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAckRbf) { (self.handle_tx_ack_rbf)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAckRbf { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAckRbf<>) as *mut _) }, is_owned: false }) } - fn handle_tx_abort(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAbort) { + fn handle_tx_abort(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAbort) { (self.handle_tx_abort)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAbort { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAbort<>) as *mut _) }, is_owned: false }) } - fn handle_update_add_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) { + fn handle_update_add_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) { (self.handle_update_add_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fulfill_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) { + fn handle_update_fulfill_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) { (self.handle_update_fulfill_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fail_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) { + fn handle_update_fail_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) { (self.handle_update_fail_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fail_malformed_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) { + fn handle_update_fail_malformed_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) { (self.handle_update_fail_malformed_htlc)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailMalformedHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_commitment_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) { + fn handle_commitment_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) { (self.handle_commitment_signed)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false }) } - fn handle_revoke_and_ack(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) { + fn handle_revoke_and_ack(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) { (self.handle_revoke_and_ack)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::RevokeAndACK<>) as *mut _) }, is_owned: false }) } - fn handle_update_fee(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) { + fn handle_update_fee(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) { (self.handle_update_fee)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFee { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFee<>) as *mut _) }, is_owned: false }) } - fn handle_announcement_signatures(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) { + fn handle_announcement_signatures(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) { (self.handle_announcement_signatures)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AnnouncementSignatures<>) as *mut _) }, is_owned: false }) } - fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) { + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret } - fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) { + fn handle_channel_reestablish(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) { (self.handle_channel_reestablish)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReestablish<>) as *mut _) }, is_owned: false }) } - fn handle_channel_update(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) { + fn handle_channel_update(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) { (self.handle_channel_update)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _) }, is_owned: false }) } - fn handle_error(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) { + fn handle_error(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) { (self.handle_error)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ErrorMessage<>) as *mut _) }, is_owned: false }) } fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { let mut ret = (self.provided_node_features)(self.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -10329,113 +10350,116 @@ impl rustChannelMessageHandler for ChannelMessageHandler { let mut local_ret = { /*ret*/ let ret_opt = ret; if ret_opt.is_none() { None } else { Some({ { let mut local_ret_0 = Vec::new(); for mut item in { ret_opt.take() }.into_rust().drain(..) { local_ret_0.push( { ::bitcoin::constants::ChainHash::from(&item.data) }); }; local_ret_0 }})} }; local_ret } + fn message_received(&self) { + (self.message_received)(self.this_arg) + } } pub struct ChannelMessageHandlerRef(ChannelMessageHandler); impl rustChannelMessageHandler for ChannelMessageHandlerRef { - fn handle_open_channel(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannel) { + fn handle_open_channel(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannel) { (self.0.handle_open_channel)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::OpenChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OpenChannel<>) as *mut _) }, is_owned: false }) } - fn handle_open_channel_v2(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannelV2) { + fn handle_open_channel_v2(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OpenChannelV2) { (self.0.handle_open_channel_v2)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::OpenChannelV2 { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OpenChannelV2<>) as *mut _) }, is_owned: false }) } - fn handle_accept_channel(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannel) { + fn handle_accept_channel(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannel) { (self.0.handle_accept_channel)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AcceptChannel { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AcceptChannel<>) as *mut _) }, is_owned: false }) } - fn handle_accept_channel_v2(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannelV2) { + fn handle_accept_channel_v2(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AcceptChannelV2) { (self.0.handle_accept_channel_v2)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AcceptChannelV2 { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AcceptChannelV2<>) as *mut _) }, is_owned: false }) } - fn handle_funding_created(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) { + fn handle_funding_created(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingCreated) { (self.0.handle_funding_created)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingCreated { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingCreated<>) as *mut _) }, is_owned: false }) } - fn handle_funding_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) { + fn handle_funding_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::FundingSigned) { (self.0.handle_funding_signed)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::FundingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::FundingSigned<>) as *mut _) }, is_owned: false }) } - fn handle_channel_ready(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReady) { + fn handle_channel_ready(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReady) { (self.0.handle_channel_ready)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReady { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReady<>) as *mut _) }, is_owned: false }) } - fn handle_shutdown(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Shutdown) { + fn handle_shutdown(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Shutdown) { (self.0.handle_shutdown)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Shutdown { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Shutdown<>) as *mut _) }, is_owned: false }) } - fn handle_closing_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) { + fn handle_closing_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ClosingSigned) { (self.0.handle_closing_signed)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ClosingSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ClosingSigned<>) as *mut _) }, is_owned: false }) } - fn handle_stfu(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Stfu) { + fn handle_stfu(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Stfu) { (self.0.handle_stfu)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Stfu { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Stfu<>) as *mut _) }, is_owned: false }) } - fn handle_tx_add_input(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddInput) { + fn handle_tx_add_input(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddInput) { (self.0.handle_tx_add_input)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAddInput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAddInput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_add_output(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddOutput) { + fn handle_tx_add_output(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAddOutput) { (self.0.handle_tx_add_output)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAddOutput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAddOutput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_remove_input(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveInput) { + fn handle_tx_remove_input(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveInput) { (self.0.handle_tx_remove_input)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxRemoveInput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxRemoveInput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_remove_output(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveOutput) { + fn handle_tx_remove_output(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxRemoveOutput) { (self.0.handle_tx_remove_output)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxRemoveOutput { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxRemoveOutput<>) as *mut _) }, is_owned: false }) } - fn handle_tx_complete(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxComplete) { + fn handle_tx_complete(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxComplete) { (self.0.handle_tx_complete)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxComplete { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxComplete<>) as *mut _) }, is_owned: false }) } - fn handle_tx_signatures(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxSignatures) { + fn handle_tx_signatures(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxSignatures) { (self.0.handle_tx_signatures)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxSignatures<>) as *mut _) }, is_owned: false }) } - fn handle_tx_init_rbf(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxInitRbf) { + fn handle_tx_init_rbf(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxInitRbf) { (self.0.handle_tx_init_rbf)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxInitRbf { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxInitRbf<>) as *mut _) }, is_owned: false }) } - fn handle_tx_ack_rbf(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAckRbf) { + fn handle_tx_ack_rbf(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAckRbf) { (self.0.handle_tx_ack_rbf)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAckRbf { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAckRbf<>) as *mut _) }, is_owned: false }) } - fn handle_tx_abort(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAbort) { + fn handle_tx_abort(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::TxAbort) { (self.0.handle_tx_abort)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::TxAbort { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::TxAbort<>) as *mut _) }, is_owned: false }) } - fn handle_update_add_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) { + fn handle_update_add_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateAddHTLC) { (self.0.handle_update_add_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateAddHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateAddHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fulfill_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) { + fn handle_update_fulfill_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFulfillHTLC) { (self.0.handle_update_fulfill_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFulfillHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFulfillHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fail_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) { + fn handle_update_fail_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailHTLC) { (self.0.handle_update_fail_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_update_fail_malformed_htlc(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) { + fn handle_update_fail_malformed_htlc(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFailMalformedHTLC) { (self.0.handle_update_fail_malformed_htlc)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFailMalformedHTLC { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFailMalformedHTLC<>) as *mut _) }, is_owned: false }) } - fn handle_commitment_signed(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) { + fn handle_commitment_signed(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::CommitmentSigned) { (self.0.handle_commitment_signed)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::CommitmentSigned { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::CommitmentSigned<>) as *mut _) }, is_owned: false }) } - fn handle_revoke_and_ack(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) { + fn handle_revoke_and_ack(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::RevokeAndACK) { (self.0.handle_revoke_and_ack)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::RevokeAndACK { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::RevokeAndACK<>) as *mut _) }, is_owned: false }) } - fn handle_update_fee(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) { + fn handle_update_fee(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::UpdateFee) { (self.0.handle_update_fee)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::UpdateFee { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::UpdateFee<>) as *mut _) }, is_owned: false }) } - fn handle_announcement_signatures(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) { + fn handle_announcement_signatures(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::AnnouncementSignatures) { (self.0.handle_announcement_signatures)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::AnnouncementSignatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::AnnouncementSignatures<>) as *mut _) }, is_owned: false }) } - fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) { + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { (self.0.peer_disconnected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret } - fn handle_channel_reestablish(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) { + fn handle_channel_reestablish(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelReestablish) { (self.0.handle_channel_reestablish)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelReestablish { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelReestablish<>) as *mut _) }, is_owned: false }) } - fn handle_channel_update(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) { + fn handle_channel_update(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ChannelUpdate) { (self.0.handle_channel_update)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _) }, is_owned: false }) } - fn handle_error(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) { + fn handle_error(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::ErrorMessage) { (self.0.handle_error)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::ErrorMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ErrorMessage<>) as *mut _) }, is_owned: false }) } fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { let mut ret = (self.0.provided_node_features)(self.0.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -10444,6 +10468,9 @@ impl rustChannelMessageHandler for ChannelMessageHandlerRef { let mut local_ret = { /*ret*/ let ret_opt = ret; if ret_opt.is_none() { None } else { Some({ { let mut local_ret_0 = Vec::new(); for mut item in { ret_opt.take() }.into_rust().drain(..) { local_ret_0.push( { ::bitcoin::constants::ChainHash::from(&item.data) }); }; local_ret_0 }})} }; local_ret } + fn message_received(&self) { + (self.0.message_received)(self.0.this_arg) + } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used @@ -10483,13 +10510,25 @@ pub struct RoutingMessageHandler { pub this_arg: *mut c_void, /// Handle an incoming `node_announcement` message, returning `true` if it should be forwarded on, /// `false` or returning an `Err` otherwise. - pub handle_node_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ, + /// + /// If `their_node_id` is `None`, the message was generated by our own local node. + /// + /// Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + pub handle_node_announcement: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ, /// Handle a `channel_announcement` message, returning `true` if it should be forwarded on, `false` /// or returning an `Err` otherwise. - pub handle_channel_announcement: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ, + /// + /// If `their_node_id` is `None`, the message was generated by our own local node. + /// + /// Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + pub handle_channel_announcement: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ, /// Handle an incoming `channel_update` message, returning true if it should be forwarded on, /// `false` or returning an `Err` otherwise. - pub handle_channel_update: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ, + /// + /// If `their_node_id` is `None`, the message was generated by our own local node. + /// + /// Note that their_node_id (or a relevant inner pointer) may be NULL or all-0s to represent None + pub handle_channel_update: extern "C" fn (this_arg: *const c_void, their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ, /// Gets channel announcements and updates required to dump our routing table to a remote node, /// starting at the `short_channel_id` indicated by `starting_point` and including announcements /// for a single channel. @@ -10586,18 +10625,21 @@ impl lightning::events::MessageSendEventsProvider for RoutingMessageHandlerRef { use lightning::ln::msgs::RoutingMessageHandler as rustRoutingMessageHandler; impl rustRoutingMessageHandler for RoutingMessageHandler { - fn handle_node_announcement(&self, mut msg: &lightning::ln::msgs::NodeAnnouncement) -> Result { - let mut ret = (self.handle_node_announcement)(self.this_arg, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::NodeAnnouncement<>) as *mut _) }, is_owned: false }); + fn handle_node_announcement(&self, mut their_node_id: Option, mut msg: &lightning::ln::msgs::NodeAnnouncement) -> Result { + let mut local_their_node_id = if their_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(their_node_id.unwrap())) } }; + let mut ret = (self.handle_node_announcement)(self.this_arg, local_their_node_id, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::NodeAnnouncement<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_channel_announcement(&self, mut msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result { - let mut ret = (self.handle_channel_announcement)(self.this_arg, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelAnnouncement<>) as *mut _) }, is_owned: false }); + fn handle_channel_announcement(&self, mut their_node_id: Option, mut msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result { + let mut local_their_node_id = if their_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(their_node_id.unwrap())) } }; + let mut ret = (self.handle_channel_announcement)(self.this_arg, local_their_node_id, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelAnnouncement<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_channel_update(&self, mut msg: &lightning::ln::msgs::ChannelUpdate) -> Result { - let mut ret = (self.handle_channel_update)(self.this_arg, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _) }, is_owned: false }); + fn handle_channel_update(&self, mut their_node_id: Option, mut msg: &lightning::ln::msgs::ChannelUpdate) -> Result { + let mut local_their_node_id = if their_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(their_node_id.unwrap())) } }; + let mut ret = (self.handle_channel_update)(self.this_arg, local_their_node_id, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } @@ -10612,27 +10654,27 @@ impl rustRoutingMessageHandler for RoutingMessageHandler { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret } - fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_reply_channel_range(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.handle_reply_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_reply_short_channel_ids_end(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_reply_short_channel_ids_end(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.handle_reply_short_channel_ids_end)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_query_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_query_channel_range(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.handle_query_channel_range)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_query_short_channel_ids(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_query_short_channel_ids(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.handle_query_short_channel_ids)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret @@ -10645,7 +10687,7 @@ impl rustRoutingMessageHandler for RoutingMessageHandler { let mut ret = (self.provided_node_features)(self.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -10653,18 +10695,21 @@ impl rustRoutingMessageHandler for RoutingMessageHandler { pub struct RoutingMessageHandlerRef(RoutingMessageHandler); impl rustRoutingMessageHandler for RoutingMessageHandlerRef { - fn handle_node_announcement(&self, mut msg: &lightning::ln::msgs::NodeAnnouncement) -> Result { - let mut ret = (self.0.handle_node_announcement)(self.0.this_arg, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::NodeAnnouncement<>) as *mut _) }, is_owned: false }); + fn handle_node_announcement(&self, mut their_node_id: Option, mut msg: &lightning::ln::msgs::NodeAnnouncement) -> Result { + let mut local_their_node_id = if their_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(their_node_id.unwrap())) } }; + let mut ret = (self.0.handle_node_announcement)(self.0.this_arg, local_their_node_id, &crate::lightning::ln::msgs::NodeAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::NodeAnnouncement<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_channel_announcement(&self, mut msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result { - let mut ret = (self.0.handle_channel_announcement)(self.0.this_arg, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelAnnouncement<>) as *mut _) }, is_owned: false }); + fn handle_channel_announcement(&self, mut their_node_id: Option, mut msg: &lightning::ln::msgs::ChannelAnnouncement) -> Result { + let mut local_their_node_id = if their_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(their_node_id.unwrap())) } }; + let mut ret = (self.0.handle_channel_announcement)(self.0.this_arg, local_their_node_id, &crate::lightning::ln::msgs::ChannelAnnouncement { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelAnnouncement<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_channel_update(&self, mut msg: &lightning::ln::msgs::ChannelUpdate) -> Result { - let mut ret = (self.0.handle_channel_update)(self.0.this_arg, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) as *mut _) }, is_owned: false }); + fn handle_channel_update(&self, mut their_node_id: Option, mut msg: &lightning::ln::msgs::ChannelUpdate) -> Result { + let mut local_their_node_id = if their_node_id.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(their_node_id.unwrap())) } }; + let mut ret = (self.0.handle_channel_update)(self.0.this_arg, local_their_node_id, &crate::lightning::ln::msgs::ChannelUpdate { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::ChannelUpdate<>) 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } @@ -10679,27 +10724,27 @@ impl rustRoutingMessageHandler for RoutingMessageHandlerRef { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret } - fn handle_reply_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_reply_channel_range(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.0.handle_reply_channel_range)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_reply_short_channel_ids_end(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_reply_short_channel_ids_end(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::ReplyShortChannelIdsEnd) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.0.handle_reply_short_channel_ids_end)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::ReplyShortChannelIdsEnd { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_query_channel_range(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_query_channel_range(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryChannelRange) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.0.handle_query_channel_range)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryChannelRange { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret } - fn handle_query_short_channel_ids(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_query_short_channel_ids(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: lightning::ln::msgs::QueryShortChannelIds) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.0.handle_query_short_channel_ids)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), crate::lightning::ln::msgs::QueryShortChannelIds { inner: ObjOps::heap_alloc(msg), is_owned: true }); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret @@ -10712,7 +10757,7 @@ impl rustRoutingMessageHandler for RoutingMessageHandlerRef { let mut ret = (self.0.provided_node_features)(self.0.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -10799,7 +10844,7 @@ pub(crate) fn OnionMessageHandler_clone_fields(orig: &OnionMessageHandler) -> On use lightning::ln::msgs::OnionMessageHandler as rustOnionMessageHandler; impl rustOnionMessageHandler for OnionMessageHandler { - fn handle_onion_message(&self, mut peer_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OnionMessage) { + fn handle_onion_message(&self, mut peer_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OnionMessage) { (self.handle_onion_message)(self.this_arg, crate::c_types::PublicKey::from_rust(&peer_node_id), &crate::lightning::ln::msgs::OnionMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OnionMessage<>) as *mut _) }, is_owned: false }) } fn next_onion_message_for_peer(&self, mut peer_node_id: bitcoin::secp256k1::PublicKey) -> Option { @@ -10807,12 +10852,12 @@ impl rustOnionMessageHandler for OnionMessageHandler { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret } - fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) { + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) } fn timer_tick_occurred(&self) { @@ -10822,7 +10867,7 @@ impl rustOnionMessageHandler for OnionMessageHandler { let mut ret = (self.provided_node_features)(self.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -10830,7 +10875,7 @@ impl rustOnionMessageHandler for OnionMessageHandler { pub struct OnionMessageHandlerRef(OnionMessageHandler); impl rustOnionMessageHandler for OnionMessageHandlerRef { - fn handle_onion_message(&self, mut peer_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OnionMessage) { + fn handle_onion_message(&self, mut peer_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::OnionMessage) { (self.0.handle_onion_message)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&peer_node_id), &crate::lightning::ln::msgs::OnionMessage { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::OnionMessage<>) as *mut _) }, is_owned: false }) } fn next_onion_message_for_peer(&self, mut peer_node_id: bitcoin::secp256k1::PublicKey) -> Option { @@ -10838,12 +10883,12 @@ impl rustOnionMessageHandler for OnionMessageHandlerRef { let mut local_ret = if ret.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(ret.take_inner()) } }) }; local_ret } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut init: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((init as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret } - fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) { + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { (self.0.peer_disconnected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) } fn timer_tick_occurred(&self) { @@ -10853,7 +10898,7 @@ impl rustOnionMessageHandler for OnionMessageHandlerRef { let mut ret = (self.0.provided_node_features)(self.0.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -10956,7 +11001,7 @@ pub extern "C" fn FinalOnionHopData_get_payment_secret(this_ptr: &FinalOnionHopD /// proof to the recipient that the payment was sent by someone with the generated invoice. #[no_mangle] pub extern "C" fn FinalOnionHopData_set_payment_secret(this_ptr: &mut FinalOnionHopData, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_secret = ::lightning::ln::types::PaymentSecret(val.data); + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_secret = ::lightning::types::payment::PaymentSecret(val.data); } /// The intended total amount that this payment is for. /// @@ -10978,7 +11023,7 @@ pub extern "C" fn FinalOnionHopData_set_total_msat(this_ptr: &mut FinalOnionHopD #[no_mangle] pub extern "C" fn FinalOnionHopData_new(mut payment_secret_arg: crate::c_types::ThirtyTwoBytes, mut total_msat_arg: u64) -> FinalOnionHopData { FinalOnionHopData { inner: ObjOps::heap_alloc(nativeFinalOnionHopData { - payment_secret: ::lightning::ln::types::PaymentSecret(payment_secret_arg.data), + payment_secret: ::lightning::types::payment::PaymentSecret(payment_secret_arg.data), total_msat: total_msat_arg, }), is_owned: true } } @@ -11001,6 +11046,18 @@ pub(crate) extern "C" fn FinalOnionHopData_clone_void(this_ptr: *const c_void) - pub extern "C" fn FinalOnionHopData_clone(orig: &FinalOnionHopData) -> FinalOnionHopData { orig.clone() } +/// Get a string which allows debug introspection of a FinalOnionHopData object +pub extern "C" fn FinalOnionHopData_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::msgs::FinalOnionHopData }).into()} +/// Checks if two FinalOnionHopDatas 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 FinalOnionHopData_eq(a: &FinalOnionHopData, b: &FinalOnionHopData) -> 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 } +} mod fuzzy_internal_msgs { use alloc::str::FromStr; diff --git a/lightning-c-bindings/src/lightning/ln/onion_payment.rs b/lightning-c-bindings/src/lightning/ln/onion_payment.rs index 2ff175b..e9b33a8 100644 --- a/lightning-c-bindings/src/lightning/ln/onion_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/onion_payment.rs @@ -179,8 +179,8 @@ pub extern "C" fn InboundHTLCErr_eq(a: &InboundHTLCErr, b: &InboundHTLCErr) -> b /// /// [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable #[no_mangle] -pub extern "C" fn peel_payment_onion(msg: &crate::lightning::ln::msgs::UpdateAddHTLC, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut cur_height: u32, mut accept_mpp_keysend: bool, mut allow_skimmed_fees: bool) -> crate::c_types::derived::CResult_PendingHTLCInfoInboundHTLCErrZ { - let mut ret = lightning::ln::onion_payment::peel_payment_onion(msg.get_native_ref(), node_signer, logger, secp256k1::global::SECP256K1, cur_height, accept_mpp_keysend, allow_skimmed_fees); +pub extern "C" fn peel_payment_onion(msg: &crate::lightning::ln::msgs::UpdateAddHTLC, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut cur_height: u32, mut allow_skimmed_fees: bool) -> crate::c_types::derived::CResult_PendingHTLCInfoInboundHTLCErrZ { + let mut ret = lightning::ln::onion_payment::peel_payment_onion(msg.get_native_ref(), node_signer, logger, secp256k1::global::SECP256K1, cur_height, allow_skimmed_fees); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::channelmanager::PendingHTLCInfo { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::onion_payment::InboundHTLCErr { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } diff --git a/lightning-c-bindings/src/lightning/ln/outbound_payment.rs b/lightning-c-bindings/src/lightning/ln/outbound_payment.rs index c54bbee..96c2f6c 100644 --- a/lightning-c-bindings/src/lightning/ln/outbound_payment.rs +++ b/lightning-c-bindings/src/lightning/ln/outbound_payment.rs @@ -178,8 +178,9 @@ pub extern "C" fn Retry_read(ser: crate::c_types::u8slice) -> crate::c_types::de #[must_use] #[repr(C)] pub enum RetryableSendFailure { - /// The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. Note - /// that this error is *not* caused by [`Retry::Timeout`]. + /// The provided [`PaymentParameters::expiry_time`] indicated that the payment has expired. + /// + ///Note that this error is *not* caused by [`Retry::Timeout`]. /// /// [`PaymentParameters::expiry_time`]: crate::routing::router::PaymentParameters::expiry_time PaymentExpired, @@ -281,283 +282,6 @@ pub extern "C" fn RetryableSendFailure_debug_str_void(o: *const c_void) -> Str { pub extern "C" fn RetryableSendFailure_eq(a: &RetryableSendFailure, b: &RetryableSendFailure) -> bool { if &a.to_native() == &b.to_native() { true } else { false } } -/// If a payment fails to send with [`ChannelManager::send_payment_with_route`], it can be in one -/// of several states. This enum is returned as the Err() type describing which state the payment -/// is in, see the description of individual enum states for more. -/// -/// [`ChannelManager::send_payment_with_route`]: crate::ln::channelmanager::ChannelManager::send_payment_with_route -#[derive(Clone)] -#[must_use] -#[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. - /// - /// You can freely resend the payment in full (with the parameter error fixed). - /// - /// Because the payment failed outright, no payment tracking is done and no - /// [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. - /// - /// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed - /// [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - 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. - /// - /// You can freely resend the payment in full (with the parameter error fixed). - /// - /// Because the payment failed outright, no payment tracking is done and no - /// [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. - /// - /// The results here are ordered the same as the paths in the route object which was passed to - /// send_payment. - /// - /// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed - /// [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - 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 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 and no - /// [`Event::PaymentPathFailed`] or [`Event::PaymentFailed`] events will be generated. - /// - /// [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed - /// [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - 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 [`Event::PaymentFailed`]). - /// - /// [`PaymentId`]: crate::ln::channelmanager::PaymentId - /// [`Event::PaymentSent`]: crate::events::Event::PaymentSent - /// [`Event::PaymentFailed`]: crate::events::Event::PaymentFailed - DuplicatePayment, - /// Some paths that were attempted failed to send, though some paths may have succeeded. At least - /// some paths have irrevocably committed to the HTLC. - /// - /// The results here are ordered the same as the paths in the route object that was passed to - /// send_payment. - /// - /// Any entries that contain `Err(APIError::MonitorUpdateInprogress)` will send once a - /// [`MonitorEvent::Completed`] is provided for the next-hop channel with the latest update_id. - /// - /// [`MonitorEvent::Completed`]: crate::chain::channelmonitor::MonitorEvent::Completed - PartialFailure { - /// The errors themselves, in the same order as the paths from the route. - results: crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ, - /// If some paths failed without irrevocably committing to the new HTLC(s), this will - /// contain a [`RouteParameters`] object for the failing paths. - /// - /// Note that this (or a relevant inner pointer) may be NULL or all-0s to represent None - failed_paths_retry: crate::lightning::routing::router::RouteParameters, - /// The payment id for the payment, which is now at least partially pending. - payment_id: crate::c_types::ThirtyTwoBytes, - }, -} -use lightning::ln::outbound_payment::PaymentSendFailure as PaymentSendFailureImport; -pub(crate) type nativePaymentSendFailure = PaymentSendFailureImport; - -impl PaymentSendFailure { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativePaymentSendFailure { - match self { - PaymentSendFailure::ParameterError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativePaymentSendFailure::ParameterError ( - a_nonref.into_native(), - ) - }, - PaymentSendFailure::PathParameterError (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( { 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::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::AllFailedResendSafe ( - local_a_nonref, - ) - }, - PaymentSendFailure::DuplicatePayment => nativePaymentSendFailure::DuplicatePayment, - PaymentSendFailure::PartialFailure {ref results, ref failed_paths_retry, ref payment_id, } => { - 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 = 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 = Clone::clone(payment_id); - nativePaymentSendFailure::PartialFailure { - results: local_results_nonref, - failed_paths_retry: local_failed_paths_retry_nonref, - payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id_nonref.data), - } - }, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativePaymentSendFailure { - match self { - PaymentSendFailure::ParameterError (mut a, ) => { - nativePaymentSendFailure::ParameterError ( - a.into_native(), - ) - }, - PaymentSendFailure::PathParameterError (mut a, ) => { - let mut local_a = Vec::new(); for mut item in a.into_rust().drain(..) { local_a.push( { let mut local_a_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_0 }); }; - nativePaymentSendFailure::PathParameterError ( - local_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::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()) } }) }; - nativePaymentSendFailure::PartialFailure { - results: local_results, - failed_paths_retry: local_failed_paths_retry, - payment_id: ::lightning::ln::channelmanager::PaymentId(payment_id.data), - } - }, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &PaymentSendFailureImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativePaymentSendFailure) }; - match native { - nativePaymentSendFailure::ParameterError (ref a, ) => { - 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 = 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::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::AllFailedResendSafe ( - local_a_nonref.into(), - ) - }, - nativePaymentSendFailure::DuplicatePayment => PaymentSendFailure::DuplicatePayment, - nativePaymentSendFailure::PartialFailure {ref results, ref failed_paths_retry, ref payment_id, } => { - 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 = 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 = Clone::clone(payment_id); - PaymentSendFailure::PartialFailure { - results: local_results_nonref.into(), - failed_paths_retry: local_failed_paths_retry_nonref, - payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id_nonref.0 }, - } - }, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativePaymentSendFailure) -> Self { - match native { - nativePaymentSendFailure::ParameterError (mut a, ) => { - PaymentSendFailure::ParameterError ( - crate::lightning::util::errors::APIError::native_into(a), - ) - }, - nativePaymentSendFailure::PathParameterError (mut a, ) => { - let mut local_a = Vec::new(); for mut item in a.drain(..) { local_a.push( { let mut local_a_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_0 }); }; - PaymentSendFailure::PathParameterError ( - local_a.into(), - ) - }, - 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::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 }; - PaymentSendFailure::PartialFailure { - results: local_results.into(), - failed_paths_retry: local_failed_paths_retry, - payment_id: crate::c_types::ThirtyTwoBytes { data: payment_id.0 }, - } - }, - } - } -} -/// Frees any resources used by the PaymentSendFailure -#[no_mangle] -pub extern "C" fn PaymentSendFailure_free(this_ptr: PaymentSendFailure) { } -/// Creates a copy of the PaymentSendFailure -#[no_mangle] -pub extern "C" fn PaymentSendFailure_clone(orig: &PaymentSendFailure) -> PaymentSendFailure { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn PaymentSendFailure_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const PaymentSendFailure)).clone() })) as *mut c_void -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn PaymentSendFailure_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut PaymentSendFailure) }; -} -#[no_mangle] -/// Utility method to constructs a new ParameterError-variant PaymentSendFailure -pub extern "C" fn PaymentSendFailure_parameter_error(a: crate::lightning::util::errors::APIError) -> PaymentSendFailure { - PaymentSendFailure::ParameterError(a, ) -} -#[no_mangle] -/// Utility method to constructs a new PathParameterError-variant PaymentSendFailure -pub extern "C" fn PaymentSendFailure_path_parameter_error(a: crate::c_types::derived::CVec_CResult_NoneAPIErrorZZ) -> PaymentSendFailure { - PaymentSendFailure::PathParameterError(a, ) -} -#[no_mangle] -/// 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 { - results, - failed_paths_retry, - payment_id, - } -} -/// Get a string which allows debug introspection of a PaymentSendFailure object -pub extern "C" fn PaymentSendFailure_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::outbound_payment::PaymentSendFailure }).into()} -/// Checks if two PaymentSendFailures contain equal inner contents. -/// This ignores pointers and is_owned flags and looks at the values in fields. -#[no_mangle] -pub extern "C" fn PaymentSendFailure_eq(a: &PaymentSendFailure, b: &PaymentSendFailure) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } -} /// An error when attempting to pay a [`Bolt12Invoice`]. #[derive(Clone)] #[must_use] @@ -687,9 +411,25 @@ pub extern "C" fn Bolt12PaymentError_eq(a: &Bolt12PaymentError, b: &Bolt12Paymen pub enum ProbeSendFailure { /// We were unable to find a route to the destination. RouteNotFound, - /// We failed to send the payment probes. - SendingFailed( - crate::lightning::ln::outbound_payment::PaymentSendFailure), + /// A parameter which was passed to [`ChannelManager::send_probe`] was invalid, preventing us from + /// attempting to send the probe at all. + /// + /// You can freely resend the probe (with the parameter error fixed). + /// + /// Because the probe failed outright, no payment tracking is done and no + /// [`Event::ProbeFailed`] events will be generated. + /// + /// [`ChannelManager::send_probe`]: crate::ln::channelmanager::ChannelManager::send_probe + /// [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed + ParameterError( + crate::lightning::util::errors::APIError), + /// Indicates that a payment for the provided [`PaymentId`] is already in-flight and has not + /// yet completed (i.e. generated an [`Event::ProbeSuccessful`] or [`Event::ProbeFailed`]). + /// + /// [`PaymentId`]: crate::ln::channelmanager::PaymentId + /// [`Event::ProbeSuccessful`]: crate::events::Event::ProbeSuccessful + /// [`Event::ProbeFailed`]: crate::events::Event::ProbeFailed + DuplicateProbe, } use lightning::ln::outbound_payment::ProbeSendFailure as ProbeSendFailureImport; pub(crate) type nativeProbeSendFailure = ProbeSendFailureImport; @@ -699,23 +439,25 @@ impl ProbeSendFailure { pub(crate) fn to_native(&self) -> nativeProbeSendFailure { match self { ProbeSendFailure::RouteNotFound => nativeProbeSendFailure::RouteNotFound, - ProbeSendFailure::SendingFailed (ref a, ) => { + ProbeSendFailure::ParameterError (ref a, ) => { let mut a_nonref = Clone::clone(a); - nativeProbeSendFailure::SendingFailed ( + nativeProbeSendFailure::ParameterError ( a_nonref.into_native(), ) }, + ProbeSendFailure::DuplicateProbe => nativeProbeSendFailure::DuplicateProbe, } } #[allow(unused)] pub(crate) fn into_native(self) -> nativeProbeSendFailure { match self { ProbeSendFailure::RouteNotFound => nativeProbeSendFailure::RouteNotFound, - ProbeSendFailure::SendingFailed (mut a, ) => { - nativeProbeSendFailure::SendingFailed ( + ProbeSendFailure::ParameterError (mut a, ) => { + nativeProbeSendFailure::ParameterError ( a.into_native(), ) }, + ProbeSendFailure::DuplicateProbe => nativeProbeSendFailure::DuplicateProbe, } } #[allow(unused)] @@ -723,23 +465,25 @@ impl ProbeSendFailure { let native = unsafe { &*(native as *const _ as *const c_void as *const nativeProbeSendFailure) }; match native { nativeProbeSendFailure::RouteNotFound => ProbeSendFailure::RouteNotFound, - nativeProbeSendFailure::SendingFailed (ref a, ) => { + nativeProbeSendFailure::ParameterError (ref a, ) => { let mut a_nonref = Clone::clone(a); - ProbeSendFailure::SendingFailed ( - crate::lightning::ln::outbound_payment::PaymentSendFailure::native_into(a_nonref), + ProbeSendFailure::ParameterError ( + crate::lightning::util::errors::APIError::native_into(a_nonref), ) }, + nativeProbeSendFailure::DuplicateProbe => ProbeSendFailure::DuplicateProbe, } } #[allow(unused)] pub(crate) fn native_into(native: nativeProbeSendFailure) -> Self { match native { nativeProbeSendFailure::RouteNotFound => ProbeSendFailure::RouteNotFound, - nativeProbeSendFailure::SendingFailed (mut a, ) => { - ProbeSendFailure::SendingFailed ( - crate::lightning::ln::outbound_payment::PaymentSendFailure::native_into(a), + nativeProbeSendFailure::ParameterError (mut a, ) => { + ProbeSendFailure::ParameterError ( + crate::lightning::util::errors::APIError::native_into(a), ) }, + nativeProbeSendFailure::DuplicateProbe => ProbeSendFailure::DuplicateProbe, } } } @@ -766,10 +510,14 @@ pub(crate) extern "C" fn ProbeSendFailure_free_void(this_ptr: *mut c_void) { pub extern "C" fn ProbeSendFailure_route_not_found() -> ProbeSendFailure { ProbeSendFailure::RouteNotFound} #[no_mangle] -/// Utility method to constructs a new SendingFailed-variant ProbeSendFailure -pub extern "C" fn ProbeSendFailure_sending_failed(a: crate::lightning::ln::outbound_payment::PaymentSendFailure) -> ProbeSendFailure { - ProbeSendFailure::SendingFailed(a, ) +/// Utility method to constructs a new ParameterError-variant ProbeSendFailure +pub extern "C" fn ProbeSendFailure_parameter_error(a: crate::lightning::util::errors::APIError) -> ProbeSendFailure { + ProbeSendFailure::ParameterError(a, ) } +#[no_mangle] +/// Utility method to constructs a new DuplicateProbe-variant ProbeSendFailure +pub extern "C" fn ProbeSendFailure_duplicate_probe() -> ProbeSendFailure { + ProbeSendFailure::DuplicateProbe} /// Get a string which allows debug introspection of a ProbeSendFailure object pub extern "C" fn ProbeSendFailure_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::outbound_payment::ProbeSendFailure }).into()} @@ -872,7 +620,7 @@ pub extern "C" fn RecipientOnionFields_get_payment_secret(this_ptr: &RecipientOn /// recipient will not reject it. #[no_mangle] pub extern "C" fn RecipientOnionFields_set_payment_secret(this_ptr: &mut RecipientOnionFields, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentSecret({ val_opt.take() }.data) }})} }; + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentSecret({ val_opt.take() }.data) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_secret = local_val; } /// The payment metadata serves a similar purpose as [`Self::payment_secret`] but is of @@ -965,7 +713,7 @@ pub extern "C" fn RecipientOnionFields_read(ser: crate::c_types::u8slice) -> cra #[must_use] #[no_mangle] pub extern "C" fn RecipientOnionFields_secret_only(mut payment_secret: crate::c_types::ThirtyTwoBytes) -> crate::lightning::ln::outbound_payment::RecipientOnionFields { - let mut ret = lightning::ln::outbound_payment::RecipientOnionFields::secret_only(::lightning::ln::types::PaymentSecret(payment_secret.data)); + let mut ret = lightning::ln::outbound_payment::RecipientOnionFields::secret_only(::lightning::types::payment::PaymentSecret(payment_secret.data)); crate::lightning::ln::outbound_payment::RecipientOnionFields { inner: ObjOps::heap_alloc(ret), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning/ln/peer_handler.rs b/lightning-c-bindings/src/lightning/ln/peer_handler.rs index 672610e..699df6b 100644 --- a/lightning-c-bindings/src/lightning/ln/peer_handler.rs +++ b/lightning-c-bindings/src/lightning/ln/peer_handler.rs @@ -105,7 +105,7 @@ impl lightning::ln::wire::CustomMessageReader for CustomMessageHandlerRef { use lightning::ln::peer_handler::CustomMessageHandler as rustCustomMessageHandler; impl rustCustomMessageHandler for CustomMessageHandler { - fn handle_custom_message(&self, mut msg: crate::lightning::ln::wire::Type, mut sender_node_id: &bitcoin::secp256k1::PublicKey) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_custom_message(&self, mut msg: crate::lightning::ln::wire::Type, mut sender_node_id: bitcoin::secp256k1::PublicKey) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.handle_custom_message)(self.this_arg, Into::into(msg), crate::c_types::PublicKey::from_rust(&sender_node_id)); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret @@ -115,10 +115,10 @@ impl rustCustomMessageHandler for CustomMessageHandler { 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_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1); local_ret_0 }); }; local_ret } - fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) { + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { (self.peer_disconnected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.peer_connected)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret @@ -127,7 +127,7 @@ impl rustCustomMessageHandler for CustomMessageHandler { let mut ret = (self.provided_node_features)(self.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.provided_init_features)(self.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -135,7 +135,7 @@ impl rustCustomMessageHandler for CustomMessageHandler { pub struct CustomMessageHandlerRef(CustomMessageHandler); impl rustCustomMessageHandler for CustomMessageHandlerRef { - fn handle_custom_message(&self, mut msg: crate::lightning::ln::wire::Type, mut sender_node_id: &bitcoin::secp256k1::PublicKey) -> Result<(), lightning::ln::msgs::LightningError> { + fn handle_custom_message(&self, mut msg: crate::lightning::ln::wire::Type, mut sender_node_id: bitcoin::secp256k1::PublicKey) -> Result<(), lightning::ln::msgs::LightningError> { let mut ret = (self.0.handle_custom_message)(self.0.this_arg, Into::into(msg), crate::c_types::PublicKey::from_rust(&sender_node_id)); 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((*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).take_inner()) } })}; local_ret @@ -145,10 +145,10 @@ impl rustCustomMessageHandler for CustomMessageHandlerRef { 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_ret_0 = (orig_ret_0_0.into_rust(), orig_ret_0_1); local_ret_0 }); }; local_ret } - fn peer_disconnected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) { + fn peer_disconnected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) { (self.0.peer_disconnected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)) } - fn peer_connected(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { + fn peer_connected(&self, mut their_node_id: bitcoin::secp256k1::PublicKey, mut msg: &lightning::ln::msgs::Init, mut inbound: bool) -> Result<(), ()> { let mut ret = (self.0.peer_connected)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id), &crate::lightning::ln::msgs::Init { inner: unsafe { ObjOps::nonnull_ptr_to_inner((msg as *const lightning::ln::msgs::Init<>) as *mut _) }, is_owned: false }, inbound); 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)) })*/ })}; local_ret @@ -157,7 +157,7 @@ impl rustCustomMessageHandler for CustomMessageHandlerRef { let mut ret = (self.0.provided_node_features)(self.0.this_arg); *unsafe { Box::from_raw(ret.take_inner()) } } - fn provided_init_features(&self, mut their_node_id: &bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { + fn provided_init_features(&self, mut their_node_id: bitcoin::secp256k1::PublicKey) -> lightning_types::features::InitFeatures { let mut ret = (self.0.provided_init_features)(self.0.this_arg, crate::c_types::PublicKey::from_rust(&their_node_id)); *unsafe { Box::from_raw(ret.take_inner()) } } @@ -321,20 +321,23 @@ pub extern "C" fn IgnoringMessageHandler_as_RoutingMessageHandler(this_arg: &Ign } #[must_use] -extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { - let mut ret = ::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, msg.get_native_ref()); +extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { + let mut local_their_node_id = if their_node_id.is_null() { None } else { Some( { their_node_id.into_rust() }) }; + let mut ret = ::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, local_their_node_id, msg.get_native_ref()); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] -extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { - let mut ret = ::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, msg.get_native_ref()); +extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { + let mut local_their_node_id = if their_node_id.is_null() { None } else { Some( { their_node_id.into_rust() }) }; + let mut ret = ::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, local_their_node_id, msg.get_native_ref()); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] -extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ { - let mut ret = ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, msg.get_native_ref()); +extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ { + let mut local_their_node_id = if their_node_id.is_null() { None } else { Some( { their_node_id.into_rust() }) }; + let mut ret = ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, local_their_node_id, msg.get_native_ref()); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } @@ -353,31 +356,31 @@ extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_get_next_node_announc } #[must_use] extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref(), inbound); + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), init.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_handle_query_short_channel_ids(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } @@ -393,7 +396,7 @@ extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_provided_node_feature } #[must_use] extern "C" fn IgnoringMessageHandler_RoutingMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust()); + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()); crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -425,7 +428,7 @@ pub extern "C" fn IgnoringMessageHandler_as_OnionMessageHandler(this_arg: &Ignor } extern "C" fn IgnoringMessageHandler_OnionMessageHandler_handle_onion_message(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage) { - ::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &peer_node_id.into_rust(), msg.get_native_ref()) + ::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, peer_node_id.into_rust(), msg.get_native_ref()) } #[must_use] extern "C" fn IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage { @@ -435,12 +438,12 @@ extern "C" fn IgnoringMessageHandler_OnionMessageHandler_next_onion_message_for_ } #[must_use] extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), init.get_native_ref(), inbound); + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), init.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } extern "C" fn IgnoringMessageHandler_OnionMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust()) + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()) } extern "C" fn IgnoringMessageHandler_OnionMessageHandler_timer_tick_occurred(this_arg: *const c_void) { ::timer_tick_occurred(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ) @@ -452,7 +455,7 @@ extern "C" fn IgnoringMessageHandler_OnionMessageHandler_provided_node_features( } #[must_use] extern "C" fn IgnoringMessageHandler_OnionMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust()); + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()); crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -510,21 +513,21 @@ pub extern "C" fn IgnoringMessageHandler_as_AsyncPaymentsMessageHandler(this_arg crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - held_htlc_available: IgnoringMessageHandler_AsyncPaymentsMessageHandler_held_htlc_available, - release_held_htlc: IgnoringMessageHandler_AsyncPaymentsMessageHandler_release_held_htlc, + handle_held_htlc_available: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_held_htlc_available, + handle_release_held_htlc: IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_release_held_htlc, release_pending_messages: IgnoringMessageHandler_AsyncPaymentsMessageHandler_release_pending_messages, } } #[must_use] -extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { +extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_held_htlc_available(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ { let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; - let mut ret = ::held_htlc_available(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); + let mut ret = ::handle_held_htlc_available(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; local_ret } -extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_release_held_htlc(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc) { - ::release_held_htlc(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }) +extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_handle_release_held_htlc(this_arg: *const c_void, mut message: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, mut context: crate::lightning::blinded_path::message::AsyncPaymentsContext) { + ::handle_release_held_htlc(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, context.into_native()) } #[must_use] extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_release_pending_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_AsyncPaymentsMessageMessageSendInstructionsZZ { @@ -533,6 +536,52 @@ extern "C" fn IgnoringMessageHandler_AsyncPaymentsMessageHandler_release_pending local_ret.into() } +impl From for crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler { + fn from(obj: nativeIgnoringMessageHandler) -> Self { + let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = IgnoringMessageHandler_as_DNSResolverMessageHandler(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(IgnoringMessageHandler_free_void); + ret + } +} +/// Constructs a new DNSResolverMessageHandler which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned DNSResolverMessageHandler must be freed before this_arg is +#[no_mangle] +pub extern "C" fn IgnoringMessageHandler_as_DNSResolverMessageHandler(this_arg: &IgnoringMessageHandler) -> crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler { + crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + handle_dnssec_query: IgnoringMessageHandler_DNSResolverMessageHandler_handle_dnssec_query, + handle_dnssec_proof: IgnoringMessageHandler_DNSResolverMessageHandler_handle_dnssec_proof, + provided_node_features: IgnoringMessageHandler_DNSResolverMessageHandler_provided_node_features, + release_pending_messages: IgnoringMessageHandler_DNSResolverMessageHandler_release_pending_messages, + } +} + +#[must_use] +extern "C" fn IgnoringMessageHandler_DNSResolverMessageHandler_handle_dnssec_query(this_arg: *const c_void, mut message: crate::lightning::onion_message::dns_resolution::DNSSECQuery, mut responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ { + let mut local_responder = if responder.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(responder.take_inner()) } }) }; + let mut ret = ::handle_dnssec_query(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, local_responder); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ::None } else { crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_ret_0 = (crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::ResponseInstruction { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; + local_ret +} +extern "C" fn IgnoringMessageHandler_DNSResolverMessageHandler_handle_dnssec_proof(this_arg: *const c_void, mut message: crate::lightning::onion_message::dns_resolution::DNSSECProof, mut context: crate::lightning::blinded_path::message::DNSResolverContext) { + ::handle_dnssec_proof(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, *unsafe { Box::from_raw(message.take_inner()) }, *unsafe { Box::from_raw(context.take_inner()) }) +} +#[must_use] +extern "C" fn IgnoringMessageHandler_DNSResolverMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { + let mut ret = ::provided_node_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); + crate::lightning_types::features::NodeFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } +} +#[must_use] +extern "C" fn IgnoringMessageHandler_DNSResolverMessageHandler_release_pending_messages(this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ { + let mut ret = ::release_pending_messages(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, ); + 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_ret_0 = (crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(orig_ret_0_0), crate::lightning::onion_message::messenger::MessageSendInstructions::native_into(orig_ret_0_1)).into(); local_ret_0 }); }; + local_ret.into() +} + impl From for crate::lightning::onion_message::messenger::CustomOnionMessageHandler { fn from(obj: nativeIgnoringMessageHandler) -> Self { let rust_obj = crate::lightning::ln::peer_handler::IgnoringMessageHandler { inner: ObjOps::heap_alloc(obj), is_owned: true }; @@ -653,11 +702,11 @@ extern "C" fn IgnoringMessageHandler_CustomMessageHandler_get_and_clear_pending_ local_ret.into() } extern "C" fn IgnoringMessageHandler_CustomMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust()) + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()) } #[must_use] extern "C" fn IgnoringMessageHandler_CustomMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref(), inbound); + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } @@ -668,7 +717,7 @@ extern "C" fn IgnoringMessageHandler_CustomMessageHandler_provided_node_features } #[must_use] extern "C" fn IgnoringMessageHandler_CustomMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, &their_node_id.into_rust()); + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeIgnoringMessageHandler) }, their_node_id.into_rust()); crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -821,6 +870,7 @@ pub extern "C" fn ErroringMessageHandler_as_ChannelMessageHandler(this_arg: &Err provided_node_features: ErroringMessageHandler_ChannelMessageHandler_provided_node_features, provided_init_features: ErroringMessageHandler_ChannelMessageHandler_provided_init_features, get_chain_hashes: ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes, + message_received: ErroringMessageHandler_ChannelMessageHandler_message_received, MessageSendEventsProvider: crate::lightning::events::MessageSendEventsProvider { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, @@ -830,103 +880,103 @@ pub extern "C" fn ErroringMessageHandler_as_ChannelMessageHandler(this_arg: &Err } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_open_channel(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OpenChannel) { - ::handle_open_channel(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_open_channel(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_open_channel_v2(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OpenChannelV2) { - ::handle_open_channel_v2(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_open_channel_v2(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_accept_channel(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AcceptChannel) { - ::handle_accept_channel(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_accept_channel(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_accept_channel_v2(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AcceptChannelV2) { - ::handle_accept_channel_v2(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_accept_channel_v2(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_created(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingCreated) { - ::handle_funding_created(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_funding_created(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_funding_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::FundingSigned) { - ::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_funding_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_ready(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReady) { - ::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_channel_ready(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_shutdown(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Shutdown) { - ::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_shutdown(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_closing_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ClosingSigned) { - ::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_closing_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_stfu(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Stfu) { - ::handle_stfu(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_stfu(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_input(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddInput) { - ::handle_tx_add_input(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_add_input(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_add_output(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAddOutput) { - ::handle_tx_add_output(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_add_output(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_remove_input(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxRemoveInput) { - ::handle_tx_remove_input(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_remove_input(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_remove_output(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxRemoveOutput) { - ::handle_tx_remove_output(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_remove_output(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_complete(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxComplete) { - ::handle_tx_complete(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_complete(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxSignatures) { - ::handle_tx_signatures(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_signatures(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_init_rbf(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxInitRbf) { - ::handle_tx_init_rbf(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_init_rbf(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_ack_rbf(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAckRbf) { - ::handle_tx_ack_rbf(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_ack_rbf(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_tx_abort(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::TxAbort) { - ::handle_tx_abort(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_tx_abort(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_add_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateAddHTLC) { - ::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_add_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fulfill_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFulfillHTLC) { - ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fulfill_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailHTLC) { - ::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fail_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fail_malformed_htlc(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFailMalformedHTLC) { - ::handle_update_fail_malformed_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fail_malformed_htlc(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_commitment_signed(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::CommitmentSigned) { - ::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_commitment_signed(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_revoke_and_ack(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::RevokeAndACK) { - ::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_revoke_and_ack(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_update_fee(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::UpdateFee) { - ::handle_update_fee(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_update_fee(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_announcement_signatures(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::AnnouncementSignatures) { - ::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_announcement_signatures(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust()) + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust()) } #[must_use] extern "C" fn ErroringMessageHandler_ChannelMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref(), inbound); + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_reestablish(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelReestablish) { - ::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_channel_reestablish(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_channel_update(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate) { - ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } extern "C" fn ErroringMessageHandler_ChannelMessageHandler_handle_error(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ErrorMessage) { - ::handle_error(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust(), msg.get_native_ref()) + ::handle_error(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust(), msg.get_native_ref()) } #[must_use] extern "C" fn ErroringMessageHandler_ChannelMessageHandler_provided_node_features(this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures { @@ -935,7 +985,7 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_provided_node_feature } #[must_use] extern "C" fn ErroringMessageHandler_ChannelMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, &their_node_id.into_rust()); + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, their_node_id.into_rust()); crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] @@ -944,6 +994,9 @@ extern "C" fn ErroringMessageHandler_ChannelMessageHandler_get_chain_hashes(this let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: *item.as_ref() } }); }; local_ret_0.into() }) }; local_ret } +extern "C" fn ErroringMessageHandler_ChannelMessageHandler_message_received(this_arg: *const c_void) { + ::message_received(unsafe { &mut *(this_arg as *mut nativeErroringMessageHandler) }, ) +} use lightning::ln::peer_handler::MessageHandler as nativeMessageHandlerImport; @@ -1675,8 +1728,11 @@ pub extern "C" fn PeerManager_read_event(this_arg: &crate::lightning::ln::peer_h /// May call [`send_data`] on [`SocketDescriptor`]s. Thus, be very careful with reentrancy /// issues! /// -/// You don't have to call this function explicitly if you are using [`lightning-net-tokio`] -/// or one of the other clients provided in our language bindings. +/// This should be called any time we may have messages to send. It is automatically called by +/// [`lightning-net-tokio`] after processing incoming messages, and by +/// [`lightning-background-processor`] when channel state has changed. Therefore, If you are not +/// using both [`lightning-net-tokio`] and [`lightning-background-processor`], you may need to call +/// this function manually to prevent messages from being delayed. /// /// Note that if there are any other calls to this function waiting on lock(s) this may return /// without doing any work. All available events that need handling will be handled before the diff --git a/lightning-c-bindings/src/lightning/ln/types.rs b/lightning-c-bindings/src/lightning/ln/types.rs index dfccfda..21f06c9 100644 --- a/lightning-c-bindings/src/lightning/ln/types.rs +++ b/lightning-c-bindings/src/lightning/ln/types.rs @@ -7,12 +7,6 @@ // source was automatically generated. //! Various wrapper types (most around 32-byte arrays) for use in lightning. -//! -//! Note that the re-exports of [`PaymentHash`], [`PaymentPreimage`], and [`PaymentSecret`] here -//! are deprecated and will be removed in a future version. Instead, use them via -//! [`lightning::types::payment`]. -//! -//! [`lightning::types::payment`]: crate::types::payment use alloc::str::FromStr; use alloc::string::String; @@ -126,9 +120,6 @@ pub(crate) extern "C" fn ChannelId_clone_void(this_ptr: *const c_void) -> *mut c pub extern "C" fn ChannelId_clone(orig: &ChannelId) -> ChannelId { orig.clone() } -/// Get a string which allows debug introspection of a ChannelId object -pub extern "C" fn ChannelId_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::ln::types::ChannelId }).into()} /// Checks if two ChannelIds 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. @@ -232,8 +223,3 @@ pub extern "C" fn ChannelId_read(ser: crate::c_types::u8slice) -> crate::c_types let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::ln::types::ChannelId { 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] -/// Get the string representation of a ChannelId object -pub extern "C" fn ChannelId_to_str(o: &crate::lightning::ln::types::ChannelId) -> Str { - alloc::format!("{}", o.get_native_ref()).into() -} diff --git a/lightning-c-bindings/src/lightning/mod.rs b/lightning-c-bindings/src/lightning/mod.rs index 6b19d5f..5f39d01 100644 --- a/lightning-c-bindings/src/lightning/mod.rs +++ b/lightning-c-bindings/src/lightning/mod.rs @@ -26,14 +26,6 @@ //! //! * `std` //! * `grind_signatures` -//! * `no-std ` - exposes write trait implementations from the `core2` crate (at least one of `no-std` or `std` are required) -//! * Skip logging of messages at levels below the given log level: -//! * `max_level_off` -//! * `max_level_error` -//! * `max_level_warn` -//! * `max_level_info` -//! * `max_level_debug` -//! * `max_level_trace` use alloc::str::FromStr; use alloc::string::String; @@ -89,7 +81,7 @@ use alloc::{vec::Vec, boxed::Box}; } } -mod poly1305 { +mod chacha20poly1305rfc { use alloc::str::FromStr; use alloc::string::String; @@ -100,8 +92,7 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -} -mod chacha20poly1305rfc { +mod real_chachapoly { use alloc::str::FromStr; use alloc::string::String; @@ -112,7 +103,9 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -mod real_chachapoly { +} +} +mod poly1305 { use alloc::str::FromStr; use alloc::string::String; @@ -123,7 +116,6 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -} } mod streams { diff --git a/lightning-c-bindings/src/lightning/offers/invoice.rs b/lightning-c-bindings/src/lightning/offers/invoice.rs index 61f2bdb..d90633a 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice.rs @@ -15,7 +15,7 @@ //! The payment recipient must include a [`PaymentHash`], so as to reveal the preimage upon payment //! receipt, and one or more [`BlindedPaymentPath`]s for the payer to use when sending the payment. //! -//! ``` +//! ```ignore //! extern crate bitcoin; //! extern crate lightning; //! @@ -27,7 +27,7 @@ //! use lightning::offers::refund::Refund; //! use lightning::util::ser::Writeable; //! -//! # use lightning::ln::types::PaymentHash; +//! # use lightning::types::payment::PaymentHash; //! # use lightning::offers::invoice::{ExplicitSigningPubkey, InvoiceBuilder}; //! # use lightning::blinded_path::payment::{BlindedPayInfo, BlindedPaymentPath}; //! # @@ -240,8 +240,7 @@ impl InvoiceWithDerivedSigningPubkeyBuilder { Self { inner: self.inner, is_owned: false } } } -/// Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. It can be signed by -/// [`UnsignedBolt12Invoice::sign`]. +/// Builds an unsigned [`Bolt12Invoice`] after checking for valid semantics. #[must_use] #[no_mangle] pub extern "C" fn InvoiceWithExplicitSigningPubkeyBuilder_build(mut this_arg: crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder) -> crate::c_types::derived::CResult_UnsignedBolt12InvoiceBolt12SemanticErrorZ { @@ -614,6 +613,20 @@ pub extern "C" fn Bolt12Invoice_clone(orig: &Bolt12Invoice) -> Bolt12Invoice { /// Get a string which allows debug introspection of a Bolt12Invoice object pub extern "C" fn Bolt12Invoice_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::invoice::Bolt12Invoice }).into()} +/// Paths to the recipient originating from publicly reachable nodes, including information +/// needed for routing payments across them. +/// +/// Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this +/// privacy is lost if a public node id is used for +///[`UnsignedBolt12Invoice::signing_pubkey`]. +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedBolt12Invoice_payment_paths(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CVec_BlindedPaymentPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_paths(); + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::payment::BlindedPaymentPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + /// Duration since the Unix epoch when the invoice was created. #[must_use] #[no_mangle] @@ -623,7 +636,7 @@ pub extern "C" fn UnsignedBolt12Invoice_created_at(this_arg: &crate::lightning:: } /// Duration since -///[`Bolt12Invoice::created_at`] +///[`UnsignedBolt12Invoice::created_at`] /// when the invoice has expired and therefore should no longer be paid. #[must_use] #[no_mangle] @@ -658,7 +671,19 @@ pub extern "C" fn UnsignedBolt12Invoice_invoice_features(this_arg: &crate::light crate::lightning_types::features::Bolt12InvoiceFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::Bolt12InvoiceFeatures<>) as *mut _) }, is_owned: false } } -/// The public key corresponding to the key used to sign the invoice. +/// A typically transient public key corresponding to the key used to sign the invoice. +/// +/// If the invoices was created in response to an [`Offer`], then this will be: +/// - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise +/// - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. +/// +/// If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by +/// the recipient. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +/// [`Refund`]: crate::offers::refund::Refund #[must_use] #[no_mangle] pub extern "C" fn UnsignedBolt12Invoice_signing_pubkey(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey { @@ -810,6 +835,22 @@ pub extern "C" fn UnsignedBolt12Invoice_supported_quantity(this_arg: &crate::lig local_ret } +/// The public key used by the recipient to sign invoices. +/// +/// From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was +/// created in response to a [`Refund`]. +/// +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// +/// 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 UnsignedBolt12Invoice_issuer_signing_pubkey(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); + let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; + local_ret +} + /// An unpredictable series of bytes from the payer. /// /// From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. @@ -848,8 +889,8 @@ pub extern "C" fn UnsignedBolt12Invoice_quantity(this_arg: &crate::lightning::of /// [`message_paths`]: Self::message_paths #[must_use] #[no_mangle] -pub extern "C" fn UnsignedBolt12Invoice_payer_id(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); +pub extern "C" fn UnsignedBolt12Invoice_payer_signing_pubkey(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_signing_pubkey(); crate::c_types::PublicKey::from_rust(&ret) } @@ -882,6 +923,20 @@ pub extern "C" fn UnsignedBolt12Invoice_amount_msats(this_arg: &crate::lightning ret } +/// Paths to the recipient originating from publicly reachable nodes, including information +/// needed for routing payments across them. +/// +/// Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this +/// privacy is lost if a public node id is used for +///[`Bolt12Invoice::signing_pubkey`]. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12Invoice_payment_paths(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::CVec_BlindedPaymentPathZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_paths(); + let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::payment::BlindedPaymentPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; + local_ret.into() +} + /// Duration since the Unix epoch when the invoice was created. #[must_use] #[no_mangle] @@ -926,7 +981,19 @@ pub extern "C" fn Bolt12Invoice_invoice_features(this_arg: &crate::lightning::of crate::lightning_types::features::Bolt12InvoiceFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning_types::features::Bolt12InvoiceFeatures<>) as *mut _) }, is_owned: false } } -/// The public key corresponding to the key used to sign the invoice. +/// A typically transient public key corresponding to the key used to sign the invoice. +/// +/// If the invoices was created in response to an [`Offer`], then this will be: +/// - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise +/// - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. +/// +/// If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by +/// the recipient. +/// +/// [`Offer`]: crate::offers::offer::Offer +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// [`Offer::paths`]: crate::offers::offer::Offer::paths +/// [`Refund`]: crate::offers::refund::Refund #[must_use] #[no_mangle] pub extern "C" fn Bolt12Invoice_signing_pubkey(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::PublicKey { @@ -1078,6 +1145,22 @@ pub extern "C" fn Bolt12Invoice_supported_quantity(this_arg: &crate::lightning:: local_ret } +/// The public key used by the recipient to sign invoices. +/// +/// From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was +/// created in response to a [`Refund`]. +/// +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey +/// +/// 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 Bolt12Invoice_issuer_signing_pubkey(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); + let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; + local_ret +} + /// An unpredictable series of bytes from the payer. /// /// From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. @@ -1116,8 +1199,8 @@ pub extern "C" fn Bolt12Invoice_quantity(this_arg: &crate::lightning::offers::in /// [`message_paths`]: Self::message_paths #[must_use] #[no_mangle] -pub extern "C" fn Bolt12Invoice_payer_id(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); +pub extern "C" fn Bolt12Invoice_payer_signing_pubkey(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_signing_pubkey(); crate::c_types::PublicKey::from_rust(&ret) } diff --git a/lightning-c-bindings/src/lightning/offers/invoice_request.rs b/lightning-c-bindings/src/lightning/offers/invoice_request.rs index 9f8565d..86d7f9e 100644 --- a/lightning-c-bindings/src/lightning/offers/invoice_request.rs +++ b/lightning-c-bindings/src/lightning/offers/invoice_request.rs @@ -24,32 +24,40 @@ //! //! use bitcoin::network::Network; //! use bitcoin::secp256k1::{Keypair, PublicKey, Secp256k1, SecretKey}; -//! use lightning::ln::features::OfferFeatures; +//! use lightning::ln::channelmanager::PaymentId; +//! use lightning::ln::inbound_payment::ExpandedKey; +//! use lightning::types::features::OfferFeatures; //! use lightning::offers::invoice_request::UnsignedInvoiceRequest; +//! # use lightning::offers::nonce::Nonce; //! use lightning::offers::offer::Offer; +//! # use lightning::sign::EntropySource; //! use lightning::util::ser::Writeable; //! +//! # struct FixedEntropy; +//! # impl EntropySource for FixedEntropy { +//! # fn get_secure_random_bytes(&self) -> [u8; 32] { +//! # [42; 32] +//! # } +//! # } //! # fn parse() -> Result<(), lightning::offers::parse::Bolt12ParseError> { +//! let expanded_key = ExpandedKey::new([42; 32]); +//! # let entropy = FixedEntropy {}; +//! # let nonce = Nonce::from_entropy_source(&entropy); //! let secp_ctx = Secp256k1::new(); -//! let keys = Keypair::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32])?); -//! let pubkey = PublicKey::from(keys); +//! let payment_id = PaymentId([1; 32]); //! let mut buffer = Vec::new(); //! -//! # use lightning::offers::invoice_request::{ExplicitPayerId, InvoiceRequestBuilder}; -//! # >::from( +//! # use lightning::offers::invoice_request::InvoiceRequestBuilder; +//! # >::from( //! \"lno1qcp4256ypq\" //! .parse::()? -//! .request_invoice(vec![42; 64], pubkey)? +//! .request_invoice(&expanded_key, nonce, &secp_ctx, payment_id)? //! # ) //! .chain(Network::Testnet)? //! .amount_msats(1000)? //! .quantity(5)? //! .payer_note(\"foo\".to_string()) -//! .build()? -//! .sign(|message: &UnsignedInvoiceRequest| -//! Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys)) -//! ) -//! .expect(\"failed verifying signature\") +//! .build_and_sign()? //! .write(&mut buffer) //! .unwrap(); //! # Ok(()) @@ -66,8 +74,8 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; -use lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder as nativeInvoiceRequestWithExplicitPayerIdBuilderImport; -pub(crate) type nativeInvoiceRequestWithExplicitPayerIdBuilder = nativeInvoiceRequestWithExplicitPayerIdBuilderImport<'static, 'static, >; +use lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder as nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilderImport; +pub(crate) type nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder = nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilderImport<'static, 'static, >; /// Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow. /// @@ -76,12 +84,12 @@ pub(crate) type nativeInvoiceRequestWithExplicitPayerIdBuilder = nativeInvoiceRe /// [module-level documentation]: self #[must_use] #[repr(C)] -pub struct InvoiceRequestWithExplicitPayerIdBuilder { +pub struct InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { /// A pointer to the opaque Rust object. /// Nearly everywhere, 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 nativeInvoiceRequestWithExplicitPayerIdBuilder, + pub inner: *mut nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder, /// Indicates that this is the only struct which contains the same pointer. /// Rust functions which take ownership of an object provided via an argument require @@ -89,37 +97,37 @@ pub struct InvoiceRequestWithExplicitPayerIdBuilder { pub is_owned: bool, } -impl core::ops::Deref for InvoiceRequestWithExplicitPayerIdBuilder { - type Target = nativeInvoiceRequestWithExplicitPayerIdBuilder; +impl core::ops::Deref for InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { + type Target = nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder; fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } } -unsafe impl core::marker::Send for InvoiceRequestWithExplicitPayerIdBuilder { } -unsafe impl core::marker::Sync for InvoiceRequestWithExplicitPayerIdBuilder { } -impl Drop for InvoiceRequestWithExplicitPayerIdBuilder { +unsafe impl core::marker::Send for InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { } +unsafe impl core::marker::Sync for InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { } +impl Drop for InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { fn drop(&mut self) { - if self.is_owned && !<*mut nativeInvoiceRequestWithExplicitPayerIdBuilder>::is_null(self.inner) { + if self.is_owned && !<*mut nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder>::is_null(self.inner) { let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the InvoiceRequestWithExplicitPayerIdBuilder, if is_owned is set and inner is non-NULL. +/// Frees any resources used by the InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_free(this_obj: InvoiceRequestWithExplicitPayerIdBuilder) { } +pub extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free(this_obj: InvoiceRequestWithDerivedPayerSigningPubkeyBuilder) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoiceRequestWithExplicitPayerIdBuilder) }; +pub(crate) extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder) }; } #[allow(unused)] -impl InvoiceRequestWithExplicitPayerIdBuilder { - pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceRequestWithExplicitPayerIdBuilder { +impl InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { + pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder { unsafe { &*ObjOps::untweak_ptr(self.inner) } } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceRequestWithExplicitPayerIdBuilder { + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder { 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 nativeInvoiceRequestWithExplicitPayerIdBuilder { + pub(crate) fn take_inner(mut self) -> *mut nativeInvoiceRequestWithDerivedPayerSigningPubkeyBuilder { assert!(self.is_owned); let ret = ObjOps::untweak_ptr(self.inner); self.inner = core::ptr::null_mut(); @@ -129,77 +137,12 @@ impl InvoiceRequestWithExplicitPayerIdBuilder { Self { inner: self.inner, is_owned: false } } } - -use lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder as nativeInvoiceRequestWithDerivedPayerIdBuilderImport; -pub(crate) type nativeInvoiceRequestWithDerivedPayerIdBuilder = nativeInvoiceRequestWithDerivedPayerIdBuilderImport<'static, 'static, >; - -/// Builds an [`InvoiceRequest`] from an [`Offer`] for the \"offer to be paid\" flow. -/// -/// See [module-level documentation] for usage. -/// -/// [module-level documentation]: self -#[must_use] -#[repr(C)] -pub struct InvoiceRequestWithDerivedPayerIdBuilder { - /// A pointer to the opaque Rust object. - - /// Nearly everywhere, 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 nativeInvoiceRequestWithDerivedPayerIdBuilder, - /// Indicates that this is the only struct which contains the same pointer. - - /// Rust 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 core::ops::Deref for InvoiceRequestWithDerivedPayerIdBuilder { - type Target = nativeInvoiceRequestWithDerivedPayerIdBuilder; - fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } -} -unsafe impl core::marker::Send for InvoiceRequestWithDerivedPayerIdBuilder { } -unsafe impl core::marker::Sync for InvoiceRequestWithDerivedPayerIdBuilder { } -impl Drop for InvoiceRequestWithDerivedPayerIdBuilder { - fn drop(&mut self) { - if self.is_owned && !<*mut nativeInvoiceRequestWithDerivedPayerIdBuilder>::is_null(self.inner) { - let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; - } - } -} -/// Frees any resources used by the InvoiceRequestWithDerivedPayerIdBuilder, if is_owned is set and inner is non-NULL. -#[no_mangle] -pub extern "C" fn InvoiceRequestWithDerivedPayerIdBuilder_free(this_obj: InvoiceRequestWithDerivedPayerIdBuilder) { } -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn InvoiceRequestWithDerivedPayerIdBuilder_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoiceRequestWithDerivedPayerIdBuilder) }; -} -#[allow(unused)] -impl InvoiceRequestWithDerivedPayerIdBuilder { - pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceRequestWithDerivedPayerIdBuilder { - unsafe { &*ObjOps::untweak_ptr(self.inner) } - } - pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceRequestWithDerivedPayerIdBuilder { - 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 nativeInvoiceRequestWithDerivedPayerIdBuilder { - assert!(self.is_owned); - let ret = ObjOps::untweak_ptr(self.inner); - self.inner = core::ptr::null_mut(); - ret - } - pub(crate) fn as_ref_to(&self) -> Self { - Self { inner: self.inner, is_owned: false } - } -} -/// Builds an unsigned [`InvoiceRequest`] after checking for valid semantics. It can be signed -/// by [`UnsignedInvoiceRequest::sign`]. +/// Builds a signed [`InvoiceRequest`] after checking for valid semantics. #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_build(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder) -> crate::c_types::derived::CResult_UnsignedInvoiceRequestBolt12SemanticErrorZ { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).build(); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::UnsignedInvoiceRequest { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; +pub extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_build_and_sign(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder) -> crate::c_types::derived::CResult_InvoiceRequestBolt12SemanticErrorZ { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).build_and_sign(); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::InvoiceRequest { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -210,7 +153,7 @@ pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_build(mut this_arg: c /// Successive calls to this method will override the previous setting. #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_chain(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, mut network: crate::bitcoin::network::Network) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { +pub extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_chain(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, mut network: crate::bitcoin::network::Network) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).chain(network.into_bitcoin()); 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret @@ -224,7 +167,7 @@ pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_chain(mut this_arg: c /// [`quantity`]: Self::quantity #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, mut amount_msats: u64) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { +pub extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_amount_msats(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, mut amount_msats: u64) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).amount_msats(amount_msats); 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret @@ -236,7 +179,7 @@ pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_amount_msats(mut this /// Successive calls to this method will override the previous setting. #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_quantity(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, mut quantity: u64) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { +pub extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_quantity(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, mut quantity: u64) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).quantity(quantity); 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret @@ -247,66 +190,18 @@ pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_quantity(mut this_arg /// Successive calls to this method will override the previous setting. #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequestWithExplicitPayerIdBuilder_payer_note(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder, mut payer_note: crate::c_types::Str) { +pub extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_payer_note(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, mut payer_note: crate::c_types::Str) { let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).payer_note(payer_note.into_string()); () /*ret*/ } -/// Builds a signed [`InvoiceRequest`] after checking for valid semantics. -#[must_use] -#[no_mangle] -pub extern "C" fn InvoiceRequestWithDerivedPayerIdBuilder_build_and_sign(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder) -> crate::c_types::derived::CResult_InvoiceRequestBolt12SemanticErrorZ { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).build_and_sign(); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::InvoiceRequest { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; - local_ret -} - -/// Sets the [`InvoiceRequest::chain`] of the given [`Network`] for paying an invoice. If not -/// called, [`Network::Bitcoin`] is assumed. Errors if the chain for `network` is not supported -/// by the offer. -/// -/// Successive calls to this method will override the previous setting. -#[must_use] -#[no_mangle] -pub extern "C" fn InvoiceRequestWithDerivedPayerIdBuilder_chain(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, mut network: crate::bitcoin::network::Network) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).chain(network.into_bitcoin()); - 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; - local_ret -} - -/// Sets the [`InvoiceRequest::amount_msats`] for paying an invoice. Errors if `amount_msats` is -/// not at least the expected invoice amount (i.e., [`Offer::amount`] times [`quantity`]). -/// -/// Successive calls to this method will override the previous setting. -/// -/// [`quantity`]: Self::quantity -#[must_use] -#[no_mangle] -pub extern "C" fn InvoiceRequestWithDerivedPayerIdBuilder_amount_msats(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, mut amount_msats: u64) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).amount_msats(amount_msats); - 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; - local_ret -} - -/// Sets [`InvoiceRequest::quantity`] of items. If not set, `1` is assumed. Errors if `quantity` -/// does not conform to [`Offer::is_valid_quantity`]. -/// -/// Successive calls to this method will override the previous setting. -#[must_use] -#[no_mangle] -pub extern "C" fn InvoiceRequestWithDerivedPayerIdBuilder_quantity(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, mut quantity: u64) -> crate::c_types::derived::CResult_NoneBolt12SemanticErrorZ { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).quantity(quantity); - 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::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; - local_ret -} - -/// Sets the [`InvoiceRequest::payer_note`]. +/// Sets the [`InvoiceRequest::offer_from_hrn`]. /// /// Successive calls to this method will override the previous setting. #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequestWithDerivedPayerIdBuilder_payer_note(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder, mut payer_note: crate::c_types::Str) { - let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).payer_note(payer_note.into_string()); +pub extern "C" fn InvoiceRequestWithDerivedPayerSigningPubkeyBuilder_sourced_from_human_readable_name(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder, mut hrn: crate::lightning::onion_message::dns_resolution::HumanReadableName) { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).sourced_from_human_readable_name(*unsafe { Box::from_raw(hrn.take_inner()) }); () /*ret*/ } @@ -740,21 +635,31 @@ pub extern "C" fn UnsignedInvoiceRequest_supported_quantity(this_arg: &crate::li crate::lightning::offers::offer::Quantity::native_into(ret) } -/// The public key used by the recipient to sign invoices. +/// The public key corresponding to the key used by the recipient to sign invoices. +/// - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for +/// sending an [`InvoiceRequest`]. +/// - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. +/// - If `None`, the signing pubkey will be the final blinded node id from the +/// [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. +/// +/// See also [`Bolt12Invoice::signing_pubkey`]. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey /// /// 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 UnsignedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); +pub extern "C" fn UnsignedInvoiceRequest_issuer_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; local_ret } /// An unpredictable series of bytes, typically containing information about the derivation of -/// [`payer_id`]. +/// [`payer_signing_pubkey`]. /// -/// [`payer_id`]: Self::payer_id +/// [`payer_signing_pubkey`]: Self::payer_signing_pubkey #[must_use] #[no_mangle] pub extern "C" fn UnsignedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::u8slice { @@ -783,6 +688,18 @@ pub extern "C" fn UnsignedInvoiceRequest_amount_msats(this_arg: &crate::lightnin local_ret } +/// Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` +/// then it was inferred from the [`Offer::amount`] and [`quantity`]. +/// +/// [`amount_msats`]: Self::amount_msats +/// [`quantity`]: Self::quantity +#[must_use] +#[no_mangle] +pub extern "C" fn UnsignedInvoiceRequest_has_amount_msats(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.has_amount_msats(); + ret +} + /// Features pertaining to requesting an invoice. #[must_use] #[no_mangle] @@ -803,8 +720,8 @@ pub extern "C" fn UnsignedInvoiceRequest_quantity(this_arg: &crate::lightning::o /// A possibly transient pubkey used to sign the invoice request. #[must_use] #[no_mangle] -pub extern "C" fn UnsignedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); +pub extern "C" fn UnsignedInvoiceRequest_payer_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_signing_pubkey(); crate::c_types::PublicKey::from_rust(&ret) } @@ -820,6 +737,18 @@ pub extern "C" fn UnsignedInvoiceRequest_payer_note(this_arg: &crate::lightning: local_ret } +/// If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the +/// builder to indicate the original [`HumanReadableName`] which was resolved. +/// +/// 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 UnsignedInvoiceRequest_offer_from_hrn(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::onion_message::dns_resolution::HumanReadableName { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_from_hrn(); + let mut local_ret = crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.as_ref().unwrap()) }) } as *const lightning::onion_message::dns_resolution::HumanReadableName<>) as *mut _ }, is_owned: false }; + local_ret +} + /// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). /// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) /// for the selected chain. @@ -911,21 +840,31 @@ pub extern "C" fn InvoiceRequest_supported_quantity(this_arg: &crate::lightning: crate::lightning::offers::offer::Quantity::native_into(ret) } -/// The public key used by the recipient to sign invoices. +/// The public key corresponding to the key used by the recipient to sign invoices. +/// - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for +/// sending an [`InvoiceRequest`]. +/// - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. +/// - If `None`, the signing pubkey will be the final blinded node id from the +/// [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. +/// +/// See also [`Bolt12Invoice::signing_pubkey`]. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey /// /// 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 InvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); +pub extern "C" fn InvoiceRequest_issuer_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; local_ret } /// An unpredictable series of bytes, typically containing information about the derivation of -/// [`payer_id`]. +/// [`payer_signing_pubkey`]. /// -/// [`payer_id`]: Self::payer_id +/// [`payer_signing_pubkey`]: Self::payer_signing_pubkey #[must_use] #[no_mangle] pub extern "C" fn InvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::u8slice { @@ -954,6 +893,18 @@ pub extern "C" fn InvoiceRequest_amount_msats(this_arg: &crate::lightning::offer local_ret } +/// Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` +/// then it was inferred from the [`Offer::amount`] and [`quantity`]. +/// +/// [`amount_msats`]: Self::amount_msats +/// [`quantity`]: Self::quantity +#[must_use] +#[no_mangle] +pub extern "C" fn InvoiceRequest_has_amount_msats(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.has_amount_msats(); + ret +} + /// Features pertaining to requesting an invoice. #[must_use] #[no_mangle] @@ -974,8 +925,8 @@ pub extern "C" fn InvoiceRequest_quantity(this_arg: &crate::lightning::offers::i /// A possibly transient pubkey used to sign the invoice request. #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); +pub extern "C" fn InvoiceRequest_payer_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_signing_pubkey(); crate::c_types::PublicKey::from_rust(&ret) } @@ -991,6 +942,18 @@ pub extern "C" fn InvoiceRequest_payer_note(this_arg: &crate::lightning::offers: local_ret } +/// If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the +/// builder to indicate the original [`HumanReadableName`] which was resolved. +/// +/// 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 InvoiceRequest_offer_from_hrn(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::onion_message::dns_resolution::HumanReadableName { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_from_hrn(); + let mut local_ret = crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.as_ref().unwrap()) }) } as *const lightning::onion_message::dns_resolution::HumanReadableName<>) as *mut _ }, is_owned: false }; + local_ret +} + /// Creates an [`InvoiceBuilder`] for the request with the given required fields and using the /// [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. /// @@ -1002,7 +965,7 @@ pub extern "C" fn InvoiceRequest_payer_note(this_arg: &crate::lightning::offers: #[no_mangle] pub extern "C" fn InvoiceRequest_respond_with(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest, mut payment_paths: crate::c_types::derived::CVec_BlindedPaymentPathZ, mut payment_hash: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { let mut local_payment_paths = Vec::new(); for mut item in payment_paths.into_rust().drain(..) { local_payment_paths.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with(local_payment_paths, ::lightning::ln::types::PaymentHash(payment_hash.data)); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with(local_payment_paths, ::lightning::types::payment::PaymentHash(payment_hash.data)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -1010,8 +973,8 @@ pub extern "C" fn InvoiceRequest_respond_with(this_arg: &crate::lightning::offer /// Creates an [`InvoiceBuilder`] for the request with the given required fields. /// /// Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after -/// `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds -/// where [`std::time::SystemTime`] is not available. +/// `created_at`, which is used to set [`Bolt12Invoice::created_at`]. +///Useful for non-`std` builds where [`std::time::SystemTime`] is not available. /// /// The caller is expected to remember the preimage of `payment_hash` in order to claim a payment /// for the invoice. @@ -1019,7 +982,7 @@ pub extern "C" fn InvoiceRequest_respond_with(this_arg: &crate::lightning::offer /// The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It /// must contain one or more elements ordered from most-preferred to least-preferred, if there's /// a preference. Note, however, that any privacy is lost if a public node id was used for -/// [`Offer::signing_pubkey`]. +/// [`Offer::issuer_signing_pubkey`]. /// /// Errors if the request contains unknown required features. /// @@ -1036,7 +999,7 @@ pub extern "C" fn InvoiceRequest_respond_with(this_arg: &crate::lightning::offer #[no_mangle] pub extern "C" fn InvoiceRequest_respond_with_no_std(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest, mut payment_paths: crate::c_types::derived::CVec_BlindedPaymentPathZ, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut created_at: u64) -> crate::c_types::derived::CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { let mut local_payment_paths = Vec::new(); for mut item in payment_paths.into_rust().drain(..) { local_payment_paths.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with_no_std(local_payment_paths, ::lightning::ln::types::PaymentHash(payment_hash.data), core::time::Duration::from_secs(created_at)); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with_no_std(local_payment_paths, ::lightning::types::payment::PaymentHash(payment_hash.data), core::time::Duration::from_secs(created_at)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -1071,9 +1034,9 @@ pub extern "C" fn InvoiceRequest_verify_using_recipient_data(mut this_arg: crate local_ret } -/// Signature of the invoice request using [`payer_id`]. +/// Signature of the invoice request using [`payer_signing_pubkey`]. /// -/// [`payer_id`]: Self::payer_id +/// [`payer_signing_pubkey`]: Self::payer_signing_pubkey #[must_use] #[no_mangle] pub extern "C" fn InvoiceRequest_signature(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::SchnorrSignature { @@ -1172,21 +1135,31 @@ pub extern "C" fn VerifiedInvoiceRequest_supported_quantity(this_arg: &crate::li crate::lightning::offers::offer::Quantity::native_into(ret) } -/// The public key used by the recipient to sign invoices. +/// The public key corresponding to the key used by the recipient to sign invoices. +/// - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for +/// sending an [`InvoiceRequest`]. +/// - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. +/// - If `None`, the signing pubkey will be the final blinded node id from the +/// [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. +/// +/// See also [`Bolt12Invoice::signing_pubkey`]. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey /// /// 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 VerifiedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); +pub extern "C" fn VerifiedInvoiceRequest_issuer_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; local_ret } /// An unpredictable series of bytes, typically containing information about the derivation of -/// [`payer_id`]. +/// [`payer_signing_pubkey`]. /// -/// [`payer_id`]: Self::payer_id +/// [`payer_signing_pubkey`]: Self::payer_signing_pubkey #[must_use] #[no_mangle] pub extern "C" fn VerifiedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::u8slice { @@ -1215,6 +1188,18 @@ pub extern "C" fn VerifiedInvoiceRequest_amount_msats(this_arg: &crate::lightnin local_ret } +/// Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` +/// then it was inferred from the [`Offer::amount`] and [`quantity`]. +/// +/// [`amount_msats`]: Self::amount_msats +/// [`quantity`]: Self::quantity +#[must_use] +#[no_mangle] +pub extern "C" fn VerifiedInvoiceRequest_has_amount_msats(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.has_amount_msats(); + ret +} + /// Features pertaining to requesting an invoice. #[must_use] #[no_mangle] @@ -1235,8 +1220,8 @@ pub extern "C" fn VerifiedInvoiceRequest_quantity(this_arg: &crate::lightning::o /// A possibly transient pubkey used to sign the invoice request. #[must_use] #[no_mangle] -pub extern "C" fn VerifiedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); +pub extern "C" fn VerifiedInvoiceRequest_payer_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_signing_pubkey(); crate::c_types::PublicKey::from_rust(&ret) } @@ -1252,6 +1237,18 @@ pub extern "C" fn VerifiedInvoiceRequest_payer_note(this_arg: &crate::lightning: local_ret } +/// If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the +/// builder to indicate the original [`HumanReadableName`] which was resolved. +/// +/// 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 VerifiedInvoiceRequest_offer_from_hrn(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::onion_message::dns_resolution::HumanReadableName { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_from_hrn(); + let mut local_ret = crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.as_ref().unwrap()) }) } as *const lightning::onion_message::dns_resolution::HumanReadableName<>) as *mut _ }, is_owned: false }; + local_ret +} + /// Creates an [`InvoiceBuilder`] for the request with the given required fields and using the /// [`Duration`] since [`std::time::SystemTime::UNIX_EPOCH`] as the creation time. /// @@ -1263,7 +1260,7 @@ pub extern "C" fn VerifiedInvoiceRequest_payer_note(this_arg: &crate::lightning: #[no_mangle] pub extern "C" fn VerifiedInvoiceRequest_respond_with(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, mut payment_paths: crate::c_types::derived::CVec_BlindedPaymentPathZ, mut payment_hash: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { let mut local_payment_paths = Vec::new(); for mut item in payment_paths.into_rust().drain(..) { local_payment_paths.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with(local_payment_paths, ::lightning::ln::types::PaymentHash(payment_hash.data)); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with(local_payment_paths, ::lightning::types::payment::PaymentHash(payment_hash.data)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -1271,8 +1268,8 @@ pub extern "C" fn VerifiedInvoiceRequest_respond_with(this_arg: &crate::lightnin /// Creates an [`InvoiceBuilder`] for the request with the given required fields. /// /// Unless [`InvoiceBuilder::relative_expiry`] is set, the invoice will expire two hours after -/// `created_at`, which is used to set [`Bolt12Invoice::created_at`]. Useful for `no-std` builds -/// where [`std::time::SystemTime`] is not available. +/// `created_at`, which is used to set [`Bolt12Invoice::created_at`]. +///Useful for non-`std` builds where [`std::time::SystemTime`] is not available. /// /// The caller is expected to remember the preimage of `payment_hash` in order to claim a payment /// for the invoice. @@ -1280,7 +1277,7 @@ pub extern "C" fn VerifiedInvoiceRequest_respond_with(this_arg: &crate::lightnin /// The `payment_paths` parameter is useful for maintaining the payment recipient's privacy. It /// must contain one or more elements ordered from most-preferred to least-preferred, if there's /// a preference. Note, however, that any privacy is lost if a public node id was used for -/// [`Offer::signing_pubkey`]. +/// [`Offer::issuer_signing_pubkey`]. /// /// Errors if the request contains unknown required features. /// @@ -1297,7 +1294,7 @@ pub extern "C" fn VerifiedInvoiceRequest_respond_with(this_arg: &crate::lightnin #[no_mangle] pub extern "C" fn VerifiedInvoiceRequest_respond_with_no_std(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, mut payment_paths: crate::c_types::derived::CVec_BlindedPaymentPathZ, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut created_at: u64) -> crate::c_types::derived::CResult_InvoiceWithExplicitSigningPubkeyBuilderBolt12SemanticErrorZ { let mut local_payment_paths = Vec::new(); for mut item in payment_paths.into_rust().drain(..) { local_payment_paths.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with_no_std(local_payment_paths, ::lightning::ln::types::PaymentHash(payment_hash.data), core::time::Duration::from_secs(created_at)); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_with_no_std(local_payment_paths, ::lightning::types::payment::PaymentHash(payment_hash.data), core::time::Duration::from_secs(created_at)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice::InvoiceWithExplicitSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -1313,7 +1310,7 @@ pub extern "C" fn VerifiedInvoiceRequest_respond_with_no_std(this_arg: &crate::l #[no_mangle] pub extern "C" fn VerifiedInvoiceRequest_respond_using_derived_keys(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, mut payment_paths: crate::c_types::derived::CVec_BlindedPaymentPathZ, mut payment_hash: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { let mut local_payment_paths = Vec::new(); for mut item in payment_paths.into_rust().drain(..) { local_payment_paths.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_using_derived_keys(local_payment_paths, ::lightning::ln::types::PaymentHash(payment_hash.data)); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_using_derived_keys(local_payment_paths, ::lightning::types::payment::PaymentHash(payment_hash.data)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -1329,7 +1326,7 @@ pub extern "C" fn VerifiedInvoiceRequest_respond_using_derived_keys(this_arg: &c #[no_mangle] pub extern "C" fn VerifiedInvoiceRequest_respond_using_derived_keys_no_std(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest, mut payment_paths: crate::c_types::derived::CVec_BlindedPaymentPathZ, mut payment_hash: crate::c_types::ThirtyTwoBytes, mut created_at: u64) -> crate::c_types::derived::CResult_InvoiceWithDerivedSigningPubkeyBuilderBolt12SemanticErrorZ { let mut local_payment_paths = Vec::new(); for mut item in payment_paths.into_rust().drain(..) { local_payment_paths.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_using_derived_keys_no_std(local_payment_paths, ::lightning::ln::types::PaymentHash(payment_hash.data), core::time::Duration::from_secs(created_at)); + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.respond_using_derived_keys_no_std(local_payment_paths, ::lightning::types::payment::PaymentHash(payment_hash.data), core::time::Duration::from_secs(created_at)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice::InvoiceWithDerivedSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -1352,6 +1349,13 @@ pub extern "C" fn InvoiceRequest_write(obj: &crate::lightning::offers::invoice_r pub(crate) extern "C" fn InvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::offers::invoice_request::nativeInvoiceRequest) }) } +#[no_mangle] +/// Read a InvoiceRequest from a byte array, created by InvoiceRequest_write +pub extern "C" fn InvoiceRequest_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_InvoiceRequestDecodeErrorZ { + 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::offers::invoice_request::InvoiceRequest { 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::offers::invoice_request::InvoiceRequestFields as nativeInvoiceRequestFieldsImport; pub(crate) type nativeInvoiceRequestFields = nativeInvoiceRequestFieldsImport; @@ -1416,14 +1420,14 @@ impl InvoiceRequestFields { } /// A possibly transient pubkey used to sign the invoice request. #[no_mangle] -pub extern "C" fn InvoiceRequestFields_get_payer_id(this_ptr: &InvoiceRequestFields) -> crate::c_types::PublicKey { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payer_id; +pub extern "C" fn InvoiceRequestFields_get_payer_signing_pubkey(this_ptr: &InvoiceRequestFields) -> crate::c_types::PublicKey { + let mut inner_val = &mut this_ptr.get_native_mut_ref().payer_signing_pubkey; crate::c_types::PublicKey::from_rust(&inner_val) } /// A possibly transient pubkey used to sign the invoice request. #[no_mangle] -pub extern "C" fn InvoiceRequestFields_set_payer_id(this_ptr: &mut InvoiceRequestFields, mut val: crate::c_types::PublicKey) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payer_id = val.into_rust(); +pub extern "C" fn InvoiceRequestFields_set_payer_signing_pubkey(this_ptr: &mut InvoiceRequestFields, mut val: crate::c_types::PublicKey) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payer_signing_pubkey = val.into_rust(); } /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. #[no_mangle] @@ -1457,18 +1461,38 @@ pub extern "C" fn InvoiceRequestFields_set_payer_note_truncated(this_ptr: &mut I let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payer_note_truncated = local_val; } +/// The Human Readable Name which the sender indicated they were paying to. +/// +/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn InvoiceRequestFields_get_human_readable_name(this_ptr: &InvoiceRequestFields) -> crate::lightning::onion_message::dns_resolution::HumanReadableName { + let mut inner_val = &mut this_ptr.get_native_mut_ref().human_readable_name; + let mut local_inner_val = crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: unsafe { (if inner_val.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (inner_val.as_ref().unwrap()) }) } as *const lightning::onion_message::dns_resolution::HumanReadableName<>) as *mut _ }, is_owned: false }; + local_inner_val +} +/// The Human Readable Name which the sender indicated they were paying to. +/// +/// Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None +#[no_mangle] +pub extern "C" fn InvoiceRequestFields_set_human_readable_name(this_ptr: &mut InvoiceRequestFields, mut val: crate::lightning::onion_message::dns_resolution::HumanReadableName) { + let mut local_val = if val.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(val.take_inner()) } }) }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.human_readable_name = local_val; +} /// Constructs a new InvoiceRequestFields given each field /// /// Note that payer_note_truncated_arg (or a relevant inner pointer) may be NULL or all-0s to represent None +/// Note that human_readable_name_arg (or a relevant inner pointer) may be NULL or all-0s to represent None #[must_use] #[no_mangle] -pub extern "C" fn InvoiceRequestFields_new(mut payer_id_arg: crate::c_types::PublicKey, mut quantity_arg: crate::c_types::derived::COption_u64Z, mut payer_note_truncated_arg: crate::lightning_types::string::UntrustedString) -> InvoiceRequestFields { +pub extern "C" fn InvoiceRequestFields_new(mut payer_signing_pubkey_arg: crate::c_types::PublicKey, mut quantity_arg: crate::c_types::derived::COption_u64Z, mut payer_note_truncated_arg: crate::lightning_types::string::UntrustedString, mut human_readable_name_arg: crate::lightning::onion_message::dns_resolution::HumanReadableName) -> InvoiceRequestFields { let mut local_quantity_arg = if quantity_arg.is_some() { Some( { quantity_arg.take() }) } else { None }; let mut local_payer_note_truncated_arg = if payer_note_truncated_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(payer_note_truncated_arg.take_inner()) } }) }; + let mut local_human_readable_name_arg = if human_readable_name_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(human_readable_name_arg.take_inner()) } }) }; InvoiceRequestFields { inner: ObjOps::heap_alloc(nativeInvoiceRequestFields { - payer_id: payer_id_arg.into_rust(), + payer_signing_pubkey: payer_signing_pubkey_arg.into_rust(), quantity: local_quantity_arg, payer_note_truncated: local_payer_note_truncated_arg, + human_readable_name: local_human_readable_name_arg, }), is_owned: true } } impl Clone for InvoiceRequestFields { diff --git a/lightning-c-bindings/src/lightning/offers/nonce.rs b/lightning-c-bindings/src/lightning/offers/nonce.rs index aad51df..e2df669 100644 --- a/lightning-c-bindings/src/lightning/offers/nonce.rs +++ b/lightning-c-bindings/src/lightning/offers/nonce.rs @@ -23,11 +23,11 @@ pub(crate) type nativeNonce = nativeNonceImport; /// A 128-bit number used only once. /// -/// Needed when constructing [`Offer::metadata`] and deriving [`Offer::signing_pubkey`] from +/// Needed when constructing [`Offer::metadata`] and deriving [`Offer::issuer_signing_pubkey`] from /// [`ExpandedKey`]. Must not be reused for any other derivation without first hashing. /// /// [`Offer::metadata`]: crate::offers::offer::Offer::metadata -/// [`Offer::signing_pubkey`]: crate::offers::offer::Offer::signing_pubkey +/// [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey /// [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey #[must_use] #[repr(C)] diff --git a/lightning-c-bindings/src/lightning/offers/offer.rs b/lightning-c-bindings/src/lightning/offers/offer.rs index a8520bd..f3ce030 100644 --- a/lightning-c-bindings/src/lightning/offers/offer.rs +++ b/lightning-c-bindings/src/lightning/offers/offer.rs @@ -181,9 +181,6 @@ pub(crate) extern "C" fn OfferId_clone_void(this_ptr: *const c_void) -> *mut c_v pub extern "C" fn OfferId_clone(orig: &OfferId) -> OfferId { orig.clone() } -/// Get a string which allows debug introspection of a OfferId object -pub extern "C" fn OfferId_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::offer::OfferId }).into()} /// Checks if two OfferIds 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. @@ -375,8 +372,8 @@ pub(crate) extern "C" fn OfferWithDerivedMetadataBuilder_clone_void(this_ptr: *c pub extern "C" fn OfferWithDerivedMetadataBuilder_clone(orig: &OfferWithDerivedMetadataBuilder) -> OfferWithDerivedMetadataBuilder { orig.clone() } -/// Creates a new builder for an offer using the [`Offer::signing_pubkey`] for signing invoices. -/// The associated secret key must be remembered while the offer is valid. +/// Creates a new builder for an offer using the `signing_pubkey` for signing invoices. The +/// associated secret key must be remembered while the offer is valid. /// /// Use a different pubkey per offer to avoid correlating offers. /// @@ -429,8 +426,8 @@ pub extern "C" fn OfferWithExplicitMetadataBuilder_amount_msats(mut this_arg: cr () /*ret*/ } -/// Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has -/// already passed is valid and can be checked for using [`Offer::is_expired`]. +/// Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. +///Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. /// /// Successive calls to this method will override the previous setting. #[must_use] @@ -461,7 +458,7 @@ pub extern "C" fn OfferWithExplicitMetadataBuilder_issuer(mut this_arg: crate::l } /// Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by -/// private channels or if [`Offer::signing_pubkey`] is not a public node id. +/// private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. /// /// Successive calls to this method will add another blinded path. Caller is responsible for not /// adding duplicate paths. @@ -495,7 +492,7 @@ pub extern "C" fn OfferWithExplicitMetadataBuilder_build(mut this_arg: crate::li /// Similar to [`OfferBuilder::new`] except, if [`OfferBuilder::path`] is called, the signing /// pubkey is derived from the given [`ExpandedKey`] and [`Nonce`]. This provides recipient /// privacy by using a different signing pubkey for each offer. Otherwise, the provided -/// `node_id` is used for the signing pubkey. +/// `node_id` is used for [`Offer::issuer_signing_pubkey`]. /// /// Also, sets the metadata when [`OfferBuilder::build`] is called such that it can be used by /// [`InvoiceRequest::verify_using_metadata`] to determine if the request was produced for the @@ -536,8 +533,8 @@ pub extern "C" fn OfferWithDerivedMetadataBuilder_amount_msats(mut this_arg: cra () /*ret*/ } -/// Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has -/// already passed is valid and can be checked for using [`Offer::is_expired`]. +/// Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. +///Any expiry that has already passed is valid and can be checked for using [`Offer::is_expired`]. /// /// Successive calls to this method will override the previous setting. #[must_use] @@ -568,7 +565,7 @@ pub extern "C" fn OfferWithDerivedMetadataBuilder_issuer(mut this_arg: crate::li } /// Adds a blinded path to [`Offer::paths`]. Must include at least one path if only connected by -/// private channels or if [`Offer::signing_pubkey`] is not a public node id. +/// private channels or if [`Offer::issuer_signing_pubkey`] is not a public node id. /// /// Successive calls to this method will add another blinded path. Caller is responsible for not /// adding duplicate paths. @@ -784,13 +781,23 @@ pub extern "C" fn Offer_supported_quantity(this_arg: &crate::lightning::offers:: crate::lightning::offers::offer::Quantity::native_into(ret) } -/// The public key used by the recipient to sign invoices. +/// The public key corresponding to the key used by the recipient to sign invoices. +/// - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for +/// sending an [`InvoiceRequest`]. +/// - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. +/// - If `None`, the signing pubkey will be the final blinded node id from the +/// [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. +/// +/// See also [`Bolt12Invoice::signing_pubkey`]. +/// +/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest +/// [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey /// /// 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 Offer_signing_pubkey(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey(); +pub extern "C" fn Offer_issuer_signing_pubkey(this_arg: &crate::lightning::offers::offer::Offer) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer_signing_pubkey(); let mut local_ret = if ret.is_none() { crate::c_types::PublicKey::null() } else { { crate::c_types::PublicKey::from_rust(&(ret.unwrap())) } }; local_ret } @@ -845,63 +852,27 @@ pub extern "C" fn Offer_expects_quantity(this_arg: &crate::lightning::offers::of ret } -/// Similar to [`Offer::request_invoice`] except it: -/// - derives the [`InvoiceRequest::payer_id`] such that a different key can be used for each -/// request, -/// - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build`] is called -/// such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine if the -/// invoice was requested using a base [`ExpandedKey`] from which the payer id was derived, -/// and +/// Creates an [`InvoiceRequestBuilder`] for the offer, which +/// - derives the [`InvoiceRequest::payer_signing_pubkey`] such that a different key can be used +/// for each request in order to protect the sender's privacy, +/// - sets [`InvoiceRequest::payer_metadata`] when [`InvoiceRequestBuilder::build_and_sign`] is +/// called such that it can be used by [`Bolt12Invoice::verify_using_metadata`] to determine +/// if the invoice was requested using a base [`ExpandedKey`] from which the payer id was +/// derived, and /// - includes the [`PaymentId`] encrypted in [`InvoiceRequest::payer_metadata`] so that it can /// be used when sending the payment for the requested invoice. /// -/// Useful to protect the sender's privacy. +/// Errors if the offer contains unknown required features. /// -/// [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id +/// [`InvoiceRequest::payer_signing_pubkey`]: crate::offers::invoice_request::InvoiceRequest::payer_signing_pubkey /// [`InvoiceRequest::payer_metadata`]: crate::offers::invoice_request::InvoiceRequest::payer_metadata /// [`Bolt12Invoice::verify_using_metadata`]: crate::offers::invoice::Bolt12Invoice::verify_using_metadata /// [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey #[must_use] #[no_mangle] -pub extern "C" fn Offer_request_invoice_deriving_payer_id(this_arg: &crate::lightning::offers::offer::Offer, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey, mut nonce: crate::lightning::offers::nonce::Nonce, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceRequestWithDerivedPayerIdBuilderBolt12SemanticErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_invoice_deriving_payer_id(expanded_key.get_native_ref(), *unsafe { Box::from_raw(nonce.take_inner()) }, secp256k1::global::SECP256K1, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerIdBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; - local_ret -} - -/// Similar to [`Offer::request_invoice_deriving_payer_id`] except uses `payer_id` for the -/// [`InvoiceRequest::payer_id`] instead of deriving a different key for each request. -/// -/// Useful for recurring payments using the same `payer_id` with different invoices. -/// -/// [`InvoiceRequest::payer_id`]: crate::offers::invoice_request::InvoiceRequest::payer_id -#[must_use] -#[no_mangle] -pub extern "C" fn Offer_request_invoice_deriving_metadata(this_arg: &crate::lightning::offers::offer::Offer, mut payer_id: crate::c_types::PublicKey, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey, mut nonce: crate::lightning::offers::nonce::Nonce, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_invoice_deriving_metadata(payer_id.into_rust(), expanded_key.get_native_ref(), *unsafe { Box::from_raw(nonce.take_inner()) }, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; - local_ret -} - -/// Creates an [`InvoiceRequestBuilder`] for the offer with the given `metadata` and `payer_id`, -/// which will be reflected in the `Bolt12Invoice` response. -/// -/// The `metadata` is useful for including information about the derivation of `payer_id` such -/// that invoice response handling can be stateless. Also serves as payer-provided entropy while -/// hashing in the signature calculation. -/// -/// This should not leak any information such as by using a simple BIP-32 derivation path. -/// Otherwise, payments may be correlated. -/// -/// Errors if the offer contains unknown required features. -/// -/// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest -#[must_use] -#[no_mangle] -pub extern "C" fn Offer_request_invoice(this_arg: &crate::lightning::offers::offer::Offer, mut metadata: crate::c_types::derived::CVec_u8Z, mut payer_id: crate::c_types::PublicKey) -> crate::c_types::derived::CResult_InvoiceRequestWithExplicitPayerIdBuilderBolt12SemanticErrorZ { - let mut local_metadata = Vec::new(); for mut item in metadata.into_rust().drain(..) { local_metadata.push( { item }); }; - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_invoice(local_metadata, payer_id.into_rust()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::InvoiceRequestWithExplicitPayerIdBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; +pub extern "C" fn Offer_request_invoice(this_arg: &crate::lightning::offers::offer::Offer, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey, mut nonce: crate::lightning::offers::nonce::Nonce, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_InvoiceRequestWithDerivedPayerSigningPubkeyBuilderBolt12SemanticErrorZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.request_invoice(expanded_key.get_native_ref(), *unsafe { Box::from_raw(nonce.take_inner()) }, secp256k1::global::SECP256K1, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::InvoiceRequestWithDerivedPayerSigningPubkeyBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -942,7 +913,7 @@ pub enum Amount { /// The amount in millisatoshi. amount_msats: u64, }, - /// An amount of currency specified using ISO 4712. + /// An amount of currency specified using ISO 4217. Currency { /// The currency that the amount is denominated in. iso4217_code: crate::c_types::ThreeBytes, diff --git a/lightning-c-bindings/src/lightning/offers/parse.rs b/lightning-c-bindings/src/lightning/offers/parse.rs index f7b438c..83e1a95 100644 --- a/lightning-c-bindings/src/lightning/offers/parse.rs +++ b/lightning-c-bindings/src/lightning/offers/parse.rs @@ -116,7 +116,7 @@ pub extern "C" fn Bolt12ParseError_debug_str_void(o: *const c_void) -> Str { #[must_use] #[repr(C)] pub enum Bolt12SemanticError { - /// The current [`std::time::SystemTime`] is past the offer or invoice's expiration. + /// The current system time is past the offer or invoice's expiration. AlreadyExpired, /// The provided chain hash does not correspond to a supported chain. UnsupportedChain, @@ -124,7 +124,7 @@ pub enum Bolt12SemanticError { UnexpectedChain, /// An amount was expected but was missing. MissingAmount, - /// The amount exceeded the total bitcoin supply. + /// The amount exceeded the total bitcoin supply or didn't match an expected amount. InvalidAmount, /// An amount was provided but was not sufficient in value. InsufficientAmount, @@ -138,12 +138,10 @@ pub enum Bolt12SemanticError { UnexpectedFeatures, /// A required description was not provided. MissingDescription, - /// A signing pubkey was not provided. - MissingSigningPubkey, - /// A signing pubkey was provided but a different one was expected. - InvalidSigningPubkey, - /// A signing pubkey was provided but was not expected. - UnexpectedSigningPubkey, + /// An issuer's signing pubkey was not provided. + MissingIssuerSigningPubkey, + /// An issuer's signing pubkey was provided but was not expected. + UnexpectedIssuerSigningPubkey, /// A quantity was expected but was missing. MissingQuantity, /// An unsupported quantity was provided. @@ -156,8 +154,8 @@ pub enum Bolt12SemanticError { UnexpectedMetadata, /// Payer metadata was expected but was missing. MissingPayerMetadata, - /// A payer id was expected but was missing. - MissingPayerId, + /// A payer signing pubkey was expected but was missing. + MissingPayerSigningPubkey, /// The payment id for a refund or request is already in use. DuplicatePaymentId, /// Blinded paths were expected but were missing. @@ -172,8 +170,17 @@ pub enum Bolt12SemanticError { MissingPaymentHash, /// An invoice payment hash was provided but was not expected. UnexpectedPaymentHash, + /// A signing pubkey was not provided. + MissingSigningPubkey, + /// A signing pubkey was provided but a different one was expected. + InvalidSigningPubkey, /// A signature was expected but was missing. MissingSignature, + /// A Human Readable Name was provided but was not expected (i.e. was included in a + /// [`Refund`]). + /// + /// [`Refund`]: super::refund::Refund + UnexpectedHumanReadableName, } use lightning::offers::parse::Bolt12SemanticError as Bolt12SemanticErrorImport; pub(crate) type nativeBolt12SemanticError = Bolt12SemanticErrorImport; @@ -193,16 +200,15 @@ impl Bolt12SemanticError { Bolt12SemanticError::UnknownRequiredFeatures => nativeBolt12SemanticError::UnknownRequiredFeatures, Bolt12SemanticError::UnexpectedFeatures => nativeBolt12SemanticError::UnexpectedFeatures, Bolt12SemanticError::MissingDescription => nativeBolt12SemanticError::MissingDescription, - Bolt12SemanticError::MissingSigningPubkey => nativeBolt12SemanticError::MissingSigningPubkey, - Bolt12SemanticError::InvalidSigningPubkey => nativeBolt12SemanticError::InvalidSigningPubkey, - Bolt12SemanticError::UnexpectedSigningPubkey => nativeBolt12SemanticError::UnexpectedSigningPubkey, + Bolt12SemanticError::MissingIssuerSigningPubkey => nativeBolt12SemanticError::MissingIssuerSigningPubkey, + Bolt12SemanticError::UnexpectedIssuerSigningPubkey => nativeBolt12SemanticError::UnexpectedIssuerSigningPubkey, Bolt12SemanticError::MissingQuantity => nativeBolt12SemanticError::MissingQuantity, Bolt12SemanticError::InvalidQuantity => nativeBolt12SemanticError::InvalidQuantity, Bolt12SemanticError::UnexpectedQuantity => nativeBolt12SemanticError::UnexpectedQuantity, Bolt12SemanticError::InvalidMetadata => nativeBolt12SemanticError::InvalidMetadata, Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata, Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata, - Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId, + Bolt12SemanticError::MissingPayerSigningPubkey => nativeBolt12SemanticError::MissingPayerSigningPubkey, Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId, Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths, Bolt12SemanticError::UnexpectedPaths => nativeBolt12SemanticError::UnexpectedPaths, @@ -210,7 +216,10 @@ impl Bolt12SemanticError { Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime, Bolt12SemanticError::MissingPaymentHash => nativeBolt12SemanticError::MissingPaymentHash, Bolt12SemanticError::UnexpectedPaymentHash => nativeBolt12SemanticError::UnexpectedPaymentHash, + Bolt12SemanticError::MissingSigningPubkey => nativeBolt12SemanticError::MissingSigningPubkey, + Bolt12SemanticError::InvalidSigningPubkey => nativeBolt12SemanticError::InvalidSigningPubkey, Bolt12SemanticError::MissingSignature => nativeBolt12SemanticError::MissingSignature, + Bolt12SemanticError::UnexpectedHumanReadableName => nativeBolt12SemanticError::UnexpectedHumanReadableName, } } #[allow(unused)] @@ -227,16 +236,15 @@ impl Bolt12SemanticError { Bolt12SemanticError::UnknownRequiredFeatures => nativeBolt12SemanticError::UnknownRequiredFeatures, Bolt12SemanticError::UnexpectedFeatures => nativeBolt12SemanticError::UnexpectedFeatures, Bolt12SemanticError::MissingDescription => nativeBolt12SemanticError::MissingDescription, - Bolt12SemanticError::MissingSigningPubkey => nativeBolt12SemanticError::MissingSigningPubkey, - Bolt12SemanticError::InvalidSigningPubkey => nativeBolt12SemanticError::InvalidSigningPubkey, - Bolt12SemanticError::UnexpectedSigningPubkey => nativeBolt12SemanticError::UnexpectedSigningPubkey, + Bolt12SemanticError::MissingIssuerSigningPubkey => nativeBolt12SemanticError::MissingIssuerSigningPubkey, + Bolt12SemanticError::UnexpectedIssuerSigningPubkey => nativeBolt12SemanticError::UnexpectedIssuerSigningPubkey, Bolt12SemanticError::MissingQuantity => nativeBolt12SemanticError::MissingQuantity, Bolt12SemanticError::InvalidQuantity => nativeBolt12SemanticError::InvalidQuantity, Bolt12SemanticError::UnexpectedQuantity => nativeBolt12SemanticError::UnexpectedQuantity, Bolt12SemanticError::InvalidMetadata => nativeBolt12SemanticError::InvalidMetadata, Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata, Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata, - Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId, + Bolt12SemanticError::MissingPayerSigningPubkey => nativeBolt12SemanticError::MissingPayerSigningPubkey, Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId, Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths, Bolt12SemanticError::UnexpectedPaths => nativeBolt12SemanticError::UnexpectedPaths, @@ -244,7 +252,10 @@ impl Bolt12SemanticError { Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime, Bolt12SemanticError::MissingPaymentHash => nativeBolt12SemanticError::MissingPaymentHash, Bolt12SemanticError::UnexpectedPaymentHash => nativeBolt12SemanticError::UnexpectedPaymentHash, + Bolt12SemanticError::MissingSigningPubkey => nativeBolt12SemanticError::MissingSigningPubkey, + Bolt12SemanticError::InvalidSigningPubkey => nativeBolt12SemanticError::InvalidSigningPubkey, Bolt12SemanticError::MissingSignature => nativeBolt12SemanticError::MissingSignature, + Bolt12SemanticError::UnexpectedHumanReadableName => nativeBolt12SemanticError::UnexpectedHumanReadableName, } } #[allow(unused)] @@ -262,16 +273,15 @@ impl Bolt12SemanticError { nativeBolt12SemanticError::UnknownRequiredFeatures => Bolt12SemanticError::UnknownRequiredFeatures, nativeBolt12SemanticError::UnexpectedFeatures => Bolt12SemanticError::UnexpectedFeatures, nativeBolt12SemanticError::MissingDescription => Bolt12SemanticError::MissingDescription, - nativeBolt12SemanticError::MissingSigningPubkey => Bolt12SemanticError::MissingSigningPubkey, - nativeBolt12SemanticError::InvalidSigningPubkey => Bolt12SemanticError::InvalidSigningPubkey, - nativeBolt12SemanticError::UnexpectedSigningPubkey => Bolt12SemanticError::UnexpectedSigningPubkey, + nativeBolt12SemanticError::MissingIssuerSigningPubkey => Bolt12SemanticError::MissingIssuerSigningPubkey, + nativeBolt12SemanticError::UnexpectedIssuerSigningPubkey => Bolt12SemanticError::UnexpectedIssuerSigningPubkey, nativeBolt12SemanticError::MissingQuantity => Bolt12SemanticError::MissingQuantity, nativeBolt12SemanticError::InvalidQuantity => Bolt12SemanticError::InvalidQuantity, nativeBolt12SemanticError::UnexpectedQuantity => Bolt12SemanticError::UnexpectedQuantity, nativeBolt12SemanticError::InvalidMetadata => Bolt12SemanticError::InvalidMetadata, nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata, nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata, - nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId, + nativeBolt12SemanticError::MissingPayerSigningPubkey => Bolt12SemanticError::MissingPayerSigningPubkey, nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId, nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths, nativeBolt12SemanticError::UnexpectedPaths => Bolt12SemanticError::UnexpectedPaths, @@ -279,7 +289,10 @@ impl Bolt12SemanticError { nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime, nativeBolt12SemanticError::MissingPaymentHash => Bolt12SemanticError::MissingPaymentHash, nativeBolt12SemanticError::UnexpectedPaymentHash => Bolt12SemanticError::UnexpectedPaymentHash, + nativeBolt12SemanticError::MissingSigningPubkey => Bolt12SemanticError::MissingSigningPubkey, + nativeBolt12SemanticError::InvalidSigningPubkey => Bolt12SemanticError::InvalidSigningPubkey, nativeBolt12SemanticError::MissingSignature => Bolt12SemanticError::MissingSignature, + nativeBolt12SemanticError::UnexpectedHumanReadableName => Bolt12SemanticError::UnexpectedHumanReadableName, } } #[allow(unused)] @@ -296,16 +309,15 @@ impl Bolt12SemanticError { nativeBolt12SemanticError::UnknownRequiredFeatures => Bolt12SemanticError::UnknownRequiredFeatures, nativeBolt12SemanticError::UnexpectedFeatures => Bolt12SemanticError::UnexpectedFeatures, nativeBolt12SemanticError::MissingDescription => Bolt12SemanticError::MissingDescription, - nativeBolt12SemanticError::MissingSigningPubkey => Bolt12SemanticError::MissingSigningPubkey, - nativeBolt12SemanticError::InvalidSigningPubkey => Bolt12SemanticError::InvalidSigningPubkey, - nativeBolt12SemanticError::UnexpectedSigningPubkey => Bolt12SemanticError::UnexpectedSigningPubkey, + nativeBolt12SemanticError::MissingIssuerSigningPubkey => Bolt12SemanticError::MissingIssuerSigningPubkey, + nativeBolt12SemanticError::UnexpectedIssuerSigningPubkey => Bolt12SemanticError::UnexpectedIssuerSigningPubkey, nativeBolt12SemanticError::MissingQuantity => Bolt12SemanticError::MissingQuantity, nativeBolt12SemanticError::InvalidQuantity => Bolt12SemanticError::InvalidQuantity, nativeBolt12SemanticError::UnexpectedQuantity => Bolt12SemanticError::UnexpectedQuantity, nativeBolt12SemanticError::InvalidMetadata => Bolt12SemanticError::InvalidMetadata, nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata, nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata, - nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId, + nativeBolt12SemanticError::MissingPayerSigningPubkey => Bolt12SemanticError::MissingPayerSigningPubkey, nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId, nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths, nativeBolt12SemanticError::UnexpectedPaths => Bolt12SemanticError::UnexpectedPaths, @@ -313,7 +325,10 @@ impl Bolt12SemanticError { nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime, nativeBolt12SemanticError::MissingPaymentHash => Bolt12SemanticError::MissingPaymentHash, nativeBolt12SemanticError::UnexpectedPaymentHash => Bolt12SemanticError::UnexpectedPaymentHash, + nativeBolt12SemanticError::MissingSigningPubkey => Bolt12SemanticError::MissingSigningPubkey, + nativeBolt12SemanticError::InvalidSigningPubkey => Bolt12SemanticError::InvalidSigningPubkey, nativeBolt12SemanticError::MissingSignature => Bolt12SemanticError::MissingSignature, + nativeBolt12SemanticError::UnexpectedHumanReadableName => Bolt12SemanticError::UnexpectedHumanReadableName, } } } @@ -377,17 +392,13 @@ pub extern "C" fn Bolt12SemanticError_unexpected_features() -> Bolt12SemanticErr pub extern "C" fn Bolt12SemanticError_missing_description() -> Bolt12SemanticError { Bolt12SemanticError::MissingDescription} #[no_mangle] -/// Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError -pub extern "C" fn Bolt12SemanticError_missing_signing_pubkey() -> Bolt12SemanticError { - Bolt12SemanticError::MissingSigningPubkey} -#[no_mangle] -/// Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError -pub extern "C" fn Bolt12SemanticError_invalid_signing_pubkey() -> Bolt12SemanticError { - Bolt12SemanticError::InvalidSigningPubkey} +/// Utility method to constructs a new MissingIssuerSigningPubkey-variant Bolt12SemanticError +pub extern "C" fn Bolt12SemanticError_missing_issuer_signing_pubkey() -> Bolt12SemanticError { + Bolt12SemanticError::MissingIssuerSigningPubkey} #[no_mangle] -/// Utility method to constructs a new UnexpectedSigningPubkey-variant Bolt12SemanticError -pub extern "C" fn Bolt12SemanticError_unexpected_signing_pubkey() -> Bolt12SemanticError { - Bolt12SemanticError::UnexpectedSigningPubkey} +/// Utility method to constructs a new UnexpectedIssuerSigningPubkey-variant Bolt12SemanticError +pub extern "C" fn Bolt12SemanticError_unexpected_issuer_signing_pubkey() -> Bolt12SemanticError { + Bolt12SemanticError::UnexpectedIssuerSigningPubkey} #[no_mangle] /// Utility method to constructs a new MissingQuantity-variant Bolt12SemanticError pub extern "C" fn Bolt12SemanticError_missing_quantity() -> Bolt12SemanticError { @@ -413,9 +424,9 @@ pub extern "C" fn Bolt12SemanticError_unexpected_metadata() -> Bolt12SemanticErr pub extern "C" fn Bolt12SemanticError_missing_payer_metadata() -> Bolt12SemanticError { Bolt12SemanticError::MissingPayerMetadata} #[no_mangle] -/// Utility method to constructs a new MissingPayerId-variant Bolt12SemanticError -pub extern "C" fn Bolt12SemanticError_missing_payer_id() -> Bolt12SemanticError { - Bolt12SemanticError::MissingPayerId} +/// Utility method to constructs a new MissingPayerSigningPubkey-variant Bolt12SemanticError +pub extern "C" fn Bolt12SemanticError_missing_payer_signing_pubkey() -> Bolt12SemanticError { + Bolt12SemanticError::MissingPayerSigningPubkey} #[no_mangle] /// Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError pub extern "C" fn Bolt12SemanticError_duplicate_payment_id() -> Bolt12SemanticError { @@ -445,9 +456,21 @@ pub extern "C" fn Bolt12SemanticError_missing_payment_hash() -> Bolt12SemanticEr pub extern "C" fn Bolt12SemanticError_unexpected_payment_hash() -> Bolt12SemanticError { Bolt12SemanticError::UnexpectedPaymentHash} #[no_mangle] +/// Utility method to constructs a new MissingSigningPubkey-variant Bolt12SemanticError +pub extern "C" fn Bolt12SemanticError_missing_signing_pubkey() -> Bolt12SemanticError { + Bolt12SemanticError::MissingSigningPubkey} +#[no_mangle] +/// Utility method to constructs a new InvalidSigningPubkey-variant Bolt12SemanticError +pub extern "C" fn Bolt12SemanticError_invalid_signing_pubkey() -> Bolt12SemanticError { + Bolt12SemanticError::InvalidSigningPubkey} +#[no_mangle] /// Utility method to constructs a new MissingSignature-variant Bolt12SemanticError pub extern "C" fn Bolt12SemanticError_missing_signature() -> Bolt12SemanticError { Bolt12SemanticError::MissingSignature} +#[no_mangle] +/// Utility method to constructs a new UnexpectedHumanReadableName-variant Bolt12SemanticError +pub extern "C" fn Bolt12SemanticError_unexpected_human_readable_name() -> Bolt12SemanticError { + Bolt12SemanticError::UnexpectedHumanReadableName} /// Get a string which allows debug introspection of a Bolt12SemanticError object pub extern "C" fn Bolt12SemanticError_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::parse::Bolt12SemanticError }).into()} diff --git a/lightning-c-bindings/src/lightning/offers/refund.rs b/lightning-c-bindings/src/lightning/offers/refund.rs index 011aa19..5642d59 100644 --- a/lightning-c-bindings/src/lightning/offers/refund.rs +++ b/lightning-c-bindings/src/lightning/offers/refund.rs @@ -173,8 +173,8 @@ pub(crate) extern "C" fn RefundMaybeWithDerivedMetadataBuilder_clone_void(this_p pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_clone(orig: &RefundMaybeWithDerivedMetadataBuilder) -> RefundMaybeWithDerivedMetadataBuilder { orig.clone() } -/// Creates a new builder for a refund using the [`Refund::payer_id`] for the public node id to -/// send to if no [`Refund::paths`] are set. Otherwise, it may be a transient pubkey. +/// Creates a new builder for a refund using the `signing_pubkey` for the public node id to send +/// to if no [`Refund::paths`] are set. Otherwise, `signing_pubkey` may be a transient pubkey. /// /// Additionally, sets the required (empty) [`Refund::description`], [`Refund::payer_metadata`], /// and [`Refund::amount_msats`]. @@ -188,9 +188,9 @@ pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_clone(orig: &RefundMaybe /// [`ChannelManager::create_refund_builder`]: crate::ln::channelmanager::ChannelManager::create_refund_builder #[must_use] #[no_mangle] -pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_new(mut metadata: crate::c_types::derived::CVec_u8Z, mut payer_id: crate::c_types::PublicKey, mut amount_msats: u64) -> crate::c_types::derived::CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { +pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_new(mut metadata: crate::c_types::derived::CVec_u8Z, mut signing_pubkey: crate::c_types::PublicKey, mut amount_msats: u64) -> crate::c_types::derived::CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { let mut local_metadata = Vec::new(); for mut item in metadata.into_rust().drain(..) { local_metadata.push( { item }); }; - let mut ret = lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder::new(local_metadata, payer_id.into_rust(), amount_msats); + let mut ret = lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder::new(local_metadata, signing_pubkey.into_rust(), amount_msats); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -214,8 +214,8 @@ pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_new(mut metadata: crate: /// [`ExpandedKey`]: crate::ln::inbound_payment::ExpandedKey #[must_use] #[no_mangle] -pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_deriving_payer_id(mut node_id: crate::c_types::PublicKey, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey, mut nonce: crate::lightning::offers::nonce::Nonce, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { - let mut ret = lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder::deriving_payer_id(node_id.into_rust(), expanded_key.get_native_ref(), *unsafe { Box::from_raw(nonce.take_inner()) }, secp256k1::global::SECP256K1, amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); +pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_deriving_signing_pubkey(mut node_id: crate::c_types::PublicKey, expanded_key: &crate::lightning::ln::inbound_payment::ExpandedKey, mut nonce: crate::lightning::offers::nonce::Nonce, mut amount_msats: u64, mut payment_id: crate::c_types::ThirtyTwoBytes) -> crate::c_types::derived::CResult_RefundMaybeWithDerivedMetadataBuilderBolt12SemanticErrorZ { + let mut ret = lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder::deriving_signing_pubkey(node_id.into_rust(), expanded_key.get_native_ref(), *unsafe { Box::from_raw(nonce.take_inner()) }, secp256k1::global::SECP256K1, amount_msats, ::lightning::ln::channelmanager::PaymentId(payment_id.data)); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::refund::RefundMaybeWithDerivedMetadataBuilder { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::offers::parse::Bolt12SemanticError::native_into(e) }).into() }; local_ret } @@ -230,8 +230,8 @@ pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_description(mut this_arg () /*ret*/ } -/// Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has -/// already passed is valid and can be checked for using [`Refund::is_expired`]. +/// Sets the [`Refund::absolute_expiry`] as seconds since the Unix epoch. +///Any expiry that has already passed is valid and can be checked for using [`Refund::is_expired`]. /// /// Successive calls to this method will override the previous setting. #[must_use] @@ -252,7 +252,7 @@ pub extern "C" fn RefundMaybeWithDerivedMetadataBuilder_issuer(mut this_arg: cra } /// Adds a blinded path to [`Refund::paths`]. Must include at least one path if only connected -/// by private channels or if [`Refund::payer_id`] is not a public node id. +/// by private channels or if [`Refund::payer_signing_pubkey`] is not a public node id. /// /// Successive calls to this method will add another blinded path. Caller is responsible for not /// adding duplicate paths. @@ -457,9 +457,9 @@ pub extern "C" fn Refund_paths(this_arg: &crate::lightning::offers::refund::Refu } /// An unpredictable series of bytes, typically containing information about the derivation of -/// [`payer_id`]. +/// [`payer_signing_pubkey`]. /// -/// [`payer_id`]: Self::payer_id +/// [`payer_signing_pubkey`]: Self::payer_signing_pubkey #[must_use] #[no_mangle] pub extern "C" fn Refund_payer_metadata(this_arg: &crate::lightning::offers::refund::Refund) -> crate::c_types::u8slice { @@ -509,8 +509,8 @@ pub extern "C" fn Refund_quantity(this_arg: &crate::lightning::offers::refund::R /// [`paths`]: Self::paths #[must_use] #[no_mangle] -pub extern "C" fn Refund_payer_id(this_arg: &crate::lightning::offers::refund::Refund) -> crate::c_types::PublicKey { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id(); +pub extern "C" fn Refund_payer_signing_pubkey(this_arg: &crate::lightning::offers::refund::Refund) -> crate::c_types::PublicKey { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_signing_pubkey(); crate::c_types::PublicKey::from_rust(&ret) } diff --git a/lightning-c-bindings/src/lightning/onion_message/async_payments.rs b/lightning-c-bindings/src/lightning/onion_message/async_payments.rs index dc778f6..08dc462 100644 --- a/lightning-c-bindings/src/lightning/onion_message/async_payments.rs +++ b/lightning-c-bindings/src/lightning/onion_message/async_payments.rs @@ -29,10 +29,10 @@ pub struct AsyncPaymentsMessageHandler { /// the held funds. /// /// Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None - pub held_htlc_available: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ, + pub handle_held_htlc_available: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::HeldHtlcAvailable, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_ReleaseHeldHtlcResponseInstructionZZ, /// Handle a [`ReleaseHeldHtlc`] message. If authentication of the message succeeds, an HTLC /// should be released to the corresponding payee. - pub release_held_htlc: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc), + pub handle_release_held_htlc: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::async_payments::ReleaseHeldHtlc, context: crate::lightning::blinded_path::message::AsyncPaymentsContext), /// Release any [`AsyncPaymentsMessage`]s that need to be sent. /// /// Typically, this is used for messages initiating an async payment flow rather than in response @@ -48,8 +48,8 @@ unsafe impl Sync for AsyncPaymentsMessageHandler {} pub(crate) fn AsyncPaymentsMessageHandler_clone_fields(orig: &AsyncPaymentsMessageHandler) -> AsyncPaymentsMessageHandler { AsyncPaymentsMessageHandler { this_arg: orig.this_arg, - held_htlc_available: Clone::clone(&orig.held_htlc_available), - release_held_htlc: Clone::clone(&orig.release_held_htlc), + handle_held_htlc_available: Clone::clone(&orig.handle_held_htlc_available), + handle_release_held_htlc: Clone::clone(&orig.handle_release_held_htlc), release_pending_messages: Clone::clone(&orig.release_pending_messages), free: Clone::clone(&orig.free), } @@ -57,14 +57,14 @@ pub(crate) fn AsyncPaymentsMessageHandler_clone_fields(orig: &AsyncPaymentsMessa use lightning::onion_message::async_payments::AsyncPaymentsMessageHandler as rustAsyncPaymentsMessageHandler; impl rustAsyncPaymentsMessageHandler for AsyncPaymentsMessageHandler { - fn held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { + fn handle_held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; - let mut ret = (self.held_htlc_available)(self.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); + let mut ret = (self.handle_held_htlc_available)(self.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; local_ret } - fn release_held_htlc(&self, mut message: lightning::onion_message::async_payments::ReleaseHeldHtlc) { - (self.release_held_htlc)(self.this_arg, crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(message), is_owned: true }) + fn handle_release_held_htlc(&self, mut message: lightning::onion_message::async_payments::ReleaseHeldHtlc, mut context: lightning::blinded_path::message::AsyncPaymentsContext) { + (self.handle_release_held_htlc)(self.this_arg, crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context)) } fn release_pending_messages(&self) -> Vec<(lightning::onion_message::async_payments::AsyncPaymentsMessage, lightning::onion_message::messenger::MessageSendInstructions)> { let mut ret = (self.release_pending_messages)(self.this_arg); @@ -75,14 +75,14 @@ impl rustAsyncPaymentsMessageHandler for AsyncPaymentsMessageHandler { pub struct AsyncPaymentsMessageHandlerRef(AsyncPaymentsMessageHandler); impl rustAsyncPaymentsMessageHandler for AsyncPaymentsMessageHandlerRef { - fn held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { + fn handle_held_htlc_available(&self, mut message: lightning::onion_message::async_payments::HeldHtlcAvailable, mut responder: Option) -> Option<(lightning::onion_message::async_payments::ReleaseHeldHtlc, lightning::onion_message::messenger::ResponseInstruction)> { let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; - let mut ret = (self.0.held_htlc_available)(self.0.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); + let mut ret = (self.0.handle_held_htlc_available)(self.0.this_arg, crate::lightning::onion_message::async_payments::HeldHtlcAvailable { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (*unsafe { Box::from_raw(orig_ret_0_0.take_inner()) }, *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; local_ret } - fn release_held_htlc(&self, mut message: lightning::onion_message::async_payments::ReleaseHeldHtlc) { - (self.0.release_held_htlc)(self.0.this_arg, crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(message), is_owned: true }) + fn handle_release_held_htlc(&self, mut message: lightning::onion_message::async_payments::ReleaseHeldHtlc, mut context: lightning::blinded_path::message::AsyncPaymentsContext) { + (self.0.handle_release_held_htlc)(self.0.this_arg, crate::lightning::onion_message::async_payments::ReleaseHeldHtlc { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::AsyncPaymentsContext::native_into(context)) } fn release_pending_messages(&self) -> Vec<(lightning::onion_message::async_payments::AsyncPaymentsMessage, lightning::onion_message::messenger::MessageSendInstructions)> { let mut ret = (self.0.release_pending_messages)(self.0.this_arg); @@ -292,23 +292,11 @@ impl HeldHtlcAvailable { Self { inner: self.inner, is_owned: false } } } -/// The secret that will be used by the recipient of this message to release the held HTLC. -#[no_mangle] -pub extern "C" fn HeldHtlcAvailable_get_payment_release_secret(this_ptr: &HeldHtlcAvailable) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_release_secret; - inner_val -} -/// The secret that will be used by the recipient of this message to release the held HTLC. -#[no_mangle] -pub extern "C" fn HeldHtlcAvailable_set_payment_release_secret(this_ptr: &mut HeldHtlcAvailable, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_release_secret = val.data; -} /// Constructs a new HeldHtlcAvailable given each field #[must_use] #[no_mangle] -pub extern "C" fn HeldHtlcAvailable_new(mut payment_release_secret_arg: crate::c_types::ThirtyTwoBytes) -> HeldHtlcAvailable { +pub extern "C" fn HeldHtlcAvailable_new() -> HeldHtlcAvailable { HeldHtlcAvailable { inner: ObjOps::heap_alloc(nativeHeldHtlcAvailable { - payment_release_secret: payment_release_secret_arg.data, }), is_owned: true } } impl Clone for HeldHtlcAvailable { @@ -393,25 +381,11 @@ impl ReleaseHeldHtlc { Self { inner: self.inner, is_owned: false } } } -/// Used to release the HTLC held upstream if it matches the corresponding -/// [`HeldHtlcAvailable::payment_release_secret`]. -#[no_mangle] -pub extern "C" fn ReleaseHeldHtlc_get_payment_release_secret(this_ptr: &ReleaseHeldHtlc) -> *const [u8; 32] { - let mut inner_val = &mut this_ptr.get_native_mut_ref().payment_release_secret; - inner_val -} -/// Used to release the HTLC held upstream if it matches the corresponding -/// [`HeldHtlcAvailable::payment_release_secret`]. -#[no_mangle] -pub extern "C" fn ReleaseHeldHtlc_set_payment_release_secret(this_ptr: &mut ReleaseHeldHtlc, mut val: crate::c_types::ThirtyTwoBytes) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_release_secret = val.data; -} /// Constructs a new ReleaseHeldHtlc given each field #[must_use] #[no_mangle] -pub extern "C" fn ReleaseHeldHtlc_new(mut payment_release_secret_arg: crate::c_types::ThirtyTwoBytes) -> ReleaseHeldHtlc { +pub extern "C" fn ReleaseHeldHtlc_new() -> ReleaseHeldHtlc { ReleaseHeldHtlc { inner: ObjOps::heap_alloc(nativeReleaseHeldHtlc { - payment_release_secret: payment_release_secret_arg.data, }), is_owned: true } } impl Clone for ReleaseHeldHtlc { diff --git a/lightning-c-bindings/src/lightning/onion_message/dns_resolution.rs b/lightning-c-bindings/src/lightning/onion_message/dns_resolution.rs new file mode 100644 index 0000000..99afd0d --- /dev/null +++ b/lightning-c-bindings/src/lightning/onion_message/dns_resolution.rs @@ -0,0 +1,852 @@ +// 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. + +//! This module defines message handling for DNSSEC proof fetching using [bLIP 32]. +//! +//! It contains [`DNSResolverMessage`]s as well as a [`DNSResolverMessageHandler`] trait to handle +//! such messages using an [`OnionMessenger`]. +//! +//! With the `dnssec` feature enabled, it also contains `OMNameResolver`, which does all the work +//! required to resolve BIP 353 [`HumanReadableName`]s using [bLIP 32] - sending onion messages to +//! a DNS resolver, validating the proofs, and ultimately surfacing validated data back to the +//! caller. +//! +//! [bLIP 32]: https://github.com/lightning/blips/blob/master/blip-0032.md +//! [`OnionMessenger`]: super::messenger::OnionMessenger + +use alloc::str::FromStr; +use alloc::string::String; +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}; + +/// A handler for an [`OnionMessage`] containing a DNS(SEC) query or a DNSSEC proof +/// +/// [`OnionMessage`]: crate::ln::msgs::OnionMessage +#[repr(C)] +pub struct DNSResolverMessageHandler { + /// 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, + /// Handle a [`DNSSECQuery`] message. + /// + /// If we provide DNS resolution services to third parties, we should respond with a + /// [`DNSSECProof`] message. + /// + /// Note that responder (or a relevant inner pointer) may be NULL or all-0s to represent None + pub handle_dnssec_query: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::dns_resolution::DNSSECQuery, responder: crate::lightning::onion_message::messenger::Responder) -> crate::c_types::derived::COption_C2Tuple_DNSResolverMessageResponseInstructionZZ, + /// Handle a [`DNSSECProof`] message (in response to a [`DNSSECQuery`] we presumably sent). + /// + /// With this, we should be able to validate the DNS record we requested. + pub handle_dnssec_proof: extern "C" fn (this_arg: *const c_void, message: crate::lightning::onion_message::dns_resolution::DNSSECProof, context: crate::lightning::blinded_path::message::DNSResolverContext), + /// Gets the node feature flags which this handler itself supports. Useful for setting the + /// `dns_resolver` flag if this handler supports returning [`DNSSECProof`] messages in response + /// to [`DNSSECQuery`] messages. + pub provided_node_features: extern "C" fn (this_arg: *const c_void) -> crate::lightning_types::features::NodeFeatures, + /// Release any [`DNSResolverMessage`]s that need to be sent. + pub release_pending_messages: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CVec_C2Tuple_DNSResolverMessageMessageSendInstructionsZZ, + /// 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 DNSResolverMessageHandler {} +unsafe impl Sync for DNSResolverMessageHandler {} +#[allow(unused)] +pub(crate) fn DNSResolverMessageHandler_clone_fields(orig: &DNSResolverMessageHandler) -> DNSResolverMessageHandler { + DNSResolverMessageHandler { + this_arg: orig.this_arg, + handle_dnssec_query: Clone::clone(&orig.handle_dnssec_query), + handle_dnssec_proof: Clone::clone(&orig.handle_dnssec_proof), + provided_node_features: Clone::clone(&orig.provided_node_features), + release_pending_messages: Clone::clone(&orig.release_pending_messages), + free: Clone::clone(&orig.free), + } +} + +use lightning::onion_message::dns_resolution::DNSResolverMessageHandler as rustDNSResolverMessageHandler; +impl rustDNSResolverMessageHandler for DNSResolverMessageHandler { + fn handle_dnssec_query(&self, mut message: lightning::onion_message::dns_resolution::DNSSECQuery, mut responder: Option) -> Option<(lightning::onion_message::dns_resolution::DNSResolverMessage, lightning::onion_message::messenger::ResponseInstruction)> { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + let mut ret = (self.handle_dnssec_query)(self.this_arg, crate::lightning::onion_message::dns_resolution::DNSSECQuery { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); + let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (orig_ret_0_0.into_native(), *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; + local_ret + } + fn handle_dnssec_proof(&self, mut message: lightning::onion_message::dns_resolution::DNSSECProof, mut context: lightning::blinded_path::message::DNSResolverContext) { + (self.handle_dnssec_proof)(self.this_arg, crate::lightning::onion_message::dns_resolution::DNSSECProof { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::DNSResolverContext { inner: ObjOps::heap_alloc(context), is_owned: true }) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.provided_node_features)(self.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn release_pending_messages(&self) -> Vec<(lightning::onion_message::dns_resolution::DNSResolverMessage, lightning::onion_message::messenger::MessageSendInstructions)> { + let mut ret = (self.release_pending_messages)(self.this_arg); + 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_ret_0 = (orig_ret_0_0.into_native(), orig_ret_0_1.into_native()); local_ret_0 }); }; + local_ret + } +} + +pub struct DNSResolverMessageHandlerRef(DNSResolverMessageHandler); +impl rustDNSResolverMessageHandler for DNSResolverMessageHandlerRef { + fn handle_dnssec_query(&self, mut message: lightning::onion_message::dns_resolution::DNSSECQuery, mut responder: Option) -> Option<(lightning::onion_message::dns_resolution::DNSResolverMessage, lightning::onion_message::messenger::ResponseInstruction)> { + let mut local_responder = crate::lightning::onion_message::messenger::Responder { inner: if responder.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((responder.unwrap())) } }, is_owned: true }; + let mut ret = (self.0.handle_dnssec_query)(self.0.this_arg, crate::lightning::onion_message::dns_resolution::DNSSECQuery { inner: ObjOps::heap_alloc(message), is_owned: true }, local_responder); + let mut local_ret = if ret.is_some() { Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = ret.take().to_rust(); let mut local_ret_0 = (orig_ret_0_0.into_native(), *unsafe { Box::from_raw(orig_ret_0_1.take_inner()) }); local_ret_0 }) } else { None }; + local_ret + } + fn handle_dnssec_proof(&self, mut message: lightning::onion_message::dns_resolution::DNSSECProof, mut context: lightning::blinded_path::message::DNSResolverContext) { + (self.0.handle_dnssec_proof)(self.0.this_arg, crate::lightning::onion_message::dns_resolution::DNSSECProof { inner: ObjOps::heap_alloc(message), is_owned: true }, crate::lightning::blinded_path::message::DNSResolverContext { inner: ObjOps::heap_alloc(context), is_owned: true }) + } + fn provided_node_features(&self) -> lightning_types::features::NodeFeatures { + let mut ret = (self.0.provided_node_features)(self.0.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } + } + fn release_pending_messages(&self) -> Vec<(lightning::onion_message::dns_resolution::DNSResolverMessage, lightning::onion_message::messenger::MessageSendInstructions)> { + let mut ret = (self.0.release_pending_messages)(self.0.this_arg); + 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_ret_0 = (orig_ret_0_0.into_native(), orig_ret_0_1.into_native()); local_ret_0 }); }; + local_ret + } +} + +// 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 DNSResolverMessageHandler { + type Target = DNSResolverMessageHandlerRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const DNSResolverMessageHandlerRef) } + } +} +impl core::ops::DerefMut for DNSResolverMessageHandler { + fn deref_mut(&mut self) -> &mut DNSResolverMessageHandlerRef { + unsafe { &mut *(self as *mut _ as *mut DNSResolverMessageHandlerRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn DNSResolverMessageHandler_free(this_ptr: DNSResolverMessageHandler) { } +impl Drop for DNSResolverMessageHandler { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} +/// An enum containing the possible onion messages which are used uses to request and receive +/// DNSSEC proofs. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum DNSResolverMessage { + /// A query requesting a DNSSEC proof + DNSSECQuery( + crate::lightning::onion_message::dns_resolution::DNSSECQuery), + /// A response containing a DNSSEC proof + DNSSECProof( + crate::lightning::onion_message::dns_resolution::DNSSECProof), +} +use lightning::onion_message::dns_resolution::DNSResolverMessage as DNSResolverMessageImport; +pub(crate) type nativeDNSResolverMessage = DNSResolverMessageImport; + +impl DNSResolverMessage { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeDNSResolverMessage { + match self { + DNSResolverMessage::DNSSECQuery (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeDNSResolverMessage::DNSSECQuery ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + DNSResolverMessage::DNSSECProof (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeDNSResolverMessage::DNSSECProof ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeDNSResolverMessage { + match self { + DNSResolverMessage::DNSSECQuery (mut a, ) => { + nativeDNSResolverMessage::DNSSECQuery ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + DNSResolverMessage::DNSSECProof (mut a, ) => { + nativeDNSResolverMessage::DNSSECProof ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &DNSResolverMessageImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeDNSResolverMessage) }; + match native { + nativeDNSResolverMessage::DNSSECQuery (ref a, ) => { + let mut a_nonref = Clone::clone(a); + DNSResolverMessage::DNSSECQuery ( + crate::lightning::onion_message::dns_resolution::DNSSECQuery { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeDNSResolverMessage::DNSSECProof (ref a, ) => { + let mut a_nonref = Clone::clone(a); + DNSResolverMessage::DNSSECProof ( + crate::lightning::onion_message::dns_resolution::DNSSECProof { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeDNSResolverMessage) -> Self { + match native { + nativeDNSResolverMessage::DNSSECQuery (mut a, ) => { + DNSResolverMessage::DNSSECQuery ( + crate::lightning::onion_message::dns_resolution::DNSSECQuery { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeDNSResolverMessage::DNSSECProof (mut a, ) => { + DNSResolverMessage::DNSSECProof ( + crate::lightning::onion_message::dns_resolution::DNSSECProof { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + } + } +} +/// Frees any resources used by the DNSResolverMessage +#[no_mangle] +pub extern "C" fn DNSResolverMessage_free(this_ptr: DNSResolverMessage) { } +/// Creates a copy of the DNSResolverMessage +#[no_mangle] +pub extern "C" fn DNSResolverMessage_clone(orig: &DNSResolverMessage) -> DNSResolverMessage { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn DNSResolverMessage_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const DNSResolverMessage)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn DNSResolverMessage_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut DNSResolverMessage) }; +} +#[no_mangle] +/// Utility method to constructs a new DNSSECQuery-variant DNSResolverMessage +pub extern "C" fn DNSResolverMessage_dnssecquery(a: crate::lightning::onion_message::dns_resolution::DNSSECQuery) -> DNSResolverMessage { + DNSResolverMessage::DNSSECQuery(a, ) +} +#[no_mangle] +/// Utility method to constructs a new DNSSECProof-variant DNSResolverMessage +pub extern "C" fn DNSResolverMessage_dnssecproof(a: crate::lightning::onion_message::dns_resolution::DNSSECProof) -> DNSResolverMessage { + DNSResolverMessage::DNSSECProof(a, ) +} +/// Get a string which allows debug introspection of a DNSResolverMessage object +pub extern "C" fn DNSResolverMessage_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::dns_resolution::DNSResolverMessage }).into()} +/// Generates a non-cryptographic 64-bit hash of the DNSResolverMessage. +#[no_mangle] +pub extern "C" fn DNSResolverMessage_hash(o: &DNSResolverMessage) -> 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 DNSResolverMessages contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn DNSResolverMessage_eq(a: &DNSResolverMessage, b: &DNSResolverMessage) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} + +use lightning::onion_message::dns_resolution::DNSSECQuery as nativeDNSSECQueryImport; +pub(crate) type nativeDNSSECQuery = nativeDNSSECQueryImport; + +/// A message which is sent to a DNSSEC prover requesting a DNSSEC proof for the given name. +#[must_use] +#[repr(C)] +pub struct DNSSECQuery { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeDNSSECQuery, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for DNSSECQuery { + type Target = nativeDNSSECQuery; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for DNSSECQuery { } +unsafe impl core::marker::Sync for DNSSECQuery { } +impl Drop for DNSSECQuery { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeDNSSECQuery>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the DNSSECQuery, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn DNSSECQuery_free(this_obj: DNSSECQuery) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn DNSSECQuery_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDNSSECQuery) }; +} +#[allow(unused)] +impl DNSSECQuery { + pub(crate) fn get_native_ref(&self) -> &'static nativeDNSSECQuery { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDNSSECQuery { + 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 nativeDNSSECQuery { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +impl Clone for DNSSECQuery { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeDNSSECQuery>::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 DNSSECQuery_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDNSSECQuery)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the DNSSECQuery +pub extern "C" fn DNSSECQuery_clone(orig: &DNSSECQuery) -> DNSSECQuery { + orig.clone() +} +/// Get a string which allows debug introspection of a DNSSECQuery object +pub extern "C" fn DNSSECQuery_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::dns_resolution::DNSSECQuery }).into()} +/// Generates a non-cryptographic 64-bit hash of the DNSSECQuery. +#[no_mangle] +pub extern "C" fn DNSSECQuery_hash(o: &DNSSECQuery) -> u64 { + if o.inner.is_null() { return 0; } + // 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.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} +/// Checks if two DNSSECQuerys 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 DNSSECQuery_eq(a: &DNSSECQuery, b: &DNSSECQuery) -> 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 } +} + +use lightning::onion_message::dns_resolution::DNSSECProof as nativeDNSSECProofImport; +pub(crate) type nativeDNSSECProof = nativeDNSSECProofImport; + +/// A message which is sent in response to [`DNSSECQuery`] containing a DNSSEC proof. +#[must_use] +#[repr(C)] +pub struct DNSSECProof { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeDNSSECProof, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for DNSSECProof { + type Target = nativeDNSSECProof; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for DNSSECProof { } +unsafe impl core::marker::Sync for DNSSECProof { } +impl Drop for DNSSECProof { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeDNSSECProof>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the DNSSECProof, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn DNSSECProof_free(this_obj: DNSSECProof) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn DNSSECProof_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeDNSSECProof) }; +} +#[allow(unused)] +impl DNSSECProof { + pub(crate) fn get_native_ref(&self) -> &'static nativeDNSSECProof { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeDNSSECProof { + 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 nativeDNSSECProof { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// An [RFC 9102 DNSSEC AuthenticationChain] providing a DNSSEC proof. +/// +/// [RFC 9102 DNSSEC AuthenticationChain]: https://www.rfc-editor.org/rfc/rfc9102.html#name-dnssec-authentication-chain +/// +/// Returns a copy of the field. +#[no_mangle] +pub extern "C" fn DNSSECProof_get_proof(this_ptr: &DNSSECProof) -> crate::c_types::derived::CVec_u8Z { + let mut inner_val = this_ptr.get_native_mut_ref().proof.clone(); + let mut local_inner_val = Vec::new(); for mut item in inner_val.drain(..) { local_inner_val.push( { item }); }; + local_inner_val.into() +} +/// An [RFC 9102 DNSSEC AuthenticationChain] providing a DNSSEC proof. +/// +/// [RFC 9102 DNSSEC AuthenticationChain]: https://www.rfc-editor.org/rfc/rfc9102.html#name-dnssec-authentication-chain +#[no_mangle] +pub extern "C" fn DNSSECProof_set_proof(this_ptr: &mut DNSSECProof, mut val: crate::c_types::derived::CVec_u8Z) { + let mut local_val = Vec::new(); for mut item in val.into_rust().drain(..) { local_val.push( { item }); }; + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.proof = local_val; +} +impl Clone for DNSSECProof { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeDNSSECProof>::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 DNSSECProof_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeDNSSECProof)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the DNSSECProof +pub extern "C" fn DNSSECProof_clone(orig: &DNSSECProof) -> DNSSECProof { + orig.clone() +} +/// Get a string which allows debug introspection of a DNSSECProof object +pub extern "C" fn DNSSECProof_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::dns_resolution::DNSSECProof }).into()} +/// Generates a non-cryptographic 64-bit hash of the DNSSECProof. +#[no_mangle] +pub extern "C" fn DNSSECProof_hash(o: &DNSSECProof) -> u64 { + if o.inner.is_null() { return 0; } + // 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.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} +/// Checks if two DNSSECProofs 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 DNSSECProof_eq(a: &DNSSECProof, b: &DNSSECProof) -> 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 } +} +/// Returns whether `tlv_type` corresponds to a TLV record for DNS Resolvers. +#[must_use] +#[no_mangle] +pub extern "C" fn DNSResolverMessage_is_known_type(mut tlv_type: u64) -> bool { + let mut ret = lightning::onion_message::dns_resolution::DNSResolverMessage::is_known_type(tlv_type); + ret +} + +#[no_mangle] +/// Serialize the DNSResolverMessage object into a byte array which can be read by DNSResolverMessage_read +pub extern "C" fn DNSResolverMessage_write(obj: &crate::lightning::onion_message::dns_resolution::DNSResolverMessage) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(&unsafe { &*obj }.to_native()) +} +#[allow(unused)] +pub(crate) extern "C" fn DNSResolverMessage_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + DNSResolverMessage_write(unsafe { &*(obj as *const DNSResolverMessage) }) +} +#[no_mangle] +/// Read a DNSResolverMessage from a byte array, created by DNSResolverMessage_write +pub extern "C" fn DNSResolverMessage_read(ser: crate::c_types::u8slice, arg: u64) -> crate::c_types::derived::CResult_DNSResolverMessageDecodeErrorZ { + let arg_conv = arg; + let res: Result = crate::c_types::deserialize_obj_arg(ser, arg_conv); + let mut local_res = match res { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::lightning::ln::msgs::DecodeError::native_into(e) }).into() }; + local_res +} +impl From for crate::lightning::onion_message::packet::OnionMessageContents { + fn from(obj: nativeDNSResolverMessage) -> Self { + let rust_obj = crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(obj); + let mut ret = DNSResolverMessage_as_OnionMessageContents(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(DNSResolverMessage_free_void); + ret + } +} +/// Constructs a new OnionMessageContents which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned OnionMessageContents must be freed before this_arg is +#[no_mangle] +pub extern "C" fn DNSResolverMessage_as_OnionMessageContents(this_arg: &DNSResolverMessage) -> crate::lightning::onion_message::packet::OnionMessageContents { + crate::lightning::onion_message::packet::OnionMessageContents { + this_arg: unsafe { ObjOps::untweak_ptr(this_arg as *const DNSResolverMessage as *mut DNSResolverMessage) as *mut c_void }, + free: None, + tlv_type: DNSResolverMessage_OnionMessageContents_tlv_type, + msg_type: DNSResolverMessage_OnionMessageContents_msg_type, + write: DNSResolverMessage_write_void, + debug_str: DNSResolverMessage_debug_str_void, + cloned: Some(OnionMessageContents_DNSResolverMessage_cloned), + } +} + +#[must_use] +extern "C" fn DNSResolverMessage_OnionMessageContents_tlv_type(this_arg: *const c_void) -> u64 { + let mut ret = ::tlv_type(unsafe { &mut *(this_arg as *mut nativeDNSResolverMessage) }, ); + ret +} +#[must_use] +extern "C" fn DNSResolverMessage_OnionMessageContents_msg_type(this_arg: *const c_void) -> crate::c_types::Str { + let mut ret = ::msg_type(unsafe { &mut *(this_arg as *mut nativeDNSResolverMessage) }, ); + ret.into() +} +extern "C" fn OnionMessageContents_DNSResolverMessage_cloned(new_obj: &mut crate::lightning::onion_message::packet::OnionMessageContents) { + new_obj.this_arg = DNSResolverMessage_clone_void(new_obj.this_arg); + new_obj.free = Some(DNSResolverMessage_free_void); +} + + +use lightning::onion_message::dns_resolution::HumanReadableName as nativeHumanReadableNameImport; +pub(crate) type nativeHumanReadableName = nativeHumanReadableNameImport; + +/// A struct containing the two parts of a BIP 353 Human Readable Name - the user and domain parts. +/// +/// The `user` and `domain` parts, together, cannot exceed 232 bytes in length, and both must be +/// non-empty. +/// +/// To protect against [Homograph Attacks], both parts of a Human Readable Name must be plain +/// ASCII. +/// +/// [Homograph Attacks]: https://en.wikipedia.org/wiki/IDN_homograph_attack +#[must_use] +#[repr(C)] +pub struct HumanReadableName { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeHumanReadableName, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for HumanReadableName { + type Target = nativeHumanReadableName; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for HumanReadableName { } +unsafe impl core::marker::Sync for HumanReadableName { } +impl Drop for HumanReadableName { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeHumanReadableName>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the HumanReadableName, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn HumanReadableName_free(this_obj: HumanReadableName) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn HumanReadableName_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeHumanReadableName) }; +} +#[allow(unused)] +impl HumanReadableName { + pub(crate) fn get_native_ref(&self) -> &'static nativeHumanReadableName { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeHumanReadableName { + 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 nativeHumanReadableName { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +impl Clone for HumanReadableName { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeHumanReadableName>::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 HumanReadableName_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeHumanReadableName)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the HumanReadableName +pub extern "C" fn HumanReadableName_clone(orig: &HumanReadableName) -> HumanReadableName { + orig.clone() +} +/// Get a string which allows debug introspection of a HumanReadableName object +pub extern "C" fn HumanReadableName_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::onion_message::dns_resolution::HumanReadableName }).into()} +/// Generates a non-cryptographic 64-bit hash of the HumanReadableName. +#[no_mangle] +pub extern "C" fn HumanReadableName_hash(o: &HumanReadableName) -> u64 { + if o.inner.is_null() { return 0; } + // 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.get_native_ref(), &mut hasher); + core::hash::Hasher::finish(&hasher) +} +/// Checks if two HumanReadableNames 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 HumanReadableName_eq(a: &HumanReadableName, b: &HumanReadableName) -> 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 } +} +/// Constructs a new [`HumanReadableName`] from the `user` and `domain` parts. See the +/// struct-level documentation for more on the requirements on each. +#[must_use] +#[no_mangle] +pub extern "C" fn HumanReadableName_new(mut user: crate::c_types::Str, mut domain: crate::c_types::Str) -> crate::c_types::derived::CResult_HumanReadableNameNoneZ { + let mut ret = lightning::onion_message::dns_resolution::HumanReadableName::new(user.into_string(), domain.into_string()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Constructs a new [`HumanReadableName`] from the standard encoding - `user`@`domain`. +/// +/// If `user` includes the standard BIP 353 â‚¿ prefix it is automatically removed as required by +/// BIP 353. +#[must_use] +#[no_mangle] +pub extern "C" fn HumanReadableName_from_encoded(mut encoded: crate::c_types::Str) -> crate::c_types::derived::CResult_HumanReadableNameNoneZ { + let mut ret = lightning::onion_message::dns_resolution::HumanReadableName::from_encoded(encoded.into_str()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Gets the `user` part of this Human Readable Name +#[must_use] +#[no_mangle] +pub extern "C" fn HumanReadableName_user(this_arg: &crate::lightning::onion_message::dns_resolution::HumanReadableName) -> crate::c_types::Str { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.user(); + ret.into() +} + +/// Gets the `domain` part of this Human Readable Name +#[must_use] +#[no_mangle] +pub extern "C" fn HumanReadableName_domain(this_arg: &crate::lightning::onion_message::dns_resolution::HumanReadableName) -> crate::c_types::Str { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.domain(); + ret.into() +} + +#[no_mangle] +/// Serialize the HumanReadableName object into a byte array which can be read by HumanReadableName_read +pub extern "C" fn HumanReadableName_write(obj: &crate::lightning::onion_message::dns_resolution::HumanReadableName) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref()) +} +#[allow(unused)] +pub(crate) extern "C" fn HumanReadableName_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z { + crate::c_types::serialize_obj(unsafe { &*(obj as *const crate::lightning::onion_message::dns_resolution::nativeHumanReadableName) }) +} +#[no_mangle] +/// Read a HumanReadableName from a byte array, created by HumanReadableName_write +pub extern "C" fn HumanReadableName_read(ser: crate::c_types::u8slice) -> crate::c_types::derived::CResult_HumanReadableNameDecodeErrorZ { + 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::dns_resolution::HumanReadableName { 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::onion_message::dns_resolution::OMNameResolver as nativeOMNameResolverImport; +pub(crate) type nativeOMNameResolver = nativeOMNameResolverImport; + +/// A stateful resolver which maps BIP 353 Human Readable Names to URIs and BOLT12 [`Offer`]s. +/// +/// It does not directly implement [`DNSResolverMessageHandler`] but implements all the core logic +/// which is required in a client which intends to. +/// +/// It relies on being made aware of the passage of time with regular calls to +/// [`Self::new_best_block`] in order to time out existing queries. Queries time out after two +/// blocks. +#[must_use] +#[repr(C)] +pub struct OMNameResolver { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeOMNameResolver, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for OMNameResolver { + type Target = nativeOMNameResolver; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for OMNameResolver { } +unsafe impl core::marker::Sync for OMNameResolver { } +impl Drop for OMNameResolver { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeOMNameResolver>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the OMNameResolver, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn OMNameResolver_free(this_obj: OMNameResolver) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn OMNameResolver_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeOMNameResolver) }; +} +#[allow(unused)] +impl OMNameResolver { + pub(crate) fn get_native_ref(&self) -> &'static nativeOMNameResolver { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeOMNameResolver { + 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 nativeOMNameResolver { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Builds a new [`OMNameResolver`]. +#[must_use] +#[no_mangle] +pub extern "C" fn OMNameResolver_new(mut latest_block_time: u32, mut latest_block_height: u32) -> crate::lightning::onion_message::dns_resolution::OMNameResolver { + let mut ret = lightning::onion_message::dns_resolution::OMNameResolver::new(latest_block_time, latest_block_height); + crate::lightning::onion_message::dns_resolution::OMNameResolver { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + +/// Informs the [`OMNameResolver`] of the passage of time in the form of a new best Bitcoin +/// block. +/// +/// This will call back to resolve some pending queries which have timed out. +#[no_mangle] +pub extern "C" fn OMNameResolver_new_best_block(this_arg: &crate::lightning::onion_message::dns_resolution::OMNameResolver, mut height: u32, mut time: u32) { + unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.new_best_block(height, time) +} + +/// Begins the process of resolving a BIP 353 Human Readable Name. +/// +/// Returns a [`DNSSECQuery`] onion message and a [`DNSResolverContext`] which should be sent +/// to a resolver (with the context used to generate the blinded response path) on success. +#[must_use] +#[no_mangle] +pub extern "C" fn OMNameResolver_resolve_name(this_arg: &crate::lightning::onion_message::dns_resolution::OMNameResolver, mut payment_id: crate::c_types::ThirtyTwoBytes, mut name: crate::lightning::onion_message::dns_resolution::HumanReadableName, entropy_source: &crate::lightning::sign::EntropySource) -> crate::c_types::derived::CResult_C2Tuple_DNSSECQueryDNSResolverContextZNoneZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.resolve_name(::lightning::ln::channelmanager::PaymentId(payment_id.data), *unsafe { Box::from_raw(name.take_inner()) }, entropy_source); + 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::lightning::onion_message::dns_resolution::DNSSECQuery { inner: ObjOps::heap_alloc(orig_ret_0_0), is_owned: true }, crate::lightning::blinded_path::message::DNSResolverContext { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} + +/// Handles a [`DNSSECProof`] message, attempting to verify it and match it against a pending +/// query. +/// +/// If verification succeeds, the resulting bitcoin: URI is parsed to find a contained +/// [`Offer`]. +/// +/// Note that a single proof for a wildcard DNS entry may complete several requests for +/// different [`HumanReadableName`]s. +/// +/// If an [`Offer`] is found, it, as well as the [`PaymentId`] and original `name` passed to +/// [`Self::resolve_name`] are returned. +#[must_use] +#[no_mangle] +pub extern "C" fn OMNameResolver_handle_dnssec_proof_for_offer(this_arg: &crate::lightning::onion_message::dns_resolution::OMNameResolver, mut msg: crate::lightning::onion_message::dns_resolution::DNSSECProof, mut context: crate::lightning::blinded_path::message::DNSResolverContext) -> crate::c_types::derived::COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_dnssec_proof_for_offer(*unsafe { Box::from_raw(msg.take_inner()) }, *unsafe { Box::from_raw(context.take_inner()) }); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ::None } else { crate::c_types::derived::COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZOfferZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_orig_ret_0_0 = Vec::new(); for mut item in orig_ret_0_0.drain(..) { local_orig_ret_0_0.push( { let (mut orig_orig_ret_0_0_0_0, mut orig_orig_ret_0_0_0_1) = item; let mut local_orig_ret_0_0_0 = (crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: ObjOps::heap_alloc(orig_orig_ret_0_0_0_0), is_owned: true }, crate::c_types::ThirtyTwoBytes { data: orig_orig_ret_0_0_0_1.0 }).into(); local_orig_ret_0_0_0 }); }; let mut local_ret_0 = (local_orig_ret_0_0.into(), crate::lightning::offers::offer::Offer { inner: ObjOps::heap_alloc(orig_ret_0_1), is_owned: true }).into(); local_ret_0 }) }; + local_ret +} + +/// Handles a [`DNSSECProof`] message, attempting to verify it and match it against any pending +/// queries. +/// +/// If verification succeeds, all matching [`PaymentId`] and [`HumanReadableName`]s passed to +/// [`Self::resolve_name`], as well as the resolved bitcoin: URI are returned. +/// +/// Note that a single proof for a wildcard DNS entry may complete several requests for +/// different [`HumanReadableName`]s. +/// +/// This method is useful for those who handle bitcoin: URIs already, handling more than just +/// BOLT12 [`Offer`]s. +#[must_use] +#[no_mangle] +pub extern "C" fn OMNameResolver_handle_dnssec_proof_for_uri(this_arg: &crate::lightning::onion_message::dns_resolution::OMNameResolver, mut msg: crate::lightning::onion_message::dns_resolution::DNSSECProof, mut context: crate::lightning::blinded_path::message::DNSResolverContext) -> crate::c_types::derived::COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.handle_dnssec_proof_for_uri(*unsafe { Box::from_raw(msg.take_inner()) }, *unsafe { Box::from_raw(context.take_inner()) }); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ::None } else { crate::c_types::derived::COption_C2Tuple_CVec_C2Tuple_HumanReadableNameThirtyTwoBytesZZStrZZ::Some( { let (mut orig_ret_0_0, mut orig_ret_0_1) = (ret.unwrap()); let mut local_orig_ret_0_0 = Vec::new(); for mut item in orig_ret_0_0.drain(..) { local_orig_ret_0_0.push( { let (mut orig_orig_ret_0_0_0_0, mut orig_orig_ret_0_0_0_1) = item; let mut local_orig_ret_0_0_0 = (crate::lightning::onion_message::dns_resolution::HumanReadableName { inner: ObjOps::heap_alloc(orig_orig_ret_0_0_0_0), is_owned: true }, crate::c_types::ThirtyTwoBytes { data: orig_orig_ret_0_0_0_1.0 }).into(); local_orig_ret_0_0_0 }); }; let mut local_ret_0 = (local_orig_ret_0_0.into(), orig_ret_0_1.into()).into(); local_ret_0 }) }; + local_ret +} + diff --git a/lightning-c-bindings/src/lightning/onion_message/messenger.rs b/lightning-c-bindings/src/lightning/onion_message/messenger.rs index a5323a8..67b6723 100644 --- a/lightning-c-bindings/src/lightning/onion_message/messenger.rs +++ b/lightning-c-bindings/src/lightning/onion_message/messenger.rs @@ -20,7 +20,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 [`OnionMessage`]s. /// @@ -92,14 +92,16 @@ pub(crate) type nativeOnionMessenger = nativeOnionMessengerImport(&self, w: &mut W) -> Result<(), io::Error> { @@ -400,6 +402,15 @@ pub(crate) extern "C" fn ResponseInstruction_clone_void(this_ptr: *const c_void) pub extern "C" fn ResponseInstruction_clone(orig: &ResponseInstruction) -> ResponseInstruction { orig.clone() } +/// Converts this [`ResponseInstruction`] into a [`MessageSendInstructions`] so that it can be +/// used to send the response via a normal message sending method. +#[must_use] +#[no_mangle] +pub extern "C" fn ResponseInstruction_into_instructions(mut this_arg: crate::lightning::onion_message::messenger::ResponseInstruction) -> crate::lightning::onion_message::messenger::MessageSendInstructions { + let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).into_instructions(); + crate::lightning::onion_message::messenger::MessageSendInstructions::native_into(ret) +} + /// Instructions for how and where to send a message. #[derive(Clone)] #[must_use] @@ -1767,8 +1778,8 @@ pub extern "C" fn peel_onion_message(msg: &crate::lightning::ln::msgs::OnionMess /// their respective handlers. #[must_use] #[no_mangle] -pub extern "C" fn OnionMessenger_new(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut node_id_lookup: crate::lightning::blinded_path::NodeIdLookUp, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut offers_handler: crate::lightning::onion_message::offers::OffersMessageHandler, mut async_payments_handler: crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler, mut custom_handler: crate::lightning::onion_message::messenger::CustomOnionMessageHandler) -> crate::lightning::onion_message::messenger::OnionMessenger { - let mut ret = lightning::onion_message::messenger::OnionMessenger::new(entropy_source, node_signer, logger, node_id_lookup, message_router, offers_handler, async_payments_handler, custom_handler); +pub extern "C" fn OnionMessenger_new(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut node_id_lookup: crate::lightning::blinded_path::NodeIdLookUp, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut offers_handler: crate::lightning::onion_message::offers::OffersMessageHandler, mut async_payments_handler: crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler, mut dns_resolver: crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler, mut custom_handler: crate::lightning::onion_message::messenger::CustomOnionMessageHandler) -> crate::lightning::onion_message::messenger::OnionMessenger { + let mut ret = lightning::onion_message::messenger::OnionMessenger::new(entropy_source, node_signer, logger, node_id_lookup, message_router, offers_handler, async_payments_handler, dns_resolver, custom_handler); crate::lightning::onion_message::messenger::OnionMessenger { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1795,8 +1806,8 @@ pub extern "C" fn OnionMessenger_new(mut entropy_source: crate::lightning::sign: /// peers. #[must_use] #[no_mangle] -pub extern "C" fn OnionMessenger_new_with_offline_peer_interception(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut node_id_lookup: crate::lightning::blinded_path::NodeIdLookUp, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut offers_handler: crate::lightning::onion_message::offers::OffersMessageHandler, mut async_payments_handler: crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler, mut custom_handler: crate::lightning::onion_message::messenger::CustomOnionMessageHandler) -> crate::lightning::onion_message::messenger::OnionMessenger { - let mut ret = lightning::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception(entropy_source, node_signer, logger, node_id_lookup, message_router, offers_handler, async_payments_handler, custom_handler); +pub extern "C" fn OnionMessenger_new_with_offline_peer_interception(mut entropy_source: crate::lightning::sign::EntropySource, mut node_signer: crate::lightning::sign::NodeSigner, mut logger: crate::lightning::util::logger::Logger, mut node_id_lookup: crate::lightning::blinded_path::NodeIdLookUp, mut message_router: crate::lightning::onion_message::messenger::MessageRouter, mut offers_handler: crate::lightning::onion_message::offers::OffersMessageHandler, mut async_payments_handler: crate::lightning::onion_message::async_payments::AsyncPaymentsMessageHandler, mut dns_resolver: crate::lightning::onion_message::dns_resolution::DNSResolverMessageHandler, mut custom_handler: crate::lightning::onion_message::messenger::CustomOnionMessageHandler) -> crate::lightning::onion_message::messenger::OnionMessenger { + let mut ret = lightning::onion_message::messenger::OnionMessenger::new_with_offline_peer_interception(entropy_source, node_signer, logger, node_id_lookup, message_router, offers_handler, async_payments_handler, dns_resolver, custom_handler); crate::lightning::onion_message::messenger::OnionMessenger { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -1904,7 +1915,7 @@ pub extern "C" fn OnionMessenger_as_OnionMessageHandler(this_arg: &OnionMessenge } extern "C" fn OnionMessenger_OnionMessageHandler_handle_onion_message(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::OnionMessage) { - ::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &peer_node_id.into_rust(), msg.get_native_ref()) + ::handle_onion_message(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, peer_node_id.into_rust(), msg.get_native_ref()) } #[must_use] extern "C" fn OnionMessenger_OnionMessageHandler_next_onion_message_for_peer(this_arg: *const c_void, mut peer_node_id: crate::c_types::PublicKey) -> crate::lightning::ln::msgs::OnionMessage { @@ -1914,12 +1925,12 @@ extern "C" fn OnionMessenger_OnionMessageHandler_next_onion_message_for_peer(thi } #[must_use] extern "C" fn OnionMessenger_OnionMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &their_node_id.into_rust(), init.get_native_ref(), inbound); + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust(), init.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } extern "C" fn OnionMessenger_OnionMessageHandler_peer_disconnected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) { - ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &their_node_id.into_rust()) + ::peer_disconnected(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust()) } extern "C" fn OnionMessenger_OnionMessageHandler_timer_tick_occurred(this_arg: *const c_void) { ::timer_tick_occurred(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, ) @@ -1931,7 +1942,7 @@ extern "C" fn OnionMessenger_OnionMessageHandler_provided_node_features(this_arg } #[must_use] extern "C" fn OnionMessenger_OnionMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, &their_node_id.into_rust()); + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeOnionMessenger) }, their_node_id.into_rust()); crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning/onion_message/mod.rs b/lightning-c-bindings/src/lightning/onion_message/mod.rs index f4c9ae5..66631af 100644 --- a/lightning-c-bindings/src/lightning/onion_message/mod.rs +++ b/lightning-c-bindings/src/lightning/onion_message/mod.rs @@ -30,6 +30,7 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; pub mod async_payments; +pub mod dns_resolution; pub mod messenger; pub mod offers; pub mod packet; diff --git a/lightning-c-bindings/src/lightning/onion_message/packet.rs b/lightning-c-bindings/src/lightning/onion_message/packet.rs index 0288684..fa5cf0d 100644 --- a/lightning-c-bindings/src/lightning/onion_message/packet.rs +++ b/lightning-c-bindings/src/lightning/onion_message/packet.rs @@ -197,6 +197,9 @@ pub enum ParsedOnionMessageContents { /// A message related to BOLT 12 Offers. Offers( crate::lightning::onion_message::offers::OffersMessage), + /// A message requesting or providing a DNSSEC proof + DNSResolver( + crate::lightning::onion_message::dns_resolution::DNSResolverMessage), /// A custom onion message specified by the user. Custom( crate::lightning::onion_message::packet::OnionMessageContents), @@ -214,6 +217,12 @@ impl ParsedOnionMessageContents { a_nonref.into_native(), ) }, + ParsedOnionMessageContents::DNSResolver (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeParsedOnionMessageContents::DNSResolver ( + a_nonref.into_native(), + ) + }, ParsedOnionMessageContents::Custom (ref a, ) => { let mut a_nonref = Clone::clone(a); nativeParsedOnionMessageContents::Custom ( @@ -230,6 +239,11 @@ impl ParsedOnionMessageContents { a.into_native(), ) }, + ParsedOnionMessageContents::DNSResolver (mut a, ) => { + nativeParsedOnionMessageContents::DNSResolver ( + a.into_native(), + ) + }, ParsedOnionMessageContents::Custom (mut a, ) => { nativeParsedOnionMessageContents::Custom ( a, @@ -247,6 +261,12 @@ impl ParsedOnionMessageContents { crate::lightning::onion_message::offers::OffersMessage::native_into(a_nonref), ) }, + nativeParsedOnionMessageContents::DNSResolver (ref a, ) => { + let mut a_nonref = Clone::clone(a); + ParsedOnionMessageContents::DNSResolver ( + crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(a_nonref), + ) + }, nativeParsedOnionMessageContents::Custom (ref a, ) => { let mut a_nonref = Clone::clone(a); ParsedOnionMessageContents::Custom ( @@ -263,6 +283,11 @@ impl ParsedOnionMessageContents { crate::lightning::onion_message::offers::OffersMessage::native_into(a), ) }, + nativeParsedOnionMessageContents::DNSResolver (mut a, ) => { + ParsedOnionMessageContents::DNSResolver ( + crate::lightning::onion_message::dns_resolution::DNSResolverMessage::native_into(a), + ) + }, nativeParsedOnionMessageContents::Custom (mut a, ) => { ParsedOnionMessageContents::Custom ( Into::into(a), @@ -295,6 +320,11 @@ pub extern "C" fn ParsedOnionMessageContents_offers(a: crate::lightning::onion_m ParsedOnionMessageContents::Offers(a, ) } #[no_mangle] +/// Utility method to constructs a new DNSResolver-variant ParsedOnionMessageContents +pub extern "C" fn ParsedOnionMessageContents_dnsresolver(a: crate::lightning::onion_message::dns_resolution::DNSResolverMessage) -> ParsedOnionMessageContents { + ParsedOnionMessageContents::DNSResolver(a, ) +} +#[no_mangle] /// Utility method to constructs a new Custom-variant ParsedOnionMessageContents pub extern "C" fn ParsedOnionMessageContents_custom(a: crate::lightning::onion_message::packet::OnionMessageContents) -> ParsedOnionMessageContents { ParsedOnionMessageContents::Custom(a, ) diff --git a/lightning-c-bindings/src/lightning/routing/gossip.rs b/lightning-c-bindings/src/lightning/routing/gossip.rs index 39db985..9f6a778 100644 --- a/lightning-c-bindings/src/lightning/routing/gossip.rs +++ b/lightning-c-bindings/src/lightning/routing/gossip.rs @@ -630,20 +630,23 @@ pub extern "C" fn P2PGossipSync_as_RoutingMessageHandler(this_arg: &P2PGossipSyn } #[must_use] -extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { - let mut ret = ::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, msg.get_native_ref()); +extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_node_announcement(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::NodeAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { + let mut local_their_node_id = if their_node_id.is_null() { None } else { Some( { their_node_id.into_rust() }) }; + let mut ret = ::handle_node_announcement(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, local_their_node_id, msg.get_native_ref()); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] -extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { - let mut ret = ::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, msg.get_native_ref()); +extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_channel_announcement(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelAnnouncement) -> crate::c_types::derived::CResult_boolLightningErrorZ { + let mut local_their_node_id = if their_node_id.is_null() { None } else { Some( { their_node_id.into_rust() }) }; + let mut ret = ::handle_channel_announcement(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, local_their_node_id, msg.get_native_ref()); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] -extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ { - let mut ret = ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, msg.get_native_ref()); +extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_channel_update(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, msg: &crate::lightning::ln::msgs::ChannelUpdate) -> crate::c_types::derived::CResult_boolLightningErrorZ { + let mut local_their_node_id = if their_node_id.is_null() { None } else { Some( { their_node_id.into_rust() }) }; + let mut ret = ::handle_channel_update(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, local_their_node_id, msg.get_native_ref()); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } @@ -662,31 +665,31 @@ extern "C" fn P2PGossipSync_RoutingMessageHandler_get_next_node_announcement(thi } #[must_use] extern "C" fn P2PGossipSync_RoutingMessageHandler_peer_connected(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, init: &crate::lightning::ln::msgs::Init, mut inbound: bool) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), init.get_native_ref(), inbound); + let mut ret = ::peer_connected(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), init.get_native_ref(), inbound); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } #[must_use] extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_reply_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_reply_channel_range(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_reply_short_channel_ids_end(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::ReplyShortChannelIdsEnd) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_reply_short_channel_ids_end(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_query_channel_range(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::QueryChannelRange) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_query_channel_range(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } #[must_use] extern "C" fn P2PGossipSync_RoutingMessageHandler_handle_query_short_channel_ids(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey, mut msg: crate::lightning::ln::msgs::QueryShortChannelIds) -> crate::c_types::derived::CResult_NoneLightningErrorZ { - let mut ret = ::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); + let mut ret = ::handle_query_short_channel_ids(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust(), *unsafe { Box::from_raw(msg.take_inner()) }); 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::msgs::LightningError { inner: ObjOps::heap_alloc(e), is_owned: true } }).into() }; local_ret } @@ -702,7 +705,7 @@ extern "C" fn P2PGossipSync_RoutingMessageHandler_provided_node_features(this_ar } #[must_use] extern "C" fn P2PGossipSync_RoutingMessageHandler_provided_init_features(this_arg: *const c_void, mut their_node_id: crate::c_types::PublicKey) -> crate::lightning_types::features::InitFeatures { - let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, &their_node_id.into_rust()); + let mut ret = ::provided_init_features(unsafe { &mut *(this_arg as *mut nativeP2PGossipSync) }, their_node_id.into_rust()); crate::lightning_types::features::InitFeatures { inner: ObjOps::heap_alloc(ret), is_owned: true } } @@ -2390,7 +2393,7 @@ pub extern "C" fn NetworkGraph_node_failed_permanent(this_arg: &crate::lightning /// in the map for a while so that these can be resynced from gossip in the future. /// /// This method is only available with the `std` feature. See -/// [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for `no-std` use. +/// [`NetworkGraph::remove_stale_channels_and_tracking_with_time`] for non-`std` use. #[no_mangle] pub extern "C" fn NetworkGraph_remove_stale_channels_and_tracking(this_arg: &crate::lightning::routing::gossip::NetworkGraph) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_and_tracking() @@ -2407,8 +2410,8 @@ pub extern "C" fn NetworkGraph_remove_stale_channels_and_tracking(this_arg: &cra /// This method will also cause us to stop tracking removed nodes and channels if they have been /// in the map for a while so that these can be resynced from gossip in the future. /// -/// This function takes the current unix time as an argument. For users with the `std` feature -/// enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. +///This function takes the current unix time as an argument. For users with the `std` feature +///enabled, [`NetworkGraph::remove_stale_channels_and_tracking`] may be preferable. #[no_mangle] pub extern "C" fn NetworkGraph_remove_stale_channels_and_tracking_with_time(this_arg: &crate::lightning::routing::gossip::NetworkGraph, mut current_time_unix: u64) { unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.remove_stale_channels_and_tracking_with_time(current_time_unix) @@ -2421,7 +2424,7 @@ pub extern "C" fn NetworkGraph_remove_stale_channels_and_tracking_with_time(this /// [`RoutingMessageHandler`] implementation to call it indirectly. This may be useful to accept /// routing messages from a source using a protocol other than the lightning P2P protocol. /// -/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or +/// If not built with `std`, any updates with a timestamp more than two weeks in the past or /// materially in the future will be rejected. #[must_use] #[no_mangle] @@ -2435,7 +2438,7 @@ pub extern "C" fn NetworkGraph_update_channel(this_arg: &crate::lightning::routi /// of the channel without verifying the associated signatures. Because we aren't given the /// associated signatures here we cannot relay the channel update to any of our peers. /// -/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or +/// If not built with `std`, any updates with a timestamp more than two weeks in the past or /// materially in the future will be rejected. #[must_use] #[no_mangle] @@ -2449,7 +2452,7 @@ pub extern "C" fn NetworkGraph_update_channel_unsigned(this_arg: &crate::lightni /// /// This checks whether the update currently is applicable by [`Self::update_channel`]. /// -/// If built with `no-std`, any updates with a timestamp more than two weeks in the past or +/// If not built with `std`, any updates with a timestamp more than two weeks in the past or /// materially in the future will be rejected. #[must_use] #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/routing/router.rs b/lightning-c-bindings/src/lightning/routing/router.rs index 84e3a73..64b3285 100644 --- a/lightning-c-bindings/src/lightning/routing/router.rs +++ b/lightning-c-bindings/src/lightning/routing/router.rs @@ -25,8 +25,10 @@ pub(crate) type nativeDefaultRouter = nativeDefaultRouterImport<&'static lightni /// /// # Privacy /// -/// Implements [`MessageRouter`] by delegating to [`DefaultMessageRouter`]. See those docs for -/// privacy implications. +/// Creating [`BlindedPaymentPath`]s may affect privacy since, if a suitable path cannot be found, +/// it will create a one-hop path using the recipient as the introduction node if it is a announced +/// node. Otherwise, there is no way to find a path to the introduction node in order to send a +/// payment, and thus an `Err` is returned. #[must_use] #[repr(C)] pub struct DefaultRouter { @@ -110,13 +112,6 @@ pub extern "C" fn DefaultRouter_as_Router(this_arg: &DefaultRouter) -> crate::li find_route: DefaultRouter_Router_find_route, find_route_with_id: DefaultRouter_Router_find_route_with_id, create_blinded_payment_paths: DefaultRouter_Router_create_blinded_payment_paths, - MessageRouter: crate::lightning::onion_message::messenger::MessageRouter { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - find_path: DefaultRouter_MessageRouter_find_path, - create_blinded_paths: DefaultRouter_MessageRouter_create_blinded_paths, - create_compact_blinded_paths: DefaultRouter_MessageRouter_create_compact_blinded_paths, - }, } } @@ -130,7 +125,7 @@ extern "C" fn DefaultRouter_Router_find_route(this_arg: *const c_void, mut payer #[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::types::PaymentHash(_payment_hash.data), ::lightning::ln::channelmanager::PaymentId(_payment_id.data)); + 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::types::payment::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 } @@ -142,51 +137,6 @@ extern "C" fn DefaultRouter_Router_create_blinded_payment_paths(this_arg: *const local_ret } -impl From for crate::lightning::onion_message::messenger::MessageRouter { - fn from(obj: nativeDefaultRouter) -> Self { - let rust_obj = crate::lightning::routing::router::DefaultRouter { inner: ObjOps::heap_alloc(obj), is_owned: true }; - let mut ret = DefaultRouter_as_MessageRouter(&rust_obj); - // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn - core::mem::forget(rust_obj); - ret.free = Some(DefaultRouter_free_void); - ret - } -} -/// Constructs a new MessageRouter which calls the relevant methods on this_arg. -/// This copies the `inner` pointer in this_arg and thus the returned MessageRouter must be freed before this_arg is -#[no_mangle] -pub extern "C" fn DefaultRouter_as_MessageRouter(this_arg: &DefaultRouter) -> crate::lightning::onion_message::messenger::MessageRouter { - crate::lightning::onion_message::messenger::MessageRouter { - this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, - free: None, - find_path: DefaultRouter_MessageRouter_find_path, - create_blinded_paths: DefaultRouter_MessageRouter_create_blinded_paths, - create_compact_blinded_paths: DefaultRouter_MessageRouter_create_compact_blinded_paths, - } -} - -#[must_use] -extern "C" fn DefaultRouter_MessageRouter_find_path(this_arg: *const c_void, mut sender: crate::c_types::PublicKey, mut peers: crate::c_types::derived::CVec_PublicKeyZ, mut destination: crate::lightning::onion_message::messenger::Destination) -> crate::c_types::derived::CResult_OnionMessagePathNoneZ { - let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { item.into_rust() }); }; - let mut ret = ::find_path(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, sender.into_rust(), local_peers, destination.into_native()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::onion_message::messenger::OnionMessagePath { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} -#[must_use] -extern "C" fn DefaultRouter_MessageRouter_create_blinded_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut peers: crate::c_types::derived::CVec_PublicKeyZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { - let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { item.into_rust() }); }; - let mut ret = ::create_blinded_paths(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, recipient.into_rust(), context.into_native(), local_peers, secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} -#[must_use] -extern "C" fn DefaultRouter_MessageRouter_create_compact_blinded_paths(this_arg: *const c_void, mut recipient: crate::c_types::PublicKey, mut context: crate::lightning::blinded_path::message::MessageContext, mut peers: crate::c_types::derived::CVec_MessageForwardNodeZ) -> crate::c_types::derived::CResult_CVec_BlindedMessagePathZNoneZ { - let mut local_peers = Vec::new(); for mut item in peers.into_rust().drain(..) { local_peers.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; - let mut ret = ::create_compact_blinded_paths(unsafe { &mut *(this_arg as *mut nativeDefaultRouter) }, recipient.into_rust(), context.into_native(), local_peers, secp256k1::global::SECP256K1); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { crate::lightning::blinded_path::message::BlindedMessagePath { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} - /// A trait defining behavior for routing a payment. #[repr(C)] pub struct Router { @@ -214,8 +164,6 @@ pub struct Router { /// are assumed to be with the `recipient`'s peers. The payment secret and any constraints are /// given in `tlvs`. pub create_blinded_payment_paths: extern "C" fn (this_arg: *const c_void, recipient: crate::c_types::PublicKey, first_hops: crate::c_types::derived::CVec_ChannelDetailsZ, tlvs: crate::lightning::blinded_path::payment::ReceiveTlvs, amount_msats: u64) -> crate::c_types::derived::CResult_CVec_BlindedPaymentPathZNoneZ, - /// Implementation of MessageRouter for this object. - pub MessageRouter: crate::lightning::onion_message::messenger::MessageRouter, /// 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, @@ -229,50 +177,9 @@ pub(crate) fn Router_clone_fields(orig: &Router) -> Router { find_route: Clone::clone(&orig.find_route), find_route_with_id: Clone::clone(&orig.find_route_with_id), create_blinded_payment_paths: Clone::clone(&orig.create_blinded_payment_paths), - MessageRouter: crate::lightning::onion_message::messenger::MessageRouter_clone_fields(&orig.MessageRouter), free: Clone::clone(&orig.free), } } -impl lightning::onion_message::messenger::MessageRouter for Router { - fn find_path(&self, mut sender: bitcoin::secp256k1::PublicKey, mut peers: Vec, mut destination: lightning::onion_message::messenger::Destination) -> Result { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::c_types::PublicKey::from_rust(&item) }); }; - let mut ret = (self.MessageRouter.find_path)(self.MessageRouter.this_arg, crate::c_types::PublicKey::from_rust(&sender), local_peers.into(), crate::lightning::onion_message::messenger::Destination::native_into(destination)); - 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(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn create_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::c_types::PublicKey::from_rust(&item) }); }; - let mut ret = (self.MessageRouter.create_blinded_paths)(self.MessageRouter.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.into()); - let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn create_compact_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::lightning::blinded_path::message::MessageForwardNode { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut ret = (self.MessageRouter.create_compact_blinded_paths)(self.MessageRouter.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.into()); - let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } -} -impl lightning::onion_message::messenger::MessageRouter for RouterRef { - fn find_path(&self, mut sender: bitcoin::secp256k1::PublicKey, mut peers: Vec, mut destination: lightning::onion_message::messenger::Destination) -> Result { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::c_types::PublicKey::from_rust(&item) }); }; - let mut ret = (self.0.MessageRouter.find_path)(self.0.MessageRouter.this_arg, crate::c_types::PublicKey::from_rust(&sender), local_peers.into(), crate::lightning::onion_message::messenger::Destination::native_into(destination)); - 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(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn create_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::c_types::PublicKey::from_rust(&item) }); }; - let mut ret = (self.0.MessageRouter.create_blinded_paths)(self.0.MessageRouter.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.into()); - let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } - fn create_compact_blinded_paths(&self, mut recipient: bitcoin::secp256k1::PublicKey, mut context: lightning::blinded_path::message::MessageContext, mut peers: Vec, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result, ()> { - let mut local_peers = Vec::new(); for mut item in peers.drain(..) { local_peers.push( { crate::lightning::blinded_path::message::MessageForwardNode { inner: ObjOps::heap_alloc(item), is_owned: true } }); }; - let mut ret = (self.0.MessageRouter.create_compact_blinded_paths)(self.0.MessageRouter.this_arg, crate::c_types::PublicKey::from_rust(&recipient), crate::lightning::blinded_path::message::MessageContext::native_into(context), local_peers.into()); - let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { *unsafe { Box::from_raw(item.take_inner()) } }); }; local_ret_0 }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } -} use lightning::routing::router::Router as rustRouter; impl rustRouter for Router { diff --git a/lightning-c-bindings/src/lightning/routing/scoring.rs b/lightning-c-bindings/src/lightning/routing/scoring.rs index 59e0e98..b105134 100644 --- a/lightning-c-bindings/src/lightning/routing/scoring.rs +++ b/lightning-c-bindings/src/lightning/routing/scoring.rs @@ -1334,7 +1334,13 @@ impl ProbabilisticScoringFeeParameters { } /// A fixed penalty in msats to apply to each channel. /// -/// Default value: 500 msat +/// In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] +/// (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the +/// most accurate total success probabilities. +/// +/// Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). +/// +/// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_base_penalty_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_msat; @@ -1342,42 +1348,60 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_base_penalty_msat(this_p } /// A fixed penalty in msats to apply to each channel. /// -/// Default value: 500 msat +/// In testing, a value of roughly 1/10th of [`historical_liquidity_penalty_multiplier_msat`] +/// (implying scaling all estimated probabilities down by a factor of ~79%) resulted in the +/// most accurate total success probabilities. +/// +/// Default value: 1,024 msat (i.e. we're willing to pay 1 sat to avoid each additional hop). +/// +/// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_set_base_penalty_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_msat = val; } -/// A multiplier used with the total amount flowing over a channel to calculate a fixed penalty -/// applied to each channel, in excess of the [`base_penalty_msat`]. +/// A multiplier used with the payment amount to calculate a fixed penalty applied to each +/// channel, in excess of the [`base_penalty_msat`]. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment -/// amount plus the amount of any other HTLCs flowing we sent over the same channel). +/// multiplier and `2^30`ths of the payment amount. /// /// ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` /// -/// Default value: 8,192 msat +/// In testing, a value of roughly ~100x (1/10th * 2^10) of +/// [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated +/// probabilities down by a factor of ~79%) resulted in the most accurate total success +/// probabilities. +/// +/// Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional +/// hop). /// /// [`base_penalty_msat`]: Self::base_penalty_msat +/// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_base_penalty_amount_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { let mut inner_val = &mut this_ptr.get_native_mut_ref().base_penalty_amount_multiplier_msat; *inner_val } -/// A multiplier used with the total amount flowing over a channel to calculate a fixed penalty -/// applied to each channel, in excess of the [`base_penalty_msat`]. +/// A multiplier used with the payment amount to calculate a fixed penalty applied to each +/// channel, in excess of the [`base_penalty_msat`]. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^30`ths of the total amount flowing over a channel (i.e. the payment -/// amount plus the amount of any other HTLCs flowing we sent over the same channel). +/// multiplier and `2^30`ths of the payment amount. /// /// ie `base_penalty_amount_multiplier_msat * amount_msat / 2^30` /// -/// Default value: 8,192 msat +/// In testing, a value of roughly ~100x (1/10th * 2^10) of +/// [`historical_liquidity_penalty_amount_multiplier_msat`] (implying scaling all estimated +/// probabilities down by a factor of ~79%) resulted in the most accurate total success +/// probabilities. +/// +/// Default value: 131,072 msat (i.e. we're willing to pay 0.125bps to avoid each additional +/// hop). /// /// [`base_penalty_msat`]: Self::base_penalty_msat +/// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_set_base_penalty_amount_multiplier_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.base_penalty_amount_multiplier_msat = val; @@ -1395,9 +1419,14 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_base_penalty_amount_mult /// /// `-log10(success_probability) * liquidity_penalty_multiplier_msat` /// -/// Default value: 30,000 msat +/// In testing, this scoring model performs much worse than the historical scoring model +/// configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled +/// by default. +/// +/// Default value: 0 msat /// /// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life +/// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_penalty_multiplier_msat; @@ -1416,21 +1445,26 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_multip /// /// `-log10(success_probability) * liquidity_penalty_multiplier_msat` /// -/// Default value: 30,000 msat +/// In testing, this scoring model performs much worse than the historical scoring model +/// configured with the [`historical_liquidity_penalty_multiplier_msat`] and thus is disabled +/// by default. +/// +/// Default value: 0 msat /// /// [`liquidity_offset_half_life`]: ProbabilisticScoringDecayParameters::liquidity_offset_half_life +/// [`historical_liquidity_penalty_multiplier_msat`]: Self::historical_liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_set_liquidity_penalty_multiplier_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.liquidity_penalty_multiplier_msat = val; } -/// A multiplier used in conjunction with the total amount flowing over a channel and the -/// negative `log10` of the channel's success probability for the payment, as determined by our -/// latest estimates of the channel's liquidity, to determine the amount penalty. +/// A multiplier used in conjunction with the payment amount and the negative `log10` of the +/// channel's success probability for the total amount flowing over a channel, as determined by +/// our latest estimates of the channel's liquidity, to determine the amount penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative -/// `log10` of the success probability. +/// multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the +/// success probability. /// /// `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` /// @@ -1440,20 +1474,26 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_liquidity_penalty_multip /// probabilities, the multiplier will have a decreasing effect as the negative `log10` will /// fall below `1`. /// -/// Default value: 192 msat +/// In testing, this scoring model performs much worse than the historical scoring model +/// configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is +/// disabled by default. +/// +/// Default value: 0 msat +/// +/// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount_multiplier_msat(this_ptr: &ProbabilisticScoringFeeParameters) -> u64 { let mut inner_val = &mut this_ptr.get_native_mut_ref().liquidity_penalty_amount_multiplier_msat; *inner_val } -/// A multiplier used in conjunction with the total amount flowing over a channel and the -/// negative `log10` of the channel's success probability for the payment, as determined by our -/// latest estimates of the channel's liquidity, to determine the amount penalty. +/// A multiplier used in conjunction with the payment amount and the negative `log10` of the +/// channel's success probability for the total amount flowing over a channel, as determined by +/// our latest estimates of the channel's liquidity, to determine the amount penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost (i.e., /// fees plus penalty) for large payments. The penalty is computed as the product of this -/// multiplier and `2^20`ths of the amount flowing over this channel, weighted by the negative -/// `log10` of the success probability. +/// multiplier and `2^20`ths of the payment amount, weighted by the negative `log10` of the +/// success probability. /// /// `-log10(success_probability) * liquidity_penalty_amount_multiplier_msat * amount_msat / 2^20` /// @@ -1463,7 +1503,13 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_liquidity_penalty_amount /// probabilities, the multiplier will have a decreasing effect as the negative `log10` will /// fall below `1`. /// -/// Default value: 192 msat +/// In testing, this scoring model performs much worse than the historical scoring model +/// configured with the [`historical_liquidity_penalty_amount_multiplier_msat`] and thus is +/// disabled by default. +/// +/// Default value: 0 msat +/// +/// [`historical_liquidity_penalty_amount_multiplier_msat`]: Self::historical_liquidity_penalty_amount_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount_multiplier_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.liquidity_penalty_amount_multiplier_msat = val; @@ -1479,7 +1525,8 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_liquidity_penalty_amount /// track which of several buckets those bounds fall into, exponentially decaying the /// probability of each bucket as new samples are added. /// -/// Default value: 10,000 msat +/// Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, +/// or 6 sats to avoid a 25% probability channel). /// /// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat #[no_mangle] @@ -1498,22 +1545,22 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_historical_liquidity_pen /// track which of several buckets those bounds fall into, exponentially decaying the /// probability of each bucket as new samples are added. /// -/// Default value: 10,000 msat +/// Default value: 10,000 msat (i.e. willing to pay 1 sat to avoid an 80% probability channel, +/// or 6 sats to avoid a 25% probability channel). /// /// [`liquidity_penalty_multiplier_msat`]: Self::liquidity_penalty_multiplier_msat #[no_mangle] pub extern "C" fn ProbabilisticScoringFeeParameters_set_historical_liquidity_penalty_multiplier_msat(this_ptr: &mut ProbabilisticScoringFeeParameters, mut val: u64) { unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.historical_liquidity_penalty_multiplier_msat = val; } -/// A multiplier used in conjunction with the total amount flowing over a channel and the -/// negative `log10` of the channel's success probability for the payment, as determined based -/// on the history of our estimates of the channel's available liquidity, to determine a +/// A multiplier used in conjunction with the payment amount and the negative `log10` of the +/// channel's success probability for the total amount flowing over a channel, as determined +/// based on the history of our estimates of the channel's available liquidity, to determine a /// penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost for /// large payments. The penalty is computed as the product of this multiplier and `2^20`ths -/// of the amount flowing over this channel, weighted by the negative `log10` of the success -/// probability. +/// of the payment amount, weighted by the negative `log10` of the success probability. /// /// This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead /// of using only our latest estimate for the current liquidity available in the channel, it @@ -1522,7 +1569,9 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_set_historical_liquidity_pen /// channel, we track which of several buckets those bounds fall into, exponentially decaying /// the probability of each bucket as new samples are added. /// -/// Default value: 64 msat +/// Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% +/// probability channels, or 0.5bps to avoid a 38% probability +/// channel). /// /// [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat #[no_mangle] @@ -1530,15 +1579,14 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_historical_liquidity_pen let mut inner_val = &mut this_ptr.get_native_mut_ref().historical_liquidity_penalty_amount_multiplier_msat; *inner_val } -/// A multiplier used in conjunction with the total amount flowing over a channel and the -/// negative `log10` of the channel's success probability for the payment, as determined based -/// on the history of our estimates of the channel's available liquidity, to determine a +/// A multiplier used in conjunction with the payment amount and the negative `log10` of the +/// channel's success probability for the total amount flowing over a channel, as determined +/// based on the history of our estimates of the channel's available liquidity, to determine a /// penalty. /// /// The purpose of the amount penalty is to avoid having fees dominate the channel cost for /// large payments. The penalty is computed as the product of this multiplier and `2^20`ths -/// of the amount flowing over this channel, weighted by the negative `log10` of the success -/// probability. +/// of the payment amount, weighted by the negative `log10` of the success probability. /// /// This penalty is similar to [`liquidity_penalty_amount_multiplier_msat`], however, instead /// of using only our latest estimate for the current liquidity available in the channel, it @@ -1547,7 +1595,9 @@ pub extern "C" fn ProbabilisticScoringFeeParameters_get_historical_liquidity_pen /// channel, we track which of several buckets those bounds fall into, exponentially decaying /// the probability of each bucket as new samples are added. /// -/// Default value: 64 msat +/// Default value: 1,250 msat (i.e. willing to pay about 0.125 bps per hop to avoid 78% +/// probability channels, or 0.5bps to avoid a 38% probability +/// channel). /// /// [`liquidity_penalty_amount_multiplier_msat`]: Self::liquidity_penalty_amount_multiplier_msat #[no_mangle] @@ -1843,11 +1893,11 @@ pub extern "C" fn ProbabilisticScoringDecayParameters_set_historical_no_updates_ /// liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper /// and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. /// -/// Default value: 6 hours +/// Default value: 30 minutes /// /// # Note /// -/// When built with the `no-std` feature, time will never elapse. Therefore, the channel +/// When not built with the `std` feature, time will never elapse. Therefore, the channel /// liquidity knowledge will never decay except when the bounds cross. #[no_mangle] pub extern "C" fn ProbabilisticScoringDecayParameters_get_liquidity_offset_half_life(this_ptr: &ProbabilisticScoringDecayParameters) -> u64 { @@ -1867,11 +1917,11 @@ pub extern "C" fn ProbabilisticScoringDecayParameters_get_liquidity_offset_half_ /// liquidity bounds are 200,000 sats and 600,000 sats, after this amount of time the upper /// and lower liquidity bounds will be decayed to 100,000 and 800,000 sats. /// -/// Default value: 6 hours +/// Default value: 30 minutes /// /// # Note /// -/// When built with the `no-std` feature, time will never elapse. Therefore, the channel +/// When not built with the `std` feature, time will never elapse. Therefore, the channel /// liquidity knowledge will never decay except when the bounds cross. #[no_mangle] pub extern "C" fn ProbabilisticScoringDecayParameters_set_liquidity_offset_half_life(this_ptr: &mut ProbabilisticScoringDecayParameters, mut val: u64) { @@ -1977,13 +2027,32 @@ pub extern "C" fn ProbabilisticScorer_historical_estimated_channel_liquidity_pro /// with `scid` towards the given `target` node, based on the historical estimated liquidity /// bounds. /// +/// Returns `None` if: +/// - the given channel is not in the network graph, the provided `target` is not a party to +/// the channel, or we don't have forwarding parameters for either direction in the channel. +/// - `allow_fallback_estimation` is *not* set and there is no (or insufficient) historical +/// data for the given channel. +/// /// These are the same bounds as returned by /// [`Self::historical_estimated_channel_liquidity_probabilities`] (but not those returned by /// [`Self::estimated_channel_liquidity_range`]). #[must_use] #[no_mangle] -pub extern "C" fn ProbabilisticScorer_historical_estimated_payment_success_probability(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer, mut scid: u64, target: &crate::lightning::routing::gossip::NodeId, mut amount_msat: u64, params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> crate::c_types::derived::COption_f64Z { - let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.historical_estimated_payment_success_probability(scid, target.get_native_ref(), amount_msat, params.get_native_ref()); +pub extern "C" fn ProbabilisticScorer_historical_estimated_payment_success_probability(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer, mut scid: u64, target: &crate::lightning::routing::gossip::NodeId, mut amount_msat: u64, params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters, mut allow_fallback_estimation: bool) -> crate::c_types::derived::COption_f64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.historical_estimated_payment_success_probability(scid, target.get_native_ref(), amount_msat, params.get_native_ref(), allow_fallback_estimation); + let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_f64Z::None } else { crate::c_types::derived::COption_f64Z::Some( { ret.unwrap() }) }; + local_ret +} + +/// Query the probability of payment success sending the given `amount_msat` over the channel +/// with `scid` towards the given `target` node, based on the live estimated liquidity bounds. +/// +/// This will return `Some` for any channel which is present in the [`NetworkGraph`], including +/// if we have no bound information beside the channel's capacity. +#[must_use] +#[no_mangle] +pub extern "C" fn ProbabilisticScorer_live_estimated_payment_success_probability(this_arg: &crate::lightning::routing::scoring::ProbabilisticScorer, mut scid: u64, target: &crate::lightning::routing::gossip::NodeId, mut amount_msat: u64, params: &crate::lightning::routing::scoring::ProbabilisticScoringFeeParameters) -> crate::c_types::derived::COption_f64Z { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.live_estimated_payment_success_probability(scid, target.get_native_ref(), amount_msat, params.get_native_ref()); let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_f64Z::None } else { crate::c_types::derived::COption_f64Z::Some( { ret.unwrap() }) }; local_ret } diff --git a/lightning-c-bindings/src/lightning/sign/ecdsa.rs b/lightning-c-bindings/src/lightning/sign/ecdsa.rs index 78668f2..2390541 100644 --- a/lightning-c-bindings/src/lightning/sign/ecdsa.rs +++ b/lightning-c-bindings/src/lightning/sign/ecdsa.rs @@ -24,6 +24,15 @@ use alloc::{vec::Vec, boxed::Box}; /// 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. +/// +/// Like [`ChannelSigner`], many of the methods allow errors to be returned to support async +/// signing. In such cases, the signing operation can be replayed by calling +/// [`ChannelManager::signer_unblocked`] or [`ChainMonitor::signer_unblocked`] (see individual +/// method documentation for which method should be called) once the result is ready, at which +/// point the channel operation will resume. +/// +/// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked +/// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked #[repr(C)] pub struct EcdsaChannelSigner { /// An opaque pointer which is passed to your function implementations as an argument. @@ -31,8 +40,6 @@ pub struct EcdsaChannelSigner { pub this_arg: *mut c_void, /// Create a signature for a counterparty's commitment transaction and associated HTLC transactions. /// - /// Note that if signing fails or is rejected, the channel will be force-closed. - /// /// Policy checks should be implemented in this function, including checking the amount /// sent to us and checking the HTLCs. /// @@ -43,6 +50,12 @@ pub struct EcdsaChannelSigner { /// /// Note that all the relevant preimages will be provided, but there may also be additional /// irrelevant or duplicate preimages. + /// + /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + /// signature and should be retried later. Once the signer is ready to provide a signature after + /// previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + /// + /// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked pub sign_counterparty_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, inbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ, outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ, /// Creates a signature for a holder's commitment transaction. /// @@ -57,9 +70,10 @@ pub struct EcdsaChannelSigner { /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid /// signature and should be retried later. Once the signer is ready to provide a signature after /// previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - /// monitor. + /// monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked pub sign_holder_commitment: extern "C" fn (this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Create a signature for the given input in a transaction spending an HTLC transaction output /// or a commitment transaction `to_local` output when our counterparty broadcasts an old state. @@ -79,9 +93,10 @@ pub struct EcdsaChannelSigner { /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid /// signature and should be retried later. Once the signer is ready to provide a signature after /// previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - /// monitor. + /// monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked 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_ECDSASignatureNoneZ, /// Create a signature for the given input in a transaction spending a commitment transaction /// HTLC output when our counterparty broadcasts an old state. @@ -105,9 +120,10 @@ pub struct EcdsaChannelSigner { /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid /// signature and should be retried later. Once the signer is ready to provide a signature after /// previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - /// monitor. + /// monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked 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_ECDSASignatureNoneZ, /// Computes the signature for a commitment transaction's HTLC output used as an input within /// `htlc_tx`, which spends the commitment transaction at index `input`. The signature returned @@ -120,11 +136,12 @@ pub struct EcdsaChannelSigner { /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid /// signature and should be retried later. Once the signer is ready to provide a signature after /// previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - /// monitor. + /// monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. /// /// [`EcdsaSighashType::All`]: bitcoin::sighash::EcdsaSighashType::All /// [`ChannelMonitor`]: crate::chain::channelmonitor::ChannelMonitor /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked pub sign_holder_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, htlc_descriptor: &crate::lightning::sign::HTLCDescriptor) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Create a signature for a claiming transaction for a HTLC output on a counterparty's commitment /// transaction, either offered or received. @@ -147,14 +164,21 @@ pub struct EcdsaChannelSigner { /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid /// signature and should be retried later. Once the signer is ready to provide a signature after /// previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - /// monitor. + /// monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked pub sign_counterparty_htlc_transaction: extern "C" fn (this_arg: *const c_void, htlc_tx: crate::c_types::Transaction, input: usize, amount: u64, per_commitment_point: crate::c_types::PublicKey, htlc: &crate::lightning::ln::chan_utils::HTLCOutputInCommitment) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Create a signature for a (proposed) closing transaction. /// /// Note that, due to rounding, there may be one \"missing\" satoshi, and either party may have /// chosen to forgo their output as dust. + /// + /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + /// signature and should be retried later. Once the signer is ready to provide a signature after + /// previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + /// + /// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked pub sign_closing_transaction: extern "C" fn (this_arg: *const c_void, closing_tx: &crate::lightning::ln::chan_utils::ClosingTransaction) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Computes the signature for a commitment transaction's anchor output used as an /// input within `anchor_tx`, which spends the commitment transaction, at index `input`. @@ -162,9 +186,10 @@ pub struct EcdsaChannelSigner { /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid /// signature and should be retried later. Once the signer is ready to provide a signature after /// previously returning an `Err`, [`ChannelMonitor::signer_unblocked`] must be called on its - /// monitor. + /// monitor or [`ChainMonitor::signer_unblocked`] called to attempt unblocking all monitors. /// /// [`ChannelMonitor::signer_unblocked`]: crate::chain::channelmonitor::ChannelMonitor::signer_unblocked + /// [`ChainMonitor::signer_unblocked`]: crate::chain::chainmonitor::ChainMonitor::signer_unblocked pub sign_holder_anchor_input: extern "C" fn (this_arg: *const c_void, anchor_tx: crate::c_types::Transaction, input: usize) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Signs a channel announcement message with our funding key proving it comes from one of the /// channel participants. @@ -172,12 +197,25 @@ pub struct EcdsaChannelSigner { /// Channel announcements also require a signature from each node's network key. Our node /// signature is computed through [`NodeSigner::sign_gossip_message`]. /// - /// Note that if this fails or is rejected, the channel will not be publicly announced and - /// our counterparty may (though likely will not) close the channel on us for violating the - /// protocol. + /// This method is *not* asynchronous. If an `Err` is returned, the channel will not be + /// publicly announced and our counterparty may (though likely will not) close the channel on + /// us for violating the protocol. /// /// [`NodeSigner::sign_gossip_message`]: crate::sign::NodeSigner::sign_gossip_message pub sign_channel_announcement_with_funding_key: extern "C" fn (this_arg: *const c_void, msg: &crate::lightning::ln::msgs::UnsignedChannelAnnouncement) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, + /// Signs the input of a splicing funding transaction with our funding key. + /// + /// In splicing, the previous funding transaction output is spent as the input of + /// the new funding transaction, and is a 2-of-2 multisig. + /// + /// `input_index`: The index of the input within the new funding transaction `tx`, + /// spending the previous funding transaction's output + /// + /// `input_value`: The value of the previous funding transaction output. + /// + /// This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + /// closed. + pub sign_splicing_funding_input: extern "C" fn (this_arg: *const c_void, tx: crate::c_types::Transaction, input_index: usize, input_value: u64) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ, /// Implementation of ChannelSigner for this object. pub ChannelSigner: crate::lightning::sign::ChannelSigner, /// Called, if set, after this EcdsaChannelSigner has been cloned into a duplicate object. @@ -203,6 +241,7 @@ pub(crate) fn EcdsaChannelSigner_clone_fields(orig: &EcdsaChannelSigner) -> Ecds sign_closing_transaction: Clone::clone(&orig.sign_closing_transaction), sign_holder_anchor_input: Clone::clone(&orig.sign_holder_anchor_input), sign_channel_announcement_with_funding_key: Clone::clone(&orig.sign_channel_announcement_with_funding_key), + sign_splicing_funding_input: Clone::clone(&orig.sign_splicing_funding_input), ChannelSigner: crate::lightning::sign::ChannelSigner_clone_fields(&orig.ChannelSigner), cloned: Clone::clone(&orig.cloned), free: Clone::clone(&orig.free), @@ -347,6 +386,11 @@ impl rustEcdsaChannelSigner for EcdsaChannelSigner { let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } + fn sign_splicing_funding_input(&self, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut input_value: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.sign_splicing_funding_input)(self.this_arg, crate::c_types::Transaction::from_bitcoin(tx), input_index, input_value); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } } pub struct EcdsaChannelSignerRef(EcdsaChannelSigner); @@ -398,6 +442,11 @@ impl rustEcdsaChannelSigner for EcdsaChannelSignerRef { let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } + fn sign_splicing_funding_input(&self, mut tx: &bitcoin::transaction::Transaction, mut input_index: usize, mut input_value: u64, mut _secp_ctx: &bitcoin::secp256k1::Secp256k1) -> Result { + let mut ret = (self.0.sign_splicing_funding_input)(self.0.this_arg, crate::c_types::Transaction::from_bitcoin(tx), input_index, input_value); + let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; + local_ret + } } // We're essentially a pointer already, or at least a set of pointers, so allow us to be used diff --git a/lightning-c-bindings/src/lightning/sign/mod.rs b/lightning-c-bindings/src/lightning/sign/mod.rs index 1f4b228..00d556d 100644 --- a/lightning-c-bindings/src/lightning/sign/mod.rs +++ b/lightning-c-bindings/src/lightning/sign/mod.rs @@ -1107,7 +1107,7 @@ pub extern "C" fn HTLCDescriptor_get_preimage(this_ptr: &HTLCDescriptor) -> crat /// taken. #[no_mangle] pub extern "C" fn HTLCDescriptor_set_preimage(this_ptr: &mut HTLCDescriptor, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ val_opt.take() }.data) }})} }; + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ val_opt.take() }.data) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.preimage = local_val; } /// The counterparty's signature required to spend the HTLC output. @@ -1125,7 +1125,7 @@ pub extern "C" fn HTLCDescriptor_set_counterparty_sig(this_ptr: &mut HTLCDescrip #[must_use] #[no_mangle] pub extern "C" fn HTLCDescriptor_new(mut channel_derivation_parameters_arg: crate::lightning::sign::ChannelDerivationParameters, mut commitment_txid_arg: crate::c_types::ThirtyTwoBytes, mut per_commitment_number_arg: u64, mut per_commitment_point_arg: crate::c_types::PublicKey, mut feerate_per_kw_arg: u32, mut htlc_arg: crate::lightning::ln::chan_utils::HTLCOutputInCommitment, mut preimage_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ, mut counterparty_sig_arg: crate::c_types::ECDSASignature) -> HTLCDescriptor { - let mut local_preimage_arg = { /*preimage_arg*/ let preimage_arg_opt = preimage_arg; if preimage_arg_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentPreimage({ preimage_arg_opt.take() }.data) }})} }; + let mut local_preimage_arg = { /*preimage_arg*/ let preimage_arg_opt = preimage_arg; if preimage_arg_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentPreimage({ preimage_arg_opt.take() }.data) }})} }; HTLCDescriptor { inner: ObjOps::heap_alloc(nativeHTLCDescriptor { channel_derivation_parameters: *unsafe { Box::from_raw(channel_derivation_parameters_arg.take_inner()) }, commitment_txid: ::bitcoin::hash_types::Txid::from_slice(&commitment_txid_arg.data[..]).unwrap(), @@ -1248,9 +1248,12 @@ pub extern "C" fn HTLCDescriptor_derive_channel_signer(this_arg: &crate::lightni /// A trait to handle Lightning channel key material without concretizing the channel type or /// the signature mechanism. /// -/// Several methods allow error types to be returned to support async signing. This feature -/// is not yet complete, and panics may occur in certain situations when returning errors -/// for these methods. +/// Several methods allow errors to be returned to support async signing. In such cases, the +/// signing operation can be replayed by calling [`ChannelManager::signer_unblocked`] once the +/// result is ready, at which point the channel operation will resume. Methods which allow for +/// async results are explicitly documented as such +/// +/// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked #[repr(C)] pub struct ChannelSigner { /// An opaque pointer which is passed to your function implementations as an argument. @@ -1260,10 +1263,9 @@ pub struct ChannelSigner { /// /// Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. /// - /// If the signer returns `Err`, then the user is responsible for either force-closing the channel - /// or calling `ChannelManager::signer_unblocked` (this method is only available when the - /// `async_signing` cfg flag is enabled) once the signature is ready. - /// + /// This method is *not* asynchronous. This method is expected to always return `Ok` + /// immediately after we reconnect to peers, and returning an `Err` may lead to an immediate + /// `panic`. This method will be made asynchronous in a future release. pub get_per_commitment_point: extern "C" fn (this_arg: *const c_void, idx: u64) -> crate::c_types::derived::CResult_PublicKeyNoneZ, /// Gets the commitment secret for a specific commitment number as part of the revocation process /// @@ -1273,6 +1275,12 @@ pub struct ChannelSigner { /// May be called more than once for the same index. /// /// Note that the commitment number starts at `(1 << 48) - 1` and counts backwards. + /// + /// An `Err` can be returned to signal that the signer is unavailable/cannot produce a valid + /// signature and should be retried later. Once the signer is ready to provide a signature after + /// previously returning an `Err`, [`ChannelManager::signer_unblocked`] must be called. + /// + /// [`ChannelManager::signer_unblocked`]: crate::ln::channelmanager::ChannelManager::signer_unblocked pub release_commitment_secret: extern "C" fn (this_arg: *const c_void, idx: u64) -> crate::c_types::derived::CResult__u832NoneZ, /// Validate the counterparty's signatures on the holder commitment transaction and HTLCs. /// @@ -1287,13 +1295,23 @@ pub struct ChannelSigner { /// /// Note that all the relevant preimages will be provided, but there may also be additional /// irrelevant or duplicate preimages. + /// + /// This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + /// closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + /// and pause future signing operations until this validation completes. pub validate_holder_commitment: extern "C" fn (this_arg: *const c_void, holder_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction, outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_NoneNoneZ, /// Validate the counterparty's revocation. /// /// This is required in order for the signer to make sure that the state has moved /// forward and it is safe to sign the next counterparty commitment. + /// + /// This method is *not* asynchronous. If an `Err` is returned, the channel will be immediately + /// closed. If you wish to make this operation asynchronous, you should instead return `Ok(())` + /// and pause future signing operations until this validation completes. pub validate_counterparty_revocation: extern "C" fn (this_arg: *const c_void, idx: u64, secret: *const [u8; 32]) -> crate::c_types::derived::CResult_NoneNoneZ, /// Returns the holder's channel public keys and basepoints. + /// + /// This method is *not* asynchronous. Instead, the value must be cached locally. pub pubkeys: core::cell::UnsafeCell, /// 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 @@ -1302,6 +1320,8 @@ pub struct ChannelSigner { /// 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 /// [`EcdsaChannelSigner`] object uniquely and lookup or re-derive its keys. + /// + /// This method is *not* asynchronous. Instead, the value must be cached locally. pub channel_keys_id: extern "C" fn (this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes, /// Set the counterparty static channel data, including basepoints, /// `counterparty_selected`/`holder_selected_contest_delay` and funding outpoint. @@ -1576,7 +1596,7 @@ pub struct NodeSigner { /// 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, - /// Get secret key material as bytes for use in encrypting and decrypting inbound payment data. + /// Get the [`ExpandedKey`] for use in encrypting and decrypting inbound payment data. /// /// If the implementor of this trait supports [phantom node payments], then every node that is /// intended to be included in the phantom invoice route hints must return the same value from @@ -1585,7 +1605,7 @@ pub struct NodeSigner { /// This method must return the same value each time it is called. /// /// [phantom node payments]: PhantomKeysManager - pub get_inbound_payment_key_material: extern "C" fn (this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes, + pub get_inbound_payment_key: extern "C" fn (this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey, /// Get node id based on the provided [`Recipient`]. /// /// This method must return the same value each time it is called with a given [`Recipient`] @@ -1614,23 +1634,8 @@ pub struct NodeSigner { /// /// Errors if the [`Recipient`] variant is not supported by the implementation. pub sign_invoice: extern "C" fn (this_arg: *const c_void, invoice: &crate::lightning_invoice::RawBolt11Invoice, recipient: crate::lightning::sign::Recipient) -> crate::c_types::derived::CResult_RecoverableSignatureNoneZ, - /// Signs the [`TaggedHash`] of a BOLT 12 invoice request. - /// - /// May be called by a function passed to [`UnsignedInvoiceRequest::sign`] where - /// `invoice_request` is the callee. - /// - /// Implementors may check that the `invoice_request` is expected rather than blindly signing - /// the tagged hash. An `Ok` result should sign `invoice_request.tagged_hash().as_digest()` with - /// the node's signing key or an ephemeral key to preserve privacy, whichever is associated with - /// [`UnsignedInvoiceRequest::payer_id`]. - /// - /// [`TaggedHash`]: crate::offers::merkle::TaggedHash - pub sign_bolt12_invoice_request: extern "C" fn (this_arg: *const c_void, invoice_request: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ, /// Signs the [`TaggedHash`] of a BOLT 12 invoice. /// - /// May be called by a function passed to [`UnsignedBolt12Invoice::sign`] where `invoice` is the - /// callee. - /// /// Implementors may check that the `invoice` is expected rather than blindly signing the tagged /// hash. An `Ok` result should sign `invoice.tagged_hash().as_digest()` with the node's signing /// key or an ephemeral key to preserve privacy, whichever is associated with @@ -1655,11 +1660,10 @@ unsafe impl Sync for NodeSigner {} pub(crate) fn NodeSigner_clone_fields(orig: &NodeSigner) -> NodeSigner { NodeSigner { this_arg: orig.this_arg, - get_inbound_payment_key_material: Clone::clone(&orig.get_inbound_payment_key_material), + get_inbound_payment_key: Clone::clone(&orig.get_inbound_payment_key), get_node_id: Clone::clone(&orig.get_node_id), ecdh: Clone::clone(&orig.ecdh), sign_invoice: Clone::clone(&orig.sign_invoice), - sign_bolt12_invoice_request: Clone::clone(&orig.sign_bolt12_invoice_request), sign_bolt12_invoice: Clone::clone(&orig.sign_bolt12_invoice), sign_gossip_message: Clone::clone(&orig.sign_gossip_message), free: Clone::clone(&orig.free), @@ -1668,9 +1672,9 @@ pub(crate) fn NodeSigner_clone_fields(orig: &NodeSigner) -> NodeSigner { use lightning::sign::NodeSigner as rustNodeSigner; impl rustNodeSigner for NodeSigner { - fn get_inbound_payment_key_material(&self) -> lightning::sign::KeyMaterial { - let mut ret = (self.get_inbound_payment_key_material)(self.this_arg); - ::lightning::sign::KeyMaterial(ret.data) + fn get_inbound_payment_key(&self) -> lightning::ln::inbound_payment::ExpandedKey { + let mut ret = (self.get_inbound_payment_key)(self.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } } fn get_node_id(&self, mut recipient: lightning::sign::Recipient) -> Result { let mut ret = (self.get_node_id)(self.this_arg, crate::lightning::sign::Recipient::native_into(recipient)); @@ -1688,11 +1692,6 @@ impl rustNodeSigner for NodeSigner { let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn sign_bolt12_invoice_request(&self, mut invoice_request: &lightning::offers::invoice_request::UnsignedInvoiceRequest) -> Result { - let mut ret = (self.sign_bolt12_invoice_request)(self.this_arg, &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest { inner: unsafe { ObjOps::nonnull_ptr_to_inner((invoice_request as *const lightning::offers::invoice_request::UnsignedInvoiceRequest<>) 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)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } fn sign_bolt12_invoice(&self, mut invoice: &lightning::offers::invoice::UnsignedBolt12Invoice) -> Result { let mut ret = (self.sign_bolt12_invoice)(self.this_arg, &crate::lightning::offers::invoice::UnsignedBolt12Invoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((invoice as *const lightning::offers::invoice::UnsignedBolt12Invoice<>) 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)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; @@ -1707,9 +1706,9 @@ impl rustNodeSigner for NodeSigner { pub struct NodeSignerRef(NodeSigner); impl rustNodeSigner for NodeSignerRef { - fn get_inbound_payment_key_material(&self) -> lightning::sign::KeyMaterial { - let mut ret = (self.0.get_inbound_payment_key_material)(self.0.this_arg); - ::lightning::sign::KeyMaterial(ret.data) + fn get_inbound_payment_key(&self) -> lightning::ln::inbound_payment::ExpandedKey { + let mut ret = (self.0.get_inbound_payment_key)(self.0.this_arg); + *unsafe { Box::from_raw(ret.take_inner()) } } fn get_node_id(&self, mut recipient: lightning::sign::Recipient) -> Result { let mut ret = (self.0.get_node_id)(self.0.this_arg, crate::lightning::sign::Recipient::native_into(recipient)); @@ -1727,11 +1726,6 @@ impl rustNodeSigner for NodeSignerRef { let mut local_ret = match ret.result_ok { true => Ok( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; local_ret } - fn sign_bolt12_invoice_request(&self, mut invoice_request: &lightning::offers::invoice_request::UnsignedInvoiceRequest) -> Result { - let mut ret = (self.0.sign_bolt12_invoice_request)(self.0.this_arg, &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest { inner: unsafe { ObjOps::nonnull_ptr_to_inner((invoice_request as *const lightning::offers::invoice_request::UnsignedInvoiceRequest<>) 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)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; - local_ret - } fn sign_bolt12_invoice(&self, mut invoice: &lightning::offers::invoice::UnsignedBolt12Invoice) -> Result { let mut ret = (self.0.sign_bolt12_invoice)(self.0.this_arg, &crate::lightning::offers::invoice::UnsignedBolt12Invoice { inner: unsafe { ObjOps::nonnull_ptr_to_inner((invoice as *const lightning::offers::invoice::UnsignedBolt12Invoice<>) 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)) }).into_rust() }), false => Err( { () /*(*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) })*/ })}; @@ -2200,9 +2194,6 @@ pub extern "C" fn InMemorySigner_get_commitment_seed(this_ptr: &InMemorySigner) 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; } -/// Get a string which allows debug introspection of a InMemorySigner object -pub extern "C" fn InMemorySigner_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::sign::InMemorySigner }).into()} impl Clone for InMemorySigner { fn clone(&self) -> Self { Self { @@ -2432,7 +2423,7 @@ extern "C" fn InMemorySigner_ChannelSigner_release_commitment_secret(this_arg: * } #[must_use] extern "C" fn InMemorySigner_ChannelSigner_validate_holder_commitment(this_arg: *const c_void, holder_tx: &crate::lightning::ln::chan_utils::HolderCommitmentTransaction, mut outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_NoneNoneZ { - let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.into_rust().drain(..) { local_outbound_htlc_preimages.push( { ::lightning::ln::types::PaymentPreimage(item.data) }); }; + let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.into_rust().drain(..) { local_outbound_htlc_preimages.push( { ::lightning::types::payment::PaymentPreimage(item.data) }); }; let mut ret = ::validate_holder_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, holder_tx.get_native_ref(), local_outbound_htlc_preimages); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { () /*o*/ }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -2490,6 +2481,7 @@ pub extern "C" fn InMemorySigner_as_EcdsaChannelSigner(this_arg: &InMemorySigner sign_closing_transaction: InMemorySigner_EcdsaChannelSigner_sign_closing_transaction, sign_holder_anchor_input: InMemorySigner_EcdsaChannelSigner_sign_holder_anchor_input, sign_channel_announcement_with_funding_key: InMemorySigner_EcdsaChannelSigner_sign_channel_announcement_with_funding_key, + sign_splicing_funding_input: InMemorySigner_EcdsaChannelSigner_sign_splicing_funding_input, ChannelSigner: crate::lightning::sign::ChannelSigner { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, @@ -2509,8 +2501,8 @@ pub extern "C" fn InMemorySigner_as_EcdsaChannelSigner(this_arg: &InMemorySigner #[must_use] extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_counterparty_commitment(this_arg: *const c_void, commitment_tx: &crate::lightning::ln::chan_utils::CommitmentTransaction, mut inbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ, mut outbound_htlc_preimages: crate::c_types::derived::CVec_ThirtyTwoBytesZ) -> crate::c_types::derived::CResult_C2Tuple_ECDSASignatureCVec_ECDSASignatureZZNoneZ { - let mut local_inbound_htlc_preimages = Vec::new(); for mut item in inbound_htlc_preimages.into_rust().drain(..) { local_inbound_htlc_preimages.push( { ::lightning::ln::types::PaymentPreimage(item.data) }); }; - let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.into_rust().drain(..) { local_outbound_htlc_preimages.push( { ::lightning::ln::types::PaymentPreimage(item.data) }); }; + let mut local_inbound_htlc_preimages = Vec::new(); for mut item in inbound_htlc_preimages.into_rust().drain(..) { local_inbound_htlc_preimages.push( { ::lightning::types::payment::PaymentPreimage(item.data) }); }; + let mut local_outbound_htlc_preimages = Vec::new(); for mut item in outbound_htlc_preimages.into_rust().drain(..) { local_outbound_htlc_preimages.push( { ::lightning::types::payment::PaymentPreimage(item.data) }); }; let mut ret = ::sign_counterparty_commitment(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, commitment_tx.get_native_ref(), local_inbound_htlc_preimages, local_outbound_htlc_preimages, secp256k1::global::SECP256K1); 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_orig_ret_0_1 = Vec::new(); for mut item in orig_ret_0_1.drain(..) { local_orig_ret_0_1.push( { crate::c_types::ECDSASignature::from_rust(&item) }); }; let mut local_ret_0 = (crate::c_types::ECDSASignature::from_rust(&orig_ret_0_0), local_orig_ret_0_1.into()).into(); local_ret_0 }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret @@ -2563,6 +2555,12 @@ extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_channel_announcement_with_f let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; local_ret } +#[must_use] +extern "C" fn InMemorySigner_EcdsaChannelSigner_sign_splicing_funding_input(this_arg: *const c_void, mut tx: crate::c_types::Transaction, mut input_index: usize, mut input_value: u64) -> crate::c_types::derived::CResult_ECDSASignatureNoneZ { + let mut ret = ::sign_splicing_funding_input(unsafe { &mut *(this_arg as *mut nativeInMemorySigner) }, &tx.into_bitcoin(), input_index, input_value, secp256k1::global::SECP256K1); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::ECDSASignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; + local_ret +} extern "C" fn EcdsaChannelSigner_InMemorySigner_cloned(new_obj: &mut crate::lightning::sign::ecdsa::EcdsaChannelSigner) { new_obj.this_arg = InMemorySigner_clone_void(new_obj.this_arg); new_obj.free = Some(InMemorySigner_free_void); @@ -2760,20 +2758,19 @@ pub extern "C" fn KeysManager_as_NodeSigner(this_arg: &KeysManager) -> crate::li crate::lightning::sign::NodeSigner { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_inbound_payment_key_material: KeysManager_NodeSigner_get_inbound_payment_key_material, + get_inbound_payment_key: KeysManager_NodeSigner_get_inbound_payment_key, get_node_id: KeysManager_NodeSigner_get_node_id, ecdh: KeysManager_NodeSigner_ecdh, sign_invoice: KeysManager_NodeSigner_sign_invoice, - sign_bolt12_invoice_request: KeysManager_NodeSigner_sign_bolt12_invoice_request, sign_bolt12_invoice: KeysManager_NodeSigner_sign_bolt12_invoice, sign_gossip_message: KeysManager_NodeSigner_sign_gossip_message, } } #[must_use] -extern "C" fn KeysManager_NodeSigner_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes { - let mut ret = ::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); - crate::c_types::ThirtyTwoBytes { data: ret.0 } +extern "C" fn KeysManager_NodeSigner_get_inbound_payment_key(this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey { + let mut ret = ::get_inbound_payment_key(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, ); + crate::lightning::ln::inbound_payment::ExpandedKey { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] extern "C" fn KeysManager_NodeSigner_get_node_id(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ { @@ -2795,12 +2792,6 @@ extern "C" fn KeysManager_NodeSigner_sign_invoice(this_arg: *const c_void, invoi local_ret } #[must_use] -extern "C" fn KeysManager_NodeSigner_sign_bolt12_invoice_request(this_arg: *const c_void, invoice_request: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { - let mut ret = ::sign_bolt12_invoice_request(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, invoice_request.get_native_ref()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} -#[must_use] extern "C" fn KeysManager_NodeSigner_sign_bolt12_invoice(this_arg: *const c_void, invoice: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { let mut ret = ::sign_bolt12_invoice(unsafe { &mut *(this_arg as *mut nativeKeysManager) }, invoice.get_native_ref()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -3016,20 +3007,19 @@ pub extern "C" fn PhantomKeysManager_as_NodeSigner(this_arg: &PhantomKeysManager crate::lightning::sign::NodeSigner { this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, free: None, - get_inbound_payment_key_material: PhantomKeysManager_NodeSigner_get_inbound_payment_key_material, + get_inbound_payment_key: PhantomKeysManager_NodeSigner_get_inbound_payment_key, get_node_id: PhantomKeysManager_NodeSigner_get_node_id, ecdh: PhantomKeysManager_NodeSigner_ecdh, sign_invoice: PhantomKeysManager_NodeSigner_sign_invoice, - sign_bolt12_invoice_request: PhantomKeysManager_NodeSigner_sign_bolt12_invoice_request, sign_bolt12_invoice: PhantomKeysManager_NodeSigner_sign_bolt12_invoice, sign_gossip_message: PhantomKeysManager_NodeSigner_sign_gossip_message, } } #[must_use] -extern "C" fn PhantomKeysManager_NodeSigner_get_inbound_payment_key_material(this_arg: *const c_void) -> crate::c_types::ThirtyTwoBytes { - let mut ret = ::get_inbound_payment_key_material(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, ); - crate::c_types::ThirtyTwoBytes { data: ret.0 } +extern "C" fn PhantomKeysManager_NodeSigner_get_inbound_payment_key(this_arg: *const c_void) -> crate::lightning::ln::inbound_payment::ExpandedKey { + let mut ret = ::get_inbound_payment_key(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, ); + crate::lightning::ln::inbound_payment::ExpandedKey { inner: ObjOps::heap_alloc(ret), is_owned: true } } #[must_use] extern "C" fn PhantomKeysManager_NodeSigner_get_node_id(this_arg: *const c_void, mut recipient: crate::lightning::sign::Recipient) -> crate::c_types::derived::CResult_PublicKeyNoneZ { @@ -3051,12 +3041,6 @@ extern "C" fn PhantomKeysManager_NodeSigner_sign_invoice(this_arg: *const c_void local_ret } #[must_use] -extern "C" fn PhantomKeysManager_NodeSigner_sign_bolt12_invoice_request(this_arg: *const c_void, invoice_request: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { - let mut ret = ::sign_bolt12_invoice_request(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, invoice_request.get_native_ref()); - let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; - local_ret -} -#[must_use] extern "C" fn PhantomKeysManager_NodeSigner_sign_bolt12_invoice(this_arg: *const c_void, invoice: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CResult_SchnorrSignatureNoneZ { let mut ret = ::sign_bolt12_invoice(unsafe { &mut *(this_arg as *mut nativePhantomKeysManager) }, invoice.get_native_ref()); let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::c_types::SchnorrSignature::from_rust(&o) }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() }; @@ -3257,9 +3241,6 @@ impl RandomBytes { Self { inner: self.inner, is_owned: false } } } -/// Get a string which allows debug introspection of a RandomBytes object -pub extern "C" fn RandomBytes_debug_str_void(o: *const c_void) -> Str { - alloc::format!("{:?}", unsafe { o as *const crate::lightning::sign::RandomBytes }).into()} /// Creates a new instance using the given seed. #[must_use] #[no_mangle] diff --git a/lightning-c-bindings/src/lightning/util/config.rs b/lightning-c-bindings/src/lightning/util/config.rs index 5573510..8baf425 100644 --- a/lightning-c-bindings/src/lightning/util/config.rs +++ b/lightning-c-bindings/src/lightning/util/config.rs @@ -1882,35 +1882,6 @@ pub extern "C" fn UserConfig_get_accept_intercept_htlcs(this_ptr: &UserConfig) - 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; } -/// If this is set to `false`, when receiving a keysend payment we'll fail it if it has multiple -/// parts. If this is set to `true`, we'll accept the payment. -/// -/// Setting this to `true` will break backwards compatibility upon downgrading to an LDK -/// version prior to 0.0.116 while receiving an MPP keysend. If we have already received an MPP -/// keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. -/// -/// Default value: `false` -/// -/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager -#[no_mangle] -pub extern "C" fn UserConfig_get_accept_mpp_keysend(this_ptr: &UserConfig) -> bool { - let mut inner_val = &mut this_ptr.get_native_mut_ref().accept_mpp_keysend; - *inner_val -} -/// If this is set to `false`, when receiving a keysend payment we'll fail it if it has multiple -/// parts. If this is set to `true`, we'll accept the payment. -/// -/// Setting this to `true` will break backwards compatibility upon downgrading to an LDK -/// version prior to 0.0.116 while receiving an MPP keysend. If we have already received an MPP -/// keysend, downgrading will cause us to fail to deserialize [`ChannelManager`]. -/// -/// Default value: `false` -/// -/// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager -#[no_mangle] -pub extern "C" fn UserConfig_set_accept_mpp_keysend(this_ptr: &mut UserConfig, mut val: bool) { - unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.accept_mpp_keysend = val; -} /// If this is set to `true`, the user needs to manually pay [`Bolt12Invoice`]s when received. /// /// When set to `true`, [`Event::InvoiceReceived`] will be generated for each received @@ -1949,7 +1920,7 @@ pub extern "C" fn UserConfig_set_manually_handle_bolt12_invoices(this_ptr: &mut /// 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, mut accept_intercept_htlcs_arg: bool, mut accept_mpp_keysend_arg: bool, mut manually_handle_bolt12_invoices_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, mut manually_handle_bolt12_invoices_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()) }, @@ -1958,7 +1929,6 @@ pub extern "C" fn UserConfig_new(mut channel_handshake_config_arg: crate::lightn accept_inbound_channels: accept_inbound_channels_arg, manually_accept_inbound_channels: manually_accept_inbound_channels_arg, accept_intercept_htlcs: accept_intercept_htlcs_arg, - accept_mpp_keysend: accept_mpp_keysend_arg, manually_handle_bolt12_invoices: manually_handle_bolt12_invoices_arg, }), is_owned: true } } diff --git a/lightning-c-bindings/src/lightning/util/errors.rs b/lightning-c-bindings/src/lightning/util/errors.rs index 884c942..d8d0681 100644 --- a/lightning-c-bindings/src/lightning/util/errors.rs +++ b/lightning-c-bindings/src/lightning/util/errors.rs @@ -67,7 +67,7 @@ pub enum APIError { /// a channel or cooperatively close one with this peer (and will have to force-close instead). /// /// [`SignerProvider::get_shutdown_scriptpubkey`]: crate::sign::SignerProvider::get_shutdown_scriptpubkey - /// [`InitFeatures`]: crate::ln::features::InitFeatures + /// [`InitFeatures`]: crate::types::features::InitFeatures IncompatibleShutdownScript { /// The incompatible shutdown script. script: crate::lightning::ln::script::ShutdownScript, diff --git a/lightning-c-bindings/src/lightning/util/hash_tables.rs b/lightning-c-bindings/src/lightning/util/hash_tables.rs index fce1b4a..197e660 100644 --- a/lightning-c-bindings/src/lightning/util/hash_tables.rs +++ b/lightning-c-bindings/src/lightning/util/hash_tables.rs @@ -6,9 +6,8 @@ // license as that which applies to the original source files from which this // source was automatically generated. -//! Generally LDK uses `std`'s `HashMap`s, however when building for no-std, LDK uses `hashbrown`'s -//! `HashMap`s with the `std` `SipHasher` and uses `getrandom` to opportunistically randomize it, -//! if randomization is available. +//! Generally LDK uses `hashbrown`'s `HashMap`s with the `std` `SipHasher` and uses `getrandom` to +//! opportunistically randomize it, if randomization is available. //! //! This module simply re-exports the `HashMap` used in LDK for public consumption. @@ -21,7 +20,7 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; -mod std_hashtables { +mod hashbrown_tables { use alloc::str::FromStr; use alloc::string::String; @@ -32,4 +31,16 @@ use crate::c_types::*; #[cfg(feature="no-std")] use alloc::{vec::Vec, boxed::Box}; +mod hasher { + +use alloc::str::FromStr; +use alloc::string::String; +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/util/logger.rs b/lightning-c-bindings/src/lightning/util/logger.rs index de9816d..a205769 100644 --- a/lightning-c-bindings/src/lightning/util/logger.rs +++ b/lightning-c-bindings/src/lightning/util/logger.rs @@ -9,9 +9,8 @@ //! Log traits live here, which are called throughout the library to provide useful information for //! debugging purposes. //! -//! There is currently 2 ways to filter log messages. First one, by using compilation features, e.g \"max_level_off\". -//! The second one, client-side by implementing check against Record Level field. -//! Each module may have its own Logger or share one. +//! Log messages should be filtered client-side by implementing check against a given [`Record`]'s +//! [`Level`] field. Each module may have its own Logger or share one. use alloc::str::FromStr; use alloc::string::String; @@ -336,7 +335,7 @@ pub extern "C" fn Record_get_payment_hash(this_ptr: &Record) -> crate::c_types:: /// `None` for logs which are not directly related to a payment. #[no_mangle] pub extern "C" fn Record_set_payment_hash(this_ptr: &mut Record, mut val: crate::c_types::derived::COption_ThirtyTwoBytesZ) { - let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ val_opt.take() }.data) }})} }; + let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ val_opt.take() }.data) }})} }; unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.payment_hash = local_val; } /// Constructs a new Record given each field @@ -348,7 +347,7 @@ pub extern "C" fn Record_set_payment_hash(this_ptr: &mut Record, mut val: crate: pub extern "C" fn Record_new(mut level_arg: crate::lightning::util::logger::Level, mut peer_id_arg: crate::c_types::PublicKey, mut channel_id_arg: crate::lightning::ln::types::ChannelId, mut args_arg: crate::c_types::Str, mut module_path_arg: crate::c_types::Str, mut file_arg: crate::c_types::Str, mut line_arg: u32, mut payment_hash_arg: crate::c_types::derived::COption_ThirtyTwoBytesZ) -> Record { let mut local_peer_id_arg = if peer_id_arg.is_null() { None } else { Some( { peer_id_arg.into_rust() }) }; let mut local_channel_id_arg = if channel_id_arg.inner.is_null() { None } else { Some( { *unsafe { Box::from_raw(channel_id_arg.take_inner()) } }) }; - let mut local_payment_hash_arg = { /*payment_hash_arg*/ let payment_hash_arg_opt = payment_hash_arg; if payment_hash_arg_opt.is_none() { None } else { Some({ { ::lightning::ln::types::PaymentHash({ payment_hash_arg_opt.take() }.data) }})} }; + let mut local_payment_hash_arg = { /*payment_hash_arg*/ let payment_hash_arg_opt = payment_hash_arg; if payment_hash_arg_opt.is_none() { None } else { Some({ { ::lightning::types::payment::PaymentHash({ payment_hash_arg_opt.take() }.data) }})} }; Record { inner: ObjOps::heap_alloc(nativeRecord { level: level_arg.into_native(), peer_id: local_peer_id_arg, diff --git a/lightning-c-bindings/src/lightning/util/persist.rs b/lightning-c-bindings/src/lightning/util/persist.rs index 4d62d06..4ce7103 100644 --- a/lightning-c-bindings/src/lightning/util/persist.rs +++ b/lightning-c-bindings/src/lightning/util/persist.rs @@ -177,6 +177,141 @@ impl Drop for KVStore { } } } +/// Provides additional interface methods that are required for [`KVStore`]-to-[`KVStore`] +/// data migration. +#[repr(C)] +pub struct MigratableKVStore { + /// 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, + /// Returns *all* known keys as a list of `primary_namespace`, `secondary_namespace`, `key` tuples. + /// + /// This is useful for migrating data from [`KVStore`] implementation to [`KVStore`] + /// implementation. + /// + /// Must exhaustively return all entries known to the store to ensure no data is missed, but + /// may return the items in arbitrary order. + pub list_all_keys: extern "C" fn (this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ, + /// Implementation of KVStore for this object. + pub KVStore: crate::lightning::util::persist::KVStore, + /// 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 MigratableKVStore {} +unsafe impl Sync for MigratableKVStore {} +#[allow(unused)] +pub(crate) fn MigratableKVStore_clone_fields(orig: &MigratableKVStore) -> MigratableKVStore { + MigratableKVStore { + this_arg: orig.this_arg, + list_all_keys: Clone::clone(&orig.list_all_keys), + KVStore: crate::lightning::util::persist::KVStore_clone_fields(&orig.KVStore), + free: Clone::clone(&orig.free), + } +} +impl lightning::util::persist::KVStore for MigratableKVStore { + fn read(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str) -> Result, lightning::io::Error> { + let mut ret = (self.KVStore.read)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { item }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } + fn write(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut buf: &[u8]) -> Result<(), lightning::io::Error> { + let mut local_buf = crate::c_types::u8slice::from_slice(buf); + let mut ret = (self.KVStore.write)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf); + 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 + } + fn remove(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut lazy: bool) -> Result<(), lightning::io::Error> { + let mut ret = (self.KVStore.remove)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), lazy); + 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 + } + fn list(&self, mut primary_namespace: &str, mut secondary_namespace: &str) -> Result, lightning::io::Error> { + let mut ret = (self.KVStore.list)(self.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { item.into_string() }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } +} +impl lightning::util::persist::KVStore for MigratableKVStoreRef { + fn read(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str) -> Result, lightning::io::Error> { + let mut ret = (self.0.KVStore.read)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { item }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } + fn write(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut buf: &[u8]) -> Result<(), lightning::io::Error> { + let mut local_buf = crate::c_types::u8slice::from_slice(buf); + let mut ret = (self.0.KVStore.write)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), local_buf); + 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 + } + fn remove(&self, mut primary_namespace: &str, mut secondary_namespace: &str, mut key: &str, mut lazy: bool) -> Result<(), lightning::io::Error> { + let mut ret = (self.0.KVStore.remove)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into(), key.into(), lazy); + 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 + } + fn list(&self, mut primary_namespace: &str, mut secondary_namespace: &str) -> Result, lightning::io::Error> { + let mut ret = (self.0.KVStore.list)(self.0.KVStore.this_arg, primary_namespace.into(), secondary_namespace.into()); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { item.into_string() }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } +} + +use lightning::util::persist::MigratableKVStore as rustMigratableKVStore; +impl rustMigratableKVStore for MigratableKVStore { + fn list_all_keys(&self) -> Result, lightning::io::Error> { + let mut ret = (self.list_all_keys)(self.this_arg); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { let (mut orig_ret_0_0_0, mut orig_ret_0_0_1, mut orig_ret_0_0_2) = item.to_rust(); let mut local_ret_0_0 = (orig_ret_0_0_0.into_string(), orig_ret_0_0_1.into_string(), orig_ret_0_0_2.into_string()); local_ret_0_0 }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } +} + +pub struct MigratableKVStoreRef(MigratableKVStore); +impl rustMigratableKVStore for MigratableKVStoreRef { + fn list_all_keys(&self) -> Result, lightning::io::Error> { + let mut ret = (self.0.list_all_keys)(self.0.this_arg); + let mut local_ret = match ret.result_ok { true => Ok( { let mut local_ret_0 = Vec::new(); for mut item in (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.result)) }).into_rust().drain(..) { local_ret_0.push( { let (mut orig_ret_0_0_0, mut orig_ret_0_0_1, mut orig_ret_0_0_2) = item.to_rust(); let mut local_ret_0_0 = (orig_ret_0_0_0.into_string(), orig_ret_0_0_1.into_string(), orig_ret_0_0_2.into_string()); local_ret_0_0 }); }; local_ret_0 }), false => Err( { (*unsafe { Box::from_raw(<*mut _>::take_ptr(&mut ret.contents.err)) }).to_rust() })}; + local_ret + } +} + +// 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 MigratableKVStore { + type Target = MigratableKVStoreRef; + fn deref(&self) -> &Self::Target { + unsafe { &*(self as *const _ as *const MigratableKVStoreRef) } + } +} +impl core::ops::DerefMut for MigratableKVStore { + fn deref_mut(&mut self) -> &mut MigratableKVStoreRef { + unsafe { &mut *(self as *mut _ as *mut MigratableKVStoreRef) } + } +} +/// Calls the free function if one is set +#[no_mangle] +pub extern "C" fn MigratableKVStore_free(this_ptr: MigratableKVStore) { } +impl Drop for MigratableKVStore { + fn drop(&mut self) { + if let Some(f) = self.free { + f(self.this_arg); + } + } +} +/// Migrates all data from one store to another. +/// +/// This operation assumes that `target_store` is empty, i.e., any data present under copied keys +/// might get overriden. User must ensure `source_store` is not modified during operation, +/// otherwise no consistency guarantees can be given. +/// +/// Will abort and return an error if any IO operation fails. Note that in this case the +/// `target_store` might get left in an intermediate state. +#[no_mangle] +pub extern "C" fn migrate_kv_store_data(source_store: &mut crate::lightning::util::persist::MigratableKVStore, target_store: &mut crate::lightning::util::persist::MigratableKVStore) -> crate::c_types::derived::CResult_NoneIOErrorZ { + let mut ret = lightning::util::persist::migrate_kv_store_data::(source_store, target_store); + 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::c_types::IOError::from_bitcoin(e) }).into() }; + local_ret +} + /// Trait that handles persisting a [`ChannelManager`], [`NetworkGraph`], and [`WriteableScore`] to disk. /// /// [`ChannelManager`]: crate::ln::channelmanager::ChannelManager @@ -534,3 +669,253 @@ extern "C" fn MonitorUpdatingPersister_Persist_archive_persisted_channel(this_ar >::archive_persisted_channel(unsafe { &mut *(this_arg as *mut nativeMonitorUpdatingPersister) }, *unsafe { Box::from_raw(channel_funding_outpoint.take_inner()) }) } + +use lightning::util::persist::MonitorName as nativeMonitorNameImport; +pub(crate) type nativeMonitorName = nativeMonitorNameImport; + +/// A struct representing a name for a channel monitor. +/// +/// `MonitorName` is primarily used within the [`MonitorUpdatingPersister`] +/// in functions that store or retrieve channel monitor snapshots. +/// It provides a consistent way to generate a unique key for channel +/// monitors based on their funding outpoints. +/// +/// While users of the Lightning Dev Kit library generally won't need +/// to interact with [`MonitorName`] directly, it can be useful for: +/// - Custom persistence implementations +/// - Debugging or logging channel monitor operations +/// - Extending the functionality of the `MonitorUpdatingPersister` +/// # Examples +/// +/// ``` +/// use std::str::FromStr; +/// +/// use bitcoin::Txid; +/// +/// use lightning::util::persist::MonitorName; +/// use lightning::chain::transaction::OutPoint; +/// +/// let outpoint = OutPoint { +///\t txid: Txid::from_str(\"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef\").unwrap(), +///\t index: 1, +/// }; +/// let monitor_name = MonitorName::from(outpoint); +/// assert_eq!(monitor_name.as_str(), \"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef_1\"); +/// +/// // Using MonitorName to generate a storage key +/// let storage_key = format!(\"channel_monitors/{}\", monitor_name.as_str()); +/// ``` +#[must_use] +#[repr(C)] +pub struct MonitorName { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeMonitorName, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for MonitorName { + type Target = nativeMonitorName; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for MonitorName { } +unsafe impl core::marker::Sync for MonitorName { } +impl Drop for MonitorName { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeMonitorName>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the MonitorName, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn MonitorName_free(this_obj: MonitorName) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn MonitorName_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeMonitorName) }; +} +#[allow(unused)] +impl MonitorName { + pub(crate) fn get_native_ref(&self) -> &'static nativeMonitorName { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeMonitorName { + 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 nativeMonitorName { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +/// Get a string which allows debug introspection of a MonitorName object +pub extern "C" fn MonitorName_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::persist::MonitorName }).into()} +/// Constructs a [`MonitorName`], after verifying that an [`OutPoint`] can +/// be formed from the given `name`. +/// This method is useful if you have a String and you want to verify that +/// it's a valid storage key for a channel monitor. +#[must_use] +#[no_mangle] +pub extern "C" fn MonitorName_new(mut name: crate::c_types::Str) -> crate::c_types::derived::CResult_MonitorNameIOErrorZ { + let mut ret = lightning::util::persist::MonitorName::new(name.into_string()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::persist::MonitorName { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_bitcoin(e) }).into() }; + local_ret +} + +/// Convert this monitor name to a str. +/// This method is particularly useful when you need to use the monitor name +/// as a key in a key-value store or when logging. +#[must_use] +#[no_mangle] +pub extern "C" fn MonitorName_as_str(this_arg: &crate::lightning::util::persist::MonitorName) -> crate::c_types::Str { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_str(); + ret.into() +} + + +use lightning::util::persist::UpdateName as nativeUpdateNameImport; +pub(crate) type nativeUpdateName = nativeUpdateNameImport; + +/// A struct representing a name for a channel monitor update. +/// +/// [`UpdateName`] is primarily used within the [`MonitorUpdatingPersister`] in +/// functions that store or retrieve partial updates to channel monitors. It +/// provides a consistent way to generate and parse unique identifiers for +/// monitor updates based on their sequence number. +/// +/// The name is derived from the update's sequence ID, which is a monotonically +/// increasing u64 value. This format allows for easy ordering of updates and +/// efficient storage and retrieval in key-value stores. +/// +/// # Usage +/// +/// While users of the Lightning Dev Kit library generally won't need to +/// interact with `UpdateName` directly, it still can be useful for custom +/// persistence implementations. The u64 value is the update_id that can be +/// compared with [ChannelMonitor::get_latest_update_id] to check if this update +/// has been applied to the channel monitor or not, which is useful for pruning +/// stale channel monitor updates off persistence. +/// +/// # Examples +/// +/// ``` +/// use lightning::util::persist::UpdateName; +/// +/// let update_id: u64 = 42; +/// let update_name = UpdateName::from(update_id); +/// assert_eq!(update_name.as_str(), \"42\"); +/// +/// // Using UpdateName to generate a storage key +/// let monitor_name = \"some_monitor_name\"; +/// let storage_key = format!(\"channel_monitor_updates/{}/{}\", monitor_name, update_name.as_str()); +/// ``` +#[must_use] +#[repr(C)] +pub struct UpdateName { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeUpdateName, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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 core::ops::Deref for UpdateName { + type Target = nativeUpdateName; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for UpdateName { } +unsafe impl core::marker::Sync for UpdateName { } +impl Drop for UpdateName { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeUpdateName>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; + } + } +} +/// Frees any resources used by the UpdateName, if is_owned is set and inner is non-NULL. +#[no_mangle] +pub extern "C" fn UpdateName_free(this_obj: UpdateName) { } +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn UpdateName_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUpdateName) }; +} +#[allow(unused)] +impl UpdateName { + pub(crate) fn get_native_ref(&self) -> &'static nativeUpdateName { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUpdateName { + 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 nativeUpdateName { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } +} +#[no_mangle] +pub extern "C" fn UpdateName_get_a(this_ptr: &UpdateName) -> u64 { + let mut inner_val = &mut this_ptr.get_native_mut_ref().0; + *inner_val +} +#[no_mangle] +pub extern "C" fn UpdateName_set_a(this_ptr: &mut UpdateName, mut val: u64) { + unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.0 = val; +} +/// Get a string which allows debug introspection of a UpdateName object +pub extern "C" fn UpdateName_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning::util::persist::UpdateName }).into()} +/// Constructs an [`UpdateName`], after verifying that an update sequence ID +/// can be derived from the given `name`. +#[must_use] +#[no_mangle] +pub extern "C" fn UpdateName_new(mut name: crate::c_types::Str) -> crate::c_types::derived::CResult_UpdateNameIOErrorZ { + let mut ret = lightning::util::persist::UpdateName::new(name.into_string()); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::util::persist::UpdateName { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_bitcoin(e) }).into() }; + local_ret +} + +/// Convert this update name to a string slice. +/// +/// This method is particularly useful when you need to use the update name +/// as part of a key in a key-value store or when logging. +/// +/// # Examples +/// +/// ``` +/// use lightning::util::persist::UpdateName; +/// +/// let update_name = UpdateName::from(42); +/// assert_eq!(update_name.as_str(), \"42\"); +/// ``` +#[must_use] +#[no_mangle] +pub extern "C" fn UpdateName_as_str(this_arg: &crate::lightning::util::persist::UpdateName) -> crate::c_types::Str { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.as_str(); + ret.into() +} + diff --git a/lightning-c-bindings/src/lightning/util/string.rs b/lightning-c-bindings/src/lightning/util/string.rs index 04f9777..46568ef 100644 --- a/lightning-c-bindings/src/lightning/util/string.rs +++ b/lightning-c-bindings/src/lightning/util/string.rs @@ -7,6 +7,10 @@ // source was automatically generated. //! Utilities to wrap untrusted strings and handle them (more) safely +//! +//! These re-exports are deprecated in favor of [`lightning::types::string`]. +//! +//! [`lightning::types::string`]: crate::types::string use alloc::str::FromStr; use alloc::string::String; diff --git a/lightning-c-bindings/src/lightning/util/wakers.rs b/lightning-c-bindings/src/lightning/util/wakers.rs index 1376de5..62aee3b 100644 --- a/lightning-c-bindings/src/lightning/util/wakers.rs +++ b/lightning-c-bindings/src/lightning/util/wakers.rs @@ -24,11 +24,10 @@ use alloc::{vec::Vec, boxed::Box}; /// A callback which is called when a [`Future`] completes. /// /// Note that this MUST NOT call back into LDK directly, it must instead schedule actions to be -/// taken later. Rust users should use the [`std::future::Future`] implementation for [`Future`] -/// instead. +/// taken later. +///Rust users should use the [`std::future::Future`] implementation for [`Future`] instead. /// -/// Note that the [`std::future::Future`] implementation may only work for runtimes which schedule -/// futures when they receive a wake, rather than immediately executing them. +///Note that the [`std::future::Future`] implementation may only work for runtimes which schedule futures when they receive a wake, rather than immediately executing them. #[repr(C)] pub struct FutureCallback { /// An opaque pointer which is passed to your function implementations as an argument. diff --git a/lightning-c-bindings/src/lightning_background_processor.rs b/lightning-c-bindings/src/lightning_background_processor.rs index 259996a..6f77b1b 100644 --- a/lightning-c-bindings/src/lightning_background_processor.rs +++ b/lightning-c-bindings/src/lightning_background_processor.rs @@ -7,8 +7,8 @@ // source was automatically generated. //! Utilities that take care of tasks that (1) need to happen periodically to keep Rust-Lightning -//! running properly, and (2) either can or should be run in the background. See docs for -//! [`BackgroundProcessor`] for more details on the nitty-gritty. +//! running properly, and (2) either can or should be run in the background. +//!See docs for [`BackgroundProcessor`] for more details. use alloc::str::FromStr; use alloc::string::String; diff --git a/lightning-c-bindings/src/lightning_invoice/mod.rs b/lightning-c-bindings/src/lightning_invoice/mod.rs index 25f6a63..08141d4 100644 --- a/lightning-c-bindings/src/lightning_invoice/mod.rs +++ b/lightning-c-bindings/src/lightning_invoice/mod.rs @@ -61,7 +61,7 @@ pub extern "C" fn SiPrefix_from_str(s: crate::c_types::Str) -> crate::c_types::d }, Err(e) => { crate::c_types::CResultTempl::err( - crate::lightning_invoice::Bolt11ParseError::native_into(e) + crate::lightning_invoice::Bolt11ParseError { inner: ObjOps::heap_alloc(e), is_owned: true } ) }, }.into() @@ -93,7 +93,7 @@ pub extern "C" fn SignedRawBolt11Invoice_from_str(s: crate::c_types::Str) -> cra }, Err(e) => { crate::c_types::CResultTempl::err( - crate::lightning_invoice::Bolt11ParseError::native_into(e) + crate::lightning_invoice::Bolt11ParseError { inner: ObjOps::heap_alloc(e), is_owned: true } ) }, }.into() @@ -101,7 +101,7 @@ pub extern "C" fn SignedRawBolt11Invoice_from_str(s: crate::c_types::Str) -> cra #[no_mangle] /// Get the string representation of a Bolt11ParseError object pub extern "C" fn Bolt11ParseError_to_str(o: &crate::lightning_invoice::Bolt11ParseError) -> Str { - alloc::format!("{}", &o.to_native()).into() + alloc::format!("{}", o.get_native_ref()).into() } #[no_mangle] /// Get the string representation of a ParseOrSemanticError object @@ -165,330 +165,98 @@ use crate::c_types::*; use alloc::{vec::Vec, boxed::Box}; } + +use lightning_invoice::Bolt11ParseError as nativeBolt11ParseErrorImport; +pub(crate) type nativeBolt11ParseError = nativeBolt11ParseErrorImport; + /// 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. -#[derive(Clone)] #[must_use] #[repr(C)] -pub enum Bolt11ParseError { - Bech32Error( - crate::c_types::Bech32Error), - ParseAmountError( - crate::c_types::Error), - MalformedSignature( - crate::c_types::Secp256k1Error), - BadPrefix, - UnknownCurrency, - UnknownSiPrefix, - MalformedHRP, - TooShortDataPart, - UnexpectedEndOfTaggedFields, - DescriptionDecodeError( - crate::c_types::Error), - PaddingError, - IntegerOverflowError, - InvalidSegWitProgramLength, - InvalidPubKeyHashLength, - InvalidScriptHashLength, - InvalidRecoveryId, - InvalidSliceLength( - crate::c_types::Str), - /// Not an error, but used internally to signal that a part of the invoice should be ignored - /// according to BOLT11 - Skip, +pub struct Bolt11ParseError { + /// A pointer to the opaque Rust object. + + /// Nearly everywhere, 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 nativeBolt11ParseError, + /// Indicates that this is the only struct which contains the same pointer. + + /// Rust 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, } -use lightning_invoice::Bolt11ParseError as Bolt11ParseErrorImport; -pub(crate) type nativeBolt11ParseError = Bolt11ParseErrorImport; -impl Bolt11ParseError { - #[allow(unused)] - pub(crate) fn to_native(&self) -> nativeBolt11ParseError { - match self { - Bolt11ParseError::Bech32Error (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeBolt11ParseError::Bech32Error ( - a_nonref.into_rust(), - ) - }, - Bolt11ParseError::ParseAmountError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeBolt11ParseError::ParseAmountError ( - u8::from_str_radix(" a", 10).unwrap_err() /*a_nonref*/, - ) - }, - Bolt11ParseError::MalformedSignature (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeBolt11ParseError::MalformedSignature ( - a_nonref.into_rust(), - ) - }, - Bolt11ParseError::BadPrefix => nativeBolt11ParseError::BadPrefix, - Bolt11ParseError::UnknownCurrency => nativeBolt11ParseError::UnknownCurrency, - Bolt11ParseError::UnknownSiPrefix => nativeBolt11ParseError::UnknownSiPrefix, - Bolt11ParseError::MalformedHRP => nativeBolt11ParseError::MalformedHRP, - Bolt11ParseError::TooShortDataPart => nativeBolt11ParseError::TooShortDataPart, - Bolt11ParseError::UnexpectedEndOfTaggedFields => nativeBolt11ParseError::UnexpectedEndOfTaggedFields, - Bolt11ParseError::DescriptionDecodeError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeBolt11ParseError::DescriptionDecodeError ( - core::str::from_utf8(&[0xff]).unwrap_err() /*a_nonref*/, - ) - }, - Bolt11ParseError::PaddingError => nativeBolt11ParseError::PaddingError, - Bolt11ParseError::IntegerOverflowError => nativeBolt11ParseError::IntegerOverflowError, - Bolt11ParseError::InvalidSegWitProgramLength => nativeBolt11ParseError::InvalidSegWitProgramLength, - Bolt11ParseError::InvalidPubKeyHashLength => nativeBolt11ParseError::InvalidPubKeyHashLength, - Bolt11ParseError::InvalidScriptHashLength => nativeBolt11ParseError::InvalidScriptHashLength, - Bolt11ParseError::InvalidRecoveryId => nativeBolt11ParseError::InvalidRecoveryId, - Bolt11ParseError::InvalidSliceLength (ref a, ) => { - let mut a_nonref = Clone::clone(a); - nativeBolt11ParseError::InvalidSliceLength ( - a_nonref.into_string(), - ) - }, - Bolt11ParseError::Skip => nativeBolt11ParseError::Skip, - } - } - #[allow(unused)] - pub(crate) fn into_native(self) -> nativeBolt11ParseError { - match self { - Bolt11ParseError::Bech32Error (mut a, ) => { - nativeBolt11ParseError::Bech32Error ( - a.into_rust(), - ) - }, - Bolt11ParseError::ParseAmountError (mut a, ) => { - nativeBolt11ParseError::ParseAmountError ( - u8::from_str_radix(" a", 10).unwrap_err() /*a*/, - ) - }, - Bolt11ParseError::MalformedSignature (mut a, ) => { - nativeBolt11ParseError::MalformedSignature ( - a.into_rust(), - ) - }, - Bolt11ParseError::BadPrefix => nativeBolt11ParseError::BadPrefix, - Bolt11ParseError::UnknownCurrency => nativeBolt11ParseError::UnknownCurrency, - Bolt11ParseError::UnknownSiPrefix => nativeBolt11ParseError::UnknownSiPrefix, - Bolt11ParseError::MalformedHRP => nativeBolt11ParseError::MalformedHRP, - Bolt11ParseError::TooShortDataPart => nativeBolt11ParseError::TooShortDataPart, - Bolt11ParseError::UnexpectedEndOfTaggedFields => nativeBolt11ParseError::UnexpectedEndOfTaggedFields, - Bolt11ParseError::DescriptionDecodeError (mut a, ) => { - nativeBolt11ParseError::DescriptionDecodeError ( - core::str::from_utf8(&[0xff]).unwrap_err() /*a*/, - ) - }, - Bolt11ParseError::PaddingError => nativeBolt11ParseError::PaddingError, - Bolt11ParseError::IntegerOverflowError => nativeBolt11ParseError::IntegerOverflowError, - Bolt11ParseError::InvalidSegWitProgramLength => nativeBolt11ParseError::InvalidSegWitProgramLength, - Bolt11ParseError::InvalidPubKeyHashLength => nativeBolt11ParseError::InvalidPubKeyHashLength, - Bolt11ParseError::InvalidScriptHashLength => nativeBolt11ParseError::InvalidScriptHashLength, - Bolt11ParseError::InvalidRecoveryId => nativeBolt11ParseError::InvalidRecoveryId, - Bolt11ParseError::InvalidSliceLength (mut a, ) => { - nativeBolt11ParseError::InvalidSliceLength ( - a.into_string(), - ) - }, - Bolt11ParseError::Skip => nativeBolt11ParseError::Skip, - } - } - #[allow(unused)] - pub(crate) fn from_native(native: &Bolt11ParseErrorImport) -> Self { - let native = unsafe { &*(native as *const _ as *const c_void as *const nativeBolt11ParseError) }; - match native { - nativeBolt11ParseError::Bech32Error (ref a, ) => { - let mut a_nonref = Clone::clone(a); - Bolt11ParseError::Bech32Error ( - crate::c_types::Bech32Error::from_rust(a_nonref), - ) - }, - nativeBolt11ParseError::ParseAmountError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - Bolt11ParseError::ParseAmountError ( - crate::c_types::Error { _dummy: 0 } /*a_nonref*/, - ) - }, - nativeBolt11ParseError::MalformedSignature (ref a, ) => { - let mut a_nonref = Clone::clone(a); - Bolt11ParseError::MalformedSignature ( - crate::c_types::Secp256k1Error::from_rust(a_nonref), - ) - }, - nativeBolt11ParseError::BadPrefix => Bolt11ParseError::BadPrefix, - nativeBolt11ParseError::UnknownCurrency => Bolt11ParseError::UnknownCurrency, - nativeBolt11ParseError::UnknownSiPrefix => Bolt11ParseError::UnknownSiPrefix, - nativeBolt11ParseError::MalformedHRP => Bolt11ParseError::MalformedHRP, - nativeBolt11ParseError::TooShortDataPart => Bolt11ParseError::TooShortDataPart, - nativeBolt11ParseError::UnexpectedEndOfTaggedFields => Bolt11ParseError::UnexpectedEndOfTaggedFields, - nativeBolt11ParseError::DescriptionDecodeError (ref a, ) => { - let mut a_nonref = Clone::clone(a); - Bolt11ParseError::DescriptionDecodeError ( - crate::c_types::Error { _dummy: 0 } /*a_nonref*/, - ) - }, - nativeBolt11ParseError::PaddingError => Bolt11ParseError::PaddingError, - nativeBolt11ParseError::IntegerOverflowError => Bolt11ParseError::IntegerOverflowError, - nativeBolt11ParseError::InvalidSegWitProgramLength => Bolt11ParseError::InvalidSegWitProgramLength, - nativeBolt11ParseError::InvalidPubKeyHashLength => Bolt11ParseError::InvalidPubKeyHashLength, - nativeBolt11ParseError::InvalidScriptHashLength => Bolt11ParseError::InvalidScriptHashLength, - nativeBolt11ParseError::InvalidRecoveryId => Bolt11ParseError::InvalidRecoveryId, - nativeBolt11ParseError::InvalidSliceLength (ref a, ) => { - let mut a_nonref = Clone::clone(a); - Bolt11ParseError::InvalidSliceLength ( - a_nonref.into(), - ) - }, - nativeBolt11ParseError::Skip => Bolt11ParseError::Skip, - } - } - #[allow(unused)] - pub(crate) fn native_into(native: nativeBolt11ParseError) -> Self { - match native { - nativeBolt11ParseError::Bech32Error (mut a, ) => { - Bolt11ParseError::Bech32Error ( - crate::c_types::Bech32Error::from_rust(a), - ) - }, - nativeBolt11ParseError::ParseAmountError (mut a, ) => { - Bolt11ParseError::ParseAmountError ( - crate::c_types::Error { _dummy: 0 } /*a*/, - ) - }, - nativeBolt11ParseError::MalformedSignature (mut a, ) => { - Bolt11ParseError::MalformedSignature ( - crate::c_types::Secp256k1Error::from_rust(a), - ) - }, - nativeBolt11ParseError::BadPrefix => Bolt11ParseError::BadPrefix, - nativeBolt11ParseError::UnknownCurrency => Bolt11ParseError::UnknownCurrency, - nativeBolt11ParseError::UnknownSiPrefix => Bolt11ParseError::UnknownSiPrefix, - nativeBolt11ParseError::MalformedHRP => Bolt11ParseError::MalformedHRP, - nativeBolt11ParseError::TooShortDataPart => Bolt11ParseError::TooShortDataPart, - nativeBolt11ParseError::UnexpectedEndOfTaggedFields => Bolt11ParseError::UnexpectedEndOfTaggedFields, - nativeBolt11ParseError::DescriptionDecodeError (mut a, ) => { - Bolt11ParseError::DescriptionDecodeError ( - crate::c_types::Error { _dummy: 0 } /*a*/, - ) - }, - nativeBolt11ParseError::PaddingError => Bolt11ParseError::PaddingError, - nativeBolt11ParseError::IntegerOverflowError => Bolt11ParseError::IntegerOverflowError, - nativeBolt11ParseError::InvalidSegWitProgramLength => Bolt11ParseError::InvalidSegWitProgramLength, - nativeBolt11ParseError::InvalidPubKeyHashLength => Bolt11ParseError::InvalidPubKeyHashLength, - nativeBolt11ParseError::InvalidScriptHashLength => Bolt11ParseError::InvalidScriptHashLength, - nativeBolt11ParseError::InvalidRecoveryId => Bolt11ParseError::InvalidRecoveryId, - nativeBolt11ParseError::InvalidSliceLength (mut a, ) => { - Bolt11ParseError::InvalidSliceLength ( - a.into(), - ) - }, - nativeBolt11ParseError::Skip => Bolt11ParseError::Skip, +impl core::ops::Deref for Bolt11ParseError { + type Target = nativeBolt11ParseError; + fn deref(&self) -> &Self::Target { unsafe { &*ObjOps::untweak_ptr(self.inner) } } +} +unsafe impl core::marker::Send for Bolt11ParseError { } +unsafe impl core::marker::Sync for Bolt11ParseError { } +impl Drop for Bolt11ParseError { + fn drop(&mut self) { + if self.is_owned && !<*mut nativeBolt11ParseError>::is_null(self.inner) { + let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) }; } } } -/// Frees any resources used by the Bolt11ParseError -#[no_mangle] -pub extern "C" fn Bolt11ParseError_free(this_ptr: Bolt11ParseError) { } -/// Creates a copy of the Bolt11ParseError +/// Frees any resources used by the Bolt11ParseError, if is_owned is set and inner is non-NULL. #[no_mangle] -pub extern "C" fn Bolt11ParseError_clone(orig: &Bolt11ParseError) -> Bolt11ParseError { - orig.clone() -} -#[allow(unused)] -/// Used only if an object of this type is returned as a trait impl by a method -pub(crate) extern "C" fn Bolt11ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void { - Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt11ParseError)).clone() })) as *mut c_void -} +pub extern "C" fn Bolt11ParseError_free(this_obj: Bolt11ParseError) { } #[allow(unused)] /// Used only if an object of this type is returned as a trait impl by a method pub(crate) extern "C" fn Bolt11ParseError_free_void(this_ptr: *mut c_void) { - let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt11ParseError) }; + let _ = unsafe { Box::from_raw(this_ptr as *mut nativeBolt11ParseError) }; } -#[no_mangle] -/// Utility method to constructs a new Bech32Error-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_bech32_error(a: crate::c_types::Bech32Error) -> Bolt11ParseError { - Bolt11ParseError::Bech32Error(a, ) -} -#[no_mangle] -/// Utility method to constructs a new ParseAmountError-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_parse_amount_error(a: crate::c_types::Error) -> Bolt11ParseError { - Bolt11ParseError::ParseAmountError(a, ) -} -#[no_mangle] -/// Utility method to constructs a new MalformedSignature-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_malformed_signature(a: crate::c_types::Secp256k1Error) -> Bolt11ParseError { - Bolt11ParseError::MalformedSignature(a, ) -} -#[no_mangle] -/// Utility method to constructs a new BadPrefix-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_bad_prefix() -> Bolt11ParseError { - Bolt11ParseError::BadPrefix} -#[no_mangle] -/// Utility method to constructs a new UnknownCurrency-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_unknown_currency() -> Bolt11ParseError { - Bolt11ParseError::UnknownCurrency} -#[no_mangle] -/// Utility method to constructs a new UnknownSiPrefix-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_unknown_si_prefix() -> Bolt11ParseError { - Bolt11ParseError::UnknownSiPrefix} -#[no_mangle] -/// Utility method to constructs a new MalformedHRP-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_malformed_hrp() -> Bolt11ParseError { - Bolt11ParseError::MalformedHRP} -#[no_mangle] -/// Utility method to constructs a new TooShortDataPart-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_too_short_data_part() -> Bolt11ParseError { - Bolt11ParseError::TooShortDataPart} -#[no_mangle] -/// Utility method to constructs a new UnexpectedEndOfTaggedFields-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_unexpected_end_of_tagged_fields() -> Bolt11ParseError { - Bolt11ParseError::UnexpectedEndOfTaggedFields} -#[no_mangle] -/// Utility method to constructs a new DescriptionDecodeError-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_description_decode_error(a: crate::c_types::Error) -> Bolt11ParseError { - Bolt11ParseError::DescriptionDecodeError(a, ) -} -#[no_mangle] -/// Utility method to constructs a new PaddingError-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_padding_error() -> Bolt11ParseError { - Bolt11ParseError::PaddingError} -#[no_mangle] -/// Utility method to constructs a new IntegerOverflowError-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_integer_overflow_error() -> Bolt11ParseError { - Bolt11ParseError::IntegerOverflowError} -#[no_mangle] -/// Utility method to constructs a new InvalidSegWitProgramLength-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_invalid_seg_wit_program_length() -> Bolt11ParseError { - Bolt11ParseError::InvalidSegWitProgramLength} -#[no_mangle] -/// Utility method to constructs a new InvalidPubKeyHashLength-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_invalid_pub_key_hash_length() -> Bolt11ParseError { - Bolt11ParseError::InvalidPubKeyHashLength} -#[no_mangle] -/// Utility method to constructs a new InvalidScriptHashLength-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_invalid_script_hash_length() -> Bolt11ParseError { - Bolt11ParseError::InvalidScriptHashLength} -#[no_mangle] -/// Utility method to constructs a new InvalidRecoveryId-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_invalid_recovery_id() -> Bolt11ParseError { - Bolt11ParseError::InvalidRecoveryId} -#[no_mangle] -/// Utility method to constructs a new InvalidSliceLength-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_invalid_slice_length(a: crate::c_types::Str) -> Bolt11ParseError { - Bolt11ParseError::InvalidSliceLength(a, ) +#[allow(unused)] +impl Bolt11ParseError { + pub(crate) fn get_native_ref(&self) -> &'static nativeBolt11ParseError { + unsafe { &*ObjOps::untweak_ptr(self.inner) } + } + pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeBolt11ParseError { + 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 nativeBolt11ParseError { + assert!(self.is_owned); + let ret = ObjOps::untweak_ptr(self.inner); + self.inner = core::ptr::null_mut(); + ret + } + pub(crate) fn as_ref_to(&self) -> Self { + Self { inner: self.inner, is_owned: false } + } } -#[no_mangle] -/// Utility method to constructs a new Skip-variant Bolt11ParseError -pub extern "C" fn Bolt11ParseError_skip() -> Bolt11ParseError { - Bolt11ParseError::Skip} /// Checks if two Bolt11ParseErrors 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 Bolt11ParseError_eq(a: &Bolt11ParseError, b: &Bolt11ParseError) -> bool { - if &a.to_native() == &b.to_native() { true } else { false } + 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 } } /// Get a string which allows debug introspection of a Bolt11ParseError object pub extern "C" fn Bolt11ParseError_debug_str_void(o: *const c_void) -> Str { alloc::format!("{:?}", unsafe { o as *const crate::lightning_invoice::Bolt11ParseError }).into()} +impl Clone for Bolt11ParseError { + fn clone(&self) -> Self { + Self { + inner: if <*mut nativeBolt11ParseError>::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 Bolt11ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt11ParseError)).clone() })) as *mut c_void +} +#[no_mangle] +/// Creates a copy of the Bolt11ParseError +pub extern "C" fn Bolt11ParseError_clone(orig: &Bolt11ParseError) -> Bolt11ParseError { + orig.clone() +} /// 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. @@ -513,7 +281,7 @@ impl ParseOrSemanticError { ParseOrSemanticError::ParseError (ref a, ) => { let mut a_nonref = Clone::clone(a); nativeParseOrSemanticError::ParseError ( - a_nonref.into_native(), + *unsafe { Box::from_raw(a_nonref.take_inner()) }, ) }, ParseOrSemanticError::SemanticError (ref a, ) => { @@ -529,7 +297,7 @@ impl ParseOrSemanticError { match self { ParseOrSemanticError::ParseError (mut a, ) => { nativeParseOrSemanticError::ParseError ( - a.into_native(), + *unsafe { Box::from_raw(a.take_inner()) }, ) }, ParseOrSemanticError::SemanticError (mut a, ) => { @@ -546,7 +314,7 @@ impl ParseOrSemanticError { nativeParseOrSemanticError::ParseError (ref a, ) => { let mut a_nonref = Clone::clone(a); ParseOrSemanticError::ParseError ( - crate::lightning_invoice::Bolt11ParseError::native_into(a_nonref), + crate::lightning_invoice::Bolt11ParseError { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, ) }, nativeParseOrSemanticError::SemanticError (ref a, ) => { @@ -562,7 +330,7 @@ impl ParseOrSemanticError { match native { nativeParseOrSemanticError::ParseError (mut a, ) => { ParseOrSemanticError::ParseError ( - crate::lightning_invoice::Bolt11ParseError::native_into(a), + crate::lightning_invoice::Bolt11ParseError { inner: ObjOps::heap_alloc(a), is_owned: true }, ) }, nativeParseOrSemanticError::SemanticError (mut a, ) => { @@ -738,6 +506,131 @@ pub extern "C" fn Bolt11Invoice_hash(o: &Bolt11Invoice) -> u64 { core::hash::Hash::hash(o.get_native_ref(), &mut hasher); core::hash::Hasher::finish(&hasher) } +/// Represents the description of an invoice which has to be either a directly included string or +/// a hash of a description provided out of band. +#[derive(Clone)] +#[must_use] +#[repr(C)] +pub enum Bolt11InvoiceDescription { + /// Description of what the invoice is for + Direct( + crate::lightning_invoice::Description), + /// Hash of the description of what the invoice is for + Hash( + crate::lightning_invoice::Sha256), +} +use lightning_invoice::Bolt11InvoiceDescription as Bolt11InvoiceDescriptionImport; +pub(crate) type nativeBolt11InvoiceDescription = Bolt11InvoiceDescriptionImport; + +impl Bolt11InvoiceDescription { + #[allow(unused)] + pub(crate) fn to_native(&self) -> nativeBolt11InvoiceDescription { + match self { + Bolt11InvoiceDescription::Direct (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeBolt11InvoiceDescription::Direct ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + Bolt11InvoiceDescription::Hash (ref a, ) => { + let mut a_nonref = Clone::clone(a); + nativeBolt11InvoiceDescription::Hash ( + *unsafe { Box::from_raw(a_nonref.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn into_native(self) -> nativeBolt11InvoiceDescription { + match self { + Bolt11InvoiceDescription::Direct (mut a, ) => { + nativeBolt11InvoiceDescription::Direct ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + Bolt11InvoiceDescription::Hash (mut a, ) => { + nativeBolt11InvoiceDescription::Hash ( + *unsafe { Box::from_raw(a.take_inner()) }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn from_native(native: &Bolt11InvoiceDescriptionImport) -> Self { + let native = unsafe { &*(native as *const _ as *const c_void as *const nativeBolt11InvoiceDescription) }; + match native { + nativeBolt11InvoiceDescription::Direct (ref a, ) => { + let mut a_nonref = Clone::clone(a); + Bolt11InvoiceDescription::Direct ( + crate::lightning_invoice::Description { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + nativeBolt11InvoiceDescription::Hash (ref a, ) => { + let mut a_nonref = Clone::clone(a); + Bolt11InvoiceDescription::Hash ( + crate::lightning_invoice::Sha256 { inner: ObjOps::heap_alloc(a_nonref), is_owned: true }, + ) + }, + } + } + #[allow(unused)] + pub(crate) fn native_into(native: nativeBolt11InvoiceDescription) -> Self { + match native { + nativeBolt11InvoiceDescription::Direct (mut a, ) => { + Bolt11InvoiceDescription::Direct ( + crate::lightning_invoice::Description { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + nativeBolt11InvoiceDescription::Hash (mut a, ) => { + Bolt11InvoiceDescription::Hash ( + crate::lightning_invoice::Sha256 { inner: ObjOps::heap_alloc(a), is_owned: true }, + ) + }, + } + } +} +/// Frees any resources used by the Bolt11InvoiceDescription +#[no_mangle] +pub extern "C" fn Bolt11InvoiceDescription_free(this_ptr: Bolt11InvoiceDescription) { } +/// Creates a copy of the Bolt11InvoiceDescription +#[no_mangle] +pub extern "C" fn Bolt11InvoiceDescription_clone(orig: &Bolt11InvoiceDescription) -> Bolt11InvoiceDescription { + orig.clone() +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Bolt11InvoiceDescription_clone_void(this_ptr: *const c_void) -> *mut c_void { + Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt11InvoiceDescription)).clone() })) as *mut c_void +} +#[allow(unused)] +/// Used only if an object of this type is returned as a trait impl by a method +pub(crate) extern "C" fn Bolt11InvoiceDescription_free_void(this_ptr: *mut c_void) { + let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt11InvoiceDescription) }; +} +#[no_mangle] +/// Utility method to constructs a new Direct-variant Bolt11InvoiceDescription +pub extern "C" fn Bolt11InvoiceDescription_direct(a: crate::lightning_invoice::Description) -> Bolt11InvoiceDescription { + Bolt11InvoiceDescription::Direct(a, ) +} +#[no_mangle] +/// Utility method to constructs a new Hash-variant Bolt11InvoiceDescription +pub extern "C" fn Bolt11InvoiceDescription_hash(a: crate::lightning_invoice::Sha256) -> Bolt11InvoiceDescription { + Bolt11InvoiceDescription::Hash(a, ) +} +/// Checks if two Bolt11InvoiceDescriptions contain equal inner contents. +/// This ignores pointers and is_owned flags and looks at the values in fields. +#[no_mangle] +pub extern "C" fn Bolt11InvoiceDescription_eq(a: &Bolt11InvoiceDescription, b: &Bolt11InvoiceDescription) -> bool { + if &a.to_native() == &b.to_native() { true } else { false } +} +/// Get a string which allows debug introspection of a Bolt11InvoiceDescription object +pub extern "C" fn Bolt11InvoiceDescription_debug_str_void(o: *const c_void) -> Str { + alloc::format!("{:?}", unsafe { o as *const crate::lightning_invoice::Bolt11InvoiceDescription }).into()} +#[no_mangle] +/// Get the string representation of a Bolt11InvoiceDescription object +pub extern "C" fn Bolt11InvoiceDescription_to_str(o: &crate::lightning_invoice::Bolt11InvoiceDescription) -> Str { + alloc::format!("{}", &o.to_native()).into() +} use lightning_invoice::SignedRawBolt11Invoice as nativeSignedRawBolt11InvoiceImport; pub(crate) type nativeSignedRawBolt11Invoice = nativeSignedRawBolt11InvoiceImport; @@ -2836,6 +2729,14 @@ pub extern "C" fn Description_new(mut description: crate::c_types::Str) -> crate local_ret } +/// Creates an empty `Description`. +#[must_use] +#[no_mangle] +pub extern "C" fn Description_empty() -> crate::lightning_invoice::Description { + let mut ret = lightning_invoice::Description::empty(); + crate::lightning_invoice::Description { inner: ObjOps::heap_alloc(ret), is_owned: true } +} + /// Returns the underlying description [`UntrustedString`] #[must_use] #[no_mangle] diff --git a/lightning-c-bindings/src/lightning_persister/fs_store.rs b/lightning-c-bindings/src/lightning_persister/fs_store.rs index 46c355d..06ecdad 100644 --- a/lightning-c-bindings/src/lightning_persister/fs_store.rs +++ b/lightning-c-bindings/src/lightning_persister/fs_store.rs @@ -142,3 +142,39 @@ extern "C" fn FilesystemStore_KVStore_list(this_arg: *const c_void, mut primary_ local_ret } +impl From for crate::lightning::util::persist::MigratableKVStore { + fn from(obj: nativeFilesystemStore) -> Self { + let rust_obj = crate::lightning_persister::fs_store::FilesystemStore { inner: ObjOps::heap_alloc(obj), is_owned: true }; + let mut ret = FilesystemStore_as_MigratableKVStore(&rust_obj); + // We want to free rust_obj when ret gets drop()'d, not rust_obj, so forget it and set ret's free() fn + core::mem::forget(rust_obj); + ret.free = Some(FilesystemStore_free_void); + ret + } +} +/// Constructs a new MigratableKVStore which calls the relevant methods on this_arg. +/// This copies the `inner` pointer in this_arg and thus the returned MigratableKVStore must be freed before this_arg is +#[no_mangle] +pub extern "C" fn FilesystemStore_as_MigratableKVStore(this_arg: &FilesystemStore) -> crate::lightning::util::persist::MigratableKVStore { + crate::lightning::util::persist::MigratableKVStore { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + list_all_keys: FilesystemStore_MigratableKVStore_list_all_keys, + KVStore: crate::lightning::util::persist::KVStore { + this_arg: unsafe { ObjOps::untweak_ptr((*this_arg).inner) as *mut c_void }, + free: None, + read: FilesystemStore_KVStore_read, + write: FilesystemStore_KVStore_write, + remove: FilesystemStore_KVStore_remove, + list: FilesystemStore_KVStore_list, + }, + } +} + +#[must_use] +extern "C" fn FilesystemStore_MigratableKVStore_list_all_keys(this_arg: *const c_void) -> crate::c_types::derived::CResult_CVec_C3Tuple_StrStrStrZZIOErrorZ { + let mut ret = ::list_all_keys(unsafe { &mut *(this_arg as *mut nativeFilesystemStore) }, ); + let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { let mut local_ret_0 = Vec::new(); for mut item in o.drain(..) { local_ret_0.push( { let (mut orig_ret_0_0_0, mut orig_ret_0_0_1, mut orig_ret_0_0_2) = item; let mut local_ret_0_0 = (orig_ret_0_0_0.into(), orig_ret_0_0_1.into(), orig_ret_0_0_2.into()).into(); local_ret_0_0 }); }; local_ret_0.into() }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { crate::c_types::IOError::from_bitcoin(e) }).into() }; + local_ret +} + diff --git a/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs b/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs index 4286473..d20f872 100644 --- a/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs +++ b/lightning-c-bindings/src/lightning_rapid_gossip_sync.rs @@ -33,8 +33,8 @@ //! Note that the first ever rapid sync should use `0` for `last_sync_timestamp`. //! //! After the gossip data snapshot has been downloaded, one of the client's graph processing -//! functions needs to be called. In this example, we process the update by reading its contents -//! from disk, which we do by calling [`RapidGossipSync::update_network_graph`]: +//! functions needs to be called. +//!In this example, we process the update by reading its contents from disk, which we do by calling [`RapidGossipSync::update_network_graph`]: //! //! ``` //! use bitcoin::constants::genesis_block; @@ -52,10 +52,9 @@ //! let network_graph = NetworkGraph::new(Network::Bitcoin, &logger); //! let rapid_sync = RapidGossipSync::new(&network_graph, &logger); //! let snapshot_contents: &[u8] = &[0; 0]; -//! // In no-std you need to provide the current time in unix epoch seconds -//! // otherwise you can use update_network_graph -//! let current_time_unix = 0; -//! let new_last_sync_timestamp_result = rapid_sync.update_network_graph_no_std(snapshot_contents, Some(current_time_unix)); +//! // In non-`std` environments you need to provide the current time in unix epoch seconds +//! // otherwise you can use `update_network_graph`: +//!let new_last_sync_timestamp_result = rapid_sync.update_network_graph(snapshot_contents); //! ``` use alloc::str::FromStr; diff --git a/lightning-c-bindings/src/lightning_types/features.rs b/lightning-c-bindings/src/lightning_types/features.rs index a7cfa21..77eeea0 100644 --- a/lightning-c-bindings/src/lightning_types/features.rs +++ b/lightning-c-bindings/src/lightning_types/features.rs @@ -48,6 +48,8 @@ //! (see [BOLT-4](https://github.com/lightning/bolts/blob/master/04-onion-routing.md#route-blinding) for more information). //! - `ShutdownAnySegwit` - requires/supports that future segwit versions are allowed in `shutdown` //! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md) for more information). +//! - `DualFund` - requires/supports V2 channel establishment +//! (see [BOLT-2](https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#channel-establishment-v2) for more information). //! - `OnionMessages` - requires/supports forwarding onion messages //! (see [BOLT-7](https://github.com/lightning/bolts/pull/759/files) for more information). //! - `ChannelType` - node supports the channel_type field in open/accept @@ -66,6 +68,8 @@ //! (see the [`Keysend` feature assignment proposal](https://github.com/lightning/bolts/issues/605#issuecomment-606679798) for more information). //! - `Trampoline` - supports receiving and forwarding Trampoline payments //! (see the [`Trampoline` feature proposal](https://github.com/lightning/bolts/pull/836) for more information). +//! - `DnsResolver` - supports resolving DNS names to TXT DNSSEC proofs for BIP 353 payments +//! (see [bLIP 32](https://github.com/lightning/blips/blob/master/blip-0032.md) for more information). //! //! LDK knows about the following features, but does not support them: //! - `AnchorsNonzeroFeeHtlcTx` - the initial version of anchor outputs, which was later found to be @@ -983,6 +987,62 @@ pub extern "C" fn NodeFeatures_requires_shutdown_anysegwit(this_arg: &crate::lig ret } +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn InitFeatures_set_dual_fund_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_dual_fund_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn InitFeatures_set_dual_fund_required(this_arg: &mut crate::lightning_types::features::InitFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeInitFeatures)) }.set_dual_fund_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_supports_dual_fund(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_dual_fund(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_dual_fund_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_dual_fund_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_dual_fund_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_dual_fund_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_dual_fund(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_dual_fund(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn InitFeatures_requires_dual_fund(this_arg: &crate::lightning_types::features::InitFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_dual_fund(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_dual_fund(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_dual_fund(); + ret +} + /// Set this feature as optional. #[no_mangle] pub extern "C" fn InitFeatures_set_taproot_optional(this_arg: &mut crate::lightning_types::features::InitFeatures) { @@ -1463,6 +1523,26 @@ pub extern "C" fn Bolt11InvoiceFeatures_supports_trampoline_routing(this_arg: &c ret } +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_set_trampoline_routing_optional(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.set_trampoline_routing_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_set_trampoline_routing_required(this_arg: &mut crate::lightning_types::features::Bolt12InvoiceFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeBolt12InvoiceFeatures)) }.set_trampoline_routing_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_supports_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_trampoline_routing(); + ret +} + /// Checks if this feature is required. #[must_use] #[no_mangle] @@ -1487,6 +1567,42 @@ pub extern "C" fn Bolt11InvoiceFeatures_requires_trampoline_routing(this_arg: &c ret } +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn Bolt12InvoiceFeatures_requires_trampoline_routing(this_arg: &crate::lightning_types::features::Bolt12InvoiceFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_trampoline_routing(); + ret +} + +/// Set this feature as optional. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_dns_resolution_optional(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_dns_resolution_optional() +} + +/// Set this feature as required. +#[no_mangle] +pub extern "C" fn NodeFeatures_set_dns_resolution_required(this_arg: &mut crate::lightning_types::features::NodeFeatures) { + unsafe { &mut (*ObjOps::untweak_ptr(this_arg.inner as *mut crate::lightning_types::features::nativeNodeFeatures)) }.set_dns_resolution_required() +} + +/// Checks if this feature is supported. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_supports_dns_resolution(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supports_dns_resolution(); + ret +} + +/// Checks if this feature is required. +#[must_use] +#[no_mangle] +pub extern "C" fn NodeFeatures_requires_dns_resolution(this_arg: &crate::lightning_types::features::NodeFeatures) -> bool { + let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.requires_dns_resolution(); + ret +} + } /// Checks if two InitFeaturess contain equal inner contents. /// This ignores pointers and is_owned flags and looks at the values in fields.